Examples: bufr_copy_data

This commit is contained in:
Shahram Najm 2017-02-07 16:04:38 +00:00
parent 650e6ce857
commit 0294edc8f4
2 changed files with 10 additions and 6 deletions

View File

@ -98,7 +98,7 @@ int main(int argc, char *argv[])
printf("Copied %s\n",keys[i]); printf("Copied %s\n",keys[i]);
free(keys[i]); free(keys[i]);
} }
printf("Copied a total of %ld keys\n", nkeys); printf("Total number of copied keys = %ld\n", nkeys);
free(keys); free(keys);
codes_handle_delete(h); codes_handle_delete(h);

View File

@ -12,11 +12,12 @@
#Define a common label for all the tmp files #Define a common label for all the tmp files
label="bufr_copy_data_c" label="bufr_copy_data_c"
TEMP=$label.out.bufr TEMP_BUFR=$label.out.bufr
TEMP_TEXT=$label.out.txt
REF=$label.compare.log.ref REF=$label.compare.log.ref
MYLOG=$label.compare.log MYLOG=$label.compare.log
rm -f ${TEMP} ${REF} ${MYLOG} rm -f ${TEMP_BUFR} ${TEMP_TEXT} ${REF} ${MYLOG}
cat > ${REF} <<EOF cat > ${REF} <<EOF
== 1 == DIFFERENCE == Different size for "unexpandedDescriptors" [43] [28] == 1 == DIFFERENCE == Different size for "unexpandedDescriptors" [43] [28]
@ -53,15 +54,18 @@ cat > ${REF} <<EOF
EOF EOF
INPUT=${data_dir}/bufr/metar_with_2_bias.bufr INPUT=${data_dir}/bufr/metar_with_2_bias.bufr
${examples_dir}/c_bufr_copy_data ${INPUT} ${TEMP} ${examples_dir}/c_bufr_copy_data ${INPUT} ${TEMP_BUFR} > ${TEMP_TEXT}
num_copied_keys=`grep -c '^Copied' ${TEMP_TEXT}`
[ $num_copied_keys -eq 58 ]
# The input and output BUFR messages should be different # The input and output BUFR messages should be different
set +e set +e
${tools_dir}/bufr_compare ${TEMP} ${INPUT} > ${MYLOG} ${tools_dir}/bufr_compare ${TEMP_BUFR} ${INPUT} > ${MYLOG}
status=$? status=$?
set -e set -e
[ $status -eq 1 ] [ $status -eq 1 ]
diff ${MYLOG} ${REF} diff ${MYLOG} ${REF}
rm -f ${TEMP} ${REF} ${MYLOG} rm -f ${TEMP_BUFR} ${REF} ${MYLOG} ${TEMP_TEXT}