ECC-1878: Add test

This commit is contained in:
shahramn 2024-07-19 11:11:46 +01:00
parent 60af035f3c
commit 58e733e4c4
2 changed files with 21 additions and 2 deletions

View File

@ -321,7 +321,7 @@ int grib_accessors_list_print(grib_handle* h, grib_accessors_list* al, const cha
if (maxcols == 0) if (maxcols == 0)
maxcols = INT_MAX; maxcols = INT_MAX;
if (equal) fprintf(out, "%s=", name); if (equal) fprintf(out, "%s=", name); // ECC-1878
if (type == -1) if (type == -1)
type = al->accessor->get_native_type(); type = al->accessor->get_native_type();
@ -439,7 +439,7 @@ int grib_recompose_print(grib_handle* h, grib_accessor* observer, const char* un
char* format = NULL; char* format = NULL;
int type = -1; int type = -1;
char* separator = NULL; char* separator = NULL;
int equal = 0; int equal = 0; // See ECC-1878
int l; int l;
char buff[10] = {0,}; char buff[10] = {0,};
char buff1[1024] = {0,}; char buff1[1024] = {0,};
@ -491,6 +491,7 @@ int grib_recompose_print(grib_handle* h, grib_accessor* observer, const char* un
i += pp - uname - i - 1; i += pp - uname - i - 1;
break; break;
case ']': case ']':
// ECC-1878: The '=' format specifier
if (loc[mode - 1] == '=') { loc[mode-1] = 0; equal = 1; } if (loc[mode - 1] == '=') { loc[mode-1] = 0; equal = 1; }
else { loc[mode] = 0; } else { loc[mode] = 0; }
mode = -1; mode = -1;

View File

@ -460,6 +460,24 @@ EOF
${tools_dir}/grib_filter $tempFilt $input ${tools_dir}/grib_filter $tempFilt $input
# ECC-1878: The '=' specifier for the print statement
# ----------------------------------------------------
input=$data_dir/sample.grib2
cat > $tempFilt <<EOF
print "[edition=%02d]";
print "[day=]";
print "[identifier=]";
print "[referenceValue=%.5g]";
EOF
${tools_dir}/grib_filter $tempFilt $input > $tempOut
cat > $tempRef <<EOF
edition=02
day=6
identifier=GRIB
referenceValue=270.47
EOF
diff $tempRef $tempOut
# Clean up # Clean up
rm -f $tempGrib $tempFilt $tempOut $tempRef rm -f $tempGrib $tempFilt $tempOut $tempRef
rm -f ${data_dir}/formatint.rules ${data_dir}/binop.rules rm -f ${data_dir}/formatint.rules ${data_dir}/binop.rules