2016-04-04 12:35:11 +00:00
|
|
|
#!/bin/sh
|
2020-01-28 14:32:34 +00:00
|
|
|
# (C) Copyright 2005- ECMWF.
|
2016-04-04 12:35:11 +00:00
|
|
|
#
|
|
|
|
# This software is licensed under the terms of the Apache Licence Version 2.0
|
|
|
|
# which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
|
|
|
#
|
|
|
|
# In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
|
|
|
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
|
|
|
#
|
|
|
|
|
2022-04-03 22:02:48 +00:00
|
|
|
. ./include.ctest.sh
|
2016-04-04 12:35:11 +00:00
|
|
|
|
|
|
|
#set -x
|
|
|
|
|
|
|
|
#Enter data dir
|
|
|
|
cd ${data_dir}/metar
|
|
|
|
|
|
|
|
#Define a common label for all the tmp files
|
|
|
|
label="metar_compare_test"
|
|
|
|
|
|
|
|
#Create log file
|
|
|
|
fLog=${label}".log"
|
|
|
|
rm -f $fLog
|
|
|
|
touch $fLog
|
|
|
|
|
|
|
|
#Define tmp METAR file
|
|
|
|
fMetarTmp=${label}".metar.tmp"
|
|
|
|
|
|
|
|
#----------------------------------------------------
|
|
|
|
# Test: comparing same files
|
|
|
|
#----------------------------------------------------
|
|
|
|
metar_file="metar.txt"
|
|
|
|
echo "Test: comparing the same files" >> $fLog
|
|
|
|
echo "file: $metar_file" >> $fLog
|
|
|
|
${tools_dir}/metar_compare $metar_file $metar_file
|
|
|
|
|
|
|
|
#----------------------------------------------------
|
|
|
|
# Test: comparing two different files
|
|
|
|
#----------------------------------------------------
|
|
|
|
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
|
|
|
|
status=$?
|
|
|
|
set -e
|
|
|
|
if [ $status -eq 0 ]; then
|
|
|
|
echo "metar_compare should have failed if files are different" >&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
#----------------------------------------------------
|
2019-12-27 11:53:03 +00:00
|
|
|
# Test: comparing with and without the -b switch
|
2016-04-04 12:35:11 +00:00
|
|
|
#----------------------------------------------------
|
|
|
|
# ${tools_dir}/metar_compare -b GG $metar_file $fMetarTmp >> $fLog
|
|
|
|
|
|
|
|
#Clean up
|
|
|
|
rm -f $fLog $fMetarTmp
|