mirror of https://github.com/ecmwf/eccodes.git
Testing: Increase coverage
This commit is contained in:
parent
d6ae6cfcf0
commit
4348d1c641
|
@ -1008,7 +1008,7 @@ static int read_any_taf(reader* r)
|
|||
int err = 0;
|
||||
unsigned char* buffer = NULL;
|
||||
unsigned long magic = 0;
|
||||
unsigned long start = 0x54414620;
|
||||
unsigned long start = 0x54414620; // 4 chars: TAF plus a space
|
||||
unsigned char tmp[1000] = {0,}; /* Should be enough */
|
||||
size_t message_size = 0;
|
||||
size_t already_read = 0;
|
||||
|
@ -1020,10 +1020,10 @@ static int read_any_taf(reader* r)
|
|||
magic &= 0xffffffff;
|
||||
|
||||
if (magic == start) {
|
||||
tmp[i++] = 0x54;
|
||||
tmp[i++] = 0x41;
|
||||
tmp[i++] = 0x46;
|
||||
tmp[i++] = 0x20;
|
||||
tmp[i++] = 0x54; //T
|
||||
tmp[i++] = 0x41; //A
|
||||
tmp[i++] = 0x46; //F
|
||||
tmp[i++] = 0x20; //space
|
||||
|
||||
r->offset = r->tell(r->read_data) - 4;
|
||||
|
||||
|
@ -1056,7 +1056,7 @@ static int read_any_metar(reader* r)
|
|||
int err = 0;
|
||||
unsigned char* buffer = NULL;
|
||||
unsigned long magic = 0;
|
||||
unsigned long start = 0x4d455441;
|
||||
unsigned long start = 0x4d455441; // 4 chars: META
|
||||
unsigned char tmp[32] = {0,}; /* Should be enough */
|
||||
size_t message_size = 0;
|
||||
size_t already_read = 0;
|
||||
|
@ -1071,10 +1071,10 @@ static int read_any_metar(reader* r)
|
|||
if (r->read(r->read_data, &c, 1, &err) != 1 || err != 0)
|
||||
break;
|
||||
if (c == 'R') {
|
||||
tmp[i++] = 0x4d;
|
||||
tmp[i++] = 0x45;
|
||||
tmp[i++] = 0x54;
|
||||
tmp[i++] = 0x41;
|
||||
tmp[i++] = 0x4d; // M
|
||||
tmp[i++] = 0x45; // E
|
||||
tmp[i++] = 0x54; // T
|
||||
tmp[i++] = 0x41; // A
|
||||
tmp[i++] = 'R';
|
||||
|
||||
r->offset = r->tell(r->read_data) - 4;
|
||||
|
|
|
@ -238,6 +238,7 @@ if( HAVE_BUILD_TOOLS )
|
|||
gts_count
|
||||
gts_compare
|
||||
wrap
|
||||
taf
|
||||
pseudo_diag
|
||||
metar_ls
|
||||
metar_get
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
#!/bin/sh
|
||||
# (C) Copyright 2005- ECMWF.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
|
||||
# Tests for TAF (Terminal Aerodrome Forecast)
|
||||
|
||||
. ./include.ctest.sh
|
||||
|
||||
label="taf_test"
|
||||
tempTaf=temp.$label.taf
|
||||
tempOut=temp.$label.out
|
||||
tempTxt=temp.$label.txt
|
||||
tempRef=temp.$label.ref
|
||||
|
||||
cat >$tempTaf<<EOF
|
||||
TAF
|
||||
KXYZ 051730Z 0518/0624 31008KT 3SM -SHRA BKN020
|
||||
FM052300 30006KT 5SM -SHRA OVC030
|
||||
PROB30 0604/0606 VRB20G35KT 1SM TSRA BKN015CB
|
||||
FM060600 25010KT 4SM -SHRA OVC050 TEMPO 0608/0611 2SM -SHRA OVC030
|
||||
RMK NXT FCST BY 00Z=
|
||||
EOF
|
||||
|
||||
${tools_dir}/grib_dump -TF -O $tempTaf
|
||||
id=`${tools_dir}/grib_get -TF -p identifier $tempTaf`
|
||||
[ "$id" = "TAF" ]
|
||||
|
||||
# Clean up
|
||||
rm -f $tempTaf $tempOut $tempRef $tempTxt
|
Loading…
Reference in New Issue