diff options
-rw-r--r-- | test/Makefile.in | 12 | ||||
-rw-r--r-- | test/dtypes.c | 77 | ||||
-rw-r--r-- | test/fillval.c | 12 | ||||
-rw-r--r-- | test/istore.c | 1 |
4 files changed, 96 insertions, 6 deletions
diff --git a/test/Makefile.in b/test/Makefile.in index 8881e0e..a7c66a4 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -15,7 +15,7 @@ LIBS=libh5test.a ../src/libhdf5.a @LIBS@ # executed, generally most specific tests to least specific tests. TEST_PROGS=testhdf5 lheap ohdr stab gheap hyperslab istore bittests dtypes \ dsets cmpd_dset extend external links unlink big mtime fillval mount \ - flush1 flush2 + flush1 flush2 enum TIMINGS=iopipe chunk ragged overhead # The libh5test.a library provides common support code for the tests. @@ -36,7 +36,8 @@ MOSTLYCLEAN=cmpd_dset.h5 dataset.h5 extend.h5 istore.h5 tfile1.h5 tfile2.h5 \ gheap1.h5 gheap2.h5 gheap3.h5 gheap4.h5 links.h5 chunk.h5 \ big.data big[0-9][0-9][0-9][0-9][0-9].h5 dtypes1.h5 dtypes2.h5 \ tattr.h5 tselect.h5 mtime.h5 ragged.h5 unlink.h5 overhead.h5 \ - fillval_[0-9].h5 fillval.raw mount_[0-9].h5 trefer.h5 flush.h5 + fillval_[0-9].h5 fillval.raw mount_[0-9].h5 trefer.h5 flush.h5 \ + enum1.h5 CLEAN=$(TIMINGS) # Source and object files for programs... The TEST_SRC list contains all the @@ -46,8 +47,8 @@ CLEAN=$(TIMINGS) TEST_SRC=big.c bittests.c chunk.c cmpd_dset.c dsets.c dtypes.c extend.c \ external.c fillval.c flush1.c flush2.c gheap.c h5test.c hyperslab.c \ iopipe.c istore.c lheap.c links.c mount.c mtime.c ohdr.c overhead.c \ - ragged.c space_overflow.c stab.c tattr.c testhdf5.c tfile.c th5s.c \ - tmeta.c trefer.c tselect.c unlink.c + ragged.c stab.c tattr.c testhdf5.c tfile.c th5s.c tmeta.c trefer.c \ + tselect.c unlink.c enum.c TEST_OBJ=$(TEST_SRC:.c=.o) # Private header files (not to be installed)... @@ -141,4 +142,7 @@ flush1: flush1.o flush2: flush2.o $(CC) $(CFLAGS) -o $@ flush2.o $(LDFLAGS) $(LIBS) +enum: enum.o + $(CC) $(CFLAGS) -o $@ enum.o $(LDFLAGS) $(LIBS) + @CONCLUDE@ diff --git a/test/dtypes.c b/test/dtypes.c index 3038d15..108fcb2 100644 --- a/test/dtypes.c +++ b/test/dtypes.c @@ -1047,7 +1047,81 @@ test_conv_str_2(void) return ret_value; } - + +/*------------------------------------------------------------------------- + * Function: test_conv_enum_1 + * + * Purpose: Test conversion speed for enum data types + * + * Return: Success: 0 + * + * Failure: -1 + * + * Programmer: Robb Matzke + * Tuesday, January 5, 1999 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +static herr_t +test_conv_enum_1(void) +{ + const int nelmts=200000, ntests=NTESTS; + int i, val, *buf=NULL; + hid_t t1, t2; + char s[80]; + herr_t ret_value=FAIL; + + /* Build the data types */ + t1 = H5Tcreate(H5T_ENUM, sizeof(int)); + t2 = H5Tenum_create(H5T_NATIVE_INT); + s[1] = '\0'; + for (i=0; i<26; i++) { + s[0] = 'A'+i; + H5Tenum_insert(t1, s, &i); + H5Tenum_insert(t2, s, (val=i*1000+i, &val)); + } + + /* Initialize the buffer */ + buf = malloc(nelmts*MAX(H5Tget_size(t1), H5Tget_size(t2))); + for (i=0; i<nelmts; i++) buf[i] = rand() % 26; + + /* Conversions */ + for (i=0; i<ntests; i++) { + if (ntests>1) { + sprintf(s, "Testing random enum conversion O(N) (test %d/%d)", + i+1, ntests); + } else { + sprintf(s, "Testing random enum conversion O(N)"); + } + printf("%-70s", s); + fflush(stdout); + if (H5Tconvert(t1, t2, nelmts, buf, NULL)<0) goto error; + PASSED(); + } + + for (i=0; i<ntests; i++) { + if (ntests>1) { + sprintf(s, "Testing random enum conversion O(N log N) " + "(test %d/%d)", i+1, ntests); + } else { + sprintf(s, "Testing random enum conversion O(N log N)"); + } + printf("%-70s", s); + fflush(stdout); + if (H5Tconvert(t2, t1, nelmts, buf, NULL)<0) goto error; + PASSED(); + } + ret_value = 0; + + error: + H5Tclose(t1); + H5Tclose(t2); + if (buf) free(buf); + reset_hdf5(); + return ret_value; +} /*------------------------------------------------------------------------- @@ -2845,6 +2919,7 @@ main(void) nerrors += test_conv_str_1()<0 ? 1 : 0; nerrors += test_conv_str_2()<0 ? 1 : 0; nerrors += test_conv_int ()<0 ? 1 : 0; + nerrors += test_conv_enum_1()<0 ? 1 : 0; /* Does floating point overflow generate a SIGFPE? */ generates_sigfpe(); diff --git a/test/fillval.c b/test/fillval.c index 53190a1..a4b0fd1 100644 --- a/test/fillval.c +++ b/test/fillval.c @@ -534,7 +534,7 @@ test_extend(hid_t fapl, const char *basename, H5D_layout_t layout) if (H5D_CONTIGUOUS==layout) { SKIPPED(); puts(" Not implemented yet -- needs H5S_SELECT_DIFF operator"); - return 0; + goto skip; } #endif @@ -665,6 +665,16 @@ test_extend(hid_t fapl, const char *basename, H5D_layout_t layout) H5Fclose(file); } H5E_END_TRY; return 1; + + skip: + H5E_BEGIN_TRY { + H5Dclose(dset); + H5Sclose(fspace); + H5Sclose(mspace); + H5Pclose(dcpl); + H5Fclose(file); + } H5E_END_TRY; + return 0; } diff --git a/test/istore.c b/test/istore.c index 93c47b7..0bd1c90 100644 --- a/test/istore.c +++ b/test/istore.c @@ -611,6 +611,7 @@ main(int argc, char *argv[]) } /* Close the test file and exit */ + H5Pclose(fcpl); H5Fclose(file); if (nerrors) { |