diff options
author | Allen Byrne <byrn@hdfgroup.org> | 2019-08-15 21:46:00 (GMT) |
---|---|---|
committer | Allen Byrne <byrn@hdfgroup.org> | 2019-08-15 21:46:15 (GMT) |
commit | 64e6665b5442fc3f46cc7e2b00fe0a1b59f03b22 (patch) | |
tree | 138fc73e4863a87dee28574d4d827b2f5a403d84 /hl/c++ | |
parent | 3a504899eef1a66031c6f52623c24bb4e51ca51e (diff) | |
download | hdf5-64e6665b5442fc3f46cc7e2b00fe0a1b59f03b22.zip hdf5-64e6665b5442fc3f46cc7e2b00fe0a1b59f03b22.tar.gz hdf5-64e6665b5442fc3f46cc7e2b00fe0a1b59f03b22.tar.bz2 |
Add HD prefix to tests
Diffstat (limited to 'hl/c++')
-rw-r--r-- | hl/c++/test/ptableTest.cpp | 122 | ||||
-rw-r--r-- | hl/c++/test/ptableTest.h | 2 |
2 files changed, 62 insertions, 62 deletions
diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index 340912e..f41dbb3 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -31,33 +31,33 @@ int main(void) fileID = H5Fcreate(TEST_FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); if(fileID <0) { - fprintf(stderr, "Couldn't create file.\n"); + HDfprintf(stderr, "Couldn't create file.\n"); num_errors = 1; } else { - num_errors += BasicTest(); + num_errors += BasicTest(); - num_errors += TestCompoundDatatype(); + num_errors += TestCompoundDatatype(); - num_errors += TestGetPacket(); + num_errors += TestGetPacket(); - num_errors += TestGetNext(); + num_errors += TestGetNext(); - num_errors += TestCompress(); + num_errors += TestCompress(); - num_errors += TestErrors(); + num_errors += TestErrors(); - num_errors += SystemTest(); + num_errors += SystemTest(); - /* Test data corruption in packed structs */ - num_errors += TestHDFFV_9758(); + /* Test data corruption in packed structs */ + num_errors += TestHDFFV_9758(); /* Terminate access to the file. */ err = H5Fclose(fileID); if( err < 0 ) { - fprintf(stderr, "Failed to close file.\n"); + HDfprintf(stderr, "Failed to close file.\n"); num_errors++; } @@ -81,7 +81,7 @@ int BasicTest() hsize_t count; int error; - TESTING("basic functionality") + TESTING2("basic functionality") FL_PacketTable wrapper(fileID, H5P_DEFAULT, BASICTEST_PT, H5T_NATIVE_INT, 1); if(! wrapper.IsValid()) @@ -137,7 +137,7 @@ int TestCompoundDatatype() hsize_t count; int error; - TESTING("compound datatypes") + TESTING2("compound datatypes") /* Create compound datatype */ typedef struct compoundType @@ -206,7 +206,7 @@ int TestGetNext() int records[2]; int i; - TESTING("GetNextPacket") + TESTING2("GetNextPacket") /* Create a dataset */ FL_PacketTable wrapper(fileID, H5P_DEFAULT, GETNEXT_PT, H5T_NATIVE_INT, 500); @@ -268,20 +268,20 @@ int TestCompress() unsigned int config = 0; size_t cd_nelemts = 0; - TESTING("compression") + TESTING2("compression") #ifdef H5_HAVE_FILTER_DEFLATE try { - /* Prepare property list to set compression, randomly use deflate */ - DSetCreatPropList dscreatplist; - dscreatplist.setDeflate(6); + /* Prepare property list to set compression, randomly use deflate */ + DSetCreatPropList dscreatplist; + dscreatplist.setDeflate(6); /* Create packet table with compression. */ FL_PacketTable wrapper(fileID, COMPRESS_PT, H5T_NATIVE_CHAR, 100, dscreatplist.getId()); - /* Close the property list */ - dscreatplist.close(); + /* Close the property list */ + dscreatplist.close(); - /* Verify that the deflate filter is set */ + /* Verify that the deflate filter is set */ /* Create an HDF5 C++ file object */ H5File file; @@ -293,10 +293,10 @@ int TestCompress() DSetCreatPropList dcpl = dset.getCreatePlist(); - char filter_name[8]; + char filter_name[8]; dcpl.getFilterById(H5Z_FILTER_DEFLATE, flags, cd_nelemts, NULL, 8, filter_name, config); - if (HDstrncmp(filter_name, "deflate", 7) != 0) - H5_FAILED() + if (HDstrncmp(filter_name, "deflate", 7) != 0) + H5_FAILED() } catch (Exception e) { H5_FAILED(); return 1; @@ -304,7 +304,7 @@ int TestCompress() PASSED(); #else SKIPPED(); - puts(" deflate filter not enabled"); + HDputs(" deflate filter not enabled"); #endif /* H5_HAVE_FILTER_DEFLATE */ return 0; } @@ -315,7 +315,7 @@ int TestGetPacket() int record; int theRecs[3]; int i; - TESTING("GetPacket") + TESTING2("GetPacket") /* Create a dataset. Does not need to specify property list because there is no compression. */ @@ -353,7 +353,7 @@ const char* PT_TESTERROR = "/TestErrors"; int TestErrors() { - TESTING("error conditions") + TESTING2("error conditions") /* Create a dataset */ FL_PacketTable wrapper(fileID, PT_TESTERROR, H5T_NATIVE_INT, 1); @@ -464,7 +464,7 @@ const char* PT_SYSTEMTST1 = "/SystemTest1"; const char* PT_SYSTEMTST2 = "/SystemTest2"; int SystemTest() { - TESTING("multiple datatypes") + TESTING2("multiple datatypes") hid_t dtypeID1, dtypeID2; hsize_t count; @@ -560,16 +560,16 @@ error: /*------------------------------------------------------------------------- * TestHDFFV_9758(): Test that a packet table with compound datatype which - * contains string type can be created and written correctly. (HDFFV-9758) + * contains string type can be created and written correctly. (HDFFV-9758) * * Notes: - * Previously, data of the field that follows the string was read back - * as garbage when #pragma pack(1) is used. + * Previously, data of the field that follows the string was read back + * as garbage when #pragma pack(1) is used. * 2016/10/20 -BMR * Updated: - * #pragma pack(1) caused failure on Emu because Sparc cannot - * access misaligned data. Changed it to pack() to do the - * default alignment. + * #pragma pack(1) caused failure on Emu because Sparc cannot + * access misaligned data. Changed it to pack() to do the + * default alignment. * 2016/10/25 -BMR *------------------------------------------------------------------------- */ @@ -592,57 +592,57 @@ int TestHDFFV_9758() }; s1_t s1[NUM_PACKETS]; - + for (hsize_t i = 0; i < NUM_PACKETS; i++) { s1[i].a = i; s1[i].b = 1.f * static_cast<float>(i * i); s1[i].c = 1. / (i + 1); - sprintf(s1[i].d, "string%d", (int)i); + HDsprintf(s1[i].d, "string%d", (int)i); s1[i].e = 100+i; } - TESTING("data corruption in packed structs (HDFFV-9758)") + TESTING2("data corruption in packed structs (HDFFV-9758)") // Build a compound datatype compound_type = H5Tcreate(H5T_COMPOUND, sizeof(s1_t)); if (compound_type < 0) - goto error; - + goto error; + err = H5Tinsert(compound_type, "a_name", HOFFSET(s1_t, a), H5T_NATIVE_INT); if (err < 0) - goto error; + goto error; err = H5Tinsert(compound_type, "b_name", HOFFSET(s1_t, b), H5T_NATIVE_FLOAT); if (err < 0) - goto error; + goto error; err = H5Tinsert(compound_type, "c_name", HOFFSET(s1_t, c), H5T_NATIVE_DOUBLE); if (err < 0) - goto error; + goto error; strtype = H5Tcopy (H5T_C_S1); if (compound_type < 0) - goto error; + goto error; err = H5Tset_size (strtype, STRING_LENGTH); /* create string */ if (err < 0) - goto error; + goto error; err = H5Tinsert(compound_type, "d_name", HOFFSET(s1_t, d), strtype); if (err < 0) - goto error; + goto error; err = H5Tinsert(compound_type, "e_name", HOFFSET(s1_t, e), H5T_NATIVE_INT); if (err < 0) - goto error; + goto error; { // so ptable will go out of scope before PASSED // Create a packet table FL_PacketTable ptable(fileID, "/examplePacketTable", compound_type, 1); if (!ptable.IsValid()) - goto error; + goto error; // Add packets to the table for (size_t i = 0; i < NUM_PACKETS; i++) { - /* Appends one packet at the current position */ + /* Appends one packet at the current position */ err = ptable.AppendPacket(s1 + i); if (err < 0) goto error; } @@ -650,11 +650,11 @@ int TestHDFFV_9758() // Check packet count const hsize_t count = ptable.GetPacketCount(err); if (err < 0) - goto error; - + goto error; + if (count != NUM_PACKETS) { - std::cerr + std::cerr << "Number of packets in packet table should be " << NUM_PACKETS << " but is " << count << endl; } @@ -663,16 +663,16 @@ int TestHDFFV_9758() ptable.ResetIndex(); for (size_t i = 0; i < NUM_PACKETS; i++) { - s1_t s2; - memset(&s2, 0, sizeof(s1_t)); - err = ptable.GetNextPacket(&s2); - if (err < 0) - goto error; - - if (s2.a != s1[i].a || s2.e != s1[i].e) - goto error; - else if (HDstrcmp(s2.d, s1[i].d)) - goto error; + s1_t s2; + HDmemset(&s2, 0, sizeof(s1_t)); + err = ptable.GetNextPacket(&s2); + if (err < 0) + goto error; + + if (s2.a != s1[i].a || s2.e != s1[i].e) + goto error; + else if (HDstrcmp(s2.d, s1[i].d)) + goto error; } } // end of ptable block diff --git a/hl/c++/test/ptableTest.h b/hl/c++/test/ptableTest.h index 8af7bff..e1ba950 100644 --- a/hl/c++/test/ptableTest.h +++ b/hl/c++/test/ptableTest.h @@ -21,9 +21,9 @@ #ifndef PTABLETEST #define PTABLETEST +#include "h5hltest.h" #include "H5PacketTable.h" #include "H5Cpp.h" -#include "h5hltest.h" static hid_t fileID; |