Commit 4f5b58ca authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

tests/cksum_write.c cleanup

parent 3fa93d44
......@@ -15,7 +15,7 @@ cksum_read_SOURCES = cksum_read.c \
ensure_array_size.h ensure_array_size.c
pio_write_SOURCES = pio_write.c cksum.h cksum.c
#
LDADD = ../src/libcdi.la -lm
LDADD = $(top_srcdir)/src/libcdi.la -lm
INCLUDES = -I$(top_srcdir)/src
#
EXTRA_DIST = $(TESTS)
......
......@@ -87,19 +87,19 @@ am_cksum_read_OBJECTS = cksum_read.$(OBJEXT) var_cksum.$(OBJEXT) \
ensure_array_size.$(OBJEXT)
cksum_read_OBJECTS = $(am_cksum_read_OBJECTS)
cksum_read_LDADD = $(LDADD)
cksum_read_DEPENDENCIES = ../src/libcdi.la
cksum_read_DEPENDENCIES = $(top_srcdir)/src/libcdi.la
am_cksum_write_OBJECTS = cksum_write.$(OBJEXT) cksum.$(OBJEXT)
cksum_write_OBJECTS = $(am_cksum_write_OBJECTS)
cksum_write_LDADD = $(LDADD)
cksum_write_DEPENDENCIES = ../src/libcdi.la
cksum_write_DEPENDENCIES = $(top_srcdir)/src/libcdi.la
am_pio_write_OBJECTS = pio_write.$(OBJEXT) cksum.$(OBJEXT)
pio_write_OBJECTS = $(am_pio_write_OBJECTS)
pio_write_LDADD = $(LDADD)
pio_write_DEPENDENCIES = ../src/libcdi.la
pio_write_DEPENDENCIES = $(top_srcdir)/src/libcdi.la
am_test_grib_OBJECTS = test_grib.$(OBJEXT)
test_grib_OBJECTS = $(am_test_grib_OBJECTS)
test_grib_LDADD = $(LDADD)
test_grib_DEPENDENCIES = ../src/libcdi.la
test_grib_DEPENDENCIES = $(top_srcdir)/src/libcdi.la
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
depcomp = $(SHELL) $(top_srcdir)/config/depcomp
am__depfiles_maybe = depfiles
......@@ -319,7 +319,7 @@ cksum_read_SOURCES = cksum_read.c \
pio_write_SOURCES = pio_write.c cksum.h cksum.c
#
LDADD = ../src/libcdi.la -lm
LDADD = $(top_srcdir)/src/libcdi.la -lm
INCLUDES = -I$(top_srcdir)/src
#
EXTRA_DIST = $(TESTS)
......
......@@ -127,8 +127,7 @@ main(int argc, char *argv[])
nts = parse_intarg("error parsing number of timesteps");
break;
default: /* '?' */
fprintf(stderr, "Usage: %s [-m nlon] [-n nlat] [-o nlev] [-t nts]\n",
argv[0]);
fprintf(stderr, "Usage: %s [-m nlon] [-n nlat] [-o nlev] [-t nts]\n", argv[0]);
exit(EXIT_FAILURE);
}
}
......@@ -141,7 +140,7 @@ main(int argc, char *argv[])
lats[i] = ((double)(i * 180))/nlat - 90.0;
levs = malloc(nlev * sizeof (levs[0]));
for (i = 0; i < nlev; ++i)
levs[i] = 101300 - 3940.3 * (exp(1.3579 * (double)(i)/(nlev - 1)) - 1.0);
levs[i] = 101300 - floor(3940.3 * (exp(2.3579 * (double)(i)/(nlev - 1)) - 1.0));
varSize[0] = nlon * nlat;
varSize[1] = nlon * nlat * nlev;
......@@ -263,10 +262,8 @@ main(int argc, char *argv[])
/ (lons[nlat-1] - lats[0]))
) * mscale)) * mrscale;
memcrc_r(&checksum_state[0], (const unsigned char *)var[0],
varSize[0] * sizeof (var[0][0]));
memcrc_r(&checksum_state[1], (const unsigned char *)var[1],
varSize[1] * sizeof (var[1][0]));
memcrc_r(&checksum_state[0], (const unsigned char *)var[0], varSize[0] * sizeof (var[0][0]));
memcrc_r(&checksum_state[1], (const unsigned char *)var[1], varSize[1] * sizeof (var[1][0]));
// Write var1 and var2
streamWriteVar(streamID, varID[0], var[0], nmiss);
......@@ -288,8 +285,7 @@ main(int argc, char *argv[])
{
uint32_t cksum;
int code;
cksum = memcrc_finish(&checksum_state[i],
(off_t)varSize[i] * sizeof (var[i][0]) * nts);
cksum = memcrc_finish(&checksum_state[i], (off_t)varSize[i] * sizeof (var[i][0]) * nts);
code = vlistInqVarCode(vlistID, varID[i]);
if (fprintf(tablefp, "%08lx %d\n", (unsigned long)cksum, code) < 0)
{
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment