Testing: Coverage

This commit is contained in:
shahramn 2024-02-24 18:24:16 +00:00
parent be75fa1a78
commit fad6fa4306
3 changed files with 18 additions and 6 deletions

View File

@ -30,12 +30,12 @@ int main(int argc, char** argv)
codes_handle* h = NULL; codes_handle* h = NULL;
int mcount = 0; int mcount = 0;
/* turn off support for GRIB2 multi-field messages */
codes_grib_multi_support_off(NULL);
/* turn on support for GRIB2 multi-field messages */ /* turn on support for GRIB2 multi-field messages */
codes_grib_multi_support_on(NULL); codes_grib_multi_support_on(NULL);
/* turn off support for GRIB2 multi-field messages */
/* codes_multi_support_off(NULL); */
in = fopen(filename, "rb"); in = fopen(filename, "rb");
if (!in) { if (!in) {
fprintf(stderr, "Error: unable to open file %s\n", filename); fprintf(stderr, "Error: unable to open file %s\n", filename);

View File

@ -37,7 +37,7 @@ static grib_handle* test0()
// packing_spec.accuracy = GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES; // packing_spec.accuracy = GRIB_UTIL_ACCURACY_USE_PROVIDED_BITS_PER_VALUES;
// packing_spec.packing = GRIB_UTIL_PACKING_USE_PROVIDED; // packing_spec.packing = GRIB_UTIL_PACKING_USE_PROVIDED;
grib_handle* finalh = grib_util_set_spec( grib_handle* finalh = codes_grib_util_set_spec(
handle, &spec, &packing_spec, set_spec_flags, handle, &spec, &packing_spec, set_spec_flags,
values, outlen, &err); values, outlen, &err);
Assert(err == 0); Assert(err == 0);

View File

@ -41,12 +41,23 @@ static void check_float_representation(const double val, const double expected,
compare_doubles(out, expected, tolerance); compare_doubles(out, expected, tolerance);
} }
static void test_get_package_name()
{
printf("Running %s ...\n", __func__);
const char* pn = codes_get_package_name();
Assert(pn != NULL);
Assert(strlen(pn) > 1);
printf("Package name = %s\n", pn);
}
static void test_get_git_sha1() static void test_get_git_sha1()
{ {
printf("Running %s ...\n", __func__); printf("Running %s ...\n", __func__);
const char* sha1 = grib_get_git_sha1(); const char* sha1 = codes_get_git_sha1();
Assert(sha1 != NULL); Assert(sha1 != NULL);
printf("Git SHA1 = %s\n", sha1);
} }
static void test_get_build_date() static void test_get_build_date()
@ -650,7 +661,7 @@ void test_codes_get_product_name()
void test_codes_get_type_name() void test_codes_get_type_name()
{ {
printf("Running %s ...\n", __func__); printf("Running %s ...\n", __func__);
Assert( STR_EQUAL("long", grib_get_type_name(GRIB_TYPE_LONG)) ); Assert( STR_EQUAL("long", codes_get_type_name(GRIB_TYPE_LONG)) );
Assert( STR_EQUAL("string", grib_get_type_name(GRIB_TYPE_STRING)) ); Assert( STR_EQUAL("string", grib_get_type_name(GRIB_TYPE_STRING)) );
Assert( STR_EQUAL("double", grib_get_type_name(GRIB_TYPE_DOUBLE)) ); Assert( STR_EQUAL("double", grib_get_type_name(GRIB_TYPE_DOUBLE)) );
Assert( STR_EQUAL("bytes", grib_get_type_name(GRIB_TYPE_BYTES)) ); Assert( STR_EQUAL("bytes", grib_get_type_name(GRIB_TYPE_BYTES)) );
@ -728,6 +739,7 @@ int main(int argc, char** argv)
test_parse_keyval_string(); test_parse_keyval_string();
test_get_git_sha1(); test_get_git_sha1();
test_get_package_name();
test_get_build_date(); test_get_build_date();
test_gribex_mode(); test_gribex_mode();
test_gts_header_mode(); test_gts_header_mode();