From ab072c1c82355ded140e5fb452f249a911ce12ed Mon Sep 17 00:00:00 2001 From: shahramn Date: Fri, 29 Nov 2024 14:03:19 +0000 Subject: [PATCH] Testing: Improve error reporting --- tests/grib_keys_iter.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/grib_keys_iter.cc b/tests/grib_keys_iter.cc index 4becf79c7..c7b0759b0 100644 --- a/tests/grib_keys_iter.cc +++ b/tests/grib_keys_iter.cc @@ -39,9 +39,15 @@ int main(int argc, char* argv[]) GRIB_CHECK(grib_get_native_type(h, name, &type), 0); Assert( type > 0 && type < 7 ); int ktype = grib_keys_iterator_get_native_type(kiter); - Assert(type == ktype); + if (type != ktype) { + fprintf(stderr, "ERROR: key=%s type=%s ktype=%s\n", name, grib_get_type_name(type), grib_get_type_name(ktype)); + return 1; + } const char* type_name = grib_get_type_name(type); - Assert( !STR_EQUAL(type_name, "unknown") ); + if (STR_EQUAL(type_name, "unknown")) { + fprintf(stderr, "ERROR: key=%s type is unknown!\n", name); + return 1; + } printf("%s = %s (%d)\n", name, type_name, type); if (STR_EQUAL(type_name, "label")) {