mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
moved tests t_nc and t_type from libsrc to nc_test and nc_test4 to simplify build
This commit is contained in:
parent
57d743dddb
commit
4496123ff7
@ -186,25 +186,12 @@ endif # BUILD_DLL
|
||||
|
||||
endif # USE_NETCDF4
|
||||
|
||||
# Test the netCDF-3 library.
|
||||
TESTPROGRAMS = t_nc
|
||||
if !USE_NETCDF4
|
||||
TESTPROGRAMS += t_type
|
||||
endif
|
||||
check_PROGRAMS = $(TESTPROGRAMS)
|
||||
TESTS = $(TESTPROGRAMS)
|
||||
|
||||
CLEANFILES += t_nc
|
||||
|
||||
# These files are cleaned on developer workstations (and then rebuilt
|
||||
# with m4), but they are included in the distribution so that the user
|
||||
# does not have to have m4.
|
||||
MAINTAINERCLEANFILES = attr.c ncx.c putget.c $(man_MANS) attrx.c putgetx.c
|
||||
EXTRA_DIST = attr.c ncx.c putget.c $(man_MANS) stub3.c netcdf_par.h
|
||||
|
||||
# This file is created by the test.
|
||||
CLEANFILES += test.nc
|
||||
|
||||
# This tells make how to turn .m4 files into .c files.
|
||||
.m4.c:
|
||||
m4 $(AM_M4FLAGS) $(M4FLAGS) $< >$@
|
||||
|
@ -11,10 +11,10 @@ AM_CPPFLAGS = -I$(top_srcdir)
|
||||
|
||||
# These files are created by the tests.
|
||||
CLEANFILES = nc_test_classic.nc nc_test_64bit.nc nc_test_netcdf4.nc \
|
||||
tst_*.nc
|
||||
tst_*.nc t_nc.nc large_files.nc quick_large_files.nc
|
||||
|
||||
# These are the tests which are always run.
|
||||
TESTPROGRAMS = tst_small nc_test tst_misc tst_norm tst_names
|
||||
TESTPROGRAMS = t_nc tst_small nc_test tst_misc tst_norm tst_names
|
||||
|
||||
# These are the source files for the main workhorse test program,
|
||||
# nc_test. If you pass nc_test, you are doing well.
|
||||
@ -26,10 +26,8 @@ AM_CPPFLAGS += -I$(top_builddir)/liblib
|
||||
|
||||
# If the user asked for large file tests, then add them.
|
||||
if LARGE_FILE_TESTS
|
||||
TESTPROGRAMS += quick_large_files tst_big_var6 tst_big_var2 tst_big_rvar tst_big_var \
|
||||
tst_large large_files
|
||||
CLEANFILES += large_files.nc quick_large_files.nc tst_big_var.nc \
|
||||
tst_big_var2.nc tst_big_rvar.nc
|
||||
TESTPROGRAMS += quick_large_files tst_big_var6 tst_big_var2 \
|
||||
tst_big_rvar tst_big_var tst_large large_files
|
||||
endif # LARGE_FILE_TESTS
|
||||
|
||||
# Set up the tests.
|
||||
@ -48,4 +46,3 @@ MAINTAINERCLEANFILES = test_get.c test_put.c
|
||||
.m4.c:
|
||||
m4 $(AM_M4FLAGS) $(M4FLAGS) $< >$@
|
||||
|
||||
test: check
|
||||
|
@ -1,20 +1,15 @@
|
||||
/*
|
||||
* Copyright 1988 University Corporation for Atmospheric Research
|
||||
* See netcdf/COPYRIGHT file for copying and redistribution conditions.
|
||||
*/
|
||||
/* $Id: t_nc.c,v 1.94 2010/05/27 21:34:13 dmh Exp $ */
|
||||
|
||||
/*
|
||||
* Program to create a cdf, exercise all cdf functions.
|
||||
* Creates cdf, stuff it full of numbers, closes it. Then
|
||||
* reopens it, and checks for consistency.
|
||||
* Leaves the file around afterwards.
|
||||
*
|
||||
* Based on a program to test the nasa look-alike program,
|
||||
* so not the most appropropriate test. See ../nctest for a
|
||||
* complete spec test.
|
||||
*/
|
||||
/* Copyright 1988-2010 University Corporation for Atmospheric Research
|
||||
See netcdf/COPYRIGHT file for copying and redistribution
|
||||
conditions.
|
||||
|
||||
Program to create a cdf, exercise all cdf functions. Creates cdf,
|
||||
stuff it full of numbers, closes it. Then reopens it, and checks
|
||||
for consistency. Leaves the file around afterwards.
|
||||
|
||||
Based on a program to test the nasa look-alike program, so not the
|
||||
most appropropriate test. See ../nctest for a complete spec test.
|
||||
|
||||
$Id: t_nc.c,v 1.94 2010/05/27 21:34:13 dmh Exp $ */
|
||||
|
||||
#define REDEF
|
||||
/* #define SYNCDEBUG */
|
||||
@ -28,16 +23,13 @@
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#include <netcdf.h>
|
||||
#ifndef USE_DISPATCH
|
||||
#include "rename.h"
|
||||
#endif
|
||||
|
||||
#define MAXSHORT 32767
|
||||
#define MAXINT 2147483647
|
||||
#define MAXBYTE 127
|
||||
|
||||
|
||||
#define FNAME "test.nc"
|
||||
#define FNAME "t_nc.nc"
|
||||
#define NUM_DIMS 3
|
||||
#define DONT_CARE -1
|
||||
/* make these numbers big when you want to give this a real workout */
|
@ -14,10 +14,10 @@ AM_CPPFLAGS = -I$(top_srcdir) -I$(top_builddir)/liblib @EXTERN_CFLAGS@
|
||||
AM_CPPFLAGS += -I$(top_srcdir)/libsrc4 -I$(top_srcdir)/libsrc
|
||||
|
||||
# Our test programs and sources...
|
||||
check_PROGRAMS = cdm_sea_soundings tst_camrun
|
||||
check_PROGRAMS = t_type cdm_sea_soundings tst_camrun
|
||||
cdm_sea_soundings_SOURCES = cdm_sea_soundings.c tests.h
|
||||
tst_camrun_SOURCES = tst_camrun.c tests.h
|
||||
TESTS = cdm_sea_soundings tst_camrun
|
||||
TESTS = t_type cdm_sea_soundings tst_camrun
|
||||
|
||||
if LARGE_FILE_TESTS
|
||||
tst_large_SOURCES = tst_large.c tests.h
|
||||
|
@ -7,27 +7,15 @@
|
||||
$Id: t_type.c,v 2.3 2010/05/26 21:43:33 dmh Exp $
|
||||
*/
|
||||
|
||||
/* #define SYNCDEBUG */
|
||||
|
||||
#include <config.h>
|
||||
#include <nc_tests.h>
|
||||
#include <stdio.h>
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
#ifndef USE_DISPATCH
|
||||
#include "rename.h"
|
||||
#endif
|
||||
#include <netcdf.h>
|
||||
|
||||
/* This macro prints an error message with line number and name of
|
||||
* test program. */
|
||||
#define ERR do { \
|
||||
fflush(stdout); /* Make sure our stdout is synced with stderr. */ \
|
||||
fprintf(stderr, "Sorry! Unexpected result, %s, line: %d\n", \
|
||||
__FILE__, __LINE__); \
|
||||
} while (0)
|
||||
|
||||
int
|
||||
main(int ac, char *av[])
|
||||
{
|
||||
@ -38,7 +26,7 @@ main(int ac, char *av[])
|
||||
|
||||
printf("\n *** Testing netCDF classic version of nc_inq_type...");
|
||||
if (nc_inq_type(ncid, 0, name_in, &size_in) != NC_EBADTYPE) ERR;
|
||||
if (nc_inq_type(ncid, NC_DOUBLE + 1, name_in, &size_in) != NC_EBADTYPE) ERR;
|
||||
if (nc_inq_type(ncid, NC_STRING + 1, name_in, &size_in) != NC_EBADTYPE) ERR;
|
||||
if (nc_inq_type(ncid, NC_BYTE, name_in, &size_in)) ERR;
|
||||
if (strcmp(name_in, "byte") || size_in != 1) ERR;
|
||||
if (nc_inq_type(ncid, NC_CHAR, name_in, &size_in)) ERR;
|
||||
@ -51,7 +39,6 @@ main(int ac, char *av[])
|
||||
if (strcmp(name_in, "float") || size_in != 4) ERR;
|
||||
if (nc_inq_type(ncid, NC_DOUBLE, name_in, &size_in)) ERR;
|
||||
if (strcmp(name_in, "double") || size_in != 8) ERR;
|
||||
printf(" OK!\n");
|
||||
|
||||
return 0;
|
||||
SUMMARIZE_ERR;
|
||||
FINAL_RESULTS;
|
||||
}
|
Loading…
Reference in New Issue
Block a user