From 21298e4489be568817039698f36553e9b672d5b8 Mon Sep 17 00:00:00 2001 From: Shahram Najm Date: Sat, 23 Dec 2023 14:18:23 +0000 Subject: [PATCH] Tools: Increase coverage --- tests/metar_dump.sh | 7 +++---- tools/metar_dump.cc | 13 ++++--------- 2 files changed, 7 insertions(+), 13 deletions(-) diff --git a/tests/metar_dump.sh b/tests/metar_dump.sh index 03d73e08e..3be590228 100755 --- a/tests/metar_dump.sh +++ b/tests/metar_dump.sh @@ -34,11 +34,10 @@ metar_file=metar.txt f=$metar_file echo $f >> $fLog -${tools_dir}/metar_dump $f >> $fLog +${tools_dir}/metar_dump -w count=1 $f >> $fLog +${tools_dir}/metar_dump -Dat $f >> $fLog +${tools_dir}/metar_dump -OH $f >> $fLog -#------------------------------------------- -# Test "-p" switch -#------------------------------------------- ref_dump=$f".dump.ref" res_dump=$f".dump.test" REDIRECT=/dev/null diff --git a/tools/metar_dump.cc b/tools/metar_dump.cc index 66bf48959..f992d1f36 100644 --- a/tools/metar_dump.cc +++ b/tools/metar_dump.cc @@ -47,7 +47,7 @@ int grib_tool_before_getopt(grib_runtime_options* options) int grib_tool_init(grib_runtime_options* options) { - int opt = grib_options_on("C") + grib_options_on("O") + grib_options_on("D"); + int opt = grib_options_on("O") + grib_options_on("D"); options->dump_mode = (char*)"default"; @@ -66,16 +66,11 @@ int grib_tool_init(grib_runtime_options* options) options->dump_flags = GRIB_DUMP_FLAG_VALUES | GRIB_DUMP_FLAG_READ_ONLY; } - if (grib_options_on("J")) { + if (grib_options_on("j")) { options->dump_mode = (char*)"json"; options->dump_flags = GRIB_DUMP_FLAG_VALUES | GRIB_DUMP_FLAG_READ_ONLY; } - if (grib_options_on("X")) { - options->dump_mode = (char*)"xml"; - options->dump_flags = GRIB_DUMP_FLAG_VALUES | GRIB_DUMP_FLAG_READ_ONLY; - } - if (grib_options_on("a")) options->dump_flags |= GRIB_DUMP_FLAG_ALIASES; @@ -104,7 +99,7 @@ int grib_tool_new_file_action(grib_runtime_options* options, grib_tools_file* fi if (!options->current_infile->name) return 0; snprintf(tmp, 1024, "FILE: %s ", options->current_infile->name); - if (!grib_options_on("C") && !grib_options_on("J") && !grib_options_on("X")) + if ( !grib_options_on("C") && !grib_options_on("j") ) fprintf(stdout, "***** %s\n", tmp); return 0; } @@ -123,7 +118,7 @@ int grib_tool_new_handle_action(grib_runtime_options* options, grib_handle* h) grib_set_flag(h, options->print_keys[i].name, GRIB_ACCESSOR_FLAG_DUMP); snprintf(tmp, 1024, "MESSAGE %d ( length=%ld )", options->handle_count, length); - if (!grib_options_on("C") && !grib_options_on("X") && !grib_options_on("J")) + if (!grib_options_on("C") && !grib_options_on("j")) fprintf(stdout, "#============== %-38s ==============\n", tmp); if (!strcmp(options->dump_mode, "default")) { GRIB_CHECK_NOLINE(grib_get_string(h, "identifier", identifier, &idlen), 0);