diff --git a/tests/grib_util_set_spec.c b/tests/grib_util_set_spec.c index 805fbec69..5f21d940e 100644 --- a/tests/grib_util_set_spec.c +++ b/tests/grib_util_set_spec.c @@ -10,7 +10,6 @@ #include "grib_api_internal.h" #include "eccodes.h" -#include #define STR_EQUAL(s1, s2) (strcmp((s1), (s2)) == 0) @@ -53,20 +52,20 @@ static void test_reduced_gg(int remove_local_def, int edition, const char* packi grib_util_grid_spec spec = {0,}; grib_util_packing_spec packing_spec = {0,}; - assert(input_filename); + Assert(input_filename); in = fopen(input_filename, "rb"); - assert(in); + Assert(in); handle = grib_handle_new_from_file(0, in, &err); - assert(handle); + Assert(handle); CODES_CHECK(grib_get_string(handle, "gridType", gridType, &slen), 0); if (!STR_EQUAL(gridType, "reduced_gg")) { grib_handle_delete(handle); return; } - assert(output_filename); + Assert(output_filename); out = fopen(output_filename, "wb"); - assert(out); + Assert(out); CODES_CHECK(grib_get_size(handle, "values", &inlen), 0); values = (double*)malloc(sizeof(double) * inlen); @@ -108,23 +107,23 @@ static void test_reduced_gg(int remove_local_def, int edition, const char* packi values, outlen, &err); - assert(finalh); - assert(err == 0); + Assert(finalh); + Assert(err == 0); /* Try some invalid inputs and check it is handled */ { codes_handle* h2 = 0; packing_spec.accuracy = 999; h2 = grib_util_set_spec(handle, &spec, &packing_spec, set_spec_flags, values, outlen, &err); - assert(err == GRIB_INTERNAL_ERROR); - assert(!h2); + Assert(err == GRIB_INTERNAL_ERROR); + Assert(!h2); if (h2) exit(1); #ifdef INFINITY packing_spec.accuracy = GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES; values[0] = INFINITY; h2 = grib_util_set_spec(handle, &spec, &packing_spec, set_spec_flags, values, outlen, &err); - assert(err == GRIB_ENCODING_ERROR); - assert(!h2); + Assert(err == GRIB_ENCODING_ERROR); + Assert(!h2); if (h2) exit(1); #endif } @@ -134,7 +133,7 @@ static void test_reduced_gg(int remove_local_def, int edition, const char* packi CODES_CHECK(codes_check_message_header(buffer, size, PRODUCT_GRIB), 0); CODES_CHECK(codes_check_message_footer(buffer, size, PRODUCT_GRIB), 0); if (fwrite(buffer, 1, size, out) != size) { - assert(0); + Assert(0); } grib_handle_delete(handle); grib_handle_delete(finalh); @@ -164,11 +163,11 @@ static void test_regular_ll(int remove_local_def, int edition, const char* packi grib_util_grid_spec spec = {0,}; grib_util_packing_spec packing_spec = {0,}; - assert(input_filename); + Assert(input_filename); in = fopen(input_filename, "rb"); - assert(in); + Assert(in); handle = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err); - assert(handle); + Assert(handle); CODES_CHECK(codes_get_long(handle, "edition", &input_edition), 0); @@ -177,9 +176,9 @@ static void test_regular_ll(int remove_local_def, int edition, const char* packi grib_handle_delete(handle); return; } - assert(output_filename); + Assert(output_filename); out = fopen(output_filename, "wb"); - assert(out); + Assert(out); CODES_CHECK(codes_get_size(handle, "values", &inlen), 0); values = (double*)malloc(sizeof(double) * inlen); @@ -224,8 +223,8 @@ static void test_regular_ll(int remove_local_def, int edition, const char* packi values, outlen, &err); - assert(finalh); - assert(err == 0); + Assert(finalh); + Assert(err == 0); /* Check expand_bounding_box worked. * Specified latitudeOfFirstGridPointInDegrees cannot be encoded in GRIB1 @@ -234,7 +233,7 @@ static void test_regular_ll(int remove_local_def, int edition, const char* packi const double expected_lat1 = 60.001; double lat1 = 0; CODES_CHECK(codes_get_double(finalh, "latitudeOfFirstGridPointInDegrees", &lat1), 0); - assert(fabs(lat1 - expected_lat1) < 1e-10); + Assert(fabs(lat1 - expected_lat1) < 1e-10); } /* Write out the message to the output file */ @@ -242,7 +241,7 @@ static void test_regular_ll(int remove_local_def, int edition, const char* packi CODES_CHECK(codes_check_message_header(buffer, size, PRODUCT_GRIB), 0); CODES_CHECK(codes_check_message_footer(buffer, size, PRODUCT_GRIB), 0); if (fwrite(buffer, 1, size, out) != size) { - assert(0); + Assert(0); } codes_handle_delete(handle); codes_handle_delete(finalh); @@ -272,15 +271,15 @@ static void test_grid_complex_spatial_differencing(int remove_local_def, int edi grib_util_grid_spec spec={0,}; grib_util_packing_spec packing_spec={0,}; - in = fopen(input_filename,"rb"); assert(in); - handle = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err); assert(handle); + in = fopen(input_filename,"rb"); Assert(in); + handle = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err); Assert(handle); CODES_CHECK(grib_get_string(handle, "packingType", gridType, &slen),0); if (!STR_EQUAL(gridType, "grid_complex_spatial_differencing")) { grib_handle_delete(handle); return; } - out = fopen(output_filename,"wb"); assert(out); + out = fopen(output_filename,"wb"); Assert(out); CODES_CHECK(codes_get_size(handle,"values",&inlen), 0); values = (double*)malloc(sizeof(double)*inlen); @@ -325,13 +324,13 @@ static void test_grid_complex_spatial_differencing(int remove_local_def, int edi values, outlen, &err); - assert(finalh); - assert(err == 0); + Assert(finalh); + Assert(err == 0); /* Write out the message to the output file */ CODES_CHECK(codes_get_message(finalh, &buffer, &size),0); if(fwrite(buffer,1,size,out) != size) { - assert(0); + Assert(0); } codes_handle_delete(handle); codes_handle_delete(finalh); diff --git a/tests/ieee.c b/tests/ieee.c index 3dcd6bf89..1c1595548 100644 --- a/tests/ieee.c +++ b/tests/ieee.c @@ -7,9 +7,7 @@ * In applying this licence, ECMWF does not waive the privileges and immunities granted to it by * virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction. */ - #include -#include #include #include "grib_api_internal.h" @@ -95,14 +93,14 @@ int main(int argc, char* argv[]) #if 1 unsigned long i = 0; printf("Test doubles with grib_ieee_to_long/grib_long_to_ieee...\n"); - assert(test_doubles(grib_ieee_to_long, grib_long_to_ieee) == 1); + Assert(test_doubles(grib_ieee_to_long, grib_long_to_ieee) == 1); printf("Test doubles with grib_ieee64_to_long/grib_long_to_ieee64...\n"); - assert(test_doubles(grib_ieee64_to_long, grib_long_to_ieee64) == 1); + Assert(test_doubles(grib_ieee64_to_long, grib_long_to_ieee64) == 1); printf("Test integers...\n"); /* test(3242539564, grib_ieee_to_long, grib_long_to_ieee); This fails! */ - assert(grib_ieee_to_long(grib_long_to_ieee(i)) == i); + Assert(grib_ieee_to_long(grib_long_to_ieee(i)) == i); /* The minimum value for which we can convert a long to ieee and back is 0x800000 */ /* The maximum value for which we can convert a long to ieee and back is 0x7f800000 */ @@ -111,8 +109,8 @@ int main(int argc, char* argv[]) if (grib_ieee_to_long(grib_long_to_ieee(i)) != i) { printf("i=%lu i=%lx e=%g x=%lx\n", i, i, grib_long_to_ieee(i), grib_ieee_to_long(grib_long_to_ieee(i))); - /*assert(grib_ieee_to_long(grib_long_to_ieee(i)) == i);*/ - assert(0); + /*Assert(grib_ieee_to_long(grib_long_to_ieee(i)) == i);*/ + Assert(0); } /*if(grib_ieee_to_long(grib_long_to_ieee(j)) != j) { @@ -133,7 +131,7 @@ int main(int argc, char* argv[]) double c = p(ref1, ref1); double d = p(ref2, ref2); - assert(min < max); + Assert(min < max); #endif printf("ALL DONE\n");