Testing: Invalid values for typeOfStatisticalProcessing

This commit is contained in:
shahramn 2024-04-24 18:17:20 +01:00
parent 7bf2f09ed6
commit dc484b8221
1 changed files with 10 additions and 0 deletions

View File

@ -52,6 +52,8 @@ static int scale_factor_missing(const char* value)
return 0;
}
#define STAT_PROC_MAX_VAL 103 // increase this with new Code Table 4.10 entries
/*
* key = paramId or shortName
* filename = paramId.def or shortName.def
@ -112,6 +114,14 @@ static int grib_check_param_concepts(const char* key, const char* filename)
key, concept_value->name, filename);
return GRIB_INVALID_KEY_VALUE;
}
if (strcmp(condition_name, "typeOfStatisticalProcessing") == 0) {
long lValue = atol(condition_value);
if (lValue > STAT_PROC_MAX_VAL || lValue < 0) {
fprintf(stderr, "Bad value for %s in %s=%s in file %s\n",
condition_name, key, concept_value->name, filename);
return GRIB_INVALID_KEY_VALUE;
}
}
if (strcmp(condition_name, "typeOfFirstFixedSurface") == 0) {
type1Missing = type_of_surface_missing(condition_name, condition_value);
}