mirror of
https://github.com/Unidata/netcdf-c.git
synced 2024-11-21 03:13:42 +08:00
finally got my distcheck act together by moving hdf4 file test to nc_test4
This commit is contained in:
parent
0c7684b1ac
commit
843db9798f
@ -95,7 +95,7 @@ endif # USE_VALGRIND_TESTS
|
||||
EXTRA_DIST = test_get.m4 test_put.m4 run_valgrind_tests.sh \
|
||||
run_diskless.sh run_diskless2.sh run_diskless5.sh run_mmap.sh \
|
||||
run_pnetcdf_test.sh test_read.m4 test_write.m4 ref_tst_diskless2.cdl \
|
||||
tst_diskless5.cdl CMakeLists.txt ref_contiguous.hdf4
|
||||
tst_diskless5.cdl CMakeLists.txt
|
||||
|
||||
# These files are created by the tests.
|
||||
CLEANFILES = nc_test_classic.nc nc_test_64bit.nc nc_test_netcdf4.nc \
|
||||
|
Binary file not shown.
@ -155,25 +155,5 @@ main(int argc, char **argv)
|
||||
SUMMARIZE_ERR;
|
||||
} /* next format */
|
||||
}
|
||||
#ifdef USE_HDF4
|
||||
printf("\n*** Testing netcdf format functions for HDF4.\n");
|
||||
{
|
||||
int ncid;
|
||||
int expected_mode;
|
||||
int expected_extended_format;
|
||||
|
||||
printf("*** testing nc_inq_format() and nc_inq_format_extended() with HDF4...");
|
||||
|
||||
/* Set up test. */
|
||||
expected_extended_format = NC_FORMATX_NC_HDF4;
|
||||
expected_mode = NC_NETCDF4;
|
||||
|
||||
/* Open a HDF4 file and check it. */
|
||||
if (nc_open(HDF4_FILE, 0, &ncid)) ERR;
|
||||
if (check_inq_format(ncid, NC_FORMAT_NETCDF4, expected_extended_format, expected_mode)) ERR;
|
||||
if (nc_close(ncid)) ERR;
|
||||
}
|
||||
SUMMARIZE_ERR;
|
||||
#endif /* USE_HDF4 */
|
||||
FINAL_RESULTS;
|
||||
}
|
||||
|
@ -104,7 +104,7 @@ endif # BUILD_UTILITIES
|
||||
TESTS += run_chunk_hdf4.sh tst_h4_lendian
|
||||
if USE_HDF4_FILE_TESTS
|
||||
check_PROGRAMS += tst_interops3
|
||||
TESTS += run_get_hdf4_files.sh tst_interops3 tst_hdf4_read_var.sh
|
||||
TESTS += run_get_hdf4_files.sh tst_hdf4_read_var.sh
|
||||
endif # USE_HDF4_FILE_TESTS
|
||||
endif # USE_HDF4
|
||||
|
||||
@ -116,7 +116,6 @@ TESTS += tst_szip.sh
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
# This will run a bunch of the test programs with valgrind, the memory
|
||||
# checking tool. (Valgrind must be present for this to work.)
|
||||
if USE_VALGRIND_TESTS
|
||||
|
@ -19,6 +19,8 @@ do
|
||||
fi
|
||||
done
|
||||
|
||||
${execdir}/tst_interops3
|
||||
|
||||
echo "SUCCESS!!!"
|
||||
|
||||
exit 0
|
||||
|
@ -15,6 +15,54 @@
|
||||
|
||||
#define FILE_NAME "tst_interops3.h4"
|
||||
|
||||
/* Function to test nc_inq_format(). */
|
||||
int
|
||||
check_inq_format(int ncid, int expected_format, int expected_extended_format, int expected_mode)
|
||||
{
|
||||
int format;
|
||||
int extended_format;
|
||||
int mode;
|
||||
|
||||
if (nc_inq_format(ncid + 66000, NULL) != NC_EBADID) ERR;
|
||||
if (nc_inq_format(ncid, NULL)) ERR;
|
||||
if (nc_inq_format(ncid, &format)) ERR;
|
||||
if (format != expected_format) {
|
||||
printf("format %d expected_format %d\n", format, expected_format);
|
||||
ERR;
|
||||
}
|
||||
if (nc_inq_format_extended(ncid + 66000, &extended_format, &mode) != NC_EBADID) ERR;
|
||||
{
|
||||
int mode;
|
||||
if (nc_inq_format_extended(ncid, NULL, &mode)) ERR;
|
||||
if (mode != expected_mode) {
|
||||
printf("expected_mode %x mode %x\n", expected_mode, mode);
|
||||
//ERR;
|
||||
}
|
||||
}
|
||||
{
|
||||
int extended_format;
|
||||
if (nc_inq_format_extended(ncid, &extended_format, NULL)) ERR;
|
||||
if (extended_format != expected_extended_format) ERR;
|
||||
}
|
||||
|
||||
if (nc_inq_format_extended(ncid, &extended_format, &mode)) ERR;
|
||||
if (mode != expected_mode) ERR;
|
||||
if (extended_format != expected_extended_format) ERR;
|
||||
|
||||
/* Nothing to do with inq_format, but let's check the base_pe
|
||||
* functions. */
|
||||
if (expected_format == NC_FORMAT_CLASSIC || expected_format == NC_FORMAT_64BIT_OFFSET ||
|
||||
expected_format == NC_FORMAT_CDF5) {
|
||||
if (nc_set_base_pe(ncid, 0)) ERR;
|
||||
if (nc_inq_base_pe(ncid, NULL)) ERR;
|
||||
} else {
|
||||
if (nc_set_base_pe(ncid, 0) != NC_ENOTNC3) ERR;
|
||||
if (nc_inq_base_pe(ncid, NULL) != NC_ENOTNC3) ERR;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
main(int argc, char **argv)
|
||||
{
|
||||
@ -30,12 +78,15 @@ main(int argc, char **argv)
|
||||
"MYD29.A2002185.0000.005.2007160150627.hdf",
|
||||
"MYD29.A2009152.0000.005.2009153124331.hdf"};
|
||||
size_t len_in;
|
||||
int expected_mode = NC_NETCDF4;
|
||||
int expected_extended_format = NC_FORMATX_NC_HDF4;
|
||||
int f;
|
||||
|
||||
for (f = 0; f < NUM_SAMPLE_FILES; f++)
|
||||
{
|
||||
if (nc_open(file_name[f], NC_NOWRITE, &ncid)) ERR;
|
||||
if (nc_inq(ncid, &ndims_in, &nvars_in, &natts_in, &unlimdim_in)) ERR;
|
||||
if (check_inq_format(ncid, NC_FORMAT_NETCDF4, expected_extended_format, expected_mode)) ERR;
|
||||
if (nc_close(ncid)) ERR;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user