File: bufr_ecc-1195.sh

package info (click to toggle)
eccodes 2.46.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 154,956 kB
  • sloc: cpp: 163,970; ansic: 26,310; sh: 22,006; f90: 6,854; perl: 6,361; python: 5,352; java: 2,226; javascript: 1,427; yacc: 854; fortran: 543; lex: 359; makefile: 279; xml: 183; awk: 66
file content (51 lines) | stat: -rwxr-xr-x 1,746 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/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.
#

. ./include.ctest.sh

# ---------------------------------------------------------------------
# This is the test for JIRA issue ECC-1195
# Accessor 'sprintf' should by default be read-only
# ---------------------------------------------------------------------

label="bufr_ecc-1195_test"
temp1=temp.$label.bufr
temp2=temp.$label.txt
sample_bufr3=$ECCODES_SAMPLES_PATH/BUFR3_local.tmpl
sample_bufr4=$ECCODES_SAMPLES_PATH/BUFR4_local.tmpl

should_fail_setting()
{
    _keyvals=$1
    _sample=$2
    set +e
    ${tools_dir}/bufr_set -s $_keyvals $_sample $temp1 2>$temp2
    status=$?
    set -e
    [ $status -ne 0 ]
    grep -q "Value is read only" $temp2
}

should_fail_setting localDate=20140102    $sample_bufr3
should_fail_setting localTime=1010        $sample_bufr3
should_fail_setting rdbtimeDate=20121030  $sample_bufr3
should_fail_setting rdbtimeTime=001018    $sample_bufr3
should_fail_setting typicalDate=20121030  $sample_bufr3
should_fail_setting typicalTime=000001    $sample_bufr3

should_fail_setting localDate=20140102    $sample_bufr4
should_fail_setting localTime=1010        $sample_bufr4
should_fail_setting rdbtimeDate=20121030  $sample_bufr4
should_fail_setting rdbtimeTime=001018    $sample_bufr4
should_fail_setting typicalDate=20121030  $sample_bufr4
should_fail_setting typicalTime=000001    $sample_bufr4


rm -f $temp1 $temp2