From b367af2fca04ef9cab608b19c799d57038ac5cfd Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Mon, 8 Jan 2024 18:28:16 +0000 Subject: [PATCH] ECC-1741: Test with and without bitmap --- tests/grib_set_large_message_fail.cc | 9 +++++++-- tests/grib_set_large_message_fail.sh | 11 ++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/tests/grib_set_large_message_fail.cc b/tests/grib_set_large_message_fail.cc index ea0b2a2c9..599d017be 100644 --- a/tests/grib_set_large_message_fail.cc +++ b/tests/grib_set_large_message_fail.cc @@ -23,9 +23,14 @@ int main(int argc, char** argv) long Ni = 0, Nj = 0; double* values = NULL; const double missing = 1.0e36; - bool use_bitmap = true; + bool use_bitmap = false; + + if (argc == 2 && strcmp(argv[1], "-b")==0) { + use_bitmap = true; + } h = codes_grib_handle_new_from_samples(NULL, "GRIB1"); + assert(h); CODES_CHECK(codes_set_double(h, "missingValue", missing), 0); @@ -54,7 +59,7 @@ int main(int argc, char** argv) if (err) { printf("codes_set_double_array failed as expected: err=%s\n", codes_get_error_message(err)); } else { - fprintf(stderr, "codes_set_double_array should have failed!\n"); + fprintf(stderr, "Error: codes_set_double_array should have failed!\n"); return 1; } diff --git a/tests/grib_set_large_message_fail.sh b/tests/grib_set_large_message_fail.sh index fbee28b36..9e8a4c775 100755 --- a/tests/grib_set_large_message_fail.sh +++ b/tests/grib_set_large_message_fail.sh @@ -10,5 +10,14 @@ . ./include.ctest.sh -$EXEC ${test_dir}/grib_set_large_message_fail +label='grib_set_large_message_fail_test' +temp=temp.$label.txt +$EXEC ${test_dir}/grib_set_large_message_fail > $temp 2>&1 +grep -q "Failed to set GRIB1 message length" $temp + +$EXEC ${test_dir}/grib_set_large_message_fail -b > $temp 2>&1 +grep -q "Unable to set double array.*bitmap" $temp + +# Clean up +rm -f $temp