From 7d9d6add9d55fd056fc097dbcf91a2f2e6de71c9 Mon Sep 17 00:00:00 2001 From: Paul Harten Date: Sun, 20 Dec 1998 22:50:15 -0500 Subject: [svn-r977] Purpose: New feature Solution: Added some new new tests to show that paths involving HARDLINKS and paths involving SOFTLINKS convert existing objects from H5 to H4 the same way that paths involving no links does. Platform tested: Solaris2.5 --- tools/testfiles/h5dumptst.c | 221 ++++++++++++++++- tools/testfiles/tall.dmp | 33 ++- tools/testfiles/tall.h5 | Bin 7836 -> 7836 bytes tools/testfiles/tattr-1.ddl | 14 ++ tools/testfiles/tattr-4.ddl | 6 +- tools/testfiles/tattr.dmp | 16 +- tools/testfiles/tattr.h5 | Bin 1088 -> 1208 bytes tools/testfiles/tcomp-1.ddl | 34 ++- tools/testfiles/tcomp-2.ddl | 2 +- tools/testfiles/tcomp-3.ddl | 30 ++- tools/testfiles/tcomp-4.ddl | 7 +- tools/testfiles/tcompound.dmp | 59 +++-- tools/testfiles/tcompound.h5 | Bin 5184 -> 7896 bytes tools/testfiles/tcompound2.dmp | 55 ++++- tools/testfiles/tcompound2.h5 | Bin 13632 -> 13632 bytes tools/testfiles/tdset-1.ddl | 92 +++++-- tools/testfiles/tdset-2.ddl | 88 +++++-- tools/testfiles/tdset.dmp | 194 ++++++++++----- tools/testfiles/tdset.h5 | Bin 4672 -> 7072 bytes tools/testfiles/tdset2.dmp | 10 +- tools/testfiles/tdset2.h5 | Bin 9936 -> 9936 bytes tools/testfiles/thlink-1.ddl | 16 +- tools/testfiles/thlink-2.ddl | 10 +- tools/testfiles/thlink-3.ddl | 10 +- tools/testfiles/thlink-4.ddl | 18 +- tools/testfiles/thlink-5.ddl | 16 +- tools/testfiles/thlink.dmp | 353 ++++----------------------- tools/testfiles/thlink.h5 | Bin 3332 -> 3332 bytes tools/testfiles/tloop.h5 | Bin 0 -> 3168 bytes tools/testfiles/tloop2.h5 | Bin 0 -> 3168 bytes tools/testfiles/tmany.dmp | 533 +++++++++++++++++++++++++++++++++++++++++ tools/testfiles/tmany.h5 | Bin 0 -> 15160 bytes 32 files changed, 1317 insertions(+), 500 deletions(-) create mode 100644 tools/testfiles/tloop.h5 create mode 100644 tools/testfiles/tloop2.h5 create mode 100644 tools/testfiles/tmany.dmp create mode 100644 tools/testfiles/tmany.h5 diff --git a/tools/testfiles/h5dumptst.c b/tools/testfiles/h5dumptst.c index b145b3d..7cc9eb4 100644 --- a/tools/testfiles/h5dumptst.c +++ b/tools/testfiles/h5dumptst.c @@ -14,6 +14,8 @@ #define FILE8 "tdset2.h5" #define FILE9 "tcompound2.h5" #define FILE10 "tloop.h5" +#define FILE11 "tloop2.h5" +#define FILE12 "tmany.h5" static void test_group(void) { hid_t fid, group; @@ -734,6 +736,17 @@ float dset2_1[10], dset2_2[3][5]; } +/* + o + /___\ + g1 o/ \o g2 + \___/ + + +o - group objects + +*/ + static void test_loop(void) { hid_t fid, group; @@ -750,6 +763,204 @@ hid_t fid, group; H5Fclose(fid); } +static void test_loop2(void) { +hid_t fid, group; + + fid = H5Fcreate(FILE11, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* create group object g1 and implcit path from root object */ + group = H5Gcreate (fid, "/g1", 0); + H5Gclose(group); + + /* create group object g2 and implcit path from root object */ + group = H5Gcreate (fid, "/g2", 0); + H5Gclose(group); + + /* create path from object at /g1 to object at /g2 and name it g1.1 */ + H5Glink (fid, H5G_LINK_HARD, "/g2", "/g1/g1.1"); /* + + /* create path from object at /g2 to object at /g1 and name it g2.1 */ + H5Glink (fid, H5G_LINK_SOFT, "/g1", "/g2/g2.1"); + + H5Fclose(fid); + +} + +/* + / + | | | \ \ \ + g1 g2 g3 g4 g5 g6 + / \ | | \ \ \ + g1.1 g1.2 slink2 link3 dset2 slink4 dset3 + | | (g1) (dset2) (dset3) + dset1 link1 + (dset1) +*/ + +static void test_many(void) { +hid_t fid, group, attr, dataset, space, space2, type, create_plist; +hsize_t dims[2]; +int data[2][2], dset2[10][10], dset3[10][10]; +double d[10]; + +char buf[60]; +int i, j; +int i0, i1, i2, i3; +int a[2][2][2][2]; +double b[2][2][2][2]; +double c[2][2][2][2]; +hsize_t sdim, maxdim; + +typedef struct { /* compound type has members with rank > 1 */ + int a[2][2][2][2]; /* arrays are 2x2x2x2 */ + double b[2][2][2][2]; + double c[2][2][2][2]; +} dset1_t; +dset1_t dset1[6]; + +size_t dim[4]; +int index[4] = {0,1,2,3}; /* normal indicies */ +const int perm[4] = {0,1,2,3}; /* the 0'th and the 3'rd indices are permuted */ + + fid = H5Fcreate(FILE12, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + group = H5Gcreate (fid, "/g1", 0); + H5Gclose(group); + + create_plist = H5Pcreate(H5P_DATASET_CREATE); + + sdim = 2; + H5Pset_chunk(create_plist, 1, &sdim); + + group = H5Gcreate (fid, "/g1/g1.1", 0); + + type = H5Tcreate (H5T_COMPOUND, sizeof(dset1[0])); + + dim[0] = dim[1] = dim[2] = dim[3] = 2; + H5Tinsert_array(type, "a_array", HOFFSET(dset1_t, a), 4, dim, perm, H5T_STD_I32BE); + H5Tinsert_array(type, "b_array", HOFFSET(dset1_t, b), 4, dim, perm, H5T_IEEE_F64BE); + H5Tinsert_array(type, "c_array", HOFFSET(dset1_t, c), 4, dim, perm, H5T_IEEE_F64BE); + +/* + H5Tcommit(group, "type1", type); +*/ + + /* dset1 */ + sdim = 6; + maxdim = H5S_UNLIMITED; + space = H5Screate_simple(1, &sdim, &maxdim); + dataset = H5Dcreate(group, "dset1", type, space, create_plist); + + /* add attributes to dset1 */ + dims[0] = 10; + space2 = H5Screate_simple(1, dims, NULL); + attr = H5Acreate (dataset, "attr1", H5T_NATIVE_CHAR, space2, H5P_DEFAULT); + sprintf(buf, "abcdefghi"); + H5Awrite(attr, H5T_NATIVE_CHAR, buf); + H5Sclose(space2); + H5Aclose(attr); + + dims[0] = 2; dims[1] = 2; + space2 = H5Screate_simple(2, dims, NULL); + attr = H5Acreate (dataset, "attr2", H5T_STD_I32BE, space2, H5P_DEFAULT); + data[0][0] = 0; data[0][1] = 1; data[1][0] = 2; data[1][1] = 3; + H5Awrite(attr, H5T_STD_I32BE, data); + H5Sclose(space2); + H5Aclose(attr); + + dims[0] = 10; + space2 = H5Screate_simple(1, dims, NULL); + attr = H5Acreate (dataset, "attr3", H5T_IEEE_F64BE, space2, H5P_DEFAULT); + for (i = 0; i < 10; i++) d[i] = 0.1 * i; + H5Awrite(attr, H5T_IEEE_F64BE, d); + H5Sclose(space2); + H5Aclose(attr); + + for (j=0; j