Testing: Increase coverage

This commit is contained in:
Shahram Najm 2023-08-23 22:18:44 +01:00
parent 8d6b11772a
commit 3eaef920ba
2 changed files with 20 additions and 11 deletions

View File

@ -35,7 +35,7 @@ fBufrInput2=${label}".bufr.input2"
gts_file="EGRR20150317121020_00493212.DAT"
echo "Test: comparing the same files" >> $fLog
echo "file: $gts_file" >> $fLog
${tools_dir}//gts_compare $gts_file $gts_file
${tools_dir}/gts_compare $gts_file $gts_file
#----------------------------------------------------
# Test: comparing two different files
@ -46,18 +46,22 @@ cat > $fRules<<EOF
EOF
${tools_dir}/gts_filter -o $fGtsTmp $fRules $gts_file
set +e
${tools_dir}//gts_compare $gts_file $fGtsTmp
${tools_dir}/gts_compare -v -d $gts_file $fGtsTmp
status=$?
set -e
if [ $status -eq 0 ]; then
echo "gts_compare should have failed if files are different" >&2
exit 1
fi
# The -d option should have created these two files
[ -f error1_1.gts ]
[ -f error2_1.gts ]
rm -f error1_1.gts error2_1.gts
#----------------------------------------------------
# Test: comparing with and without the -b switch
#----------------------------------------------------
${tools_dir}//gts_compare -b GG $gts_file $fGtsTmp >> $fLog
${tools_dir}/gts_compare -b GG $gts_file $fGtsTmp >> $fLog
#Clean up
rm -f $fLog $fGtsTmp $fRules

View File

@ -10,20 +10,18 @@
. ./include.ctest.sh
#set -x
#Enter data dir
# Enter data dir
cd ${data_dir}/metar
#Define a common label for all the tmp files
# Define a common label for all the tmp files
label="metar_compare_test"
#Create log file
# Create log file
fLog=${label}".log"
rm -f $fLog
touch $fLog
#Define tmp METAR file
# Define tmp METAR file
fMetarTmp=${label}".metar.tmp"
#----------------------------------------------------
@ -39,7 +37,7 @@ ${tools_dir}/metar_compare $metar_file $metar_file
#----------------------------------------------------
sed -e 's:^METAR VECC 022350Z 00000KT 1600 BR NSC 15/13 Q1013 NOSIG:METAR VECC 022349Z 00000KT 1600 BR NSC 15/13 Q1013 NOSIG:' < metar.txt > $fMetarTmp
set +e
${tools_dir}/metar_compare $metar_file $fMetarTmp
${tools_dir}/metar_compare -v -d $metar_file $fMetarTmp
status=$?
set -e
if [ $status -eq 0 ]; then
@ -47,10 +45,17 @@ if [ $status -eq 0 ]; then
exit 1
fi
# The -d option should have created these two files
[ -f error1_1.metar ]
[ -f error2_1.metar ]
[ -f error1_2.metar ]
[ -f error2_2.metar ]
rm -f error1_1.metar error2_1.metar error1_2.metar error2_2.metar
#----------------------------------------------------
# Test: comparing with and without the -b switch
#----------------------------------------------------
# ${tools_dir}/metar_compare -b GG $metar_file $fMetarTmp >> $fLog
${tools_dir}/metar_compare -b minute,theMessage $metar_file $fMetarTmp
#Clean up
rm -f $fLog $fMetarTmp