mirror of https://github.com/ecmwf/eccodes.git
Testing: BUFR headers and key comparisons
This commit is contained in:
parent
b4aa46878c
commit
8dc64c35c6
|
@ -199,4 +199,38 @@ status=$?
|
||||||
set -e
|
set -e
|
||||||
[ $status -ne 0 ]
|
[ $status -ne 0 ]
|
||||||
|
|
||||||
|
|
||||||
|
echo "Test with nonexistent file..."
|
||||||
|
# ---------------------------------
|
||||||
|
set +e
|
||||||
|
$EXEC ${test_dir}/bufr_extract_headers centre nosuchfile > $temp1 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "Unable to read file" $temp1
|
||||||
|
|
||||||
|
|
||||||
|
echo "Test with bad BUFR file..."
|
||||||
|
# ---------------------------------
|
||||||
|
echo BUFR > $temp1
|
||||||
|
set +e
|
||||||
|
$EXEC ${test_dir}/bufr_extract_headers centre $temp1 > $temp2 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "Unable to count BUFR messages" $temp2
|
||||||
|
|
||||||
|
|
||||||
|
echo "Test with GRIB file..."
|
||||||
|
# ---------------------------------
|
||||||
|
input=${data_dir}/sample.grib2
|
||||||
|
set +e
|
||||||
|
$EXEC ${test_dir}/bufr_extract_headers centre $input > $temp2 2>&1
|
||||||
|
status=$?
|
||||||
|
set -e
|
||||||
|
[ $status -ne 0 ]
|
||||||
|
grep -q "No BUFR messages in file" $temp2
|
||||||
|
|
||||||
|
|
||||||
|
# Clean up
|
||||||
rm -f $temp1 $temp2
|
rm -f $temp1 $temp2
|
||||||
|
|
|
@ -54,6 +54,8 @@ int main(int argc, char* argv[])
|
||||||
codes_compare_key(h1, h2, "computeStatistics", 0); // statistics
|
codes_compare_key(h1, h2, "computeStatistics", 0); // statistics
|
||||||
codes_compare_key(h1, h2, "paramId", 0); // concept
|
codes_compare_key(h1, h2, "paramId", 0); // concept
|
||||||
codes_compare_key(h1, h2, "identifier", 0); // ascii
|
codes_compare_key(h1, h2, "identifier", 0); // ascii
|
||||||
|
err = codes_compare_key(h1, h2, "abcdefghij", 0); // no such key
|
||||||
|
Assert(err == GRIB_NOT_FOUND);
|
||||||
|
|
||||||
if (list_provided_keys) {
|
if (list_provided_keys) {
|
||||||
for (i = 0; list_provided_keys[i] != NULL; ++i) {
|
for (i = 0; list_provided_keys[i] != NULL; ++i) {
|
||||||
|
|
|
@ -37,6 +37,7 @@ key: hoursAfterDataCutoff (Long values are different)
|
||||||
key: minutesAfterDataCutoff (Long values are different)
|
key: minutesAfterDataCutoff (Long values are different)
|
||||||
key: numberOfValues (Long values are different)
|
key: numberOfValues (Long values are different)
|
||||||
key: referenceValue (Double values are different)
|
key: referenceValue (Double values are different)
|
||||||
|
ECCODES ERROR : Key abcdefghij not found in first message
|
||||||
|
|
||||||
Comparison failed: 13 differences
|
Comparison failed: 13 differences
|
||||||
EOF
|
EOF
|
||||||
|
@ -57,6 +58,7 @@ cat $tempLog
|
||||||
cat > $tempRef <<EOF
|
cat > $tempRef <<EOF
|
||||||
key: referenceValue (Double values are different)
|
key: referenceValue (Double values are different)
|
||||||
key: codedValues (Double values are different)
|
key: codedValues (Double values are different)
|
||||||
|
ECCODES ERROR : Key abcdefghij not found in first message
|
||||||
|
|
||||||
Comparison failed: 2 differences
|
Comparison failed: 2 differences
|
||||||
EOF
|
EOF
|
||||||
|
|
Loading…
Reference in New Issue