Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more large file testing #484

Merged
merged 6 commits into from
Feb 28, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
changed name of util file
edwardhartnett committed Feb 22, 2024
commit 85b797aa69915e681e122d6b682b38bc3ba095d2
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ endif()

# Build a C program test.
function(g2c_build_test name)
add_executable(${name} ${name}.c util.c)
add_executable(${name} ${name}.c g2c_test_util.c)
target_link_libraries(${name} PUBLIC g2c::g2c)
if(BUILD_G2C)
target_link_libraries(${name} PRIVATE ${LIBXML2_LIBRARIES})
@@ -104,7 +104,7 @@ endfunction()

# Build a C program test.
function(g2c_build_test name)
add_executable(${name} ${name}.c util.c)
add_executable(${name} ${name}.c g2c_test_util.c)
target_link_libraries(${name} PUBLIC g2c::g2c)
target_link_libraries(${name} PRIVATE ${LIBXML2_LIBRARIES})
target_include_directories(${name} PRIVATE "${LIBXML2_INCLUDE_DIR}")
9 changes: 6 additions & 3 deletions tests/util.c → tests/g2c_test_util.c
Original file line number Diff line number Diff line change
@@ -41,8 +41,9 @@ cmpString(const void *p, const void *q)
* Ed Hartnett 10/6/22
*/
int
degrib2_lines_not_equal(char *line1, char *l2)
degrib2_lines_not_equal(int cnt, char *line1, char *l2)
{
int cnt;
char long_abbrev[MAX_LINE_LEN + 1], long_cmin[MAX_LINE_LEN + 1];
char long_cavg[MAX_LINE_LEN + 1], long_cmax[MAX_LINE_LEN + 1];
char abbrev1[G2C_MAX_NOAA_ABBREV_LEN + 1];
@@ -110,6 +111,7 @@ degrib2_lines_not_equal(char *line1, char *l2)
}
else
{
printf("\nline %d\n", cnt);
printf("\n%s\n", line1);
printf("expected:\n%s\n", l2);
return G2C_ERROR;
@@ -123,10 +125,11 @@ degrib2_lines_not_equal(char *line1, char *l2)
* Ed Hartnett 10/6/22
*/
int
compare_degrib2_files2(char *fname1, char *fname2)
compare_degrib2_files2(int cnt, char *fname1, char *fname2)
{
FILE *fp1, *fp2;
char l1[MAX_LINE_LEN + 1], l2[MAX_LINE_LEN + 1];
int cnt = 1;

/* Open the two files. */
if (!(fp1 = fopen(fname1, "r")))
@@ -141,7 +144,7 @@ compare_degrib2_files2(char *fname1, char *fname2)
return G2C_ERROR;
/* printf("l1: %s\n", l1); */
/* printf("l2: %s\n", l2); */
if (degrib2_lines_not_equal(l1, l2))
if (degrib2_lines_not_equal(cnt++, l1, l2))
return G2C_ERROR;
}