summaryrefslogtreecommitdiffstats
path: root/tools/h5diff/h5diffgentest.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/h5diff/h5diffgentest.c')
-rw-r--r--tools/h5diff/h5diffgentest.c98
1 files changed, 82 insertions, 16 deletions
diff --git a/tools/h5diff/h5diffgentest.c b/tools/h5diff/h5diffgentest.c
index f4fd90a..b96511d 100644
--- a/tools/h5diff/h5diffgentest.c
+++ b/tools/h5diff/h5diffgentest.c
@@ -159,7 +159,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
{
double data1[3][2] = {{1,1}, {1,1}, {0,0}};
double data2[3][2] = {{0,1.1},{1.01,1.001},{0,1}};
- double data3[3][2] = {{100,100},{100,100},{100,100}};
+ double data3[3][2] = {{100,100},{100,100},{100,100}};
double data4[3][2] = {{105,120},{160,95},{80,40}};
write_dset(gid1,2,dims2,"dset1",H5T_NATIVE_DOUBLE,data1);
@@ -175,7 +175,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- int data5[3][2] = {{100,100},{100,0},{0,100}};
+ int data5[3][2] = {{100,100},{100,0},{0,100}};
int data6[3][2] = {{120,80}, {0,100},{0,50}};
write_dset(gid1,2,dims2,"dset5",H5T_NATIVE_INT,data5);
@@ -189,7 +189,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- unsigned long_long data7[3][2] = {{100,100},{100,0},{0,100}};
+ unsigned long_long data7[3][2] = {{100,100},{100,0},{0,100}};
unsigned long_long data8[3][2] = {{120,80}, {0,100},{0,50}};
write_dset(gid1,2,dims2,"dset7",H5T_NATIVE_ULLONG,data7);
@@ -211,7 +211,7 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
*-------------------------------------------------------------------------
*/
{
- double data9[3][2] = {{100,100},{100,0},{0,100}};
+ double data9[3][2] = {{100,100},{100,0},{0,100}};
double data10[3][2] ={{120,80}, {0,100},{0,50}};
write_dset(gid1,2,dims2,"dset9",H5T_NATIVE_DOUBLE,data9);
@@ -239,6 +239,23 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
}
+#if H5_SIZEOF_LONG_DOUBLE !=0
+ {
+
+ /*-------------------------------------------------------------------------
+ * H5T_NATIVE_LDOUBLE
+ *-------------------------------------------------------------------------
+ */
+
+ long double data15[3][2] ={{1,1},{1,1},{1,1}};
+
+ write_dset(gid1,2,dims2,"ld",H5T_NATIVE_LDOUBLE,data15);
+
+ }
+#endif
+
+
+
/*-------------------------------------------------------------------------
* NaNs in H5T_NATIVE_FLOAT
*-------------------------------------------------------------------------
@@ -294,21 +311,71 @@ int test_basic(const char *fname1, const char *fname2, const char *fname3)
write_dset(gid1,1,dims1,"fp18",H5T_NATIVE_DOUBLE,data18);
}
-
-#if H5_SIZEOF_LONG_DOUBLE !=0
+
+ /* not comparable objects */
{
+
+ typedef struct cmp1_t
+ {
+ double d;
+ int i;
+ } cmp1_t;
+
+ typedef struct cmp2_t
+ {
+ int i;
+ double d;
+ } cmp2_t;
+
+ typedef struct cmp3_t
+ {
+ int i;
+ } cmp3_t;
+
+ double data2[6] = {0,0,0,0,0,0};
+ int data3[6] = {0,0,0,0,0,0};
+ int data4[3][2] = {{0,0},{0,0},{0,0}};
+ int data5[2][2] = {{0,0},{0,0}};
+ unsigned int data6[3][2] = {{0,0},{0,0},{0,0}};
+ cmp1_t data7[1] = {1,2};
+ cmp2_t data8[1] = {1,2};
+ hsize_t dims3[2] = { 2,2 };
+ hsize_t dims4[1] = { 1 };
+ size_t type_size;
+ hid_t tid;
+
- /*-------------------------------------------------------------------------
- * H5T_NATIVE_LDOUBLE
- *-------------------------------------------------------------------------
- */
-
- long double data15[3][2] ={{1,1},{1,1},{1,1}};
-
- write_dset(gid1,2,dims2,"ld",H5T_NATIVE_LDOUBLE,data15);
+
+ write_dset(gid3,1,dims1,"dset1",H5T_NATIVE_DOUBLE,NULL);
+ write_dset(gid3,1,dims1,"dset2",H5T_NATIVE_DOUBLE,data2);
+ write_dset(gid3,1,dims1,"dset3",H5T_NATIVE_INT,data3);
+ write_dset(gid3,2,dims2,"dset4",H5T_NATIVE_INT,data4);
+ write_dset(gid3,2,dims3,"dset5",H5T_NATIVE_INT,data5);
+ write_dset(gid3,2,dims2,"dset6",H5T_NATIVE_UINT,data6);
+
+ /* case of compound with different type members */
+ type_size = sizeof( cmp1_t );
+ tid = H5Tcreate (H5T_COMPOUND, type_size );
+ H5Tinsert(tid, "d", HOFFSET( cmp1_t, d ), H5T_NATIVE_DOUBLE );
+ H5Tinsert(tid, "i", HOFFSET( cmp1_t, i ), H5T_NATIVE_INT );
+ write_dset(gid3,1,dims4,"dset7",tid,data7);
+ H5Tclose(tid);
+
+ type_size = sizeof( cmp2_t );
+ tid = H5Tcreate (H5T_COMPOUND, type_size );
+ H5Tinsert(tid, "i", HOFFSET( cmp2_t, i ), H5T_NATIVE_INT );
+ H5Tinsert(tid, "d", HOFFSET( cmp2_t, d ), H5T_NATIVE_DOUBLE );
+ write_dset(gid3,1,dims4,"dset8",tid,data8);
+ H5Tclose(tid);
+
+ /* case of compound with different number of members */
+ type_size = sizeof( cmp3_t );
+ tid = H5Tcreate (H5T_COMPOUND, type_size );
+ H5Tinsert(tid, "i", HOFFSET( cmp2_t, i ), H5T_NATIVE_INT );
+ write_dset(gid3,1,dims4,"dset9",tid,NULL);
+ H5Tclose(tid);
}
-#endif /* H5_SIZEOF_LONG_DOUBLE */
/*-------------------------------------------------------------------------
@@ -328,7 +395,6 @@ out:
}
-
/*-------------------------------------------------------------------------
* Function: test_types
*