Testing: grib_compare & bufr_compare options

This commit is contained in:
shahramn 2024-08-24 16:17:15 +01:00
parent 2d24ad7039
commit 264edafab9
3 changed files with 19 additions and 15 deletions

View File

@ -306,20 +306,35 @@ status=$?
set -e
[ $status -ne 0 ]
# Key unpackedValues
#-------------------
${tools_dir}/grib_set -s scaleValuesBy=1.01 $ECCODES_SAMPLES_PATH/sh_ml_grib2.tmpl $temp1
${tools_dir}/grib_compare -c unpackedValues -A 1.86 $ECCODES_SAMPLES_PATH/sh_ml_grib2.tmpl $temp1
# -----------------
# Failing cases
# -----------------
set +e
${tools_dir}/grib_compare -H -c data:n $temp1 $temp2
${tools_dir}/grib_compare -Rxxxx $temp1 $temp2 > $outfile 2>&1
status=$?
set -e
[ $status -eq 1 ]
grep "Invalid argument" $outfile
set +e
${tools_dir}/grib_compare -a $temp1 $temp2
${tools_dir}/grib_compare -H -c data:n $temp1 $temp2 > $outfile 2>&1
status=$?
set -e
[ $status -eq 1 ]
grep -q "options are incompatible" $outfile
set +e
${tools_dir}/grib_compare -a $temp1 $temp2 > $outfile 2>&1
status=$?
set -e
[ $status -eq 1 ]
grep -q "a option requires -c option" $outfile
echo GRIB > $temp1

View File

@ -49,17 +49,6 @@ const char* tool_name = "bufr_compare";
const char* tool_online_doc = "https://confluence.ecmwf.int/display/ECC/bufr_compare";
const char* tool_usage = "[options] bufr_file1 bufr_file2";
GRIB_INLINE static int grib_inline_strcmp(const char* a, const char* b)
{
if (*a != *b)
return 1;
while ((*a != 0 && *b != 0) && *(a) == *(b)) {
a++;
b++;
}
return (*a == 0 && *b == 0) ? 0 : 1;
}
typedef double (*compare_double_proc)(const double*, const double*, const double*);
typedef struct grib_error grib_error;
@ -657,7 +646,7 @@ static int strings_are_different(grib_handle* h1, grib_handle* h2, const char* k
const char* s1, const char* s2,
size_t slen1, size_t slen2)
{
if (grib_inline_strcmp(s1, s2) == 0) {
if (strcmp(s1, s2) == 0) {
return 0;
}
/* Strings are different. Now check if strings are 'missing'.

View File

@ -367,8 +367,8 @@ int grib_tool_init(grib_runtime_options* options)
options->tolerance_count = MAX_KEYS;
ret = parse_keyval_string(tool_name, sarg, 1, GRIB_TYPE_DOUBLE, options->tolerance, &(options->tolerance_count));
if (ret == GRIB_INVALID_ARGUMENT) {
fprintf(stderr, "%s: Invalid argument for -R\n",tool_name);
usage();
exit(1);
}
}