Skip to content

Commit

Permalink
changed name of util file
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardhartnett committed Feb 22, 2024
1 parent 6fdd524 commit 85b797a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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}")
Expand Down
9 changes: 6 additions & 3 deletions tests/util.c → tests/g2c_test_util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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;
Expand All @@ -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")))
Expand All @@ -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;
}

Expand Down

0 comments on commit 85b797a

Please sign in to comment.