Testing: Check descriptor code: FXY must be 6 digits

This commit is contained in:
Shahram Najm 2021-10-10 18:22:35 +01:00
parent d825769d43
commit 2b6e5af279
1 changed files with 6 additions and 0 deletions

View File

@ -12,6 +12,7 @@
#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) {