Testing: Check descriptor code: FXY must be 6 digits
#include "grib_api_internal.h"
static const size_t MIN_NUM_COLUMNS = 8;
+static const size_t NUM_DESCRIPTOR_DIGITS = 6; /* FXY */
#define NUMBER(a) (sizeof(a) / sizeof(a[0]))
static const char* allowed_types[] = { "long", "double", "table", "flag", "string" };
@@ -73,6 +74,11 @@ int main(int argc, char** argv)
line_number, str_code);
return 1;
}
+ if (strlen(str_code) != NUM_DESCRIPTOR_DIGITS) {
+ fprintf(stderr, "Error on line %lu: descriptor code '%s' (column 1) is not %lu digits.\n",
+ line_number, str_code, NUM_DESCRIPTOR_DIGITS);
+ return 1;
+ }
str_key = list[1];
str_type = list[2];
if (check_descriptor_type(str_type) != GRIB_SUCCESS) {
