Testing: Coverage

This commit is contained in:
shahramn 2024-03-04 20:45:39 +00:00
parent c38285e567
commit 3fc47dcf77
8 changed files with 13 additions and 45 deletions

View File

@ -12,12 +12,6 @@
#undef NDEBUG
#include <assert.h>
static void usage(const char* prog)
{
printf("usage: %s [-a|-d] infile\n", prog);
exit(1);
}
#define ITER_ALL_KEYS 1
#define ITER_DATA_KEYS 2
@ -28,12 +22,11 @@ int main(int argc, char* argv[])
codes_handle* h = NULL;
codes_bufr_keys_iterator* kiter = NULL;
char* input_filename = NULL;
const char* prog = argv[0];
FILE* f = NULL;
int iterator_mode = ITER_ALL_KEYS;
if (argc == 1 || argc > 3)
usage(prog);
return 1; // usage: prog [-a|-d] infile
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-a") == 0) {

View File

@ -10,12 +10,6 @@
#include "grib_api.h"
static void usage(char* prog)
{
printf("usage: %s file1.grib file2.grib\n", prog);
exit(1);
}
int main(int argc, char* argv[])
{
grib_handle *h1, *h2;
@ -34,7 +28,7 @@ int main(int argc, char* argv[])
c = grib_context_get_default();
if (argc < 3) usage(argv[0]);
if (argc < 3) return 1;//usage: %s file1.grib file2.grib
infile1 = argv[1];
infile2 = argv[2];

View File

@ -12,11 +12,6 @@
#undef NDEBUG
#include <assert.h>
static void usage(const char* app)
{
fprintf(stderr, "Usage is: %s input_file ouput_file\n", app);
}
int main(int argc, char* argv[])
{
FILE* in = NULL;
@ -32,7 +27,7 @@ int main(int argc, char* argv[])
size_t messageLength_src = 0, messageLength_dst = 0;
if (argc != 3) {
usage(argv[0]);
// Usage: prog input_file ouput_file
return 1;
}
@ -73,7 +68,7 @@ int main(int argc, char* argv[])
assert(isConstant_dst == 1);
}
/* write out the cloned buffer */
// write out the cloned buffer
if (fwrite(buffer, 1, messageLength_dst, out) != messageLength_dst) {
perror(argv[1]);
return 1;

View File

@ -8,6 +8,9 @@
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
*/
//
// ECC-1467: Support data values array decoded as "floats" (single-precision)
//
#include <math.h>
#include "eccodes.h"
#include "grib_api_internal.h"
@ -60,8 +63,7 @@ int main(int argc, char** argv)
fval = fvalues[i];
if (!((dmin <= fval) && (fval <= dmax))) {
fprintf(stderr, "Error:\n");
fprintf(stderr, "dvalue: %f, fvalue: %f\n", dvalues[i], fvalues[i]);
fprintf(stderr, "Error: dvalue: %f, fvalue: %f\n", dvalues[i], fvalues[i]);
fprintf(stderr, "\tmin < fvalue < max = %.20e < %.20e < %.20e FAILED\n",
dmin, fvalues[i], dmax);
fprintf(stderr, "\tfvalue - min = %.20e (%s)\n",

View File

@ -8,6 +8,8 @@
# virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
#
# ECC-1467: Support data values array decoded as "floats" (single-precision)
. ./include.ctest.sh
# Constant fields

View File

@ -13,12 +13,6 @@
#include "grib_api.h"
static void usage(const char* prog)
{
fprintf(stderr, "Usage: %s order_by grib_file grib_file ...\n", prog);
exit(1);
}
int main(int argc, char** argv)
{
int err = 0;
@ -34,7 +28,7 @@ int main(int argc, char** argv)
size_t lenDate = 10, lenParam = 20, lenLevel = 50;
char* order_by = NULL;
if (argc != 3) usage(argv[0]);
if (argc != 3) return 1; //Usage: prog order_by grib_file grib_file ...
nkeys = sizeof(keys) / sizeof(*keys);
order_by = argv[1];

View File

@ -10,12 +10,6 @@
#include "grib_api.h"
void usage(char* prog)
{
printf("usage: %s infile\n", prog);
exit(1);
}
int main(int argc, char* argv[])
{
grib_index* index = NULL;
@ -27,7 +21,7 @@ int main(int argc, char* argv[])
size_t lenshortName = 200;
int ret = 0, count = 0;
if (argc != 2) usage(argv[0]);
if (argc != 2) return 1;
infile = argv[1];
outfile = argv[2];

View File

@ -14,12 +14,6 @@
#include <unistd.h>
#endif
void usage(const char* prog)
{
printf("usage: %s filename\n", prog);
exit(1);
}
int main(int argc, char* argv[])
{
off_t offsetin = 0, offsetout = 0;
@ -30,7 +24,7 @@ int main(int argc, char* argv[])
char str[10];
int i;
if (argc != 2) usage(argv[0]);
if (argc != 2) return 1;
printf("sizeof(off_t)=%zu sizeof(long)=%zu\n", sizeof(off_t), sizeof(long));