mirror of https://github.com/ecmwf/eccodes.git
Testing: Increase coverage
This commit is contained in:
parent
c7976199f8
commit
cda5be5877
|
@ -42,14 +42,14 @@ int main(int argc, char** argv)
|
|||
return 1;
|
||||
}
|
||||
|
||||
CODES_CHECK(grib_count_in_file(NULL, in, &mcount), 0);
|
||||
CODES_CHECK(codes_count_in_file(NULL, in, &mcount), 0);
|
||||
assert(mcount == 56);
|
||||
printf("grib_count_in_file counted %d messages\n", mcount);
|
||||
printf("count_in_file counted %d messages\n", mcount);
|
||||
|
||||
mcount = 0;
|
||||
CODES_CHECK(grib_count_in_filename(NULL, filename, &mcount), 0);
|
||||
CODES_CHECK(codes_count_in_filename(NULL, filename, &mcount), 0);
|
||||
assert(mcount == 56);
|
||||
printf("grib_count_in_filename counted %d messages\n", mcount);
|
||||
printf("count_in_filename counted %d messages\n", mcount);
|
||||
|
||||
mcount = 0;
|
||||
while ((h = codes_handle_new_from_file(0, in, PRODUCT_GRIB, &err)) != NULL) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
#include "eccodes.h"
|
||||
|
||||
/* Windows always has a colon in pathnames e.g. C:\temp\file. So instead we use semi-colons as delimiter */
|
||||
/* in order to have multiple definitions/samples directories */
|
||||
|
@ -32,6 +33,7 @@ int main(int argc, char** argv)
|
|||
sample_name = argv[1];
|
||||
new_dir = argv[2]; /* The directory containing the given sample */
|
||||
|
||||
codes_context_set_debug(c, -1);
|
||||
printf("Initial samples path = %s\n", grib_samples_path(c));
|
||||
|
||||
/* Should fail - default samples path does not include ifs_samples dirs */
|
||||
|
@ -40,7 +42,9 @@ int main(int argc, char** argv)
|
|||
|
||||
snprintf(full_path, 2048, "%s%c%s", new_dir, ECC_PATH_DELIMITER_CHAR, grib_samples_path(c));
|
||||
printf("Change samples_path to: %s\n", full_path);
|
||||
grib_context_set_samples_path(c, full_path);
|
||||
codes_context_set_samples_path(c, full_path);
|
||||
|
||||
codes_context_set_debug(c, 0);
|
||||
|
||||
h = grib_handle_new_from_samples(c, sample_name);
|
||||
Assert(h);
|
||||
|
|
|
@ -770,6 +770,9 @@ void test_codes_context_set_debug()
|
|||
int main(int argc, char** argv)
|
||||
{
|
||||
printf("Doing unit tests. ecCodes version = %ld\n", grib_get_api_version());
|
||||
printf("codes_print_api_version gives: ");
|
||||
codes_print_api_version(stdout);
|
||||
printf("\n");
|
||||
|
||||
test_codes_context_set_debug();
|
||||
test_codes_get_error_message();
|
||||
|
|
Loading…
Reference in New Issue