diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/dsets.c | 2 | ||||
-rw-r--r-- | test/tstab.c | 93 |
2 files changed, 91 insertions, 4 deletions
diff --git a/test/dsets.c b/test/dsets.c index 1e0799d..0fb7732 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -703,7 +703,7 @@ test_multiopen (hid_t file) if ((space=H5Screate_simple (1, cur_size, max_size))<0) goto error; if ((dset1=H5Dcreate (file, "multiopen", H5T_NATIVE_INT, space, dcpl))<0) goto error; - if ((dset2=H5Dopen (file, "multiopen"))<0) goto error; + if ((dset2=H5Dopen (dset1, "."))<0) goto error; if (H5Sclose (space)<0) goto error; /* Extend with the first handle */ diff --git a/test/tstab.c b/test/tstab.c index 5ddad69..64dced5 100644 --- a/test/tstab.c +++ b/test/tstab.c @@ -24,13 +24,98 @@ #include <H5Gprivate.h> #include <H5Oprivate.h> -#define TEST_FILE "tstab2.h5" +#define TEST_FILE_1 "tstab1.h5" +#define TEST_FILE_2 "tstab2.h5" /* * This file needs to access private datatypes from the H5G package. */ #define H5G_PACKAGE #include <H5Gpkg.h> + + +/*------------------------------------------------------------------------- + * Function: test_1 + * + * Purpose: Miscellaneous group tests + * + * Return: void + * + * Programmer: Robb Matzke + * Friday, September 11, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static void +test_1(void) +{ + hid_t file; + hid_t g1, g2, g3, g4; + herr_t status; + char comment[64]; + int cmp; + + /* Test current working groups */ + MESSAGE(2, ("........current working groups\n")); + file = H5Fcreate(TEST_FILE_1, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + CHECK_I(file, "H5Fcreate"); + + g1 = H5Gcreate(file, "test_1a", 0); + CHECK_I(g1, "H5Gcreate"); + status = H5Gset(file, "test_1a"); + + g2 = H5Gcreate(g1, "sub_1", 0); + CHECK_I(g2, "H5Gcreate"); + g3 = H5Gcreate(file, "sub_2", 0); + CHECK_I(g3, "H5Gcreate"); + + H5Gpop(g3); + g4 = H5Gcreate(file, "test_1b", 0); + CHECK_I(g4, "H5Gcreate"); + status = H5Gset_comment(g4, ".", "hello world"); + CHECK_I(status, "H5Gset_comment"); + + /* Close all groups */ + status = H5Gclose(g1); + CHECK_I(status, "H5Gclose"); + status = H5Gclose(g2); + CHECK_I(status, "H5Gclose"); + status = H5Gclose(g3); + CHECK_I(status, "H5Gclose"); + status = H5Gclose(g4); + CHECK_I(status, "H5Gclose"); + + /* Open all groups with absolute names to check for exsistence */ + g1 = H5Gopen(file, "/test_1a"); + CHECK_I(g1, "H5Gopen"); + g2 = H5Gopen(file, "/test_1a/sub_1"); + CHECK_I(g2, "H5Gopen"); + g3 = H5Gopen(file, "/test_1a/sub_2"); + CHECK_I(g3, "H5Gopen"); + g4 = H5Gopen(file, "/test_1b"); + CHECK_I(g4, "H5Gopen"); + status = H5Gget_comment(g4, "././.", sizeof comment, comment); + CHECK_I(status, "H5Gget_comment"); + cmp = strcmp(comment, "hello world"); + VERIFY(cmp, 0, "strcmp"); + + /* Close all groups */ + status = H5Gclose(g1); + CHECK_I(status, "H5Gclose"); + status = H5Gclose(g2); + CHECK_I(status, "H5Gclose"); + status = H5Gclose(g3); + CHECK_I(status, "H5Gclose"); + status = H5Gclose(g4); + CHECK_I(status, "H5Gclose"); + + /* Close file */ + status = H5Fclose(file); + CHECK_I(status, "H5Fclose"); +} + /*------------------------------------------------------------------------- * Function: test_2 @@ -94,7 +179,7 @@ test_2(void) #endif /* create the file */ - fid = H5Fcreate(TEST_FILE, H5F_ACC_TRUNC, create_plist, access_plist); + fid = H5Fcreate(TEST_FILE_2, H5F_ACC_TRUNC, create_plist, access_plist); CHECK(fid, FAIL, "H5Fcreate"); f = H5I_object(fid); CHECK(f, NULL, "H5I_object"); @@ -149,6 +234,7 @@ test_2(void) void test_stab(void) { + test_1(); test_2(); } @@ -170,6 +256,7 @@ test_stab(void) void cleanup_stab(void) { - remove(TEST_FILE); + remove(TEST_FILE_1); + remove(TEST_FILE_2); } |