From 1b6c627c30c324f7ca837a4be00b97e9837383f7 Mon Sep 17 00:00:00 2001 From: Raymond Lu Date: Fri, 21 Jan 2011 14:04:14 -0500 Subject: [svn-r19972] I added a test case for dataset with scale-offset filter into cross_read.c and updated the data files from BE, LE, and VMS. Tested on jam and linew. --- test/be_data.h5 | Bin 2288 -> 6808 bytes test/cross_read.c | 118 ++++++++++++++++++++++++++++++++++---- test/gen_cross.c | 166 +++++++++++++++++++++++++++++++++++++++++++++++------- test/le_data.h5 | Bin 2288 -> 6808 bytes test/vms_data.h5 | Bin 2288 -> 6808 bytes 5 files changed, 252 insertions(+), 32 deletions(-) diff --git a/test/be_data.h5 b/test/be_data.h5 index f906545..1b02828 100644 Binary files a/test/be_data.h5 and b/test/be_data.h5 differ diff --git a/test/cross_read.c b/test/cross_read.c index 6b2badf..6d6f26c 100755 --- a/test/cross_read.c +++ b/test/cross_read.c @@ -31,10 +31,11 @@ const char *FILENAME[] = { NULL }; -#define DATASETNAME "Array" -#define NX 5 /* output buffer dimensions */ -#define NY 6 -#define RANK 2 +#define DATASETNAME "Array" +#define DATASETNAME2 "Scale_offset_data" +#define NX 6 +#define NY 6 +#define RANK 2 static int read_data(char *fname) { @@ -46,6 +47,22 @@ static int read_data(char *fname) double data_out[NX][NY]; /* output buffer */ int i, j; unsigned nerrors = 0; + const char *not_supported= " Scaleoffset filter is not enabled."; + /*const char *not_fixed= " Scaleoffset filter bug (2131) is not fixed yet.";*/ + + /* + * Open the file. + */ + if((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + TEST_ERROR; + + TESTING(" regular dataset"); + + /* + * Open the regular dataset. + */ + if((dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT)) < 0) + TEST_ERROR; /* * Data and output buffer initialization. @@ -62,17 +79,74 @@ static int read_data(char *fname) * 2 3 4 5 6 7 * 3 4 5 6 7 8 * 4 5 6 7 8 9 + * 5 6 7 8 9 10 */ /* - * Open the file and the dataset. + * Get datatype and dataspace handles and then query + * dataset class, order, size, rank and dimensions. */ - if((file = H5Fopen(pathname, H5F_ACC_RDONLY, H5P_DEFAULT)) < 0) + if((dt = H5Dget_type(dataset)) < 0) /* datatype handle */ TEST_ERROR; - if((dataset = H5Dopen2(file, DATASETNAME, H5P_DEFAULT)) < 0) + if((datatype = H5Tget_native_type(dt, H5T_DIR_DEFAULT)) < 0) + TEST_ERROR; + + /* + * Read data from hyperslab in the file into the hyperslab in + * memory and display. + */ + if(H5Dread(dataset, datatype, H5S_ALL, H5S_ALL, H5P_DEFAULT, data_out) < 0) + TEST_ERROR; + + /* Check results */ + for (j=0; j