mirror of https://github.com/ecmwf/eccodes.git
Testing: unit tests
This commit is contained in:
parent
7d42718609
commit
413e22aa2f
|
@ -41,8 +41,8 @@ static void check_float_representation(const double val, const double expected,
|
|||
static void test_get_git_sha1()
|
||||
{
|
||||
const char* sha1 = grib_get_git_sha1();
|
||||
printf("Testing: test_get_git_sha1...\n");
|
||||
assert(sha1 != NULL);
|
||||
Assert(sha1 != NULL);
|
||||
printf("Testing: test_get_git_sha1... %s\n", sha1);
|
||||
}
|
||||
|
||||
static void test_grib_nearest_smaller_ibmfloat()
|
||||
|
@ -1389,7 +1389,7 @@ static void test_string_splitting()
|
|||
printf("Testing: test_string_splitting...\n");
|
||||
|
||||
list = string_split(input, "|");
|
||||
assert(list);
|
||||
if (!list) { assert(!"List is NULL"); return; }
|
||||
for (i = 0; list[i] != NULL; ++i) {} /* count how many tokens */
|
||||
assert(i == 4);
|
||||
if (strcmp(list[0], "Born") != 0) assert(0);
|
||||
|
@ -1403,7 +1403,7 @@ static void test_string_splitting()
|
|||
|
||||
strcpy(input, "12345|a gap|");
|
||||
list = string_split(input, "|");
|
||||
assert(list);
|
||||
if (!list) { assert(!"List is NULL"); return; }
|
||||
for (i = 0; list[i] != NULL; ++i) {} /* count how many tokens */
|
||||
assert(i == 2);
|
||||
if (strcmp(list[0], "12345") != 0) assert(0);
|
||||
|
@ -1415,7 +1415,7 @@ static void test_string_splitting()
|
|||
|
||||
strcpy(input, "Steppenwolf");
|
||||
list = string_split(input, ",");
|
||||
assert(list);
|
||||
if (!list) { assert(!"List is NULL"); return; }
|
||||
for (i = 0; list[i] != NULL; ++i) {} /* count how many tokens */
|
||||
assert(i == 1);
|
||||
if (strcmp(list[0], "Steppenwolf") != 0) assert(0);
|
||||
|
@ -1469,21 +1469,21 @@ static void test_concept_condition_strings()
|
|||
printf("Testing: test_concept_condition_strings...\n");
|
||||
|
||||
err = get_concept_condition_string(h, "typeOfLevel", NULL, result);
|
||||
assert(!err);
|
||||
assert(strcmp(result, "typeOfFirstFixedSurface=1,typeOfSecondFixedSurface=255") == 0);
|
||||
Assert(!err);
|
||||
Assert(strcmp(result, "typeOfFirstFixedSurface=1,typeOfSecondFixedSurface=255") == 0);
|
||||
|
||||
err = get_concept_condition_string(h, "paramId", NULL, result);
|
||||
assert(!err);
|
||||
assert(strcmp(result, "discipline=0,parameterCategory=0,parameterNumber=0") == 0);
|
||||
Assert(!err);
|
||||
Assert(strcmp(result, "discipline=0,parameterCategory=0,parameterNumber=0") == 0);
|
||||
|
||||
err = get_concept_condition_string(h, "gridType", NULL, result);
|
||||
assert(!err);
|
||||
Assert(!err);
|
||||
/*printf("%s\n", result);*/
|
||||
assert(strcmp(result, "gridDefinitionTemplateNumber=0,PLPresent=0") == 0);
|
||||
Assert(strcmp(result, "gridDefinitionTemplateNumber=0,PLPresent=0") == 0);
|
||||
|
||||
err = get_concept_condition_string(h, "stepType", NULL, result);
|
||||
assert(!err);
|
||||
assert(strcmp(result, "selectStepTemplateInstant=1,stepTypeInternal=instant") == 0);
|
||||
Assert(!err);
|
||||
Assert(strcmp(result, "selectStepTemplateInstant=1,stepTypeInternal=instant") == 0);
|
||||
|
||||
grib_handle_delete(h);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue