diff options
Diffstat (limited to 'hl')
-rw-r--r-- | hl/c++/src/H5PacketTable.cpp | 4 | ||||
-rw-r--r-- | hl/c++/test/ptableTest.cpp | 164 |
2 files changed, 84 insertions, 84 deletions
diff --git a/hl/c++/src/H5PacketTable.cpp b/hl/c++/src/H5PacketTable.cpp index 50e11f6..b033790 100644 --- a/hl/c++/src/H5PacketTable.cpp +++ b/hl/c++/src/H5PacketTable.cpp @@ -130,7 +130,7 @@ /* GetDatatype * Returns the datatype identifier used by the packet table, on success, - * or FAIL, on failure. + * or H5I_INVALID_HID, on failure. * Note: it is best to avoid using this identifier in applications, unless * the desired functionality cannot be performed via the packet table ID. */ @@ -141,7 +141,7 @@ /* GetDataset * Returns the dataset identifier associated with the packet table, on - * success, or FAIL, on failure. + * success, or H5I_INVALID_HID, on failure. * Note: it is best to avoid using this identifier in applications, unless * the desired functionality cannot be performed via the packet table ID. */ diff --git a/hl/c++/test/ptableTest.cpp b/hl/c++/test/ptableTest.cpp index ff99285..18bf421 100644 --- a/hl/c++/test/ptableTest.cpp +++ b/hl/c++/test/ptableTest.cpp @@ -88,19 +88,19 @@ int BasicTest() FL_PacketTable wrapper(fileID, H5P_DEFAULT, BASICTEST_PT, H5T_NATIVE_INT, 1); if(! wrapper.IsValid()) - goto out; + goto error; /* Ensure initial count is zero */ count = wrapper.GetPacketCount(error); if(count != 0 || error != 0) - goto out; + goto error; myRecord = 1; /* add some records test */ err = wrapper.AppendPacket(&myRecord); if(err < 0) - goto out; + goto error; myRecord = 2; @@ -109,26 +109,26 @@ int BasicTest() /* get number of records test */ count = wrapper.GetPacketCount(); if(count != 2) - goto out; + goto error; /* get records test */ err = wrapper.GetPacket(0, &myRecord); if(err < 0) - goto out; + goto error; if(myRecord != 1) - goto out; + goto error; err = wrapper.GetPacket(1, &myRecord); if(err < 0) - goto out; + goto error; if(myRecord != 2) - goto out; + goto error; PASSED(); return 0; -out: +error: H5_FAILED(); return 1; } @@ -160,7 +160,7 @@ int TestCompoundDatatype() FL_PacketTable wrapper(fileID, H5P_DEFAULT, CMPDTEST_PT, dtypeID, 1); if(! wrapper.IsValid()) - goto out; + goto error; compoundType first; first.a = 1; @@ -172,7 +172,7 @@ int TestCompoundDatatype() count = wrapper.GetPacketCount(error); if(count != 1) - goto out; + goto error; first.a = first.b = first.c = 0; first.e = 0; @@ -181,16 +181,16 @@ int TestCompoundDatatype() wrapper.GetPacket(0, &first); if(first.a != 1) - goto out; + goto error; if(first.e != 5) - goto out; + goto error; PASSED(); H5Tclose(dtypeID); return 0; -out: +error: H5E_BEGIN_TRY { H5Tclose(dtypeID); @@ -215,7 +215,7 @@ int TestGetNext() FL_PacketTable wrapper(fileID, H5P_DEFAULT, GETNEXT_PT, H5T_NATIVE_INT, 500); if(! wrapper.IsValid()) - goto out; + goto error; /* Append 5 records to the dataset */ for(record = 1; record < 6; record++) @@ -226,40 +226,40 @@ int TestGetNext() { wrapper.GetNextPacket(&record); if(record != i) - goto out; + goto error; } /* Reset the index and check that it worked */ wrapper.ResetIndex(); - if(wrapper.GetIndex(error) != 0) goto out; - if(error < 0) goto out; + if(wrapper.GetIndex(error) != 0) goto error; + if(error < 0) goto error; /* Ensure that we can interate through the records and get the right ones */ for(i = 1; i < 6; i++) { error = wrapper.GetNextPacket(&record); if(record != i || error <0) - goto out; + goto error; } wrapper.SetIndex(1); - if(wrapper.GetIndex(error) != 1) goto out; - if(error < 0) goto out; + if(wrapper.GetIndex(error) != 1) goto error; + if(error < 0) goto error; /* Ensure we can get multiple records with our index pointer */ wrapper.GetNextPackets(2, records); if(records[0] != 2 || records[1] != 3) - goto out; + goto error; /* Ensure our pointer was updated correctly */ wrapper.GetNextPacket(&record); if(record != 4) - goto out; + goto error; PASSED(); return 0; -out: +error: H5_FAILED(); return 1; } @@ -324,7 +324,7 @@ int TestGetPacket() FL_PacketTable wrapper(fileID, H5P_DEFAULT, PT_TESTGETPT, H5T_NATIVE_INT, 1); if(! wrapper.IsValid()) - goto out; + goto error; /* Append 5 records to the dataset */ for(record = 1; record < 6; record++) @@ -333,20 +333,20 @@ int TestGetPacket() /* Ensure that the records were written properly */ wrapper.GetPacket(1, &record); if(record != 2) - goto out; + goto error; /* Ensure that we can retrieve multiple records */ wrapper.GetPackets(1, 3, theRecs); for(i = 0; i < 3; i++) { if(theRecs[i] != i+2) - goto out; + goto error; } PASSED(); return 0; -out: +error: H5_FAILED(); return 1; } @@ -361,7 +361,7 @@ int TestErrors() FL_PacketTable wrapper(fileID, H5P_DEFAULT, PT_TESTERROR, H5T_NATIVE_INT, 1); if(! wrapper.IsValid()) - goto out; + goto error; int record; int records[3]; @@ -372,92 +372,92 @@ int TestErrors() wrapper.AppendPacket(&record); /* Try to confuse functions with bad indexes */ - error = wrapper.GetPacket( (unsigned) -1, &record); + error = wrapper.GetPacket(static_cast<unsigned>(-1), &record); if(error >= 0) - goto out; + goto error; error = wrapper.GetPacket(4, &record); if(error >= 0) - goto out; - error = wrapper.GetPacket((unsigned) -250, &record); + goto error; + error = wrapper.GetPacket(static_cast<unsigned>(-250), &record); if(error >= 0) - goto out; + goto error; error = wrapper.GetPacket(3000, &record); if(error >= 0) - goto out; + goto error; error = wrapper.GetPacket(1, &record); if(error < 0) - goto out; + goto error; - error = wrapper.GetPackets((unsigned) -1, 1, records); + error = wrapper.GetPackets(static_cast<unsigned>(-1), 1, records); if(error >= 0) - goto out; + goto error; error = wrapper.GetPackets(2, 4, records); if(error >= 0) - goto out; - error = wrapper.GetPackets((unsigned) -60, (unsigned) -62, records); + goto error; + error = wrapper.GetPackets(static_cast<unsigned>(-60), static_cast<unsigned>(-62), records); if(error >= 0) - goto out; + goto error; error = wrapper.GetPackets(10, 12, records); if(error >= 0) - goto out; + goto error; error = wrapper.GetPackets(0, 2, records); if(error < 0) - goto out; + goto error; error = wrapper.GetPackets(2, 0, records); if(error >= 0) - goto out; + goto error; error = wrapper.GetPackets(1, 1, records); if(error < 0) - goto out; + goto error; error = wrapper.GetPackets(1, 3, records); if(error < 0) - goto out; + goto error; wrapper.ResetIndex(); - error = wrapper.SetIndex((unsigned) -1); + error = wrapper.SetIndex(static_cast<unsigned>(-1)); if(error >= 0) - goto out; - if(wrapper.GetIndex(error) != 0) goto out; - if(error < 0) goto out; + goto error; + if(wrapper.GetIndex(error) != 0) goto error; + if(error < 0) goto error; error = wrapper.GetNextPacket(&record); if(error < 0) - goto out; + goto error; if(record != 1) - goto out; - if(wrapper.GetIndex(error) != 1) goto out; - if(error < 0) goto out; + goto error; + if(wrapper.GetIndex(error) != 1) goto error; + if(error < 0) goto error; error = wrapper.SetIndex(20); if(error >= 0) - goto out; + goto error; error = wrapper.GetNextPacket(&record); if(error < 0) - goto out; + goto error; if(record != 2) - goto out; + goto error; wrapper.SetIndex(3); error = wrapper.GetNextPacket(&record); if(error < 0) - goto out; + goto error; if(record != 4) - goto out; - if(wrapper.GetIndex(error) != 4) goto out; - if(error < 0) goto out; + goto error; + if(wrapper.GetIndex(error) != 4) goto error; + if(error < 0) goto error; error = wrapper.GetNextPacket(&record); if(error >= 0) - goto out; + goto error; wrapper.ResetIndex(); error = wrapper.GetNextPackets(10, records); if(error >= 0) - goto out; + goto error; error = wrapper.GetNextPackets(0, records); if(error < 0) - goto out; + goto error; PASSED(); return 0; -out: +error: H5_FAILED(); return 1; } @@ -510,16 +510,16 @@ int SystemTest() FL_PacketTable wrapper2(fileID, H5P_DEFAULT, PT_SYSTEMTST2, dtypeID2, 1); if(! wrapper1.IsValid()) - goto out; + goto error; if(! wrapper2.IsValid()) - goto out; + goto error; /* Write and read packets, ensure that nothing is unusual */ wrapper2.AppendPacket(ct2); count = wrapper1.GetPacketCount(); if(count != 0) - goto out; + goto error; compoundType ct1[10]; ct1[0].a = 31; @@ -536,13 +536,13 @@ int SystemTest() wrapper1.ResetIndex(); wrapper1.GetNextPacket(&ct1[1]); wrapper2.GetPacket(1, &ct2[2]); - if(wrapper1.GetIndex(error) != 1) goto out; - if(error < 0) goto out; - if(wrapper2.GetIndex(error) != 0) goto out; - if(error < 0) goto out; + if(wrapper1.GetIndex(error) != 1) goto error; + if(error < 0) goto error; + if(wrapper2.GetIndex(error) != 0) goto error; + if(error < 0) goto error; if(ct1[1].b != ct2[2].g.b) - goto out; + goto error; H5Tclose(dtypeID1); H5Tclose(dtypeID2); @@ -550,7 +550,7 @@ int SystemTest() PASSED(); return 0; -out: +error: H5E_BEGIN_TRY { H5Tclose(dtypeID1); @@ -577,7 +577,7 @@ int VariableLengthTest(void) /* Verify that the creation succeeded */ if(! test_VLPT->IsValid()) - goto out; + goto error; /* Append some packets */ test_short = 9; @@ -589,9 +589,9 @@ int VariableLengthTest(void) test_VLPT->GetNextPackets(1, &read_buf); if(read_buf.len != sizeof(short)) - goto out; + goto error; if(*(short *)(read_buf.p) != test_short) - goto out; + goto error; /* Free the memory used by the read */ test_VLPT->FreeReadbuff(1, &read_buf); @@ -600,9 +600,9 @@ int VariableLengthTest(void) test_VLPT->GetNextPackets(1, &read_buf); if(read_buf.len != sizeof(long)) - goto out; + goto error; if(*(long *)(read_buf.p) != test_long) - goto out; + goto error; /* Free the memory used by the read */ test_VLPT->FreeReadbuff(1, &read_buf); @@ -615,10 +615,10 @@ int VariableLengthTest(void) /* Verify that the open succeeded */ if(! new_pt->IsValid()) - goto out; + goto error; if(new_pt->IsVariableLength() != 1) - goto out; + goto error; /* Close the packet table */ delete new_pt; @@ -626,7 +626,7 @@ int VariableLengthTest(void) PASSED(); return 0; -out: +error: H5_FAILED(); return 1; } |