Testing: Ascii keys encoding

This commit is contained in:
Shahram Najm 2023-07-23 17:14:42 +01:00
parent b5a0d2d452
commit 41a9ebc44c
2 changed files with 19 additions and 2 deletions

View File

@ -185,13 +185,13 @@ static int pack_string(grib_accessor* a, const char* val, size_t* len)
static int pack_long(grib_accessor* a, const long* v, size_t* len)
{
grib_context_log(a->context, GRIB_LOG_ERROR, " Should not pack %s as long", a->name);
grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as long (It's a string)", a->name);
return GRIB_NOT_IMPLEMENTED;
}
static int pack_double(grib_accessor* a, const double* v, size_t* len)
{
grib_context_log(a->context, GRIB_LOG_ERROR, " Should not pack %s as double", a->name);
grib_context_log(a->context, GRIB_LOG_ERROR, "Should not pack %s as double (It's a string)", a->name);
return GRIB_NOT_IMPLEMENTED;
}

View File

@ -154,6 +154,23 @@ set -e
grep -q "String cannot be converted to a double" $temp
# Set ascii key via double or long
# --------------------------------
${tools_dir}/grib_set -s setLocalDefinition=1,localDefinitionNumber=21 $ECCODES_SAMPLES_PATH/GRIB2.tmpl $outfile
${tools_dir}/grib_set -s marsDomain=x $outfile $temp
grib_check_key_equals $temp 'marsDomain' 'x'
set +e
${tools_dir}/grib_set -s marsDomain=9 $outfile $temp
status=$?
set -e
[ $status -ne 0 ]
set +e
${tools_dir}/grib_set -s marsDomain=1.2 $outfile $temp
status=$?
set -e
[ $status -ne 0 ]
# Strict option
# ---------------
# There is only one field in this file with shortName=2t