Testing: Get native type of all keys

This commit is contained in:
Shahram Najm 2024-01-18 11:57:27 +00:00
parent 0f3e710d33
commit eca34ff1a6
3 changed files with 12 additions and 4 deletions

View File

@ -1,3 +1 @@
label "_local 98.1";
label "_x";

View File

@ -34,7 +34,12 @@ int main(int argc, char* argv[])
while (grib_keys_iterator_next(kiter)) {
const char* name = grib_keys_iterator_get_name(kiter);
Assert(name);
printf("%s\n", name);
int type = 0;
GRIB_CHECK(grib_get_native_type(h, name, &type), 0);
Assert( type > 0 && type < 7 );
const char* type_name = grib_get_type_name(type);
Assert( !STR_EQUAL(type_name, "unknown") );
printf("%s = %s (%d)\n", name, type_name, type);
}
grib_keys_iterator_delete(kiter);

View File

@ -19,6 +19,11 @@ cd ${data_dir}
f='tigge/tiggelam_cnmc_sfc.grib'
$EXEC ${test_dir}/grib_keys_iter $f > /dev/null
# Samples
$EXEC ${test_dir}/grib_keys_iter $ECCODES_SAMPLES_PATH/GRIB1.tmpl > /dev/null
$EXEC ${test_dir}/grib_keys_iter $ECCODES_SAMPLES_PATH/GRIB2.tmpl > /dev/null
$EXEC ${test_dir}/grib_keys_iter $ECCODES_SAMPLES_PATH/sh_ml_grib2.tmpl > /dev/null
grib_files=`cat ${data_dir}/grib_data_files.txt`
for f in ${grib_files}; do
${test_dir}/grib_keys_iter $f > $tempOut