Test all sprintf BUFR keys
@@ -14,15 +14,34 @@ REDIRECT=/dev/null
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 localDate=20140102 $sample_bufr4 $temp1 2>$temp2
+ ${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
