mirror of https://github.com/ecmwf/eccodes.git
Testing: Detect empty concept value
This commit is contained in:
parent
dace02c52f
commit
8a9186a37a
|
@ -204,6 +204,7 @@ sub process {
|
|||
}
|
||||
elsif ($this =~ /'(.*)' *= *{/) {
|
||||
$concept = $1;
|
||||
die "File: $filename, line: $lineNum: Value is empty." if ($concept eq '');
|
||||
die "File: $filename, line: $lineNum: Value contains invalid characters." if (non_printable($concept));
|
||||
if ($filename eq 'cfVarName.def') {
|
||||
#if ($concept =~ /^[0-9]/) {
|
||||
|
|
|
@ -59,6 +59,7 @@ static int scale_factor_missing(const char* value)
|
|||
static int grib_check_param_concepts(const char* key, const char* filename)
|
||||
{
|
||||
int isLocal = 0;
|
||||
int count = 0;
|
||||
grib_concept_value* concept_value = grib_parse_concept_file(NULL, filename);
|
||||
if (!concept_value)
|
||||
return GRIB_IO_PROBLEM;
|
||||
|
@ -67,6 +68,11 @@ static int grib_check_param_concepts(const char* key, const char* filename)
|
|||
isLocal = 1;
|
||||
}
|
||||
while (concept_value) {
|
||||
count++;
|
||||
if (strlen(concept_value->name) == 0) {
|
||||
fprintf(stderr, "%s %s: Empty concept value (count=%d)\n", key, concept_value->name, count);
|
||||
Assert(0);
|
||||
}
|
||||
grib_concept_condition* concept_condition = concept_value->conditions;
|
||||
/* Convention:
|
||||
* -1 key not present
|
||||
|
|
|
@ -36,6 +36,12 @@ for a_dataset in $datasets; do
|
|||
$EXEC ${test_dir}/grib_check_param_concepts shortName $ECCODES_DEFINITION_PATH/grib2/localConcepts/$a_dataset/shortName.def
|
||||
done
|
||||
|
||||
# Check WMO name.def etc
|
||||
$EXEC ${test_dir}/grib_check_param_concepts name $ECCODES_DEFINITION_PATH/grib2/name.def
|
||||
$EXEC ${test_dir}/grib_check_param_concepts units $ECCODES_DEFINITION_PATH/grib2/units.def
|
||||
$EXEC ${test_dir}/grib_check_param_concepts units $ECCODES_DEFINITION_PATH/grib2/cfVarName.def
|
||||
|
||||
|
||||
# Check the group: name.def paramId.def shortName.def units.def cfVarName.def
|
||||
# ----------------------------------------------------------------------------
|
||||
# Check whether the Test::More Perl module is available
|
||||
|
@ -56,11 +62,8 @@ defs_dirs="
|
|||
$ECCODES_DEFINITION_PATH/grib1/localConcepts/ecmf
|
||||
$ECCODES_DEFINITION_PATH/grib2/localConcepts/ecmf
|
||||
|
||||
$ECCODES_DEFINITION_PATH/grib1/localConcepts/ammc
|
||||
$ECCODES_DEFINITION_PATH/grib1/localConcepts/eidb
|
||||
$ECCODES_DEFINITION_PATH/grib1/localConcepts/ekmi
|
||||
$ECCODES_DEFINITION_PATH/grib1/localConcepts/enmi
|
||||
$ECCODES_DEFINITION_PATH/grib1/localConcepts/eswi
|
||||
$ECCODES_DEFINITION_PATH/grib1/localConcepts/lfpw
|
||||
$ECCODES_DEFINITION_PATH/grib1/localConcepts/lowm
|
||||
$ECCODES_DEFINITION_PATH/grib1/localConcepts/rjtd
|
||||
|
|
Loading…
Reference in New Issue