mirror of https://github.com/ecmwf/eccodes.git
Testing: grib_compare & bufr_compare options
This commit is contained in:
parent
2d24ad7039
commit
264edafab9
|
@ -306,20 +306,35 @@ status=$?
|
||||||
set -e
|
set -e
|
||||||
[ $status -ne 0 ]
|
[ $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
|
# Failing cases
|
||||||
# -----------------
|
# -----------------
|
||||||
set +e
|
set +e
|
||||||
${tools_dir}/grib_compare -H -c data:n $temp1 $temp2
|
${tools_dir}/grib_compare -Rxxxx $temp1 $temp2 > $outfile 2>&1
|
||||||
status=$?
|
status=$?
|
||||||
set -e
|
set -e
|
||||||
[ $status -eq 1 ]
|
[ $status -eq 1 ]
|
||||||
|
grep "Invalid argument" $outfile
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
${tools_dir}/grib_compare -a $temp1 $temp2
|
${tools_dir}/grib_compare -H -c data:n $temp1 $temp2 > $outfile 2>&1
|
||||||
status=$?
|
status=$?
|
||||||
set -e
|
set -e
|
||||||
[ $status -eq 1 ]
|
[ $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
|
echo GRIB > $temp1
|
||||||
|
|
|
@ -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_online_doc = "https://confluence.ecmwf.int/display/ECC/bufr_compare";
|
||||||
const char* tool_usage = "[options] bufr_file1 bufr_file2";
|
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 double (*compare_double_proc)(const double*, const double*, const double*);
|
||||||
|
|
||||||
typedef struct grib_error grib_error;
|
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,
|
const char* s1, const char* s2,
|
||||||
size_t slen1, size_t slen2)
|
size_t slen1, size_t slen2)
|
||||||
{
|
{
|
||||||
if (grib_inline_strcmp(s1, s2) == 0) {
|
if (strcmp(s1, s2) == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
/* Strings are different. Now check if strings are 'missing'.
|
/* Strings are different. Now check if strings are 'missing'.
|
||||||
|
|
|
@ -367,8 +367,8 @@ int grib_tool_init(grib_runtime_options* options)
|
||||||
options->tolerance_count = MAX_KEYS;
|
options->tolerance_count = MAX_KEYS;
|
||||||
ret = parse_keyval_string(tool_name, sarg, 1, GRIB_TYPE_DOUBLE, options->tolerance, &(options->tolerance_count));
|
ret = parse_keyval_string(tool_name, sarg, 1, GRIB_TYPE_DOUBLE, options->tolerance, &(options->tolerance_count));
|
||||||
if (ret == GRIB_INVALID_ARGUMENT) {
|
if (ret == GRIB_INVALID_ARGUMENT) {
|
||||||
|
fprintf(stderr, "%s: Invalid argument for -R\n",tool_name);
|
||||||
usage();
|
usage();
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue