summaryrefslogtreecommitdiffstats
path: root/hl
diff options
context:
space:
mode:
authorScot Breitenfeld <brtnfld@hdfgroup.org>2009-06-17 15:57:44 (GMT)
committerScot Breitenfeld <brtnfld@hdfgroup.org>2009-06-17 15:57:44 (GMT)
commite390b0e3129c020988cee7027168b3f0ad1863d2 (patch)
tree07349bebe5eb0a829f53a88363ff91c2c30abe6a /hl
parent0a28f5d7c6ee2841515db08954e011cc1de328eb (diff)
downloadhdf5-e390b0e3129c020988cee7027168b3f0ad1863d2.zip
hdf5-e390b0e3129c020988cee7027168b3f0ad1863d2.tar.gz
hdf5-e390b0e3129c020988cee7027168b3f0ad1863d2.tar.bz2
[svn-r17073] Description:
Code clean-up.
Diffstat (limited to 'hl')
-rw-r--r--hl/test/test_bitfield.c72
1 files changed, 58 insertions, 14 deletions
diff --git a/hl/test/test_bitfield.c b/hl/test/test_bitfield.c
index 2e334df..ae14674 100644
--- a/hl/test/test_bitfield.c
+++ b/hl/test/test_bitfield.c
@@ -1,27 +1,46 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * Copyright by the Board of Trustees of the University of Illinois. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the files COPYING and Copyright.html. COPYING can be found at the root *
+ * of the source code distribution tree; Copyright.html can be found at the *
+ * root level of an installed copy of the electronic HDF5 document set and *
+ * is linked from the top-level documents page. It can also be found at *
+ * http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have *
+ * access to either file, you may request a copy from help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+/*
+ Tests H5LTread_bitfield_value
+*/
#include <stdlib.h>
+#include "h5hltest.h"
#include "hdf5.h"
#include "hdf5_hl.h"
#define filename "NPOESS_EDR.h5"
-#define DIM0 4
-#define DIM1 7
+#define DIM0 2
+#define DIM1 3
#define num_flags 4
-int main(void)
+static int bitfield( void )
{
int qf_data[DIM0][DIM1][num_flags];
hid_t qf_dset;
unsigned int offset[4] = {0,2,4,6};
unsigned int length[4] = {2,2,2,2};
- hid_t file, dset, space;
+ hid_t file, space;
int ndims;
herr_t status;
int rank = 2;
hsize_t dims[2] = {DIM0,DIM1};
- hid_t file_id, space_id, dset_id, group_id;
+ hid_t file_id, space_id, dset_id;
unsigned char wdata[DIM0][DIM1];
- int i, j, k, icnt;
+ int i, j, k;
+ int correct[DIM0][DIM1][num_flags] ={0,0,0,0,3,0,1,1,2,0,2,2,0,1,0,1,0,1,1,2,0,1,2,3};
/*
* Initialize data. We will manually fill four 2-bit integers into
@@ -67,24 +86,49 @@ int main(void)
ndims = H5Sget_simple_extent_dims (space, dims, NULL);
status = H5Sclose (space);
-
+
+ TESTING("H5LTread_bitfield_value");
+
/*
* For each element read the IST quality flag that takes first two bits and
* store it in a char buffer. This selects all the elements (H5S_ALL)
*/
status = H5LTread_bitfield_value(qf_dset, num_flags, offset, length,
H5S_ALL, qf_data);
- printf("Bit Field:\n");
for (i = 0; i<DIM0; i++) {
- printf (" [");
for (j = 0; j<DIM1; j++) {
- printf(" {",i,j);
for (k = 0; k<num_flags; k++){
- printf(" %d ", qf_data[i][j][k]);
+ if(qf_data[i][j][k] != correct[i][j][k]) goto out;
}
- printf("} ");
}
- printf("]\n");
}
-
+ PASSED();
+
+
+ return 0;
+ out:
+ H5_FAILED();
+ return -1;
+}
+
+/*-------------------------------------------------------------------------
+* the main program
+*-------------------------------------------------------------------------
+*/
+int main( void )
+{
+ int nerrors=0;
+
+ /* test region region references and hyperslab selections */
+ nerrors += bitfield();
+
+ /* check for errors */
+ if (nerrors)
+ goto error;
+
+ return 0;
+
+error:
+ return 1;
+
}