mirror of https://github.com/ecmwf/eccodes.git
Testing: Enable assert macro (even in release mode)
This commit is contained in:
parent
1d54dfca84
commit
f44ce5cc55
23
tests/bits.c
23
tests/bits.c
|
@ -10,8 +10,6 @@
|
|||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
|
||||
|
@ -23,6 +21,7 @@
|
|||
|
||||
void test_bits(double x, unsigned long mode)
|
||||
{
|
||||
int err = 0;
|
||||
double y = 0, z = 0, w = 0, t = 0;
|
||||
double dy = 0, dz = 0, dw = 0, dt = 0;
|
||||
unsigned long i = 0, j = 0, k = 0, l = 0;
|
||||
|
@ -39,7 +38,8 @@ void test_bits(double x, unsigned long mode)
|
|||
dw = w - x;
|
||||
|
||||
if (!(mode & NO_NEAREST_SMALLER_IBM_FLOAT)) {
|
||||
t = grib_nearest_smaller_ibm_float(x);
|
||||
err = grib_nearest_smaller_ibm_float(x, &t);
|
||||
Assert(!err);
|
||||
l = grib_ibm_to_long(y);
|
||||
dt = t - x;
|
||||
}
|
||||
|
@ -94,19 +94,14 @@ void print_machine_parameters()
|
|||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
double x, y, z, w, d, eps, epst, epsh;
|
||||
double dt = 0;
|
||||
unsigned long i, j, n, nc, c, m;
|
||||
unsigned long seed = 123;
|
||||
unsigned char ibm[4];
|
||||
float xf = 0;
|
||||
int r;
|
||||
double x, y, z, d, eps, epst, epsh;
|
||||
unsigned long i, j, nc, c;
|
||||
/*unsigned char ibm[4];*/
|
||||
unsigned long iminp = 0x00100000, imaxp = 0x7fffffff;
|
||||
unsigned long iminn = 0x80100000, imaxn = 0xffffffff;
|
||||
double dminp = 0, dmaxp = 0, dminn = 0, dmaxn = 0;
|
||||
double dminpn = 0, dmaxpp = 0, dminnn = 0, dmaxnp = 0;
|
||||
unsigned long A;
|
||||
long e;
|
||||
int k, cc;
|
||||
|
||||
dminp = grib_long_to_ibm(iminp);
|
||||
|
@ -124,7 +119,7 @@ int main(int argc, char* argv[])
|
|||
printf("grib_ibm_to_long(%.20e)=0x%lX grib_long_to_ibm(0x%lX)=%.20e grib_ibm_nearest_smaller_to_long(%.20e)=0x%lX\n",
|
||||
x, i, i, grib_long_to_ibm(i), x, j);
|
||||
printf("grib_long_to_ibm(grib_ibm_nearest_smaller_to_long(%.20e))=%.20e\n", x, grib_long_to_ibm(j));
|
||||
exit(0);
|
||||
/* exit(0); */
|
||||
|
||||
/*
|
||||
if (argc > 1 ) {
|
||||
|
@ -242,9 +237,9 @@ int main(int argc, char* argv[])
|
|||
}
|
||||
|
||||
A = (i & 0x7f000000) >> 24;
|
||||
e = A - 70;
|
||||
/*e = A - 70;*/
|
||||
eps = 1;
|
||||
m = (i & 0xffffff);
|
||||
/*m = (i & 0xffffff);*/
|
||||
/* printf("---m=0x%lX\n",m); */
|
||||
|
||||
eps = grib_ibm_table_e(A);
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "grib_api_internal.h"
|
||||
|
||||
static const size_t MIN_NUM_COLUMNS = 8;
|
||||
|
|
|
@ -1,4 +1,15 @@
|
|||
/*
|
||||
* (C) Copyright 2005- ECMWF.
|
||||
*
|
||||
* This software is licensed under the terms of the Apache Licence Version 2.0
|
||||
* which can be obtained at http://www.apache.org/licenses/LICENSE-2.0.
|
||||
*
|
||||
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#include "eccodes.h"
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
#ifndef HAVE_FSEEKO
|
||||
|
|
|
@ -7,7 +7,9 @@
|
|||
* In applying this licence, ECMWF does not waive the privileges and immunities granted to it by
|
||||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#include "eccodes.h"
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
#include "eccodes.h"
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
#define MAX_KEYS 100
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
#include "eccodes.h"
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
static void compare_doubles(const double d1, const double d2, const double epsilon)
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
|
||||
#include "eccodes.h"
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
static void usage(const char* prog)
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "grib_api_internal.h"
|
||||
|
||||
typedef struct sample_t {
|
||||
|
@ -48,11 +47,11 @@ int main(int argc, char** argv)
|
|||
|
||||
printf("Testing codes_handle_new_from_samples on %s\n", name);
|
||||
h = codes_handle_new_from_samples(0, name);
|
||||
assert(h);
|
||||
assert(samples[i].expected_kind == h->product_kind);
|
||||
Assert(h);
|
||||
Assert(samples[i].expected_kind == h->product_kind);
|
||||
|
||||
GRIB_CHECK(grib_get_string(h, "identifier", identifier, &len), 0);
|
||||
assert( strcmp(samples[i].expected_ID, identifier) == 0 );
|
||||
Assert( strcmp(samples[i].expected_ID, identifier) == 0 );
|
||||
grib_handle_delete(h);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "grib_api_internal.h"
|
||||
|
||||
/* Windows always has a colon in pathnames e.g. C:\temp\file. So instead we use semi-colons as delimiter */
|
||||
|
|
|
@ -9,6 +9,8 @@
|
|||
*/
|
||||
|
||||
#include "eccodes.h"
|
||||
|
||||
#undef NDEBUG
|
||||
#include <assert.h>
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
* setting the wrong number of bpv should result in an error
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include "grib_api.h"
|
||||
#include "grib_api_internal.h"
|
||||
|
||||
static double compare_double_absolute(double a, double b, double tolerance)
|
||||
{
|
||||
|
@ -55,9 +54,9 @@ int main(int argc, char** argv)
|
|||
|
||||
for (i = 0; i < 255; i++) {
|
||||
FILE* in = fopen(filename, "rb");
|
||||
assert(in);
|
||||
Assert(in);
|
||||
h = grib_handle_new_from_file(0, in, &err);
|
||||
assert(h);
|
||||
Assert(h);
|
||||
|
||||
/* get the size of the values array*/
|
||||
GRIB_CHECK(grib_get_size(h, "values", &values_len), 0);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "eccodes.h"
|
||||
|
||||
static void usage(const char* prog)
|
||||
|
|
|
@ -9,8 +9,6 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
#include "grib_api_internal.h"
|
||||
|
||||
|
@ -18,15 +16,15 @@ int main(int argc, char* argv[])
|
|||
{
|
||||
unsigned long i = 0;
|
||||
|
||||
assert(grib_ibm_to_long(grib_long_to_ibm(i)) == i);
|
||||
Assert(grib_ibm_to_long(grib_long_to_ibm(i)) == i);
|
||||
|
||||
for (i = 1; i < 0x7fffffff; i++) {
|
||||
unsigned long j = i | 0x80000000;
|
||||
if (grib_ibm_to_long(grib_long_to_ibm(i)) != i) {
|
||||
printf("i=%ld i=%lx e=%g x=%lx\n", i, i, grib_long_to_ibm(i), grib_ibm_to_long(grib_long_to_ibm(i)));
|
||||
assert(grib_ibm_to_long(grib_long_to_ibm(i)) == i);
|
||||
Assert(grib_ibm_to_long(grib_long_to_ibm(i)) == i);
|
||||
}
|
||||
assert(grib_ibm_to_long(grib_long_to_ibm(j)) == j);
|
||||
Assert(grib_ibm_to_long(grib_long_to_ibm(j)) == j);
|
||||
if ((i % 100000) == 0)
|
||||
printf("i = %08lx %08lx %g %g\n", i, j, grib_long_to_ibm(i), grib_long_to_ibm(j));
|
||||
}
|
||||
|
|
|
@ -8,14 +8,13 @@
|
|||
* virtue of its status as an intergovernmental organisation nor does it submit to any jurisdiction.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef ECCODES_ON_WINDOWS
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "grib_api.h"
|
||||
#include "grib_api_internal.h"
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue