diff options
-rw-r--r-- | c++/test/Makefile.am | 2 | ||||
-rw-r--r-- | c++/test/Makefile.in | 395 | ||||
-rw-r--r-- | c++/test/tattr.cpp | 1059 |
3 files changed, 1206 insertions, 250 deletions
diff --git a/c++/test/Makefile.am b/c++/test/Makefile.am index 62dfb37..4e221fe 100644 --- a/c++/test/Makefile.am +++ b/c++/test/Makefile.am @@ -34,6 +34,6 @@ check_PROGRAMS=$(TEST_PROG) LDADD=$(LIBH5CPP) $(LIBH5TEST) $(LIBHDF5) dsets_SOURCES=dsets.cpp h5cpputil.cpp -testhdf5_SOURCES=testhdf5.cpp tfile.cpp th5s.cpp h5cpputil.cpp +testhdf5_SOURCES=testhdf5.cpp tattr.cpp tfile.cpp th5s.cpp h5cpputil.cpp include $(top_srcdir)/config/conclude.am diff --git a/c++/test/Makefile.in b/c++/test/Makefile.in index 8efc7f4..f58e4d8 100644 --- a/c++/test/Makefile.in +++ b/c++/test/Makefile.in @@ -1,8 +1,8 @@ -# Makefile.in generated by automake 1.9.5 from Makefile.am. +# Makefile.in generated by automake 1.6.3 from Makefile.am. # @configure_input@ -# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, -# 2003, 2004, 2005 Free Software Foundation, Inc. +# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 +# Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. @@ -29,136 +29,91 @@ # # HDF5-C++ Makefile(.in) # -SOURCES = $(dsets_SOURCES) $(testhdf5_SOURCES) +SHELL = @SHELL@ srcdir = @srcdir@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +oldincludedir = /usr/include pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ top_builddir = ../.. + am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c +INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) -transform = $(program_transform_name) +transform = @program_transform_name@ NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : -build_triplet = @build@ +host_alias = @host_alias@ host_triplet = @host@ -DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ - $(top_srcdir)/config/commence.am \ - $(top_srcdir)/config/conclude.am -check_PROGRAMS = $(am__EXEEXT_1) -subdir = c++/test -ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 -am__aclocal_m4_deps = $(top_srcdir)/configure.in -am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ - $(ACLOCAL_M4) -mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs -CONFIG_HEADER = $(top_builddir)/src/H5config.h -CONFIG_CLEAN_FILES = -am__EXEEXT_1 = dsets$(EXEEXT) testhdf5$(EXEEXT) -am_dsets_OBJECTS = dsets.$(OBJEXT) h5cpputil.$(OBJEXT) -dsets_OBJECTS = $(am_dsets_OBJECTS) -dsets_LDADD = $(LDADD) -am__DEPENDENCIES_1 = $(top_builddir)/c++/src/libhdf5_cpp.la -am__DEPENDENCIES_2 = $(top_builddir)/test/libh5test.la -am__DEPENDENCIES_3 = $(top_builddir)/src/libhdf5.la -dsets_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_3) -am_testhdf5_OBJECTS = testhdf5.$(OBJEXT) tfile.$(OBJEXT) \ - th5s.$(OBJEXT) h5cpputil.$(OBJEXT) -testhdf5_OBJECTS = $(am_testhdf5_OBJECTS) -testhdf5_LDADD = $(LDADD) -testhdf5_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \ - $(am__DEPENDENCIES_3) -DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src -depcomp = $(SHELL) $(top_srcdir)/bin/depcomp -am__depfiles_maybe = depfiles -CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ - $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -LTCXXCOMPILE = $(LIBTOOL) --tag=CXX --mode=compile $(CXX) $(DEFS) \ - $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ - $(AM_CXXFLAGS) $(CXXFLAGS) -CXXLD = $(CXX) -CXXLINK = $(LIBTOOL) --tag=CXX --mode=link $(CXXLD) $(AM_CXXFLAGS) \ - $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ -SOURCES = $(dsets_SOURCES) $(testhdf5_SOURCES) -DIST_SOURCES = $(dsets_SOURCES) $(testhdf5_SOURCES) -ETAGS = etags -CTAGS = ctags -DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +EXEEXT = @EXEEXT@ +OBJEXT = @OBJEXT@ +PATH_SEPARATOR = @PATH_SEPARATOR@ + +# Install directories that automake doesn't know about +includedir = $(exec_prefix)/include + # Set the paths for autotools to be correct on heping. # Ideally, these tools should never be needed during the build. ACLOCAL = /usr/bin/aclocal +AUTOCONF = /usr/local/autoconf-2.59/bin/autoconf +AUTOMAKE = /usr/bin/automake +AUTOHEADER = /usr/local/autoconf-2.59/bin/autoheader ADD_PARALLEL_FILES = @ADD_PARALLEL_FILES@ -AMDEP_FALSE = @AMDEP_FALSE@ -AMDEP_TRUE = @AMDEP_TRUE@ AMTAR = @AMTAR@ AM_MAKEFLAGS = @AM_MAKEFLAGS@ AR = @AR@ -AUTOCONF = /usr/local/autoconf-2.59/bin/autoconf -AUTOHEADER = /usr/local/autoconf-2.59/bin/autoheader -AUTOMAKE = /usr/bin/automake +AS = @AS@ AWK = @AWK@ -BUILD_CXX_CONDITIONAL_FALSE = @BUILD_CXX_CONDITIONAL_FALSE@ -BUILD_CXX_CONDITIONAL_TRUE = @BUILD_CXX_CONDITIONAL_TRUE@ -BUILD_FORTRAN_CONDITIONAL_FALSE = @BUILD_FORTRAN_CONDITIONAL_FALSE@ -BUILD_FORTRAN_CONDITIONAL_TRUE = @BUILD_FORTRAN_CONDITIONAL_TRUE@ -BUILD_HDF5_HL_CONDITIONAL_FALSE = @BUILD_HDF5_HL_CONDITIONAL_FALSE@ -BUILD_HDF5_HL_CONDITIONAL_TRUE = @BUILD_HDF5_HL_CONDITIONAL_TRUE@ -BUILD_PABLO_CONDITIONAL_FALSE = @BUILD_PABLO_CONDITIONAL_FALSE@ -BUILD_PABLO_CONDITIONAL_TRUE = @BUILD_PABLO_CONDITIONAL_TRUE@ -BUILD_PARALLEL_CONDITIONAL_FALSE = @BUILD_PARALLEL_CONDITIONAL_FALSE@ -BUILD_PARALLEL_CONDITIONAL_TRUE = @BUILD_PARALLEL_CONDITIONAL_TRUE@ BUILD_PDB2HDF = @BUILD_PDB2HDF@ -BUILD_PDB2HDF_CONDITIONAL_FALSE = @BUILD_PDB2HDF_CONDITIONAL_FALSE@ -BUILD_PDB2HDF_CONDITIONAL_TRUE = @BUILD_PDB2HDF_CONDITIONAL_TRUE@ BYTESEX = @BYTESEX@ CC = @CC@ -CCDEPMODE = @CCDEPMODE@ CC_VERSION = @CC_VERSION@ -CFLAGS = @CFLAGS@ CONFIG_DATE = @CONFIG_DATE@ CONFIG_MODE = @CONFIG_MODE@ CONFIG_USER = @CONFIG_USER@ -CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXCPP = @CXXCPP@ -CXXDEPMODE = @CXXDEPMODE@ -CXXFLAGS = @CXXFLAGS@ -CYGPATH_W = @CYGPATH_W@ DEBUG_PKG = @DEBUG_PKG@ -DEFS = @DEFS@ DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ DYNAMIC_DIRS = @DYNAMIC_DIRS@ ECHO = @ECHO@ -ECHO_C = @ECHO_C@ -ECHO_N = @ECHO_N@ -ECHO_T = @ECHO_T@ -EGREP = @EGREP@ -EXEEXT = @EXEEXT@ F77 = @F77@ - -# Make sure that these variables are exported to the Makefiles -F9XMODEXT = @F9XMODEXT@ -F9XMODFLAG = @F9XMODFLAG@ F9XSUFFIXFLAG = @F9XSUFFIXFLAG@ FC = @FC@ -FCFLAGS = @FCFLAGS@ FFLAGS = @FFLAGS@ FILTERS = @FILTERS@ FSEARCH_DIRS = @FSEARCH_DIRS@ +GASS = @GASS@ H5_VERSION = @H5_VERSION@ HADDR_T = @HADDR_T@ HDF5_INTERFACES = @HDF5_INTERFACES@ @@ -168,33 +123,17 @@ HL_FOR = @HL_FOR@ HSIZET = @HSIZET@ HSIZE_T = @HSIZE_T@ HSSIZE_T = @HSSIZE_T@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INSTRUMENT_LIBRARY = @INSTRUMENT_LIBRARY@ -LDFLAGS = @LDFLAGS@ -LIBOBJS = @LIBOBJS@ -LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LN_S = @LN_S@ -LTLIBOBJS = @LTLIBOBJS@ LT_STATIC_EXEC = @LT_STATIC_EXEC@ MAINT = @MAINT@ -MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@ -MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@ -MAKEINFO = @MAKEINFO@ MPE = @MPE@ +OBJDUMP = @OBJDUMP@ OBJECT_NAMELEN_DEFAULT_F = @OBJECT_NAMELEN_DEFAULT_F@ -OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ -PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ -PACKAGE_NAME = @PACKAGE_NAME@ -PACKAGE_STRING = @PACKAGE_STRING@ -PACKAGE_TARNAME = @PACKAGE_TARNAME@ -PACKAGE_VERSION = @PACKAGE_VERSION@ PARALLEL = @PARALLEL@ -PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PTHREAD = @PTHREAD@ RANLIB = @RANLIB@ @@ -205,12 +144,12 @@ R_INTEGER = @R_INTEGER@ R_LARGE = @R_LARGE@ SEARCH = @SEARCH@ SETX = @SETX@ -SET_MAKE = @SET_MAKE@ -SHELL = @SHELL@ SIZE_T = @SIZE_T@ SRB = @SRB@ +SSL = @SSL@ STATIC_SHARED = @STATIC_SHARED@ STRIP = @STRIP@ +TESTGASS = @TESTGASS@ TESTPARALLEL = @TESTPARALLEL@ TESTSRB = @TESTSRB@ TRACE_API = @TRACE_API@ @@ -221,52 +160,9 @@ USE_FILTER_SCALEOFFSET = @USE_FILTER_SCALEOFFSET@ USE_FILTER_SHUFFLE = @USE_FILTER_SHUFFLE@ USE_FILTER_SZIP = @USE_FILTER_SZIP@ VERSION = @VERSION@ -ac_ct_AR = @ac_ct_AR@ -ac_ct_CC = @ac_ct_CC@ -ac_ct_CXX = @ac_ct_CXX@ -ac_ct_F77 = @ac_ct_F77@ -ac_ct_FC = @ac_ct_FC@ -ac_ct_RANLIB = @ac_ct_RANLIB@ -ac_ct_STRIP = @ac_ct_STRIP@ -am__fastdepCC_FALSE = @am__fastdepCC_FALSE@ -am__fastdepCC_TRUE = @am__fastdepCC_TRUE@ -am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@ -am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@ am__include = @am__include@ -am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ -am__tar = @am__tar@ -am__untar = @am__untar@ -bindir = @bindir@ -build = @build@ -build_alias = @build_alias@ -build_cpu = @build_cpu@ -build_os = @build_os@ -build_vendor = @build_vendor@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -host = @host@ -host_alias = @host_alias@ -host_cpu = @host_cpu@ -host_os = @host_os@ -host_vendor = @host_vendor@ - -# Install directories that automake doesn't know about -includedir = $(exec_prefix)/include -infodir = @infodir@ install_sh = @install_sh@ -libdir = @libdir@ -libexecdir = @libexecdir@ -localstatedir = @localstatedir@ -mandir = @mandir@ -mkdir_p = @mkdir_p@ -oldincludedir = @oldincludedir@ -prefix = @prefix@ -program_transform_name = @program_transform_name@ -sbindir = @sbindir@ -sharedstatedir = @sharedstatedir@ -sysconfdir = @sysconfdir@ -target_alias = @target_alias@ # Shell commands used in Makefiles RM = rm -f @@ -289,6 +185,10 @@ H5CC_PP = $(bindir)/h5pcc H5FC = $(bindir)/h5fc H5FC_PP = $(bindir)/h5pfc +# Make sure that these variables are exported to the Makefiles +F9XMODEXT = @F9XMODEXT@ +F9XMODFLAG = @F9XMODFLAG@ + # Include src, test, and c++/src directories INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/test -I$(top_srcdir)/c++/src @@ -298,11 +198,13 @@ AM_LDFLAGS = -static # These are our main targets. They should be listed in the order to be # executed, generally most specific tests to least specific tests. TEST_PROG = dsets testhdf5 +check_PROGRAMS = $(TEST_PROG) # The tests depend on the hdf5 library, test library, and the c++ library LDADD = $(LIBH5CPP) $(LIBH5TEST) $(LIBHDF5) + dsets_SOURCES = dsets.cpp h5cpputil.cpp -testhdf5_SOURCES = testhdf5.cpp tfile.cpp th5s.cpp h5cpputil.cpp +testhdf5_SOURCES = testhdf5.cpp tattr.cpp tfile.cpp th5s.cpp h5cpputil.cpp # Automake needs to be taught how to build lib, progs, and tests targets. # These will be filled in automatically for the most part (e.g., @@ -316,39 +218,58 @@ PROGS = $(bin_PROGRAMS) $(bin_SCRIPTS) $(noinst_PROGRAMS) $(noinst_SCRIPTS) \ $(EXTRA_PROG) TESTS = $(check_PROGRAMS) $(check_SCRIPTS) $(EXTRA_TEST) +subdir = c++/test +mkinstalldirs = $(SHELL) $(top_srcdir)/bin/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/src/H5config.h +CONFIG_CLEAN_FILES = +check_PROGRAMS = dsets$(EXEEXT) testhdf5$(EXEEXT) +am_dsets_OBJECTS = dsets.$(OBJEXT) h5cpputil.$(OBJEXT) +dsets_OBJECTS = $(am_dsets_OBJECTS) +dsets_LDADD = $(LDADD) +dsets_DEPENDENCIES = $(top_builddir)/c++/src/libhdf5_cpp.la \ + $(top_builddir)/test/libh5test.la \ + $(top_builddir)/src/libhdf5.la +dsets_LDFLAGS = +am_testhdf5_OBJECTS = testhdf5.$(OBJEXT) tattr.$(OBJEXT) tfile.$(OBJEXT) \ + th5s.$(OBJEXT) h5cpputil.$(OBJEXT) +testhdf5_OBJECTS = $(am_testhdf5_OBJECTS) +testhdf5_LDADD = $(LDADD) +testhdf5_DEPENDENCIES = $(top_builddir)/c++/src/libhdf5_cpp.la \ + $(top_builddir)/test/libh5test.la \ + $(top_builddir)/src/libhdf5.la +testhdf5_LDFLAGS = + +DEFS = @DEFS@ +DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/src +LDFLAGS = @LDFLAGS@ +LIBS = @LIBS@ +depcomp = $(SHELL) $(top_srcdir)/bin/depcomp +am__depfiles_maybe = depfiles +@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/dsets.Po ./$(DEPDIR)/h5cpputil.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/tattr.Po ./$(DEPDIR)/testhdf5.Po \ +@AMDEP_TRUE@ ./$(DEPDIR)/tfile.Po ./$(DEPDIR)/th5s.Po +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +CXXFLAGS = @CXXFLAGS@ +DIST_SOURCES = $(dsets_SOURCES) $(testhdf5_SOURCES) +DIST_COMMON = Makefile.am Makefile.in +SOURCES = $(dsets_SOURCES) $(testhdf5_SOURCES) + all: all-am .SUFFIXES: .SUFFIXES: .cpp .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(am__configure_deps) - @for dep in $?; do \ - case '$(am__configure_deps)' in \ - *$$dep*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ - && exit 0; \ - exit 1;; \ - esac; \ - done; \ - echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign c++/test/Makefile'; \ +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/config/commence.am $(top_srcdir)/config/conclude.am $(top_srcdir)/configure.in $(ACLOCAL_M4) cd $(top_srcdir) && \ $(AUTOMAKE) --foreign c++/test/Makefile -.PRECIOUS: Makefile -Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status - @case '$?' in \ - *config.status*) \ - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ - *) \ - echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ - cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ - esac; - -$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh - -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) - cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe) clean-checkPROGRAMS: @list='$(check_PROGRAMS)'; for p in $$list; do \ @@ -364,37 +285,39 @@ testhdf5$(EXEEXT): $(testhdf5_OBJECTS) $(testhdf5_DEPENDENCIES) $(CXXLINK) $(testhdf5_LDFLAGS) $(testhdf5_OBJECTS) $(testhdf5_LDADD) $(LIBS) mostlyclean-compile: - -rm -f *.$(OBJEXT) + -rm -f *.$(OBJEXT) core *.core distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dsets.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/h5cpputil.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tattr.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testhdf5.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tfile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/th5s.Po@am__quote@ +distclean-depend: + -rm -rf ./$(DEPDIR) + .cpp.o: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< .cpp.obj: -@am__fastdepCXX_TRUE@ if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` +@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(CXXCOMPILE) -c -o $@ `cygpath -w $<` .cpp.lo: -@am__fastdepCXX_TRUE@ if $(LTCXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \ -@am__fastdepCXX_TRUE@ then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Plo"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $< +@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@ +@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ + $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$< +CXXDEPMODE = @CXXDEPMODE@ mostlyclean-libtool: -rm -f *.lo @@ -406,6 +329,11 @@ distclean-libtool: -rm -f libtool uninstall-info-am: +ETAGS = etags +ETAGSFLAGS = + +tags: TAGS + ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ @@ -414,7 +342,6 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique -tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) @@ -426,24 +353,8 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ - if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ - test -n "$$unique" || unique=$$empty_fix; \ - $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ - $$tags $$unique; \ - fi -ctags: CTAGS -CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ - $(TAGS_FILES) $(LISP) - tags=; \ - here=`pwd`; \ - list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ - unique=`for i in $$list; do \ - if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ - done | \ - $(AWK) ' { files[$$0] = 1; } \ - END { for (i in files) print i; }'`; \ - test -z "$(CTAGS_ARGS)$$tags$$unique" \ - || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + test -z "$(ETAGS_ARGS)$$tags$$unique" \ + || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique GTAGS: @@ -452,22 +363,19 @@ GTAGS: && gtags -i $(GTAGS_ARGS) $$here distclean-tags: - -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) + +top_distdir = ../.. +distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - $(mkdir_p) $(distdir)/../../config - @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ - topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \ - list='$(DISTFILES)'; for file in $$list; do \ - case $$file in \ - $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ - $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \ - esac; \ + @list='$(DISTFILES)'; for file in $$list; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ dir="/$$dir"; \ - $(mkdir_p) "$(distdir)$$dir"; \ + $(mkinstalldirs) "$(distdir)$$dir"; \ else \ dir=''; \ fi; \ @@ -487,7 +395,9 @@ check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-TESTS check: check-am all-am: Makefile all-local + installdirs: + install: install-am install-exec: install-exec-am install-data: install-data-am @@ -499,7 +409,7 @@ install-am: all-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ - install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: @@ -507,28 +417,24 @@ mostlyclean-generic: clean-generic: distclean-generic: - -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -rm -f Makefile $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-checkPROGRAMS clean-generic clean-libtool \ - mostlyclean-am +clean-am: clean-checkPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile -distclean-am: clean-am distclean-compile distclean-generic \ - distclean-libtool distclean-tags + +distclean-am: clean-am distclean-compile distclean-depend \ + distclean-generic distclean-libtool distclean-tags dvi: dvi-am dvi-am: -html: html-am - info: info-am info-am: @@ -544,8 +450,7 @@ install-man: installcheck-am: maintainer-clean: maintainer-clean-am - -rm -rf ./$(DEPDIR) - -rm -f Makefile + maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am @@ -553,27 +458,19 @@ mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool -pdf: pdf-am - -pdf-am: - -ps: ps-am - -ps-am: - uninstall-am: uninstall-info-am -.PHONY: CTAGS GTAGS all all-am all-local check check-TESTS check-am \ - clean clean-checkPROGRAMS clean-generic clean-libtool ctags \ - distclean distclean-compile distclean-generic \ - distclean-libtool distclean-tags distdir dvi dvi-am html \ - html-am info info-am install install-am install-data \ - install-data-am install-exec install-exec-am install-info \ - install-info-am install-man install-strip installcheck \ - installcheck-am installdirs maintainer-clean \ - maintainer-clean-generic mostlyclean mostlyclean-compile \ - mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ - tags uninstall uninstall-am uninstall-info-am +.PHONY: GTAGS all all-am all-local check check-TESTS check-am clean \ + clean-checkPROGRAMS clean-generic clean-libtool distclean \ + distclean-compile distclean-depend distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am info \ + info-am install install-am install-data install-data-am \ + install-exec install-exec-am install-info install-info-am \ + install-man install-strip installcheck installcheck-am \ + installdirs maintainer-clean maintainer-clean-generic \ + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool tags uninstall uninstall-am \ + uninstall-info-am # lib/progs/tests targets recurse into subdirectories. build-* targets diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp new file mode 100644 index 0000000..48b95b1 --- /dev/null +++ b/c++/test/tattr.cpp @@ -0,0 +1,1059 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * 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://hdf.ncsa.uiuc.edu/HDF5/doc/Copyright.html. If you do not have * + * access to either file, you may request a copy from hdfhelp@ncsa.uiuc.edu. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/***************************************************************************** + FILE + tattr.cpp - HDF5 C++ testing the functionalities associated with the + C attribute interface (H5A) + + ***************************************************************************/ + +#include <string> + +#ifdef OLD_HEADER_FILENAME +#include <iostream.h> +#else +#include <iostream> +#endif + +#include "testhdf5.h" // C test header file +#include "H5Cpp.h" // C++ API header file + +#ifndef H5_NO_NAMESPACE +using namespace H5; +#endif + +#include "h5cpputil.h" // C++ utilility header file + +const string FILENAME("tattr.h5"); +const size_t ATTR_NAME_LEN = 16; +const size_t ATTR_MAX_DIMS = 7; +const string ATTR_TMP_NAME("temp_name"); + +/* 3-D dataset with fixed dimensions */ +const string SPACE1_NAME("Space1"); +const int SPACE1_RANK = 3; +const int SPACE1_DIM1 = 3; +const int SPACE1_DIM2 = 15; +const int SPACE1_DIM3 = 13; + +/* Dataset Information */ +const string DSET1_NAME("Dataset1"); +const string DSET2_NAME("Dataset2"); + +/* Group Information */ +const string GROUP1_NAME("/Group1"); + +/* Attribute Rank & Dimensions */ +const string ATTR1_NAME("Attr1"); +const int ATTR1_RANK = 1; +const int ATTR1_DIM1 = 3; +int attr_data1[ATTR1_DIM1]={512,-234,98123}; /* Test data for 1st attribute */ + +const string ATTR2_NAME("Attr2"); +const int ATTR2_RANK = 2; +const int ATTR2_DIM1 = 2; +const int ATTR2_DIM2 = 2; +int attr_data2[ATTR2_DIM1][ATTR2_DIM2]={{7614,-416},{197814,-3}}; /* Test data for 2nd attribute */ + +const string ATTR3_NAME("Attr3"); +const int ATTR3_RANK = 3; +const int ATTR3_DIM1 = 2; +const int ATTR3_DIM2 = 2; +const int ATTR3_DIM3 = 2; +double attr_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{2.3,-26.1},{0.123,-10.0}},{{981724.2,-0.91827},{2.0,23.0}}}; /* Test data for 3rd attribute */ + +const string ATTR4_NAME("Attr4"); +const int ATTR4_RANK = 2; +const int ATTR4_DIM1 = 2; +const int ATTR4_DIM2 = 2; + +const string ATTR4_FIELDNAME1("i"); +const string ATTR4_FIELDNAME2("d"); +const string ATTR4_FIELDNAME3("c"); +size_t attr4_field1_off=0; +size_t attr4_field2_off=0; +size_t attr4_field3_off=0; +struct attr4_struct { + int i; + double d; + char c; + } attr_data4[ATTR4_DIM1][ATTR4_DIM2]={{{3,-26.1,'d'},{-100000, 0.123,'3'}}, + {{-23,981724.2,'Q'},{0,2.0,'\n'}}}; // Test data for 4th attribute + +const string ATTR5_NAME("Attr5"); +const int ATTR5_RANK = 0; +float attr_data5 = (float)-5.123; // Test data for 5th attribute + +/* Info for another attribute */ +#define ATTR1A_NAME "Attr1_a" +int attr_data1a[ATTR1_DIM1]={256,11945,-22107}; + +/**************************************************************** +** +** test_attr_basic_write(): Test basic write attribute. +** Tests integer attributes on both datasets and groups +** +****************************************************************/ +static void +test_attr_basic_write(void) +{ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + hsize_t dims2[] = {ATTR1_DIM1}; + hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; + int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute + int i; + + // Output message about test being performed + MESSAGE(5, ("Testing Basic Attribute Writing Functions\n")); + + try { + // Create file + H5File fid1 (FILENAME, H5F_ACC_TRUNC); + + // Create dataspace for dataset + DataSpace ds_space (SPACE1_RANK, dims1); + + // Create a dataset + DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space); + + // Create dataspace for attribute + DataSpace att_space (ATTR1_RANK, dims2); + + // Create an attribute for the dataset + Attribute ds_attr1 = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space); + + // Try creating an attribute that already exists. This should fail + // since two attributes cannot have the same name. If an exception + // is not thrown for this action by createAttribute, then throw an + // invalid action exception. + try { + Attribute invalid_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space); + + // continuation here, that means no exception has been thrown + throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset"); + } + catch (AttributeIException E) // catching invalid creating attribute + {} // do nothing, exception expected + + // Write attribute information + ds_attr1.write (PredType::NATIVE_INT, attr_data1); + + // Read attribute information immediately, without closing attribute + ds_attr1.read (PredType::NATIVE_INT, read_data1); + + // Verify values read in + for(i=0; i<ATTR1_DIM1; i++) + if(attr_data1[i]!=read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); + + // Create another attribute for this dataset + Attribute ds_attr2 = dataset.createAttribute (ATTR1A_NAME, PredType::NATIVE_INT, att_space); + + // Write attribute information + ds_attr2.write (PredType::NATIVE_INT, attr_data1a); + + // Read attribute information immediately, without closing attribute + ds_attr2.read (PredType::NATIVE_INT, read_data1); + + // Verify values read in + for(i=0; i<ATTR1_DIM1; i++) + if(attr_data1a[i]!=read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1a[i],i,read_data1[i]); + + // Close both attributes + ds_attr1.close(); + ds_attr2.close(); + + /* + * Test attribute with group + */ + + // Create group in file fid1 + Group group = fid1.createGroup (GROUP1_NAME); + + // Create dataspace for attribute + DataSpace sid3(ATTR2_RANK, dims3); + + // Create an attribute for the group + Attribute gr_attr = group.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, sid3); + + // Check storage size for attribute + hsize_t attr_size = gr_attr.getStorageSize(); + verify_val(attr_size, (ATTR2_DIM1*ATTR2_DIM2*sizeof(int)), "Attribute::getStorageSize", __LINE__, __FILE__); + + // Try to create the same attribute again (should fail) + try { + Attribute invalid_attr = group.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, sid3); + // continuation here, that means no exception has been thrown + throw InvalidActionException("H5Group::createAttribute", "Attempting to create an existing attribute"); + } + catch (AttributeIException E) // catching invalid creating attribute + {} // do nothing, exception expected + + // Write attribute information + gr_attr.write (PredType::NATIVE_INT, attr_data2); + + // Check storage size for attribute + attr_size = gr_attr.getStorageSize(); + verify_val(attr_size, (ATTR2_DIM1*ATTR2_DIM2*sizeof(int)), "Attribute::getStorageSize", __LINE__, __FILE__); + } // end try block + + catch (Exception E) { + issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + } +} /* test_attr_basic_write() */ + +/**************************************************************** +** +** test_attr_rename(): Test renaming attribute function. +** +****************************************************************/ +static void +test_attr_rename(void) +{ + int read_data1[ATTR1_DIM1]={0}; // Buffer for reading the attribute + int i; + + // Output message about test being performed + MESSAGE(5, ("Testing Rename Attribute Function\n")); + + try { + // Open file + H5File fid1(FILENAME, H5F_ACC_RDWR); + + // Open the dataset + DataSet dataset = fid1.openDataSet(DSET1_NAME); + + // Check rename + + // change attribute name + dataset.renameAttr(ATTR1_NAME, ATTR_TMP_NAME); + + // Open attribute again + Attribute attr1(dataset.openAttribute(ATTR_TMP_NAME)); + + // Verify new attribute name + string attr_name = attr1.getName(); + verify_val(attr_name, ATTR_TMP_NAME, "Attribute::getName", __LINE__, __FILE__); + + // Read attribute information immediately, without closing attribute + attr1.read (PredType::NATIVE_INT, read_data1); + + // Verify values read in + for(i=0; i<ATTR1_DIM1; i++) + if(attr_data1[i]!=read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); + + // Close attribute + attr1.close(); + + // Open the second attribute + Attribute attr2(dataset.openAttribute(ATTR1A_NAME)); + + // Verify second attribute name + string attr2_name = attr2.getName(); + verify_val(attr2_name, ATTR1A_NAME, "Attribute::getName", __LINE__, __FILE__); + + // Read attribute information immediately, without closing attribute + attr2.read (PredType::NATIVE_INT, read_data1); + + // Verify values read in + for(i=0; i<ATTR1_DIM1; i++) + if(attr_data1a[i]!=read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1a[i],i,read_data1[i]); + + // Close attribute + attr2.close(); + + // Change first attribute back to the original name + dataset.renameAttr(ATTR_TMP_NAME, ATTR1_NAME); + + } // end try block + catch (Exception E) { + issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + } +} /* test_attr_rename() */ + +/******************************************************************** +** +** test_attr_basic_read(): Test basic read attribute. +** +********************************************************************/ +static void +test_attr_basic_read(void) +{ + // Output message about test being performed + MESSAGE(5, ("Testing Basic Attribute Reading Functions\n")); + + try { + // Open file + H5File fid1(FILENAME, H5F_ACC_RDWR); + + // Open the dataset + DataSet dataset = fid1.openDataSet(DSET1_NAME); + + // Verify the correct number of attributes + int num_attrs = dataset.getNumAttrs(); + verify_val(num_attrs, 2, "H5Object::getNumAttrs", __LINE__, __FILE__); + + // Open an attribute for the dataset + Attribute ds_attr=dataset.openAttribute(ATTR1_NAME); + + // Read attribute information + int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute + ds_attr.read(PredType::NATIVE_INT, &read_data1); + + // Verify values read in + for(int i=0; i<ATTR1_DIM1; i++) + if(attr_data1[i]!=read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); + + /* + * Test attribute with group + */ + // Open the group + Group group = fid1.openGroup(GROUP1_NAME); + + // Verify the correct number of attributes + num_attrs = group.getNumAttrs(); + verify_val(num_attrs, 1, "H5Group::getNumAttrs", __LINE__, __FILE__); + + // Open an attribute for the group + Attribute gr_attr = group.openAttribute(ATTR2_NAME); + + // Buffer for reading 2nd attribute + int read_data2[ATTR2_DIM1][ATTR2_DIM2]={{0}}; + + // Read attribute information + gr_attr.read(PredType::NATIVE_INT, read_data2); + + // Verify values read in + for(int i=0; i<ATTR2_DIM1; i++) + for(int j=0; j<ATTR2_DIM2; j++) + if(attr_data2[i][j]!=read_data2[i][j]) { + TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__, i,j,attr_data2[i][j],i,j,read_data1[i]); + } + } // end try block + catch (Exception E) { + issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + } +} /* test_attr_basic_read() */ + +/**************************************************************** +** +** test_attr_compound_write(): Tests compound datatype attributes +** +****************************************************************/ +static void +test_attr_compound_write(void) +{ + + // Output message about test being performed + MESSAGE(5, ("Testing Multiple Attribute Functions\n")); + + try { + // Create file + H5File fid1(FILENAME.c_str(), H5F_ACC_TRUNC); + + // Create dataspace for dataset + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + DataSpace sid1(SPACE1_RANK, dims1); + + // Create a dataset + DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR,sid1); + + // Create the attribute datatype. + CompType comp_type(sizeof(struct attr4_struct)); + + attr4_field1_off = HOFFSET(struct attr4_struct, i); + comp_type.insertMember(ATTR4_FIELDNAME1, attr4_field1_off, PredType::NATIVE_INT); + + attr4_field2_off = HOFFSET(struct attr4_struct, d); + comp_type.insertMember(ATTR4_FIELDNAME2, attr4_field2_off, PredType::NATIVE_DOUBLE); + + attr4_field3_off = HOFFSET(struct attr4_struct, c); + comp_type.insertMember(ATTR4_FIELDNAME3, attr4_field3_off, PredType::NATIVE_SCHAR); + + // Create dataspace for 1st attribute + hsize_t dims2[] = {ATTR4_DIM1,ATTR4_DIM2}; + DataSpace sid2(ATTR4_RANK, dims2); + + // Create complex attribute for the dataset + Attribute attr = dataset.createAttribute(ATTR4_NAME, comp_type, sid2); + + // Try to create the same attribute again (should fail) + try { + Attribute invalid_attr = dataset.createAttribute (ATTR4_NAME, comp_type, sid2); + } + catch (AttributeIException E) // catching invalid creating attribute + {} // do nothing, exception expected + + // Write complex attribute data + attr.write(comp_type, attr_data4); + + } // end try block + catch (Exception E) { + issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + } +} /* test_attr_compound_write() */ + +/**************************************************************** +** +** test_attr_compound_read(): Test basic H5A (attribute) code. +** +****************************************************************/ +static void +test_attr_compound_read(void) +{ + char attr_name[ATTR_NAME_LEN]; // Buffer for attribute names + hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions + size_t size; // Attribute datatype size as stored in file + size_t offset; // Attribute datatype field offset + hid_t field; // Attribute field datatype + struct attr4_struct read_data4[ATTR4_DIM1][ATTR4_DIM2]; // Buffer for reading 4th attribute + int i,j; + + // Output message about test being performed + MESSAGE(5, ("Testing Basic Attribute Functions\n")); + + try { + // Open file + H5File fid1(FILENAME, H5F_ACC_RDWR); + + // Open the dataset + DataSet dataset = fid1.openDataSet(DSET1_NAME); + + // Verify the correct number of attributes + int num_attrs = dataset.getNumAttrs(); + verify_val(num_attrs, 1, "H5Object::getNumAttrs", __LINE__, __FILE__); + + // Open 1st attribute for the dataset + Attribute attr = dataset.openAttribute((unsigned)0); + + /* Verify Dataspace */ + + // Get the dataspace of the attribute + DataSpace space = attr.getSpace(); + + // Get the rank of the dataspace and verify it + int rank = space.getSimpleExtentNdims(); + verify_val(rank, ATTR4_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); + + // Get the dims of the dataspace and verify them + int ndims = space.getSimpleExtentDims(dims); + if(dims[0]!=ATTR4_DIM1) + verify_val(dims[0], ATTR4_DIM1, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__); + verify_val(dims[1], ATTR4_DIM2, "DataSpace::getSimpleExtentDims",__LINE__, __FILE__); + + // Get the class of the datatype that is used by attr + H5T_class_t type_class = attr.getTypeClass(); + + // Verify that the type is of compound datatype + verify_val(type_class, H5T_COMPOUND, "Attribute::getTypeClass", __LINE__, __FILE__); + + // Get the compound datatype + CompType datatype = attr.getCompType(); + + // Verify the number of fields in the datatype, which must be 3 + int fields = datatype.getNmembers(); + verify_val(fields, 3, "CompType::getNmembers", __LINE__, __FILE__); + + // Verify that the fields have the same names as when the type + // was created + for(i=0; i<fields; i++) + { + string fieldname = datatype.getMemberName(i); + if(!((fieldname == ATTR4_FIELDNAME1) || + (fieldname == ATTR4_FIELDNAME2) || + (fieldname == ATTR4_FIELDNAME3))) + TestErrPrintf("%d:invalid field name for field #%d: %s\n",__LINE__,i,fieldname.c_str()); + } /* end for */ + + offset = datatype.getMemberOffset(0); + verify_val(offset, attr4_field1_off, "DataType::getMemberOffset", __LINE__, __FILE__); + + offset = datatype.getMemberOffset(1); + verify_val(offset, attr4_field2_off, "DataType::getMemberOffset", __LINE__, __FILE__); + + offset = datatype.getMemberOffset(2); + verify_val(offset, attr4_field3_off, "DataType::getMemberOffset", __LINE__, __FILE__); + + /* Verify each field's type, class & size */ + + // Get and verify the type class of the first member + type_class = datatype.getMemberClass(0); + verify_val(type_class, H5T_INTEGER, "DataType::getMemberClass", __LINE__, __FILE__); + // Get and verify the order of this member's type + IntType i_type = datatype.getMemberIntType(0); + H5T_order_t order = i_type.getOrder(); + verify_val(order, H5Tget_order(H5T_NATIVE_INT), "DataType::getOrder", __LINE__, __FILE__); + + // Get and verify the size of this member's type + size = i_type.getSize(); + verify_val(size, H5Tget_size(H5T_NATIVE_INT), "DataType::getSize", __LINE__, __FILE__); + + // Get and verify class, order, and size of the second member's type + type_class = datatype.getMemberClass(1); + verify_val(type_class, H5T_FLOAT, "DataType::getMemberClass", __LINE__, __FILE__); + FloatType f_type = datatype.getMemberFloatType(1); + order = f_type.getOrder(); + verify_val(order, H5Tget_order(H5T_NATIVE_DOUBLE), "DataType::getOrder", __LINE__, __FILE__); + size = f_type.getSize(); + verify_val(size, H5Tget_size(H5T_NATIVE_DOUBLE), "DataType::getSize", __LINE__, __FILE__); + + // Get and verify class, order, and size of the third member's type + type_class = datatype.getMemberClass(2); + verify_val(type_class, H5T_INTEGER, "DataType::getMemberClass", __LINE__, __FILE__); + // Note: H5T_INTEGER is correct here! + + StrType s_type = datatype.getMemberStrType(2); + order = s_type.getOrder(); + verify_val(order, H5Tget_order(H5T_NATIVE_SCHAR), "DataType::getOrder", __LINE__, __FILE__); + size = s_type.getSize(); + verify_val(size, H5Tget_size(H5T_NATIVE_SCHAR), "DataType::getSize", __LINE__, __FILE__); + + // Read attribute information + attr.read(datatype, read_data4); + + // Verify values read in + for(i=0; i<ATTR4_DIM1; i++) + for(j=0; j<ATTR4_DIM2; j++) + if(HDmemcmp(&attr_data4[i][j],&read_data4[i][j],sizeof(struct attr4_struct))) { + TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n",__LINE__,i,j,attr_data4[i][j].i,i,j,read_data4[i][j].i); + TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n",__LINE__,i,j,attr_data4[i][j].d,i,j,read_data4[i][j].d); + TestErrPrintf("%d:attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n",__LINE__,i,j,attr_data4[i][j].c,i,j,read_data4[i][j].c); + } /* end if */ + + // Verify name + string attr_name = attr.getName(); + verify_val(attr_name, ATTR4_NAME, "Attribute::getName", __LINE__, __FILE__); + } // end try block + catch (Exception E) { + issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + } +} /* test_attr_compound_read() */ + +/**************************************************************** +** +** test_attr_scalar_write(): Test scalar attribute writing functionality. +** +****************************************************************/ +static void +test_attr_scalar_write(void) +{ + hid_t fid1; // HDF5 File IDs */ + hid_t dataset; // Dataset ID */ + hid_t sid1,sid2; // Dataspace ID */ + hid_t attr; // Attribute ID */ + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + herr_t ret; // Generic return value */ + + // Output message about test being performed + MESSAGE(5, ("Testing Basic Scalar Attribute Writing Functions\n")); + + try { + // Create file + H5File fid1(FILENAME, H5F_ACC_TRUNC); + + // Create dataspace for dataset + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + DataSpace sid1(SPACE1_RANK, dims1); + + // Create a dataset + DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR,sid1); + + // Close dataset's dataspace + sid1.close(); + + // Create dataspace for attribute + DataSpace att_space(ATTR5_RANK, NULL); + + // Create an attribute for the dataset + Attribute ds_attr = dataset.createAttribute (ATTR5_NAME, PredType::NATIVE_FLOAT, att_space); + + // Try creating an attribute that already exists. This should fail + // since two attributes cannot have the same name. If an exception + // is not thrown for this action by createAttribute, then throw an + // invalid action exception. + try { + Attribute invalid_attr = dataset.createAttribute (ATTR5_NAME, PredType::NATIVE_FLOAT, att_space); + + // continuation here, that means no exception has been thrown + throw InvalidActionException("H5File::createDataSet", "Library allowed overwrite of existing dataset"); + } + catch (AttributeIException E) // catching invalid creating attribute + {} // do nothing, exception expected + + // Write attribute information + ds_attr.write (PredType::NATIVE_FLOAT, &attr_data5); + } // end try block + + catch (Exception E) { + issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + } +} /* test_attr_scalar_write() */ + +/**************************************************************** +** +** test_attr_scalar_read(): Test scalar attribute reading functionality. +** +****************************************************************/ +static void +test_attr_scalar_read(void) +{ + // Output message about test being performed + MESSAGE(5, ("Testing Basic Scalar Attribute Reading Functions\n")); + + try { + // Open file + H5File fid1(FILENAME, H5F_ACC_RDWR); + + // Open the dataset + DataSet dataset = fid1.openDataSet(DSET1_NAME); + + // Verify the correct number of attributes + int num_attrs = dataset.getNumAttrs(); + verify_val(num_attrs, 1, "H5Object::getNumAttrs", __LINE__, __FILE__); + + // Open an attribute for the dataset + Attribute ds_attr=dataset.openAttribute(ATTR5_NAME); + + // Read attribute information + float read_data2=0.0; // Buffer for reading 1st attribute + ds_attr.read(PredType::NATIVE_FLOAT,&read_data2); + verify_val(read_data2, attr_data5, "Attribute::read", __LINE__, __FILE__); + + // Get the dataspace of the attribute + DataSpace att_space = ds_attr.getSpace(); + + // Make certain the dataspace is scalar + H5S_class_t space_type = att_space.getSimpleExtentType(); + verify_val(space_type, H5S_SCALAR, "DataSpace::getSimpleExtentType", __LINE__, __FILE__); + } // end try block + + catch (Exception E) { + issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + } +} /* test_attr_scalar_read() */ + +/**************************************************************** +** +** test_attr_mult_write(): Test multiple attributes +** +****************************************************************/ +static void +test_attr_mult_write(void) +{ + // Output message about test being performed + MESSAGE(5, ("Testing Multiple Attribute Writing Functions\n")); + + try { + // Create file + H5File fid1 (FILENAME, H5F_ACC_TRUNC); + + // Create dataspace for dataset + hsize_t dims1[] = {SPACE1_DIM1, SPACE1_DIM2, SPACE1_DIM3}; + DataSpace ds_space (SPACE1_RANK, dims1); + + // Create a dataset + DataSet dataset = fid1.createDataSet(DSET1_NAME, PredType::NATIVE_UCHAR, ds_space); + + // Create dataspace for 1st attribute + hsize_t dims2[] = {ATTR1_DIM1}; + DataSpace att_space (ATTR1_RANK, dims2); + + // Create 1st attribute for the dataset + Attribute ds_attr = dataset.createAttribute (ATTR1_NAME, PredType::NATIVE_INT, att_space); + + // Write attribute information + ds_attr.write (PredType::NATIVE_INT, attr_data1); + + // Create dataspace for 2nd attribute + hsize_t dims3[] = {ATTR2_DIM1,ATTR2_DIM2}; + DataSpace att2_space (ATTR2_RANK, dims3); + + // Create 2nd attribute for the dataset + Attribute ds_attr2 = dataset.createAttribute (ATTR2_NAME, PredType::NATIVE_INT, att2_space); + + // Write 2nd attribute information + ds_attr2.write (PredType::NATIVE_INT, attr_data2); + + // Create dataspace for 3rd attribute + hsize_t dims4[] = {ATTR3_DIM1,ATTR3_DIM2,ATTR3_DIM3}; + DataSpace att3_space (ATTR3_RANK, dims4); + + // Create 3rd attribute for the dataset + Attribute ds_attr3 = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space); + + // Try creating an attribute that already exists. This should fail + // since two attributes cannot have the same name. If an exception + // is not thrown for this action by createAttribute, then throw an + // invalid action exception. + try { + Attribute invalid_attr = dataset.createAttribute (ATTR3_NAME, PredType::NATIVE_DOUBLE, att3_space); + + // continuation here, that means no exception has been thrown + throw InvalidActionException("DataSet::createAttribute", "Attempting to create a duplicate attribute"); + } + catch (AttributeIException E) // catching invalid creating attribute + {} // do nothing, exception expected + + // Write 3rd attribute information + ds_attr3.write (PredType::NATIVE_DOUBLE, attr_data3); + } // end try block + + catch (Exception E) { + issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + } +} /* test_attr_mult_write() */ + +/**************************************************************** +** +** test_attr_mult_read(): Test reading multiple attributes. +** +****************************************************************/ +static void +test_attr_mult_read(void) +{ + int read_data1[ATTR1_DIM1]={0}; // Buffer for reading 1st attribute + int read_data2[ATTR2_DIM1][ATTR2_DIM2]={{0}}; // Buffer for reading 2nd attribute + double read_data3[ATTR3_DIM1][ATTR3_DIM2][ATTR3_DIM3]={{{0}}}; // Buffer for reading 3rd attribute + int i,j,k; + + // Output message about test being performed + MESSAGE(5, ("Testing Multiple Attribute Reading Functions\n")); + + try { + // Open file + H5File fid1(FILENAME, H5F_ACC_RDWR); + + // Open the dataset + DataSet dataset = fid1.openDataSet(DSET1_NAME); + + // Verify the correct number of attributes + int num_attrs = dataset.getNumAttrs(); + verify_val(num_attrs, 3, "H5Object::getNumAttrs", __LINE__, __FILE__); + + // Open 1st attribute for the dataset + Attribute attr = dataset.openAttribute((unsigned)0); + + /* Verify Dataspace */ + + // Get the dataspace of the attribute + DataSpace space = attr.getSpace(); + + // Get the rank of the dataspace and verify it + int rank = space.getSimpleExtentNdims(); + verify_val(rank, ATTR1_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); + + // Get the dims of the dataspace and verify them + hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions + int ndims = space.getSimpleExtentDims(dims); + if(dims[0]!=ATTR1_DIM1) + TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %d\n",__LINE__,(int)dims[0],ATTR1_DIM1); + + /* Verify Datatype */ + + // Get the class of the datatype that is used by attr + H5T_class_t type_class = attr.getTypeClass(); + + // Verify that the type is of integer datatype + verify_val(type_class, H5T_INTEGER, "Attribute::getTypeClass", __LINE__, __FILE__); + + // Get the integer datatype + IntType i_type1 = attr.getIntType(); + + // Get and verify the order of this type + H5T_order_t order = i_type1.getOrder(); + verify_val(order, H5Tget_order(H5T_NATIVE_INT), "DataType::getOrder", __LINE__, __FILE__); + + // Get and verify the size of this type + size_t size = i_type1.getSize(); + verify_val(size, H5Tget_size(H5T_NATIVE_INT), "DataType::getSize", __LINE__, __FILE__); + + // Read attribute information + attr.read(PredType::NATIVE_INT, read_data1); + + // Verify values read in + for(i=0; i<ATTR1_DIM1; i++) + if(attr_data1[i]!=read_data1[i]) + TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n",__LINE__,i,attr_data1[i],i,read_data1[i]); + + // Verify Name + string attr_name = attr.getName(); + verify_val(attr_name, ATTR1_NAME, "DataType::getName", __LINE__, __FILE__); + + attr.close(); + space.close(); + + // Open 2nd attribute for the dataset + attr = dataset.openAttribute((unsigned)1); + + /* Verify Dataspace */ + + // Get the dataspace of the attribute + space = attr.getSpace(); + + // Get the rank of the dataspace and verify it + rank = space.getSimpleExtentNdims(); + verify_val(rank, ATTR2_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); + + // Get the dims of the dataspace and verify them + ndims = space.getSimpleExtentDims(dims); + if(dims[0]!=ATTR2_DIM1) + TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %d\n",__LINE__,(int)dims[0],ATTR2_DIM1); + if(dims[1]!=ATTR2_DIM2) + TestErrPrintf("%d:attribute dimensions different: dims[1]=%d, should be %d\n",__LINE__,(int)dims[1],ATTR2_DIM2); + + /* Verify Datatype */ + + // Get the class of the datatype that is used by attr + type_class = attr.getTypeClass(); + + // Verify that the type is of integer datatype + verify_val(type_class, H5T_INTEGER, "Attribute::getTypeClass", __LINE__, __FILE__); + + // Get the integer datatype + IntType i_type2 = attr.getIntType(); + + // Get and verify the order of this type + order = i_type2.getOrder(); + verify_val(order, H5Tget_order(H5T_NATIVE_INT), "DataType::getOrder", __LINE__, __FILE__); + + // Get and verify the size of this type + size = i_type2.getSize(); + verify_val(size, H5Tget_size(H5T_NATIVE_INT), "DataType::getSize", __LINE__, __FILE__); + + // Read attribute information + attr.read(PredType::NATIVE_INT, read_data2); + //attr.read(i_type, read_data2); + + // Verify values read in + for(i=0; i<ATTR2_DIM1; i++) + for(j=0; j<ATTR2_DIM2; j++) + if(attr_data2[i][j]!=read_data2[i][j]) + TestErrPrintf("%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",__LINE__,i,j,attr_data2[i][j],i,j,read_data2[i][j]); + + // Verify Name + attr_name = attr.getName(); + verify_val(attr_name, ATTR2_NAME, "DataType::getName", __LINE__, __FILE__); + attr.close(); + space.close(); + + // Open 3rd attribute for the dataset + attr = dataset.openAttribute((unsigned)2); + + /* Verify Dataspace */ + + // Get the dataspace of the attribute + space = attr.getSpace(); + + // Get the rank of the dataspace and verify it + rank = space.getSimpleExtentNdims(); + verify_val(rank, ATTR3_RANK, "DataSpace::getSimpleExtentNdims", __LINE__, __FILE__); + + // Get the dims of the dataspace and verify them + ndims = space.getSimpleExtentDims(dims); + verify_val(dims[0],ATTR3_DIM1,"attribute dimensions",__FILE__,__LINE__); + verify_val(dims[1],ATTR3_DIM2,"attribute dimensions",__FILE__,__LINE__); + verify_val(dims[2],ATTR3_DIM3,"attribute dimensions",__FILE__,__LINE__); + + /* Verify Datatype */ + + // Get the class of the datatype that is used by attr + type_class = attr.getTypeClass(); + + // Verify that the type is of compound datatype + verify_val(type_class, H5T_FLOAT, "Attribute::getTypeClass", __LINE__, __FILE__); + + // Get the double datatype + FloatType f_type = attr.getFloatType(); + + // Get and verify the order of this type + order = f_type.getOrder(); + verify_val(order, H5Tget_order(H5T_NATIVE_DOUBLE), "DataType::getOrder", __LINE__, __FILE__); + + // Get and verify the size of this type + size = f_type.getSize(); + verify_val(size, H5Tget_size(H5T_NATIVE_DOUBLE), "DataType::getSize", __LINE__, __FILE__); + + // Read attribute information + attr.read(PredType::NATIVE_DOUBLE, read_data3); + + // Verify values read in + for(i=0; i<ATTR3_DIM1; i++) + for(j=0; j<ATTR3_DIM2; j++) + for(k=0; k<ATTR3_DIM3; k++) + if(attr_data3[i][j][k]!=read_data3[i][j][k]) + TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, read_data3[%d][%d][%d]=%f\n",__LINE__,i,j,k,attr_data3[i][j][k],i,j,k,read_data3[i][j][k]); + + // Verify Name + attr_name = attr.getName(); + verify_val(attr_name, ATTR3_NAME, "DataType::getName", __LINE__, __FILE__); + } // end try block + + catch (Exception E) { + issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + } +} /* test_attr_mult_read() */ + +/**************************************************************** +** +** test_attr_delete(): Test deleting attribute from different +** hdf5 objects. +** +****************************************************************/ +static void +test_attr_delete(void) +{ + hid_t fid1; // HDF5 File ID + hid_t dataset; // Dataset ID + hid_t attr; // Attribute ID + string attr_name; // Buffer for attribute names + + // Output message about test being performed + MESSAGE(5, ("Testing Removing Attribute Function\n")); + + try { + // Open file + H5File fid1(FILENAME, H5F_ACC_RDWR); + + // Open the dataset + DataSet dataset = fid1.openDataSet(DSET1_NAME); + + // Verify the correct number of attributes + int num_attrs = dataset.getNumAttrs(); + verify_val(num_attrs, 3, "H5Object::getNumAttrs", __LINE__, __FILE__); + + // Try to delete bogus attribute, should fail. + try { + dataset.removeAttr("Bogus"); + + // continuation here, that means no exception has been thrown + throw InvalidActionException("DataSet::removeAttr", "Attempting to remove non-existing attribute"); + } + catch (AttributeIException E) // catching invalid removing attribute + {} // do nothing, exception expected + + // Verify the correct number of attributes + num_attrs = dataset.getNumAttrs(); + verify_val(num_attrs, 3, "H5Object::getNumAttrs", __LINE__, __FILE__); + + // Delete middle (2nd) attribute + dataset.removeAttr(ATTR2_NAME); + + // Verify the correct number of attributes + num_attrs = dataset.getNumAttrs(); + verify_val(num_attrs, 2, "H5Object::getNumAttrs", __LINE__, __FILE__); + + // Open 1st attribute for the dataset + Attribute attr = dataset.openAttribute((unsigned)0); + + // Verify Name + attr_name = attr.getName(); + verify_val(attr_name, ATTR1_NAME, "Attribute::getName", __LINE__, __FILE__); + + // Close attribute + attr.close(); + + // Open last (formally 3rd) attribute for the dataset + attr = dataset.openAttribute((unsigned)1); + + // Verify Name + attr_name = attr.getName(); + verify_val(attr_name, ATTR3_NAME, "Attribute::getName", __LINE__, __FILE__); + + attr.close(); + + // Delete first attribute + dataset.removeAttr(ATTR1_NAME); + + // Verify the correct number of attributes + num_attrs = dataset.getNumAttrs(); + verify_val(num_attrs, 1, "H5Object::getNumAttrs", __LINE__, __FILE__); + + // Open last (formally 3rd) attribute for the dataset + attr = dataset.openAttribute((unsigned)0); + + // Verify Name + attr_name = attr.getName(); + verify_val(attr_name, ATTR3_NAME, "Attribute::getName", __LINE__, __FILE__); + // Close attribute + attr.close(); + + // Delete first attribute + dataset.removeAttr(ATTR3_NAME); + + // Verify the correct number of attributes + num_attrs = dataset.getNumAttrs(); + verify_val(num_attrs, 0, "H5Object::getNumAttrs", __LINE__, __FILE__); + } // end try block + + catch (Exception E) { + issue_fail_msg(E.getCFuncName(), __LINE__, __FILE__, E.getCDetailMsg()); + } +} /* test_attr_delete() */ + +/**************************************************************** +** +** test_attr(): Main attribute testing routine. +** +****************************************************************/ +void +test_attr(void) +{ + // Output message about test being performed + MESSAGE(5, ("Testing Attributes\n")); + + // These next two tests use the same file information + test_attr_basic_write(); // Test basic H5A writing code + test_attr_rename(); // Test renaming attribute + test_attr_basic_read(); // Test basic H5A reading code + + // These next two tests use the same file information + test_attr_compound_write(); // Test complex datatype H5A writing code + test_attr_compound_read(); // Test complex datatype H5A reading code + + // These next two tests use the same file information + test_attr_scalar_write(); // Test scalar dataspace H5A writing code + test_attr_scalar_read(); // Test scalar dataspace H5A reading code + + // These next four tests use the same file information + test_attr_mult_write(); // Test H5A writing code for multiple attributes + test_attr_mult_read(); // Test H5A reading code for multiple attributes + test_attr_delete(); // Test H5A code for deleting attributes + +} /* test_attr() */ + +/*------------------------------------------------------------------------- + * Function: cleanup_attr + * + * Purpose: Cleanup temporary test files + * + * Return: none + * + * Programmer: Albert Cheng + * July 2, 1998 + * + * Modifications: + * + *------------------------------------------------------------------------- + */ +void +cleanup_attr(void) +{ + remove(FILENAME.c_str()); +} + |