diff --git a/src/applications/bmqstoragetool/README.md b/src/applications/bmqstoragetool/README.md index 5c04d3391..aab789b29 100644 --- a/src/applications/bmqstoragetool/README.md +++ b/src/applications/bmqstoragetool/README.md @@ -25,8 +25,8 @@ Usage: bmqstoragetool [-r|record-type ]* [--queue-key ]* [--timestamp-gt ] [--timestamp-lt ] - [--seqnum-gt ] - [--seqnum-lt ] + [--seqnum-gt ] + [--seqnum-lt ] [--offset-gt ] [--offset-lt ] [--outstanding] @@ -63,10 +63,10 @@ Where: lower timestamp bound --timestamp-lt higher timestamp bound - --seqnum-gt - lower composit sequence number bound, defined in form , e.g. 123-456 - --seqnum-lt - higher composit sequence number bound, defined in form , e.g. 123-456 + --seqnum-gt + lower composite sequence number bound, defined in form , e.g. 123-456 + --seqnum-lt + higher composite sequence number bound, defined in form , e.g. 123-456 --offset-gt lower offset bound --offset-lt diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_commandprocessorfactory.t.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_commandprocessorfactory.t.cpp index f4a3a62ee..f6e13b84b 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_commandprocessorfactory.t.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_commandprocessorfactory.t.cpp @@ -54,7 +54,8 @@ static void test1_breathingTest() fileManager, bsl::cout, bmqtst::TestHelperUtil::allocator()); - ASSERT(dynamic_cast(cmdProcessor.get()) != 0); + BMQTST_ASSERT(dynamic_cast(cmdProcessor.get()) != + 0); } // ============================================================================ diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_compositesequencenumber.t.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_compositesequencenumber.t.cpp index 4cb74d80c..779386935 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_compositesequencenumber.t.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_compositesequencenumber.t.cpp @@ -46,14 +46,14 @@ static void test1_breathingTest() { CompositeSequenceNumber compositeSeqNum; - ASSERT(!compositeSeqNum.isSet()); + BMQTST_ASSERT(!compositeSeqNum.isSet()); } { CompositeSequenceNumber compositeSeqNum(1, 2); - ASSERT(compositeSeqNum.isSet()); - ASSERT_EQ(compositeSeqNum.leaseId(), 1ul); - ASSERT_EQ(compositeSeqNum.sequenceNumber(), 2ul); + BMQTST_ASSERT(compositeSeqNum.isSet()); + BMQTST_ASSERT_EQ(compositeSeqNum.leaseId(), 1ul); + BMQTST_ASSERT_EQ(compositeSeqNum.sequenceNumber(), 2ul); } } @@ -81,10 +81,10 @@ static void test2_fromStringTest() bmqtst::TestHelperUtil::allocator()); compositeSeqNum.fromString(errorDescription, inputString); - ASSERT(compositeSeqNum.isSet()); - ASSERT_EQ(compositeSeqNum.leaseId(), 123u); - ASSERT_EQ(compositeSeqNum.sequenceNumber(), 456u); - ASSERT(errorDescription.str().empty()); + BMQTST_ASSERT(compositeSeqNum.isSet()); + BMQTST_ASSERT_EQ(compositeSeqNum.leaseId(), 123u); + BMQTST_ASSERT_EQ(compositeSeqNum.sequenceNumber(), 456u); + BMQTST_ASSERT(errorDescription.str().empty()); } // Valid string with leading zeros @@ -95,10 +95,10 @@ static void test2_fromStringTest() bmqtst::TestHelperUtil::allocator()); compositeSeqNum.fromString(errorDescription, inputString); - ASSERT(compositeSeqNum.isSet()); - ASSERT_EQ(compositeSeqNum.leaseId(), 123u); - ASSERT_EQ(compositeSeqNum.sequenceNumber(), 456u); - ASSERT(errorDescription.str().empty()); + BMQTST_ASSERT(compositeSeqNum.isSet()); + BMQTST_ASSERT_EQ(compositeSeqNum.leaseId(), 123u); + BMQTST_ASSERT_EQ(compositeSeqNum.sequenceNumber(), 456u); + BMQTST_ASSERT(errorDescription.str().empty()); } // Empty string @@ -108,9 +108,10 @@ static void test2_fromStringTest() bsl::string inputString("", bmqtst::TestHelperUtil::allocator()); compositeSeqNum.fromString(errorDescription, inputString); - ASSERT_EQ(compositeSeqNum.isSet(), false); - ASSERT(!errorDescription.str().empty()); - ASSERT_EQ(errorDescription.str(), "Invalid input: empty string."); + BMQTST_ASSERT_EQ(compositeSeqNum.isSet(), false); + BMQTST_ASSERT(!errorDescription.str().empty()); + BMQTST_ASSERT_EQ(errorDescription.str(), + "Invalid input: empty string."); } // Invalid string with missed separator @@ -121,10 +122,10 @@ static void test2_fromStringTest() errorDescription.reset(); compositeSeqNum.fromString(errorDescription, inputString); - ASSERT_EQ(compositeSeqNum.isSet(), false); - ASSERT(!errorDescription.str().empty()); - ASSERT_EQ(errorDescription.str(), - "Invalid format: no '-' separator found."); + BMQTST_ASSERT_EQ(compositeSeqNum.isSet(), false); + BMQTST_ASSERT(!errorDescription.str().empty()); + BMQTST_ASSERT_EQ(errorDescription.str(), + "Invalid format: no '-' separator found."); } // Invalid string with wrong separator @@ -136,10 +137,10 @@ static void test2_fromStringTest() errorDescription.reset(); compositeSeqNum.fromString(errorDescription, inputString); - ASSERT_EQ(compositeSeqNum.isSet(), false); - ASSERT(!errorDescription.str().empty()); - ASSERT_EQ(errorDescription.str(), - "Invalid format: no '-' separator found."); + BMQTST_ASSERT_EQ(compositeSeqNum.isSet(), false); + BMQTST_ASSERT(!errorDescription.str().empty()); + BMQTST_ASSERT_EQ(errorDescription.str(), + "Invalid format: no '-' separator found."); } // Invalid string with non-numeric value in first part @@ -151,10 +152,10 @@ static void test2_fromStringTest() errorDescription.reset(); compositeSeqNum.fromString(errorDescription, inputString); - ASSERT_EQ(compositeSeqNum.isSet(), false); - ASSERT(!errorDescription.str().empty()); - ASSERT_EQ(errorDescription.str(), - "Invalid input: non-numeric values encountered."); + BMQTST_ASSERT_EQ(compositeSeqNum.isSet(), false); + BMQTST_ASSERT(!errorDescription.str().empty()); + BMQTST_ASSERT_EQ(errorDescription.str(), + "Invalid input: non-numeric values encountered."); } // Invalid string with non-numeric value in second part @@ -166,10 +167,10 @@ static void test2_fromStringTest() errorDescription.reset(); compositeSeqNum.fromString(errorDescription, inputString); - ASSERT_EQ(compositeSeqNum.isSet(), false); - ASSERT(!errorDescription.str().empty()); - ASSERT_EQ(errorDescription.str(), - "Invalid input: non-numeric values encountered."); + BMQTST_ASSERT_EQ(compositeSeqNum.isSet(), false); + BMQTST_ASSERT(!errorDescription.str().empty()); + BMQTST_ASSERT_EQ(errorDescription.str(), + "Invalid input: non-numeric values encountered."); } // Invalid string with zero value in first part @@ -180,10 +181,10 @@ static void test2_fromStringTest() errorDescription.reset(); compositeSeqNum.fromString(errorDescription, inputString); - ASSERT_EQ(compositeSeqNum.isSet(), false); - ASSERT(!errorDescription.str().empty()); - ASSERT_EQ(errorDescription.str(), - "Invalid input: zero values encountered."); + BMQTST_ASSERT_EQ(compositeSeqNum.isSet(), false); + BMQTST_ASSERT(!errorDescription.str().empty()); + BMQTST_ASSERT_EQ(errorDescription.str(), + "Invalid input: zero values encountered."); } // Invalid string with zero value in second part @@ -194,10 +195,10 @@ static void test2_fromStringTest() errorDescription.reset(); compositeSeqNum.fromString(errorDescription, inputString); - ASSERT_EQ(compositeSeqNum.isSet(), false); - ASSERT(!errorDescription.str().empty()); - ASSERT_EQ(errorDescription.str(), - "Invalid input: zero values encountered."); + BMQTST_ASSERT_EQ(compositeSeqNum.isSet(), false); + BMQTST_ASSERT(!errorDescription.str().empty()); + BMQTST_ASSERT_EQ(errorDescription.str(), + "Invalid input: zero values encountered."); } // Invalid string with out of range value in first part @@ -210,10 +211,10 @@ static void test2_fromStringTest() errorDescription.reset(); compositeSeqNum.fromString(errorDescription, inputString); - ASSERT_EQ(compositeSeqNum.isSet(), false); - ASSERT(!errorDescription.str().empty()); - ASSERT_EQ(errorDescription.str(), - "Invalid input: number out of range."); + BMQTST_ASSERT_EQ(compositeSeqNum.isSet(), false); + BMQTST_ASSERT(!errorDescription.str().empty()); + BMQTST_ASSERT_EQ(errorDescription.str(), + "Invalid input: number out of range."); } // Invalid string with out of range value in second part @@ -226,10 +227,10 @@ static void test2_fromStringTest() errorDescription.reset(); compositeSeqNum.fromString(errorDescription, inputString); - ASSERT_EQ(compositeSeqNum.isSet(), false); - ASSERT(!errorDescription.str().empty()); - ASSERT_EQ(errorDescription.str(), - "Invalid input: number out of range."); + BMQTST_ASSERT_EQ(compositeSeqNum.isSet(), false); + BMQTST_ASSERT(!errorDescription.str().empty()); + BMQTST_ASSERT_EQ(errorDescription.str(), + "Invalid input: number out of range."); } } @@ -250,56 +251,56 @@ static void test3_comparisonTest() { CompositeSequenceNumber lhs(1, 2); CompositeSequenceNumber rhs(2, 1); - ASSERT(lhs < rhs); + BMQTST_ASSERT(lhs < rhs); } // leaseId is less, seqNumber is less { CompositeSequenceNumber lhs(1, 1); CompositeSequenceNumber rhs(2, 2); - ASSERT(lhs < rhs); + BMQTST_ASSERT(lhs < rhs); } // leaseId is greater, seqNumber is greater { CompositeSequenceNumber lhs(3, 2); CompositeSequenceNumber rhs(2, 1); - ASSERT_EQ((lhs < rhs), false); + BMQTST_ASSERT_EQ((lhs < rhs), false); } // leaseId is greater, seqNumber is less { CompositeSequenceNumber lhs(3, 1); CompositeSequenceNumber rhs(2, 2); - ASSERT_EQ((lhs < rhs), false); + BMQTST_ASSERT_EQ((lhs < rhs), false); } // leaseId is equal, seqNumber is less { CompositeSequenceNumber lhs(1, 1); CompositeSequenceNumber rhs(1, 2); - ASSERT(lhs < rhs); + BMQTST_ASSERT(lhs < rhs); } // leaseId is equal, seqNumber is greater { CompositeSequenceNumber lhs(1, 2); CompositeSequenceNumber rhs(1, 1); - ASSERT_EQ((lhs < rhs), false); + BMQTST_ASSERT_EQ((lhs < rhs), false); } // Compare for equality: leaseId is equal, seqNumber is equal { CompositeSequenceNumber lhs(1, 2); CompositeSequenceNumber rhs(1, 2); - ASSERT_EQ((lhs == rhs), true); + BMQTST_ASSERT_EQ((lhs == rhs), true); } // Compare for equality using '<=': leaseId is equal, seqNumber is equal { CompositeSequenceNumber lhs(1, 2); CompositeSequenceNumber rhs(1, 2); - ASSERT_EQ((lhs <= rhs), true); + BMQTST_ASSERT_EQ((lhs <= rhs), true); } } diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_filemanager.h b/src/applications/bmqstoragetool/m_bmqstoragetool_filemanager.h index 4d03ba80c..eefc5cce9 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_filemanager.h +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_filemanager.h @@ -127,7 +127,7 @@ inline FileManagerImpl::FileHandler::FileHandler( } template -inline FileManagerImpl::FileHandler::~FileHandler() +inline FileManagerImpl::FileHandler::~FileHandler() { d_iter.clear(); if (d_mfd.isValid()) { diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.cpp index 7cc459be4..d63cff5b7 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.cpp @@ -20,7 +20,28 @@ namespace BloombergLP { namespace m_bmqstoragetool { -// NOTHING +FileManagerMock::FileManagerMock() +: d_journalFileIt() +, d_dataFileIt() +{ + EXPECT_CALL(*this, dataFileIterator()) + .WillRepeatedly(testing::Return(&d_dataFileIt)); +} + +FileManagerMock::FileManagerMock(const JournalFile& journalFile) +: d_journalFileIt(&journalFile.mappedFileDescriptor(), + journalFile.fileHeader(), + false) +, d_dataFileIt() +{ + EXPECT_CALL(*this, dataFileIterator()) + .WillRepeatedly(testing::Return(&d_dataFileIt)); +} + +mqbs::JournalFileIterator* FileManagerMock::journalFileIterator() +{ + return &d_journalFileIt; +} } // close package namespace diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.h b/src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.h index c0084be13..6968ecaf5 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.h +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.h @@ -27,37 +27,8 @@ #include #include -// GMOCK -// If bmqst_testhelper.h was defined before gtest.h, preserve macroses values. -// If not, undefine values from gtest.h. -#pragma push_macro("ASSERT_EQ") -#pragma push_macro("ASSERT_NE") -#pragma push_macro("ASSERT_LT") -#pragma push_macro("ASSERT_LE") -#pragma push_macro("ASSERT_GT") -#pragma push_macro("ASSERT_GE") -#pragma push_macro("TEST_F") -#pragma push_macro("TEST") - #include -#undef ASSERT_EQ -#undef ASSERT_NE -#undef ASSERT_LT -#undef ASSERT_LE -#undef ASSERT_GT -#undef ASSERT_GE -#undef TEST_F -#undef TEST -#pragma pop_macro("ASSERT_EQ") -#pragma pop_macro("ASSERT_NE") -#pragma pop_macro("ASSERT_LT") -#pragma pop_macro("ASSERT_LE") -#pragma pop_macro("ASSERT_GT") -#pragma pop_macro("ASSERT_GE") -#pragma pop_macro("TEST_F") -#pragma pop_macro("TEST") - namespace BloombergLP { namespace m_bmqstoragetool { @@ -98,33 +69,6 @@ class FileManagerMock : public FileManager { // INLINE DEFINITIONS // ============================================================================ -// ===================== -// class FileManagerMock -// ===================== - -inline FileManagerMock::FileManagerMock() -: d_journalFileIt() -, d_dataFileIt() -{ - EXPECT_CALL(*this, dataFileIterator()) - .WillRepeatedly(testing::Return(&d_dataFileIt)); -} - -inline FileManagerMock::FileManagerMock(const JournalFile& journalFile) -: d_journalFileIt(&journalFile.mappedFileDescriptor(), - journalFile.fileHeader(), - false) -, d_dataFileIt() -{ - EXPECT_CALL(*this, dataFileIterator()) - .WillRepeatedly(testing::Return(&d_dataFileIt)); -} - -inline mqbs::JournalFileIterator* FileManagerMock::journalFileIterator() -{ - return &d_journalFileIt; -} - } // close package namespace } // close enterprise namespace diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.t.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.t.cpp index 2c221cce4..12f4c758e 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.t.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.t.cpp @@ -223,7 +223,7 @@ static void test1_breathingTest() expectedStream << foundMessagesCount << " message GUID(s) found." << bsl::endl; - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test2_searchGuidTest() @@ -291,7 +291,7 @@ static void test2_searchGuidTest() expectedStream << searchGuids.size() << " message GUID(s) found." << bsl::endl; - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test3_searchNonExistingGuidTest() @@ -352,7 +352,7 @@ static void test3_searchNonExistingGuidTest() expectedStream << searchGuids[0] << bsl::endl << searchGuids[1] << bsl::endl; - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test4_searchExistingAndNonExistingGuidTest() @@ -436,7 +436,7 @@ static void test4_searchExistingAndNonExistingGuidTest() expectedStream << searchGuids[2] << bsl::endl << searchGuids[3] << bsl::endl; - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test5_searchOutstandingMessagesTest() @@ -501,7 +501,7 @@ static void test5_searchOutstandingMessagesTest() << outstandingGUIDS.size() << "/" << messageCount << ")" << bsl::endl; - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test6_searchConfirmedMessagesTest() @@ -565,7 +565,7 @@ static void test6_searchConfirmedMessagesTest() << (messageCount - confirmedGUIDS.size()) << "/" << messageCount << ")" << bsl::endl; - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test7_searchPartiallyConfirmedMessagesTest() @@ -632,7 +632,7 @@ static void test7_searchPartiallyConfirmedMessagesTest() << partiallyConfirmedGUIDS.size() + 1 << "/" << messageCount << ")" << bsl::endl; - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test8_searchMessagesByQueueKeyTest() @@ -693,7 +693,7 @@ static void test8_searchMessagesByQueueKeyTest() expectedStream << foundMessagesCount << " message GUID(s) found." << bsl::endl; - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test9_searchMessagesByQueueNameTest() @@ -764,7 +764,7 @@ static void test9_searchMessagesByQueueNameTest() expectedStream << foundMessagesCount << " message GUID(s) found." << bsl::endl; - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test10_searchMessagesByQueueNameAndQueueKeyTest() @@ -839,7 +839,7 @@ static void test10_searchMessagesByQueueNameAndQueueKeyTest() expectedStream << foundMessagesCount << " message GUID(s) found." << bsl::endl; - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test11_searchMessagesByTimestamp() @@ -907,7 +907,7 @@ static void test11_searchMessagesByTimestamp() bmqtst::TestHelperUtil::allocator()); searchProcessor->process(); - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test12_printMessagesDetailsTest() @@ -970,8 +970,8 @@ static void test12_printMessagesDetailsTest() for (size_t i = 0; i < confirmedGUIDS.size(); i++) { // Check Message type size_t foundIdx = resultString.find(messageRecordCaption, startIdx); - ASSERT_D(messageRecordCaption, (foundIdx != bsl::string::npos)); - ASSERT_D(messageRecordCaption, (foundIdx >= startIdx)); + BMQTST_ASSERT_D(messageRecordCaption, (foundIdx != bsl::string::npos)); + BMQTST_ASSERT_D(messageRecordCaption, (foundIdx >= startIdx)); startIdx = foundIdx + bsl::strlen(messageRecordCaption); // Check GUID @@ -979,20 +979,20 @@ static void test12_printMessagesDetailsTest() outputGuidString(ss, confirmedGUIDS.at(i)); bsl::string guidStr(ss.str(), bmqtst::TestHelperUtil::allocator()); foundIdx = resultString.find(guidStr, startIdx); - ASSERT_D(guidStr, (foundIdx != bsl::string::npos)); - ASSERT_D(guidStr, (foundIdx >= startIdx)); + BMQTST_ASSERT_D(guidStr, (foundIdx != bsl::string::npos)); + BMQTST_ASSERT_D(guidStr, (foundIdx >= startIdx)); startIdx = foundIdx + guidStr.length(); // Check Confirm type foundIdx = resultString.find(confirmRecordCaption, startIdx); - ASSERT_D(confirmRecordCaption, (foundIdx != bsl::string::npos)); - ASSERT_D(confirmRecordCaption, (foundIdx >= startIdx)); + BMQTST_ASSERT_D(confirmRecordCaption, (foundIdx != bsl::string::npos)); + BMQTST_ASSERT_D(confirmRecordCaption, (foundIdx >= startIdx)); startIdx = foundIdx + bsl::strlen(messageRecordCaption); // Check Delete type foundIdx = resultString.find(deleteRecordCaption, startIdx); - ASSERT_D(deleteRecordCaption, (foundIdx != bsl::string::npos)); - ASSERT_D(deleteRecordCaption, (foundIdx >= startIdx)); + BMQTST_ASSERT_D(deleteRecordCaption, (foundIdx != bsl::string::npos)); + BMQTST_ASSERT_D(deleteRecordCaption, (foundIdx >= startIdx)); startIdx = foundIdx + bsl::strlen(messageRecordCaption); } } @@ -1052,8 +1052,8 @@ static void test13_searchMessagesWithPayloadDumpTest() MESSAGES, k_NUM_MSGS, messageOffsets); - ASSERT(pd != 0); - ASSERT_GT(mfdData.fileSize(), 0ULL); + BMQTST_ASSERT(pd != 0); + BMQTST_ASSERT_GT(mfdData.fileSize(), 0ULL); // Create data file iterator DataFileIterator dataIt(&mfdData, fileHeader); @@ -1120,8 +1120,8 @@ static void test13_searchMessagesWithPayloadDumpTest() bsl::string guidStr(ss.str(), bmqtst::TestHelperUtil::allocator()); size_t foundIdx = resultString.find(guidStr, startIdx); - ASSERT_D(guidStr, (foundIdx != bsl::string::npos)); - ASSERT_D(guidStr, (foundIdx >= startIdx)); + BMQTST_ASSERT_D(guidStr, (foundIdx != bsl::string::npos)); + BMQTST_ASSERT_D(guidStr, (foundIdx >= startIdx)); startIdx = foundIdx + guidStr.length(); @@ -1129,8 +1129,8 @@ static void test13_searchMessagesWithPayloadDumpTest() bsl::string dumpStr = expectedPayloadSubstring[i]; foundIdx = resultString.find(dumpStr, startIdx); - ASSERT_D(dumpStr, (foundIdx != bsl::string::npos)); - ASSERT_D(guidStr, (foundIdx >= startIdx)); + BMQTST_ASSERT_D(dumpStr, (foundIdx != bsl::string::npos)); + BMQTST_ASSERT_D(guidStr, (foundIdx >= startIdx)); startIdx = foundIdx + dumpStr.length(); } @@ -1192,7 +1192,7 @@ static void test14_summaryTest() expectedStream << "Outstanding ratio: 40% (2/5)\n"; bsl::string res(resultStream.str(), bmqtst::TestHelperUtil::allocator()); - ASSERT(res.starts_with(expectedStream.str())); + BMQTST_ASSERT(res.starts_with(expectedStream.str())); } static void test15_timestampSearchTest() @@ -1220,15 +1220,15 @@ static void test15_timestampSearchTest() static void check(mqbs::JournalFileIterator& it, const bsls::Types::Uint64& ts) { - ASSERT_GT(it.recordHeader().timestamp(), ts); - ASSERT(!it.isReverseMode()); + BMQTST_ASSERT_GT(it.recordHeader().timestamp(), ts); + BMQTST_ASSERT(!it.isReverseMode()); // Check previous record it.flipDirection(); - ASSERT_EQ(it.nextRecord(), 1); - ASSERT_LE(it.recordHeader().timestamp(), ts); + BMQTST_ASSERT_EQ(it.nextRecord(), 1); + BMQTST_ASSERT_LE(it.recordHeader().timestamp(), ts); // Set 'it' to its original state it.flipDirection(); - ASSERT_EQ(it.nextRecord(), 1); + BMQTST_ASSERT_EQ(it.nextRecord(), 1); } }; @@ -1241,16 +1241,22 @@ static void test15_timestampSearchTest() journalFile.fileHeader(), false); // Move the iterator to the beginning of the file - ASSERT_EQ(journalFileIt.nextRecord(), 1); + BMQTST_ASSERT_EQ(journalFileIt.nextRecord(), 1); Parameters::Range range; range.d_type = Parameters::Range::e_TIMESTAMP; range.d_timestampGt = ts; LessThanLowerBoundFn lessThanLowerBoundFn(range); - ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, - lessThanLowerBoundFn), - 1); + BMQTST_ASSERT_EQ( + m_bmqstoragetool::moveToLowerBound(&journalFileIt, + lessThanLowerBoundFn), + 1); + BMQTST_ASSERT_EQ(journalFileIt.nextRecord(), 1); + BMQTST_ASSERT_EQ( + m_bmqstoragetool::moveToLowerBound(&journalFileIt, + lessThanLowerBoundFn), + 1); ResultChecker::check(journalFileIt, ts); } @@ -1264,52 +1270,56 @@ static void test15_timestampSearchTest() false); // Move the iterator to the center of the file - ASSERT_EQ(journalFileIt.nextRecord(), 1); - ASSERT_EQ(journalFileIt.advance(k_NUM_RECORDS / 2), 1); + BMQTST_ASSERT_EQ(journalFileIt.nextRecord(), 1); + BMQTST_ASSERT_EQ(journalFileIt.advance(k_NUM_RECORDS / 2), 1); // Find record with lower timestamp than the record pointed by the // specified iterator, which is initially forward - ASSERT_GT(journalFileIt.recordHeader().timestamp(), ts1); + BMQTST_ASSERT_GT(journalFileIt.recordHeader().timestamp(), ts1); Parameters::Range range; range.d_type = Parameters::Range::e_TIMESTAMP; range.d_timestampGt = ts1; LessThanLowerBoundFn lessThanLowerBoundFn(range); - ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, - lessThanLowerBoundFn), - 1); + BMQTST_ASSERT_EQ( + m_bmqstoragetool::moveToLowerBound(&journalFileIt, + lessThanLowerBoundFn), + 1); ResultChecker::check(journalFileIt, ts1); // Find record with higher timestamp than the record pointed by the // specified iterator, which is initially forward - ASSERT_LT(journalFileIt.recordHeader().timestamp(), ts2); + BMQTST_ASSERT_LT(journalFileIt.recordHeader().timestamp(), ts2); range.d_timestampGt = ts2; LessThanLowerBoundFn lessThanLowerBoundFn2(range); - ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, - lessThanLowerBoundFn2), - 1); + BMQTST_ASSERT_EQ( + m_bmqstoragetool::moveToLowerBound(&journalFileIt, + lessThanLowerBoundFn2), + 1); ResultChecker::check(journalFileIt, ts2); // Find record with lower timestamp than the record pointed by the // specified iterator, which is initially backward - ASSERT_GT(journalFileIt.recordHeader().timestamp(), ts1); + BMQTST_ASSERT_GT(journalFileIt.recordHeader().timestamp(), ts1); journalFileIt.flipDirection(); - ASSERT(journalFileIt.isReverseMode()); - ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, - lessThanLowerBoundFn), - 1); + BMQTST_ASSERT(journalFileIt.isReverseMode()); + BMQTST_ASSERT_EQ( + m_bmqstoragetool::moveToLowerBound(&journalFileIt, + lessThanLowerBoundFn), + 1); ResultChecker::check(journalFileIt, ts1); // Find record with higher timestamp than the record pointed by the // specified iterator, which is initially backward - ASSERT_LT(journalFileIt.recordHeader().timestamp(), ts2); + BMQTST_ASSERT_LT(journalFileIt.recordHeader().timestamp(), ts2); journalFileIt.flipDirection(); - ASSERT(journalFileIt.isReverseMode()); - ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, - lessThanLowerBoundFn2), - 1); + BMQTST_ASSERT(journalFileIt.isReverseMode()); + BMQTST_ASSERT_EQ( + m_bmqstoragetool::moveToLowerBound(&journalFileIt, + lessThanLowerBoundFn2), + 1); ResultChecker::check(journalFileIt, ts2); } @@ -1322,19 +1332,20 @@ static void test15_timestampSearchTest() journalFile.fileHeader(), false); // Move the iterator to the beginning of the file - ASSERT_EQ(journalFileIt.nextRecord(), 1); + BMQTST_ASSERT_EQ(journalFileIt.nextRecord(), 1); Parameters::Range range; range.d_type = Parameters::Range::e_TIMESTAMP; range.d_timestampGt = ts; LessThanLowerBoundFn lessThanLowerBoundFn(range); - ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, - lessThanLowerBoundFn), - 0); - ASSERT_EQ(journalFileIt.recordIndex(), k_NUM_RECORDS - 1); - ASSERT_LT(journalFileIt.recordHeader().timestamp(), ts); - ASSERT(!journalFileIt.isReverseMode()); + BMQTST_ASSERT_EQ( + m_bmqstoragetool::moveToLowerBound(&journalFileIt, + lessThanLowerBoundFn), + 0); + BMQTST_ASSERT_EQ(journalFileIt.recordIndex(), k_NUM_RECORDS - 1); + BMQTST_ASSERT_LT(journalFileIt.recordHeader().timestamp(), ts); + BMQTST_ASSERT(!journalFileIt.isReverseMode()); } { @@ -1345,19 +1356,20 @@ static void test15_timestampSearchTest() journalFile.fileHeader(), false); // Move the iterator to the beginning of the file - ASSERT_EQ(journalFileIt.nextRecord(), 1); + BMQTST_ASSERT_EQ(journalFileIt.nextRecord(), 1); Parameters::Range range; range.d_type = Parameters::Range::e_TIMESTAMP; range.d_timestampGt = ts; LessThanLowerBoundFn lessThanLowerBoundFn(range); - ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, - lessThanLowerBoundFn), - 1); - ASSERT_EQ(journalFileIt.recordIndex(), 0U); - ASSERT_GT(journalFileIt.recordHeader().timestamp(), ts); - ASSERT(!journalFileIt.isReverseMode()); + BMQTST_ASSERT_EQ( + m_bmqstoragetool::moveToLowerBound(&journalFileIt, + lessThanLowerBoundFn), + 1); + BMQTST_ASSERT_EQ(journalFileIt.recordIndex(), 0U); + BMQTST_ASSERT_GT(journalFileIt.recordHeader().timestamp(), ts); + BMQTST_ASSERT(!journalFileIt.isReverseMode()); } } @@ -1424,23 +1436,24 @@ static void test16_sequenceNumberLowerBoundTest() : (test.d_seqNumberGt + 1); // Move the iterator to the beginning of the file - ASSERT_EQ(journalFileIt.nextRecord(), 1); + BMQTST_ASSERT_EQ(journalFileIt.nextRecord(), 1); Parameters::Range range; range.d_type = Parameters::Range::e_SEQUENCE_NUM; range.d_seqNumGt = seqNumGt; LessThanLowerBoundFn lessThanLowerBoundFn(range); - ASSERT_EQ_D(test.d_line, - m_bmqstoragetool::moveToLowerBound(&journalFileIt, - lessThanLowerBoundFn), - 1); - ASSERT_EQ_D(test.d_line, - journalFileIt.recordHeader().primaryLeaseId(), - expectedLeaseId); - ASSERT_EQ_D(test.d_line, - journalFileIt.recordHeader().sequenceNumber(), - expectedSeqNumber); + BMQTST_ASSERT_EQ_D( + test.d_line, + m_bmqstoragetool::moveToLowerBound(&journalFileIt, + lessThanLowerBoundFn), + 1); + BMQTST_ASSERT_EQ_D(test.d_line, + journalFileIt.recordHeader().primaryLeaseId(), + expectedLeaseId); + BMQTST_ASSERT_EQ_D(test.d_line, + journalFileIt.recordHeader().sequenceNumber(), + expectedSeqNumber); } // Edge case: not in the range (greater then the last record) @@ -1459,7 +1472,7 @@ static void test16_sequenceNumberLowerBoundTest() false); // Move the iterator to the beginning of the file - ASSERT_EQ(journalFileIt.nextRecord(), 1); + BMQTST_ASSERT_EQ(journalFileIt.nextRecord(), 1); CompositeSequenceNumber seqNumGt(1, k_NUM_RECORDS); Parameters::Range range; @@ -1467,12 +1480,13 @@ static void test16_sequenceNumberLowerBoundTest() range.d_seqNumGt = seqNumGt; LessThanLowerBoundFn lessThanLowerBoundFn(range); - ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, - lessThanLowerBoundFn), - 0); - ASSERT_EQ(journalFileIt.recordHeader().primaryLeaseId(), 1u); - ASSERT_EQ(journalFileIt.recordHeader().sequenceNumber(), - k_NUM_RECORDS); + BMQTST_ASSERT_EQ( + m_bmqstoragetool::moveToLowerBound(&journalFileIt, + lessThanLowerBoundFn), + 0); + BMQTST_ASSERT_EQ(journalFileIt.recordHeader().primaryLeaseId(), 1u); + BMQTST_ASSERT_EQ(journalFileIt.recordHeader().sequenceNumber(), + k_NUM_RECORDS); } } @@ -1544,7 +1558,7 @@ static void test17_searchMessagesBySequenceNumbersRange() bmqtst::TestHelperUtil::allocator()); searchProcessor->process(); - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test18_searchMessagesByOffsetsRange() @@ -1617,7 +1631,7 @@ static void test18_searchMessagesByOffsetsRange() bmqtst::TestHelperUtil::allocator()); searchProcessor->process(); - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test19_searchQueueOpRecords() @@ -1693,7 +1707,7 @@ static void test19_searchQueueOpRecords() bmqtst::TestHelperUtil::allocator()); searchProcessor->process(); - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test20_searchJournalOpRecords() @@ -1770,7 +1784,7 @@ static void test20_searchJournalOpRecords() bmqtst::TestHelperUtil::allocator()); searchProcessor->process(); - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test21_searchAllTypesRecords() @@ -1875,7 +1889,7 @@ static void test21_searchAllTypesRecords() bmqtst::TestHelperUtil::allocator()); searchProcessor->process(); - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test22_searchQueueOpRecordsByOffset() @@ -1948,7 +1962,7 @@ static void test22_searchQueueOpRecordsByOffset() bmqtst::TestHelperUtil::allocator()); searchProcessor->process(); - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } static void test23_searchJournalOpRecordsBySeqNumber() @@ -2020,7 +2034,7 @@ static void test23_searchJournalOpRecordsBySeqNumber() bmqtst::TestHelperUtil::allocator()); searchProcessor->process(); - ASSERT_EQ(resultStream.str(), expectedStream.str()); + BMQTST_ASSERT_EQ(resultStream.str(), expectedStream.str()); } // ============================================================================ diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_parameters.h b/src/applications/bmqstoragetool/m_bmqstoragetool_parameters.h index c08bfa96b..db6afac2c 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_parameters.h +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_parameters.h @@ -54,56 +54,57 @@ namespace m_bmqstoragetool { struct CommandLineArguments { // PUBLIC DATA + + /// Record types constants static const char* k_MESSAGE_TYPE; static const char* k_QUEUEOP_TYPE; static const char* k_JOURNALOP_TYPE; - // Record types constants + /// List of record types to process (message, journalOp, queueOp) bsl::vector d_recordType; - // List of record types to process (message, journalOp, queueOp) + /// Filter messages by minimum timestamp bsls::Types::Int64 d_timestampGt; - // Filter messages by minimum timestamp + /// Filter messages by maximum timestamp bsls::Types::Int64 d_timestampLt; - // Filter messages by maximum timestamp + /// Filter messages by minimum record composite sequence number bsl::string d_seqNumGt; - // Filter messages by minimum record composite sequence number + /// Filter messages by maximum record composite sequence number bsl::string d_seqNumLt; - // Filter messages by maximum record composite sequence number + /// Filter messages by minimum record offset bsls::Types::Int64 d_offsetGt; - // Filter messages by minimum record offset + /// Filter messages by maximum record offset bsls::Types::Int64 d_offsetLt; - // Filter messages by maximum record offset + /// Path to find all files from bsl::string d_journalPath; - // Path to find all files from + /// Path to read journal files from bsl::string d_journalFile; - // Path to read journal files from + /// Path to read data files from bsl::string d_dataFile; - // Path to read data files from + /// Path to read CSL files from bsl::string d_cslFile; - // Path to read CSL files from + /// Filter messages by message guids bsl::vector d_guid; - // Filter messages by message guids + /// Filter messages by record composite sequence numbers bsl::vector d_seqNum; - // Filter messages by record composite sequence numbers + /// Filter messages by record offsets bsl::vector d_offset; - // Filter messages by record offsets + /// Filter messages by queue keys bsl::vector d_queueKey; - // Filter messages by queue keys + /// Filter messages by queue names bsl::vector d_queueName; - // Filter messages by queue names + /// Limit number of bytes to int d_dumpLimit; - // Limit number of bytes to + /// Print message details bool d_details; - // Print message details + /// Print message payload bool d_dumpPayload; - // Print message payload + /// Print summary of messages bool d_summary; - // Print summary of messages + /// Show only outstanding messages (not deleted) bool d_outstanding; - // Show only outstanding messages (not deleted) + /// Show only messages, confirmed by all the appId's bool d_confirmed; - // Show only messages, confirmed by all the appId's + /// Show only messages, confirmed by some of the appId's bool d_partiallyConfirmed; - // Show only messages, confirmed by some of the appId's // CREATORS explicit CommandLineArguments(bslma::Allocator* allocator = 0); @@ -128,7 +129,7 @@ struct CommandLineArguments { struct Parameters { // PUBLIC TYPES - // VST representing search range parameters + /// VST representing search range parameters struct Range { // PUBLIC TYPES enum Type { @@ -139,22 +140,23 @@ struct Parameters { }; // PUBLIC DATA - Type d_type; /// Range type + Type d_type; + /// Filter messages greater than timestamp value bsls::Types::Uint64 d_timestampGt; - // Filter messages greater than timestamp value + /// Filter messages less than timestamp value bsls::Types::Uint64 d_timestampLt; - // Filter messages less than timestamp value + /// Filter messages greater than offset value bsls::Types::Uint64 d_offsetGt; - // Filter messages greater than offset value + /// Filter messages less than offset value bsls::Types::Uint64 d_offsetLt; - // Filter messages less than offset value + /// Filter messages greater than sequence number CompositeSequenceNumber d_seqNumGt; - // Filter messages greater than sequence number + /// Filter messages less than sequence number CompositeSequenceNumber d_seqNumLt; - // Filter messages less than sequence number // CREATORS + /// Default constructor explicit Range(); }; @@ -173,36 +175,37 @@ struct Parameters { }; // PUBLIC DATA + + /// Record types to process ProcessRecordTypes d_processRecordTypes; - // Record types to process + /// Queue map containing uri to key and key to info mappings QueueMap d_queueMap; - // Queue map containing uri to key and key to info mappings + /// Range parameters for filtering Range d_range; - // Range parameters for filtering + /// Filter messages by message guids bsl::vector d_guid; - // Filter messages by message guids + /// Filter messages by message sequence number bsl::vector d_seqNum; - // Filter messages by message sequence number + /// Filter messages by message offsets bsl::vector d_offset; - // Filter messages by message offsets + /// Filter messages by queue keys bsl::vector d_queueKey; - // Filter messages by queue keys + /// Filter messages by queue names bsl::vector d_queueName; - // Filter messages by queue names + /// Limit number of bytes to dump unsigned int d_dumpLimit; - // Limit number of bytes to dump + /// Print message details bool d_details; - // Print message details + /// Print message payload bool d_dumpPayload; - // Print message payload + /// Print summary of messages bool d_summary; - // Print summary of messages + /// Show only outstanding messages (not deleted) bool d_outstanding; - // Show only outstanding messages (not deleted) + /// Show only messages, confirmed by all the appId's bool d_confirmed; - // Show only messages, confirmed by all the appId's + /// Show only messages, confirmed by some of the appId's bool d_partiallyConfirmed; - // Show only messages, confirmed by some of the appId's // CREATORS /// Default constructor diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_searchresult.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_searchresult.cpp index d1a57c7a6..6cb3d08a0 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_searchresult.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_searchresult.cpp @@ -470,11 +470,15 @@ SearchShortResult::SearchShortResult( , d_printedJournalOpCount(0) , d_guidMap(allocator) , d_guidList(allocator) -, d_allocator_p(allocator) { // NOTHING } +bslma::Allocator* SearchShortResult::allocator() const +{ + return d_guidMap.get_allocator().mechanism(); +} + bool SearchShortResult::processMessageRecord( const mqbs::MessageRecord& record, BSLS_ANNOTATION_UNUSED bsls::Types::Uint64 recordIndex, diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_searchresult.h b/src/applications/bmqstoragetool/m_bmqstoragetool_searchresult.h index 6976bd15c..84b5c06f3 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_searchresult.h +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_searchresult.h @@ -178,8 +178,6 @@ class SearchShortResult : public SearchResult { // Map to store guid and list iterator, for fast searching by guid. bsl::list d_guidList; // List to store ordered guid data to preserve messages order for output. - bslma::Allocator* d_allocator_p; - // Allocator used inside the class. // PRIVATE MANIPULATORS @@ -200,6 +198,10 @@ class SearchShortResult : public SearchResult { bool printOnDelete = false, bslma::Allocator* allocator = 0); + // ACCESSORS + + bslma::Allocator* allocator() const; + // MANIPULATORS /// Process `message` record with the specified `record`, `recordIndex` and @@ -445,9 +447,9 @@ class SearchResultTimestampDecorator : public SearchResultDecorator { // ACCESSORS + /// Return 'true' if the specified 'timestamp' is greater than + /// 'd_timestampLt' and internal cache is empty. bool stop(const bsls::Types::Uint64 timestamp) const; - // Return 'true' if the specified 'timestamp' is greater than - // 'd_timestampLt' and internal cache is empty. public: // CREATORS @@ -488,14 +490,14 @@ class SearchResultTimestampDecorator : public SearchResultDecorator { /// This class provides decorator to handle offsets. class SearchResultOffsetDecorator : public SearchResultDecorator { private: + /// Higher bound offset. const bsls::Types::Uint64 d_offsetLt; - // Higher bound offset. // ACCESSORS + /// Return 'true' if the specified 'offset' is greater than + /// 'd_offsetLt' and internal cache is empty. bool stop(const bsls::Types::Uint64 offset) const; - // Return 'true' if the specified 'offset' is greater than - // 'd_offsetLt' and internal cache is empty. public: // CREATORS @@ -535,14 +537,14 @@ class SearchResultOffsetDecorator : public SearchResultDecorator { /// This class provides decorator to handle composite sequence numbers. class SearchResultSequenceNumberDecorator : public SearchResultDecorator { private: + /// Higher bound sequence number. const CompositeSequenceNumber sequenceNumberLt; - // Higher bound sequence number. // ACCESSORS + /// Return 'true' if the specified 'sequenceNumber' is greater than + /// 'sequenceNumberLt' and internal cache is empty. bool stop(const CompositeSequenceNumber& sequenceNumber) const; - // Return 'true' if the specified 'sequenceNumber' is greater than - // 'sequenceNumberLt' and internal cache is empty. public: // CREATORS @@ -756,12 +758,12 @@ class SearchGuidDecorator : public SearchResultDecorator { class SearchOffsetDecorator : public SearchResultDecorator { private: // PRIVATE DATA + /// List of offsets to search for. bsl::vector d_offsets; - // List of offsets to search for. + /// Reference to output stream. bsl::ostream& d_ostream; - // Reference to output stream. - bool d_withDetails; // If 'true', output detailed result, output short one otherwise. + bool d_withDetails; public: // CREATORS diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_searchresultfactory.t.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_searchresultfactory.t.cpp index 1c1aa77f9..d1d9f8747 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_searchresultfactory.t.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_searchresultfactory.t.cpp @@ -55,7 +55,7 @@ static void test1_breathingTest() fileManager, bsl::cout, bmqtst::TestHelperUtil::allocator()); - ASSERT(dynamic_cast(searchResult.get()) != 0); + BMQTST_ASSERT(dynamic_cast(searchResult.get()) != 0); } // ============================================================================ diff --git a/src/applications/bmqtool/m_bmqtool_inpututil.t.cpp b/src/applications/bmqtool/m_bmqtool_inpututil.t.cpp index 37fba0b55..dc8e7dc8f 100644 --- a/src/applications/bmqtool/m_bmqtool_inpututil.t.cpp +++ b/src/applications/bmqtool/m_bmqtool_inpututil.t.cpp @@ -113,11 +113,11 @@ static void test1_decodeHexDumpTest() input, bmqtst::TestHelperUtil::allocator()); // Check rc - ASSERT_EQ_D(test.d_line, rc, test.d_expectedRc); + BMQTST_ASSERT_EQ_D(test.d_line, rc, test.d_expectedRc); // Check error - ASSERT_EQ_D(test.d_line, error.str(), test.d_expectedError); + BMQTST_ASSERT_EQ_D(test.d_line, error.str(), test.d_expectedError); // Check output - ASSERT_EQ_D(test.d_line, output.str(), test.d_expectedOutput); + BMQTST_ASSERT_EQ_D(test.d_line, output.str(), test.d_expectedOutput); } } @@ -264,8 +264,8 @@ static void test2_loadMessageFromFileTest() &error, "wrongFilePath", bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(rc, false); - ASSERT_EQ(error.str(), "Failed to open file: wrongFilePath"); + BMQTST_ASSERT_EQ(rc, false); + BMQTST_ASSERT_EQ(error.str(), "Failed to open file: wrongFilePath"); } const size_t k_NUM_DATA = sizeof(k_DATA) / sizeof(*k_DATA); @@ -277,7 +277,7 @@ static void test2_loadMessageFromFileTest() const bsl::string filePath = tempFile.path(); { bsl::ofstream ofs(filePath.c_str()); - ASSERT_EQ(ofs.is_open(), true); + BMQTST_ASSERT_EQ(ofs.is_open(), true); ofs << test.d_fileContent; } @@ -291,11 +291,11 @@ static void test2_loadMessageFromFileTest() filePath, bmqtst::TestHelperUtil::allocator()); // Check rc - ASSERT_EQ_D(test.d_line, rc, test.d_expectedRc); + BMQTST_ASSERT_EQ_D(test.d_line, rc, test.d_expectedRc); // Check error - ASSERT_EQ_D(test.d_line, error.str(), test.d_expectedError); + BMQTST_ASSERT_EQ_D(test.d_line, error.str(), test.d_expectedError); // Check payload - ASSERT_EQ_D(test.d_line, payload.str(), test.d_expectedPayload); + BMQTST_ASSERT_EQ_D(test.d_line, payload.str(), test.d_expectedPayload); // Check properties (deserialize into properties instance) bdlbb::PooledBlobBufferFactory bufferFactory( 128, @@ -306,7 +306,7 @@ static void test2_loadMessageFromFileTest() bdlbb::BlobUtil::append(&blob, properties.str().c_str(), static_cast(properties.str().size())); - ASSERT_EQ_D(test.d_line, messageProperties.streamIn(blob), 0); + BMQTST_ASSERT_EQ_D(test.d_line, messageProperties.streamIn(blob), 0); } } diff --git a/src/groups/bmq/bmqa/bmqa_abstractsession.t.cpp b/src/groups/bmq/bmqa/bmqa_abstractsession.t.cpp index 3355f20be..dcf0c0502 100644 --- a/src/groups/bmq/bmqa/bmqa_abstractsession.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_abstractsession.t.cpp @@ -306,13 +306,13 @@ static void test1_breathingTest() bmqtst::TestHelperUtil::verbosityLevel() > 2); PV("Verify that the protocol is NOT abstract"); - ASSERT(!testObj.testAbstract()); + BMQTST_ASSERT(!testObj.testAbstract()); PV("Verify that there are no data members"); - ASSERT(testObj.testNoDataMembers()); + BMQTST_ASSERT(testObj.testNoDataMembers()); PV("Verify that the destructor is virtual"); - ASSERT(testObj.testVirtualDestructor()); + BMQTST_ASSERT(testObj.testVirtualDestructor()); PV("Verify that methods are public and virtual"); @@ -481,136 +481,143 @@ static void test2_instanceInvariants() const bmqa::AbstractSession::CloseQueueCallback closeQueueCallback; // Base class instance - ASSERT_OPT_FAIL(concreteObj.start(dummyTimeInterval)); - ASSERT_OPT_FAIL(concreteObj.startAsync(dummyTimeInterval)); - ASSERT_OPT_FAIL(concreteObj.stop()); - ASSERT_OPT_FAIL(concreteObj.stopAsync()); - ASSERT_OPT_FAIL(concreteObj.finalizeStop()); - ASSERT_OPT_FAIL( + BMQTST_ASSERT_OPT_FAIL(concreteObj.start(dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(concreteObj.startAsync(dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(concreteObj.stop()); + BMQTST_ASSERT_OPT_FAIL(concreteObj.stopAsync()); + BMQTST_ASSERT_OPT_FAIL(concreteObj.finalizeStop()); + BMQTST_ASSERT_OPT_FAIL( concreteObj.loadMessageEventBuilder(dummyMessageEventBuilderPtr)); - ASSERT_OPT_FAIL( + BMQTST_ASSERT_OPT_FAIL( concreteObj.loadConfirmEventBuilder(dummyConfirmEventBuilderPtr)); - ASSERT_OPT_FAIL( + BMQTST_ASSERT_OPT_FAIL( concreteObj.loadMessageProperties(dummyMessagePropertiesPtr)); - ASSERT_OPT_FAIL(concreteObj.getQueueId(dummyQueueIdPtr, dummyUri)); - ASSERT_OPT_FAIL( + BMQTST_ASSERT_OPT_FAIL(concreteObj.getQueueId(dummyQueueIdPtr, dummyUri)); + BMQTST_ASSERT_OPT_FAIL( concreteObj.getQueueId(dummyQueueIdPtr, dummyCorrelationId)); - ASSERT_OPT_FAIL(concreteObj.openQueue(dummyQueueIdPtr, - dummyUri, - 0, - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(concreteObj.openQueueSync(dummyQueueIdPtr, - dummyUri, - 0, - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(concreteObj.openQueueAsync(dummyQueueIdPtr, - dummyUri, - 0, - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(concreteObj.openQueueAsync(dummyQueueIdPtr, - dummyUri, - 0, - openQueueCallback, - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(concreteObj.configureQueue(dummyQueueIdPtr, - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(concreteObj.configureQueueSync(dummyQueueIdPtr, - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(concreteObj.configureQueueAsync(dummyQueueIdPtr, - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(concreteObj.configureQueueAsync(dummyQueueIdPtr, - dummyQueueOptions, - configureQueueCallback, - dummyTimeInterval)); - ASSERT_OPT_FAIL( + BMQTST_ASSERT_OPT_FAIL(concreteObj.openQueue(dummyQueueIdPtr, + dummyUri, + 0, + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(concreteObj.openQueueSync(dummyQueueIdPtr, + dummyUri, + 0, + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(concreteObj.openQueueAsync(dummyQueueIdPtr, + dummyUri, + 0, + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(concreteObj.openQueueAsync(dummyQueueIdPtr, + dummyUri, + 0, + openQueueCallback, + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(concreteObj.configureQueue(dummyQueueIdPtr, + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(concreteObj.configureQueueSync(dummyQueueIdPtr, + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(concreteObj.configureQueueAsync(dummyQueueIdPtr, + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL( + concreteObj.configureQueueAsync(dummyQueueIdPtr, + dummyQueueOptions, + configureQueueCallback, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL( concreteObj.closeQueue(dummyQueueIdPtr, dummyTimeInterval)); - ASSERT_OPT_FAIL( + BMQTST_ASSERT_OPT_FAIL( concreteObj.closeQueueSync(dummyQueueIdPtr, dummyTimeInterval)); - ASSERT_OPT_FAIL( + BMQTST_ASSERT_OPT_FAIL( concreteObj.closeQueueAsync(dummyQueueIdPtr, dummyTimeInterval)); - ASSERT_OPT_FAIL(concreteObj.closeQueueAsync(dummyQueueIdPtr, - closeQueueCallback, - dummyTimeInterval)); - ASSERT_OPT_FAIL(concreteObj.nextEvent(dummyTimeInterval)); - ASSERT_OPT_FAIL(concreteObj.post(dummyMessageEvent)); - ASSERT_OPT_FAIL(concreteObj.confirmMessage(dummyMessage)); - ASSERT_OPT_FAIL( + BMQTST_ASSERT_OPT_FAIL(concreteObj.closeQueueAsync(dummyQueueIdPtr, + closeQueueCallback, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(concreteObj.nextEvent(dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(concreteObj.post(dummyMessageEvent)); + BMQTST_ASSERT_OPT_FAIL(concreteObj.confirmMessage(dummyMessage)); + BMQTST_ASSERT_OPT_FAIL( concreteObj.confirmMessage(dummyMessageConfirmationCookie)); - ASSERT_OPT_FAIL(concreteObj.confirmMessages(dummyConfirmEventBuilderPtr)); - ASSERT_OPT_FAIL(concreteObj.configureMessageDumping("")); + BMQTST_ASSERT_OPT_FAIL( + concreteObj.confirmMessages(dummyConfirmEventBuilderPtr)); + BMQTST_ASSERT_OPT_FAIL(concreteObj.configureMessageDumping("")); // Derived instance - ASSERT_OPT_FAIL(testObj.start(dummyTimeInterval)); - ASSERT_OPT_FAIL(testObj.startAsync(dummyTimeInterval)); - ASSERT_OPT_FAIL(testObj.stop()); - ASSERT_OPT_FAIL(testObj.stopAsync()); - ASSERT_OPT_FAIL(testObj.finalizeStop()); - ASSERT_OPT_FAIL( + BMQTST_ASSERT_OPT_FAIL(testObj.start(dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(testObj.startAsync(dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(testObj.stop()); + BMQTST_ASSERT_OPT_FAIL(testObj.stopAsync()); + BMQTST_ASSERT_OPT_FAIL(testObj.finalizeStop()); + BMQTST_ASSERT_OPT_FAIL( testObj.loadMessageEventBuilder(dummyMessageEventBuilderPtr)); - ASSERT_OPT_FAIL( + BMQTST_ASSERT_OPT_FAIL( testObj.loadConfirmEventBuilder(dummyConfirmEventBuilderPtr)); - ASSERT_OPT_FAIL(testObj.loadMessageProperties(dummyMessagePropertiesPtr)); - ASSERT_OPT_FAIL(testObj.getQueueId(dummyQueueIdPtr, dummyUri)); - ASSERT_OPT_FAIL(testObj.getQueueId(dummyQueueIdPtr, dummyCorrelationId)); - ASSERT_OPT_FAIL(testObj.openQueue(dummyQueueIdPtr, - dummyUri, - 0, - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(testObj.openQueueSync(dummyQueueIdPtr, - dummyUri, - 0, // flags - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(testObj.openQueueAsync(dummyQueueIdPtr, - dummyUri, - 0, - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(testObj.openQueueAsync(dummyQueueIdPtr, - dummyUri, - 0, - openQueueCallback, - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(testObj.configureQueue(dummyQueueIdPtr, - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(testObj.configureQueueSync(dummyQueueIdPtr, - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(testObj.configureQueueAsync(dummyQueueIdPtr, - dummyQueueOptions, - dummyTimeInterval)); - ASSERT_OPT_FAIL(testObj.configureQueueAsync(dummyQueueIdPtr, - dummyQueueOptions, - configureQueueCallback, - dummyTimeInterval)); - ASSERT_OPT_FAIL(testObj.closeQueue(dummyQueueIdPtr, dummyTimeInterval)); - ASSERT_OPT_FAIL( + BMQTST_ASSERT_OPT_FAIL( + testObj.loadMessageProperties(dummyMessagePropertiesPtr)); + BMQTST_ASSERT_OPT_FAIL(testObj.getQueueId(dummyQueueIdPtr, dummyUri)); + BMQTST_ASSERT_OPT_FAIL( + testObj.getQueueId(dummyQueueIdPtr, dummyCorrelationId)); + BMQTST_ASSERT_OPT_FAIL(testObj.openQueue(dummyQueueIdPtr, + dummyUri, + 0, + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(testObj.openQueueSync(dummyQueueIdPtr, + dummyUri, + 0, // flags + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(testObj.openQueueAsync(dummyQueueIdPtr, + dummyUri, + 0, + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(testObj.openQueueAsync(dummyQueueIdPtr, + dummyUri, + 0, + openQueueCallback, + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(testObj.configureQueue(dummyQueueIdPtr, + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(testObj.configureQueueSync(dummyQueueIdPtr, + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(testObj.configureQueueAsync(dummyQueueIdPtr, + dummyQueueOptions, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(testObj.configureQueueAsync(dummyQueueIdPtr, + dummyQueueOptions, + configureQueueCallback, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL( + testObj.closeQueue(dummyQueueIdPtr, dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL( testObj.closeQueueSync(dummyQueueIdPtr, dummyTimeInterval)); - ASSERT_OPT_FAIL( + BMQTST_ASSERT_OPT_FAIL( testObj.closeQueueAsync(dummyQueueIdPtr, dummyTimeInterval)); - ASSERT_OPT_FAIL(testObj.closeQueueAsync(dummyQueueIdPtr, - closeQueueCallback, - dummyTimeInterval)); - ASSERT_OPT_FAIL(testObj.nextEvent(dummyTimeInterval)); - ASSERT_OPT_FAIL(testObj.post(dummyMessageEvent)); - ASSERT_OPT_FAIL(testObj.confirmMessage(dummyMessage)); - ASSERT_OPT_FAIL(testObj.confirmMessage(dummyMessageConfirmationCookie)); - ASSERT_OPT_FAIL(testObj.confirmMessages(dummyConfirmEventBuilderPtr)); + BMQTST_ASSERT_OPT_FAIL(testObj.closeQueueAsync(dummyQueueIdPtr, + closeQueueCallback, + dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(testObj.nextEvent(dummyTimeInterval)); + BMQTST_ASSERT_OPT_FAIL(testObj.post(dummyMessageEvent)); + BMQTST_ASSERT_OPT_FAIL(testObj.confirmMessage(dummyMessage)); + BMQTST_ASSERT_OPT_FAIL( + testObj.confirmMessage(dummyMessageConfirmationCookie)); + BMQTST_ASSERT_OPT_FAIL( + testObj.confirmMessages(dummyConfirmEventBuilderPtr)); PV("Verify that overriden methods execute as intended"); - ASSERT_OPT_PASS(testObj.configureMessageDumping("")); - ASSERT_EQ(testObj.configureMessageDumping(""), -1497); + BMQTST_ASSERT_OPT_PASS(testObj.configureMessageDumping("")); + BMQTST_ASSERT_EQ(testObj.configureMessageDumping(""), -1497); } // ============================================================================ diff --git a/src/groups/bmq/bmqa/bmqa_closequeuestatus.t.cpp b/src/groups/bmq/bmqa/bmqa_closequeuestatus.t.cpp index 31222e65b..3fde374bb 100644 --- a/src/groups/bmq/bmqa/bmqa_closequeuestatus.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_closequeuestatus.t.cpp @@ -56,10 +56,10 @@ static void test1_breathingTest() PV("Default Constructor"); { bmqa::CloseQueueStatus obj(bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(bool(obj), true); - ASSERT_EQ(obj.result(), bmqt::CloseQueueResult::e_SUCCESS); - ASSERT_EQ(obj.errorDescription(), - bsl::string("", bmqtst::TestHelperUtil::allocator())); + BMQTST_ASSERT_EQ(bool(obj), true); + BMQTST_ASSERT_EQ(obj.result(), bmqt::CloseQueueResult::e_SUCCESS); + BMQTST_ASSERT_EQ(obj.errorDescription(), + bsl::string("", bmqtst::TestHelperUtil::allocator())); } PV("Valued Constructor"); @@ -78,10 +78,10 @@ static void test1_breathingTest() errorDescription, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(bool(obj), false); - ASSERT_EQ(obj.queueId(), queueId); - ASSERT_EQ(obj.result(), statusCode); - ASSERT_EQ(obj.errorDescription(), errorDescription); + BMQTST_ASSERT_EQ(bool(obj), false); + BMQTST_ASSERT_EQ(obj.queueId(), queueId); + BMQTST_ASSERT_EQ(obj.result(), statusCode); + BMQTST_ASSERT_EQ(obj.errorDescription(), errorDescription); } PV("Copy Constructor"); @@ -101,10 +101,10 @@ static void test1_breathingTest() bmqtst::TestHelperUtil::allocator()); bmqa::CloseQueueStatus obj2(obj1, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(bool(obj1), bool(obj2)); - ASSERT_EQ(obj1.queueId(), obj2.queueId()); - ASSERT_EQ(obj1.result(), obj2.result()); - ASSERT_EQ(obj1.errorDescription(), obj2.errorDescription()); + BMQTST_ASSERT_EQ(bool(obj1), bool(obj2)); + BMQTST_ASSERT_EQ(obj1.queueId(), obj2.queueId()); + BMQTST_ASSERT_EQ(obj1.result(), obj2.result()); + BMQTST_ASSERT_EQ(obj1.errorDescription(), obj2.errorDescription()); } PV("Assignment Operator"); @@ -125,10 +125,10 @@ static void test1_breathingTest() bmqa::CloseQueueStatus obj2(bmqtst::TestHelperUtil::allocator()); obj2 = obj1; - ASSERT_EQ(bool(obj1), bool(obj2)); - ASSERT_EQ(obj1.queueId(), obj2.queueId()); - ASSERT_EQ(obj1.result(), obj2.result()); - ASSERT_EQ(obj1.errorDescription(), obj2.errorDescription()); + BMQTST_ASSERT_EQ(bool(obj1), bool(obj2)); + BMQTST_ASSERT_EQ(obj1.queueId(), obj2.queueId()); + BMQTST_ASSERT_EQ(obj1.result(), obj2.result()); + BMQTST_ASSERT_EQ(obj1.errorDescription(), obj2.errorDescription()); } } @@ -171,7 +171,7 @@ static void test2_comparison() bmqtst::TestHelperUtil::allocator()); bmqa::CloseQueueStatus obj2(obj1, bmqtst::TestHelperUtil::allocator()); - ASSERT(obj1 == obj2); + BMQTST_ASSERT(obj1 == obj2); } PV("Inequality"); @@ -196,7 +196,7 @@ static void test2_comparison() errorDescription, bmqtst::TestHelperUtil::allocator()); - ASSERT(obj1 != obj2); + BMQTST_ASSERT(obj1 != obj2); } } @@ -252,13 +252,13 @@ static void test3_print() // operator<< out << obj; - ASSERT_EQ(out.str(), expected); + BMQTST_ASSERT_EQ(out.str(), expected); // Print out.reset(); obj.print(out, 0, -1); - ASSERT_EQ(out.str(), expected); + BMQTST_ASSERT_EQ(out.str(), expected); } // ============================================================================ diff --git a/src/groups/bmq/bmqa/bmqa_configurequeuestatus.t.cpp b/src/groups/bmq/bmqa/bmqa_configurequeuestatus.t.cpp index f71925a13..252839e00 100644 --- a/src/groups/bmq/bmqa/bmqa_configurequeuestatus.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_configurequeuestatus.t.cpp @@ -56,10 +56,10 @@ static void test1_breathingTest() PV("Default Constructor"); { bmqa::ConfigureQueueStatus obj(bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(bool(obj), true); - ASSERT_EQ(obj.result(), bmqt::ConfigureQueueResult::e_SUCCESS); - ASSERT_EQ(obj.errorDescription(), - bsl::string("", bmqtst::TestHelperUtil::allocator())); + BMQTST_ASSERT_EQ(bool(obj), true); + BMQTST_ASSERT_EQ(obj.result(), bmqt::ConfigureQueueResult::e_SUCCESS); + BMQTST_ASSERT_EQ(obj.errorDescription(), + bsl::string("", bmqtst::TestHelperUtil::allocator())); } PV("Valued Constructor"); @@ -78,10 +78,10 @@ static void test1_breathingTest() errorDescription, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(bool(obj), false); - ASSERT_EQ(obj.queueId(), queueId); - ASSERT_EQ(obj.result(), result); - ASSERT_EQ(obj.errorDescription(), errorDescription); + BMQTST_ASSERT_EQ(bool(obj), false); + BMQTST_ASSERT_EQ(obj.queueId(), queueId); + BMQTST_ASSERT_EQ(obj.result(), result); + BMQTST_ASSERT_EQ(obj.errorDescription(), errorDescription); } PV("Copy Constructor"); @@ -102,10 +102,10 @@ static void test1_breathingTest() bmqa::ConfigureQueueStatus obj2(obj1, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(bool(obj1), bool(obj2)); - ASSERT_EQ(obj1.queueId(), obj2.queueId()); - ASSERT_EQ(obj1.result(), obj2.result()); - ASSERT_EQ(obj1.errorDescription(), obj2.errorDescription()); + BMQTST_ASSERT_EQ(bool(obj1), bool(obj2)); + BMQTST_ASSERT_EQ(obj1.queueId(), obj2.queueId()); + BMQTST_ASSERT_EQ(obj1.result(), obj2.result()); + BMQTST_ASSERT_EQ(obj1.errorDescription(), obj2.errorDescription()); } PV("Assignment Operator"); @@ -126,10 +126,10 @@ static void test1_breathingTest() bmqa::ConfigureQueueStatus obj2(bmqtst::TestHelperUtil::allocator()); obj2 = obj1; - ASSERT_EQ(bool(obj1), bool(obj2)); - ASSERT_EQ(obj1.queueId(), obj2.queueId()); - ASSERT_EQ(obj1.result(), obj2.result()); - ASSERT_EQ(obj1.errorDescription(), obj2.errorDescription()); + BMQTST_ASSERT_EQ(bool(obj1), bool(obj2)); + BMQTST_ASSERT_EQ(obj1.queueId(), obj2.queueId()); + BMQTST_ASSERT_EQ(obj1.result(), obj2.result()); + BMQTST_ASSERT_EQ(obj1.errorDescription(), obj2.errorDescription()); } } @@ -173,7 +173,7 @@ static void test2_comparison() bmqa::ConfigureQueueStatus obj2(obj1, bmqtst::TestHelperUtil::allocator()); - ASSERT(obj1 == obj2); + BMQTST_ASSERT(obj1 == obj2); } PV("Inequality"); @@ -198,7 +198,7 @@ static void test2_comparison() errorDescription, bmqtst::TestHelperUtil::allocator()); - ASSERT(obj1 != obj2); + BMQTST_ASSERT(obj1 != obj2); } } @@ -254,13 +254,13 @@ static void test3_print() // operator<< out << obj; - ASSERT_EQ(out.str(), expected); + BMQTST_ASSERT_EQ(out.str(), expected); // Print out.reset(); obj.print(out, 0, -1); - ASSERT_EQ(out.str(), expected); + BMQTST_ASSERT_EQ(out.str(), expected); } // ============================================================================ diff --git a/src/groups/bmq/bmqa/bmqa_confirmeventbuilder.cpp b/src/groups/bmq/bmqa/bmqa_confirmeventbuilder.cpp index 572604506..32dee1c88 100644 --- a/src/groups/bmq/bmqa/bmqa_confirmeventbuilder.cpp +++ b/src/groups/bmq/bmqa/bmqa_confirmeventbuilder.cpp @@ -100,7 +100,7 @@ const bdlbb::Blob& ConfirmEventBuilder::blob() const // PRECONDITIONS BSLS_ASSERT(d_impl.d_builder_p); - return d_impl.d_builder_p->blob(); + return *d_impl.d_builder_p->blob(); } } // close package namespace diff --git a/src/groups/bmq/bmqa/bmqa_event.t.cpp b/src/groups/bmq/bmqa/bmqa_event.t.cpp index 2487288d5..c33ff4959 100644 --- a/src/groups/bmq/bmqa/bmqa_event.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_event.t.cpp @@ -72,8 +72,8 @@ static void test1_breathingTest() bmqtst::TestHelperUtil::allocator()); bmqa::Event event = convertEvent(eventImpl); - ASSERT_EQ(event.isSessionEvent(), false); - ASSERT_EQ(event.isMessageEvent(), false); + BMQTST_ASSERT_EQ(event.isSessionEvent(), false); + BMQTST_ASSERT_EQ(event.isMessageEvent(), false); PV("EmptyEvent: " << event); } @@ -91,15 +91,15 @@ static void test1_breathingTest() bmqa::Event event = convertEvent(eventImpl); // Validate type of the event - ASSERT_EQ(event.isSessionEvent(), true); - ASSERT_EQ(event.isMessageEvent(), false); + BMQTST_ASSERT_EQ(event.isSessionEvent(), true); + BMQTST_ASSERT_EQ(event.isMessageEvent(), false); // Validate session event values bmqa::SessionEvent se = event.sessionEvent(); - ASSERT_EQ(se.type(), bmqt::SessionEventType::e_TIMEOUT); - ASSERT_EQ(se.statusCode(), -3); - ASSERT_EQ(se.correlationId(), bmqt::CorrelationId(13)); - ASSERT_EQ(se.errorDescription(), "test"); + BMQTST_ASSERT_EQ(se.type(), bmqt::SessionEventType::e_TIMEOUT); + BMQTST_ASSERT_EQ(se.statusCode(), -3); + BMQTST_ASSERT_EQ(se.correlationId(), bmqt::CorrelationId(13)); + BMQTST_ASSERT_EQ(se.errorDescription(), "test"); PV("Event: " << event); } } diff --git a/src/groups/bmq/bmqa/bmqa_message.t.cpp b/src/groups/bmq/bmqa/bmqa_message.t.cpp index d12225587..f389e4513 100644 --- a/src/groups/bmq/bmqa/bmqa_message.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_message.t.cpp @@ -109,36 +109,36 @@ static void test1_messageOnStackIsInvalid() bmqa::Message msg; - ASSERT_SAFE_FAIL(msg.queueId()); - ASSERT_SAFE_FAIL(msg.correlationId()); + BMQTST_ASSERT_SAFE_FAIL(msg.queueId()); + BMQTST_ASSERT_SAFE_FAIL(msg.correlationId()); #ifdef BMQ_ENABLE_MSG_GROUPID - ASSERT_SAFE_FAIL(msg.groupId()); + BMQTST_ASSERT_SAFE_FAIL(msg.groupId()); #endif - ASSERT_SAFE_FAIL(msg.messageGUID()); - ASSERT_SAFE_FAIL(msg.confirmationCookie()); - ASSERT_SAFE_FAIL(msg.ackStatus()); - ASSERT_SAFE_FAIL(msg.dataSize()); - ASSERT_SAFE_FAIL(msg.hasProperties()); + BMQTST_ASSERT_SAFE_FAIL(msg.messageGUID()); + BMQTST_ASSERT_SAFE_FAIL(msg.confirmationCookie()); + BMQTST_ASSERT_SAFE_FAIL(msg.ackStatus()); + BMQTST_ASSERT_SAFE_FAIL(msg.dataSize()); + BMQTST_ASSERT_SAFE_FAIL(msg.hasProperties()); #ifdef BMQ_ENABLE_MSG_GROUPID - ASSERT_SAFE_FAIL(msg.hasGroupId()); + BMQTST_ASSERT_SAFE_FAIL(msg.hasGroupId()); #endif PV("Cloned object - uninitialized"); bmqa::Message clone = msg.clone(); - ASSERT_SAFE_FAIL(clone.queueId()); - ASSERT_SAFE_FAIL(clone.correlationId()); + BMQTST_ASSERT_SAFE_FAIL(clone.queueId()); + BMQTST_ASSERT_SAFE_FAIL(clone.correlationId()); #ifdef BMQ_ENABLE_MSG_GROUPID - ASSERT_SAFE_FAIL(clone.groupId()); + BMQTST_ASSERT_SAFE_FAIL(clone.groupId()); #endif - ASSERT_SAFE_FAIL(clone.messageGUID()); - ASSERT_SAFE_FAIL(clone.confirmationCookie()); - ASSERT_SAFE_FAIL(clone.ackStatus()); - ASSERT_SAFE_FAIL(clone.dataSize()); - ASSERT_SAFE_FAIL(clone.hasProperties()); + BMQTST_ASSERT_SAFE_FAIL(clone.messageGUID()); + BMQTST_ASSERT_SAFE_FAIL(clone.confirmationCookie()); + BMQTST_ASSERT_SAFE_FAIL(clone.ackStatus()); + BMQTST_ASSERT_SAFE_FAIL(clone.dataSize()); + BMQTST_ASSERT_SAFE_FAIL(clone.hasProperties()); #ifdef BMQ_ENABLE_MSG_GROUPID - ASSERT_SAFE_FAIL(clone.hasGroupId()); + BMQTST_ASSERT_SAFE_FAIL(clone.hasGroupId()); #endif } @@ -166,6 +166,10 @@ static void test2_validPushMessagePrint() bdlbb::PooledBlobBufferFactory bufferFactory( 4 * 1024, bmqtst::TestHelperUtil::allocator()); + bmqp::BlobPoolUtil::BlobSpPool blobSpPool( + bmqp::BlobPoolUtil::createBlobPool( + &bufferFactory, + bmqtst::TestHelperUtil::allocator())); bmqa::Event event; EventImplSp& implPtr = reinterpret_cast(event); @@ -184,26 +188,28 @@ static void test2_validPushMessagePrint() bmqtst::TestHelperUtil::allocator()); bdlbb::Blob payload(&bufferFactory, bmqtst::TestHelperUtil::allocator()); bdlbb::BlobUtil::append(&payload, buffer, bsl::strlen(buffer)); - ASSERT_EQ(static_cast(payload.length()), - bsl::strlen(buffer)); + BMQTST_ASSERT_EQ(static_cast(payload.length()), + bsl::strlen(buffer)); // Create PushEventBuilder - bmqp::PushEventBuilder peb(&bufferFactory, + bmqp::PushEventBuilder peb(&blobSpPool, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(sizeof(bmqp::EventHeader), static_cast(peb.eventSize())); - ASSERT_EQ(sizeof(bmqp::EventHeader), - static_cast(peb.blob().length())); - ASSERT_EQ(0, peb.messageCount()); + BMQTST_ASSERT_EQ(sizeof(bmqp::EventHeader), + static_cast(peb.eventSize())); + BMQTST_ASSERT_EQ(sizeof(bmqp::EventHeader), + static_cast(peb.blob()->length())); + BMQTST_ASSERT_EQ(0, peb.messageCount()); // Add SubQueueInfo option generateSubQueueInfos(&subQueueInfos, numSubQueueInfos); bmqt::EventBuilderResult::Enum rc = peb.addSubQueueInfosOption( subQueueInfos); - ASSERT_EQ(bmqt::EventBuilderResult::e_SUCCESS, rc); - ASSERT_EQ(sizeof(bmqp::EventHeader), static_cast(peb.eventSize())); + BMQTST_ASSERT_EQ(bmqt::EventBuilderResult::e_SUCCESS, rc); + BMQTST_ASSERT_EQ(sizeof(bmqp::EventHeader), + static_cast(peb.eventSize())); // 'eventSize()' excludes unpacked messages - ASSERT_LT(sizeof(bmqp::EventHeader), - static_cast(peb.blob().length())); + BMQTST_ASSERT_LT(sizeof(bmqp::EventHeader), + static_cast(peb.blob()->length())); // But the option is written to the underlying blob rc = peb.packMessage(payload, queueId, @@ -211,11 +217,11 @@ static void test2_validPushMessagePrint() flags, bmqt::CompressionAlgorithmType::e_NONE); - ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); - ASSERT_LT(payload.length(), peb.eventSize()); - ASSERT_EQ(1, peb.messageCount()); + BMQTST_ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); + BMQTST_ASSERT_LT(payload.length(), peb.eventSize()); + BMQTST_ASSERT_EQ(1, peb.messageCount()); - bmqp::Event bmqpEvent(&peb.blob(), + bmqp::Event bmqpEvent(peb.blob().get(), bmqtst::TestHelperUtil::allocator(), true); implPtr->configureAsMessageEvent(bmqpEvent); @@ -226,8 +232,8 @@ static void test2_validPushMessagePrint() bmqa::MessageIterator mIter = pushMsgEvt.messageIterator(); mIter.nextMessage(); bmqa::Message message = mIter.message(); - ASSERT_EQ(message.compressionAlgorithmType(), - bmqt::CompressionAlgorithmType::e_NONE); + BMQTST_ASSERT_EQ(message.compressionAlgorithmType(), + bmqt::CompressionAlgorithmType::e_NONE); } static void test3_messageProperties() @@ -250,6 +256,10 @@ static void test3_messageProperties() bdlbb::PooledBlobBufferFactory bufferFactory( 4 * 1024, bmqtst::TestHelperUtil::allocator()); + bmqp::BlobPoolUtil::BlobSpPool blobSpPool( + bmqp::BlobPoolUtil::createBlobPool( + &bufferFactory, + bmqtst::TestHelperUtil::allocator())); const int queueId = 4321; const bmqt::MessageGUID guid; @@ -280,13 +290,13 @@ static void test3_messageProperties() bdlbb::BlobUtil::append(&payload, buffer, bsl::strlen(buffer)); // Create PushEventBuilder - bmqp::PushEventBuilder peb(&bufferFactory, + bmqp::PushEventBuilder peb(&blobSpPool, bmqtst::TestHelperUtil::allocator()); // Add SubQueueInfo option bmqt::EventBuilderResult::Enum rc = peb.addSubQueueInfosOption( subQueueInfos); - ASSERT_EQ(bmqt::EventBuilderResult::e_SUCCESS, rc); + BMQTST_ASSERT_EQ(bmqt::EventBuilderResult::e_SUCCESS, rc); rc = peb.packMessage(payload, queueId, @@ -295,9 +305,9 @@ static void test3_messageProperties() bmqt::CompressionAlgorithmType::e_NONE, input); - ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); - ASSERT_LT(payload.length(), peb.eventSize()); - ASSERT_EQ(1, peb.messageCount()); + BMQTST_ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); + BMQTST_ASSERT_LT(payload.length(), peb.eventSize()); + BMQTST_ASSERT_EQ(1, peb.messageCount()); bmqa::Event event; bsl::shared_ptr& implPtr = @@ -314,7 +324,7 @@ static void test3_messageProperties() queue->setId(queueId); implPtr->insertQueue(subQueueId, queue); - bmqp::Event bmqpEvent(&peb.blob(), + bmqp::Event bmqpEvent(peb.blob().get(), bmqtst::TestHelperUtil::allocator(), true); @@ -327,20 +337,20 @@ static void test3_messageProperties() bmqa::Message message = mIter.message(); bmqa::MessageProperties out1(bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(0, message.loadProperties(&out1)); + BMQTST_ASSERT_EQ(0, message.loadProperties(&out1)); // 1st setProperty w/o getProperty and then getProperty { bmqa::MessageProperties out2(bmqtst::TestHelperUtil::allocator()); // The second read is/was optimized (only one MPS header) - ASSERT_EQ(0, message.loadProperties(&out2)); + BMQTST_ASSERT_EQ(0, message.loadProperties(&out2)); - ASSERT_EQ(0, out2.setPropertyAsString("y", mod)); - ASSERT_EQ(out1.totalSize() + sizeof(mod) - sizeof(y), - out2.totalSize()); + BMQTST_ASSERT_EQ(0, out2.setPropertyAsString("y", mod)); + BMQTST_ASSERT_EQ(out1.totalSize() + sizeof(mod) - sizeof(y), + out2.totalSize()); - ASSERT_EQ(out2.getPropertyAsString("z"), z); + BMQTST_ASSERT_EQ(out2.getPropertyAsString("z"), z); } // 2nd getProperty, setProperty and then load all @@ -348,10 +358,10 @@ static void test3_messageProperties() bmqa::MessageProperties out3(bmqtst::TestHelperUtil::allocator()); // The third read is/was optimized (only one MPS header) - ASSERT_EQ(0, message.loadProperties(&out3)); + BMQTST_ASSERT_EQ(0, message.loadProperties(&out3)); - ASSERT_EQ(y, out3.getPropertyAsString("y")); - ASSERT_EQ(0, out3.setPropertyAsString("y", mod)); + BMQTST_ASSERT_EQ(y, out3.getPropertyAsString("y")); + BMQTST_ASSERT_EQ(0, out3.setPropertyAsString("y", mod)); bmqu::MemOutStream os(bmqtst::TestHelperUtil::allocator()); out3.print(os, 0, -1); @@ -360,12 +370,12 @@ static void test3_messageProperties() bmqa::MessagePropertiesIterator it(&out3); - ASSERT(it.hasNext()); - ASSERT_EQ(it.getAsString(), x); - ASSERT(it.hasNext()); - ASSERT_EQ(it.getAsString(), mod); - ASSERT(it.hasNext()); - ASSERT_EQ(it.getAsString(), z); + BMQTST_ASSERT(it.hasNext()); + BMQTST_ASSERT_EQ(it.getAsString(), x); + BMQTST_ASSERT(it.hasNext()); + BMQTST_ASSERT_EQ(it.getAsString(), mod); + BMQTST_ASSERT(it.hasNext()); + BMQTST_ASSERT_EQ(it.getAsString(), z); } // 3rd getProperty, setProperty and then getProperty @@ -373,14 +383,14 @@ static void test3_messageProperties() bmqa::MessageProperties out4(bmqtst::TestHelperUtil::allocator()); // The fourth read is/was optimized (only one MPS header) - ASSERT_EQ(0, message.loadProperties(&out4)); + BMQTST_ASSERT_EQ(0, message.loadProperties(&out4)); - ASSERT_EQ(y, out4.getPropertyAsString("y")); - ASSERT_EQ(0, out4.setPropertyAsString("y", mod)); - ASSERT_EQ(out1.totalSize() + sizeof(mod) - sizeof(y), - out4.totalSize()); + BMQTST_ASSERT_EQ(y, out4.getPropertyAsString("y")); + BMQTST_ASSERT_EQ(0, out4.setPropertyAsString("y", mod)); + BMQTST_ASSERT_EQ(out1.totalSize() + sizeof(mod) - sizeof(y), + out4.totalSize()); - ASSERT_EQ(out4.getPropertyAsString("z"), z); + BMQTST_ASSERT_EQ(out4.getPropertyAsString("z"), z); } } @@ -422,13 +432,17 @@ static void test4_subscriptionHandle() bdlbb::PooledBlobBufferFactory bufferFactory( 4 * 1024, bmqtst::TestHelperUtil::allocator()); + bmqp::BlobPoolUtil::BlobSpPool blobSpPool( + bmqp::BlobPoolUtil::createBlobPool( + &bufferFactory, + bmqtst::TestHelperUtil::allocator())); bdlbb::Blob payload(&bufferFactory, bmqtst::TestHelperUtil::allocator()); queueSp->setId(queueId); bdlbb::BlobUtil::append(&payload, buffer, bsl::strlen(buffer)); - ASSERT_EQ(static_cast(payload.length()), - bsl::strlen(buffer)); + BMQTST_ASSERT_EQ(static_cast(payload.length()), + bsl::strlen(buffer)); PV("PUSH MESSAGE - SUBSCRIPTION") { @@ -445,21 +459,21 @@ static void test4_subscriptionHandle() bmqtst::TestHelperUtil::allocator()); // Create PushEventBuilder - bmqp::PushEventBuilder peb(&bufferFactory, + bmqp::PushEventBuilder peb(&blobSpPool, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(0, peb.messageCount()); + BMQTST_ASSERT_EQ(0, peb.messageCount()); // Add SubQueueInfo option (subscription Id) subQueueInfos.push_back(bmqp::SubQueueInfo(sId)); bmqt::EventBuilderResult::Enum rc = peb.addSubQueueInfosOption( subQueueInfos); - ASSERT_EQ(bmqt::EventBuilderResult::e_SUCCESS, rc); - ASSERT_EQ(sizeof(bmqp::EventHeader), - static_cast(peb.eventSize())); + BMQTST_ASSERT_EQ(bmqt::EventBuilderResult::e_SUCCESS, rc); + BMQTST_ASSERT_EQ(sizeof(bmqp::EventHeader), + static_cast(peb.eventSize())); // 'eventSize()' excludes unpacked messages - ASSERT_LT(sizeof(bmqp::EventHeader), - static_cast(peb.blob().length())); + BMQTST_ASSERT_LT(sizeof(bmqp::EventHeader), + static_cast(peb.blob()->length())); // But the option is written to the underlying blob // Add message @@ -469,11 +483,11 @@ static void test4_subscriptionHandle() flags, bmqt::CompressionAlgorithmType::e_NONE); - ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); - ASSERT_LT(payload.length(), peb.eventSize()); - ASSERT_EQ(1, peb.messageCount()); + BMQTST_ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); + BMQTST_ASSERT_LT(payload.length(), peb.eventSize()); + BMQTST_ASSERT_EQ(1, peb.messageCount()); - bmqp::Event bmqpEvent(&peb.blob(), + bmqp::Event bmqpEvent(peb.blob().get(), bmqtst::TestHelperUtil::allocator(), true); implPtr->configureAsMessageEvent(bmqpEvent); @@ -484,15 +498,16 @@ static void test4_subscriptionHandle() bmqa::MessageEvent pushMsgEvt = event.messageEvent(); bmqa::MessageIterator mIter = pushMsgEvt.messageIterator(); - ASSERT(mIter.nextMessage()); + BMQTST_ASSERT(mIter.nextMessage()); bmqa::Message message = mIter.message(); PVVV("Message: " << message); const bmqt::SubscriptionHandle& actualHandle = message.subscriptionHandle(); PVV("Non-empty subscription handle: " << actualHandle); - ASSERT_EQ(actualHandle.id(), sId); - ASSERT_EQ(actualHandle.correlationId(), sHandle.correlationId()); + BMQTST_ASSERT_EQ(actualHandle.id(), sId); + BMQTST_ASSERT_EQ(actualHandle.correlationId(), + sHandle.correlationId()); } PV("PUSH MESSAGE - NO SUBSCRIPTION") @@ -510,9 +525,9 @@ static void test4_subscriptionHandle() bmqtst::TestHelperUtil::allocator()); // Create PushEventBuilder - bmqp::PushEventBuilder peb(&bufferFactory, + bmqp::PushEventBuilder peb(&blobSpPool, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(0, peb.messageCount()); + BMQTST_ASSERT_EQ(0, peb.messageCount()); // Add message bmqt::EventBuilderResult::Enum rc = peb.packMessage( @@ -522,11 +537,11 @@ static void test4_subscriptionHandle() flags, bmqt::CompressionAlgorithmType::e_NONE); - ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); - ASSERT_LT(payload.length(), peb.eventSize()); - ASSERT_EQ(1, peb.messageCount()); + BMQTST_ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); + BMQTST_ASSERT_LT(payload.length(), peb.eventSize()); + BMQTST_ASSERT_EQ(1, peb.messageCount()); - bmqp::Event bmqpEvent(&peb.blob(), + bmqp::Event bmqpEvent(peb.blob().get(), bmqtst::TestHelperUtil::allocator(), true); implPtr->configureAsMessageEvent(bmqpEvent); @@ -537,15 +552,15 @@ static void test4_subscriptionHandle() bmqa::MessageEvent pushMsgEvt = event.messageEvent(); bmqa::MessageIterator mIter = pushMsgEvt.messageIterator(); - ASSERT(mIter.nextMessage()); + BMQTST_ASSERT(mIter.nextMessage()); bmqa::Message message = mIter.message(); PVVV("Message: " << message); const bmqt::SubscriptionHandle& actualHandle = message.subscriptionHandle(); PVV("Empty subscription handle: " << actualHandle); - ASSERT_EQ(actualHandle.id(), defaultSubscriptionId); - ASSERT_EQ(actualHandle.correlationId(), emptyCorrelationId); + BMQTST_ASSERT_EQ(actualHandle.id(), defaultSubscriptionId); + BMQTST_ASSERT_EQ(actualHandle.correlationId(), emptyCorrelationId); } PV("PUT MESSAGE - FAIL") @@ -558,9 +573,9 @@ static void test4_subscriptionHandle() bmqtst::TestHelperUtil::allocator()); // Create PutEventBuilder - bmqp::PutEventBuilder builder(&bufferFactory, + bmqp::PutEventBuilder builder(&blobSpPool, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(0, builder.messageCount()); + BMQTST_ASSERT_EQ(0, builder.messageCount()); // Add message builder.startMessage(); @@ -569,10 +584,10 @@ static void test4_subscriptionHandle() bmqt::EventBuilderResult::Enum rc = builder.packMessage(queueId); - ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); - ASSERT_EQ(1, builder.messageCount()); + BMQTST_ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); + BMQTST_ASSERT_EQ(1, builder.messageCount()); - bmqp::Event bmqpEvent(&builder.blob(), + bmqp::Event bmqpEvent(builder.blob().get(), bmqtst::TestHelperUtil::allocator()); implPtr->configureAsMessageEvent(bmqpEvent); @@ -582,11 +597,11 @@ static void test4_subscriptionHandle() bmqa::MessageEvent putMsgEvt = event.messageEvent(); bmqa::MessageIterator mIter = putMsgEvt.messageIterator(); - ASSERT(mIter.nextMessage()); + BMQTST_ASSERT(mIter.nextMessage()); bmqa::Message message = mIter.message(); PVVV("Message: " << message); - ASSERT_OPT_FAIL(message.subscriptionHandle()); + BMQTST_ASSERT_OPT_FAIL(message.subscriptionHandle()); } PV("ACK MESSAGE - FAIL") @@ -599,17 +614,17 @@ static void test4_subscriptionHandle() bmqtst::TestHelperUtil::allocator()); // Create AckEventBuilder - bmqp::AckEventBuilder builder(&bufferFactory, + bmqp::AckEventBuilder builder(&blobSpPool, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(0, builder.messageCount()); + BMQTST_ASSERT_EQ(0, builder.messageCount()); bmqt::EventBuilderResult::Enum rc = builder.appendMessage(0, queueId, guid, queueId); - ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); - ASSERT_EQ(1, builder.messageCount()); + BMQTST_ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); + BMQTST_ASSERT_EQ(1, builder.messageCount()); - bmqp::Event bmqpEvent(&builder.blob(), + bmqp::Event bmqpEvent(builder.blob().get(), bmqtst::TestHelperUtil::allocator()); implPtr->configureAsMessageEvent(bmqpEvent); @@ -619,11 +634,11 @@ static void test4_subscriptionHandle() bmqa::MessageEvent ackMsgEvt = event.messageEvent(); bmqa::MessageIterator mIter = ackMsgEvt.messageIterator(); - ASSERT(mIter.nextMessage()); + BMQTST_ASSERT(mIter.nextMessage()); bmqa::Message message = mIter.message(); PVVV("Message: " << message); - ASSERT_OPT_FAIL(message.subscriptionHandle()); + BMQTST_ASSERT_OPT_FAIL(message.subscriptionHandle()); } } diff --git a/src/groups/bmq/bmqa/bmqa_messageevent.t.cpp b/src/groups/bmq/bmqa/bmqa_messageevent.t.cpp index 46e06bbc1..17dd6834c 100644 --- a/src/groups/bmq/bmqa/bmqa_messageevent.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_messageevent.t.cpp @@ -81,7 +81,7 @@ static void appendMessages(bmqp::AckEventBuilder* builder, data.d_corrId, data.d_guid, data.d_queueId); - ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(rc, 0); vec->push_back(data); } } @@ -167,14 +167,19 @@ static void test2_ackMesageIteratorTest() bdlbb::PooledBlobBufferFactory bufferFactory( 256, bmqtst::TestHelperUtil::allocator()); - bmqp::AckEventBuilder builder(&bufferFactory, + bmqp::BlobPoolUtil::BlobSpPool blobSpPool( + bmqp::BlobPoolUtil::createBlobPool( + &bufferFactory, + bmqtst::TestHelperUtil::allocator())); + bmqp::AckEventBuilder builder(&blobSpPool, bmqtst::TestHelperUtil::allocator()); bsl::vector messages(bmqtst::TestHelperUtil::allocator()); PVV("Appending messages"); appendMessages(&builder, &messages, k_NUM_MSGS); - bmqp::Event rawEvent(&builder.blob(), bmqtst::TestHelperUtil::allocator()); + bmqp::Event rawEvent(builder.blob().get(), + bmqtst::TestHelperUtil::allocator()); bsl::shared_ptr eventImpl; eventImpl.createInplace(bmqtst::TestHelperUtil::allocator(), @@ -200,13 +205,13 @@ static void test2_ackMesageIteratorTest() while (i.nextMessage()) { const bmqa::Message* msg = &(i.message()); - ASSERT_EQ(msg->correlationId(), - bmqt::CorrelationId(messages[offset].d_corrId)); - ASSERT_EQ(msg->messageGUID(), messages[offset].d_guid); + BMQTST_ASSERT_EQ(msg->correlationId(), + bmqt::CorrelationId(messages[offset].d_corrId)); + BMQTST_ASSERT_EQ(msg->messageGUID(), messages[offset].d_guid); ++offset; } - ASSERT_EQ(offset, k_NUM_MSGS); + BMQTST_ASSERT_EQ(offset, k_NUM_MSGS); } } @@ -229,7 +234,11 @@ static void test3_putMessageIteratorTest() bdlbb::PooledBlobBufferFactory bufferFactory( 256, bmqtst::TestHelperUtil::allocator()); - bmqp::PutEventBuilder builder(&bufferFactory, + bmqp::BlobPoolUtil::BlobSpPool blobSpPool( + bmqp::BlobPoolUtil::createBlobPool( + &bufferFactory, + bmqtst::TestHelperUtil::allocator())); + bmqp::PutEventBuilder builder(&blobSpPool, bmqtst::TestHelperUtil::allocator()); bsl::vector messages(bmqtst::TestHelperUtil::allocator()); @@ -241,10 +250,11 @@ static void test3_putMessageIteratorTest() &messages, &bufferFactory, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); + BMQTST_ASSERT_EQ(rc, bmqt::EventBuilderResult::e_SUCCESS); } - bmqp::Event rawEvent(&builder.blob(), bmqtst::TestHelperUtil::allocator()); + bmqp::Event rawEvent(builder.blob().get(), + bmqtst::TestHelperUtil::allocator()); bsl::shared_ptr eventImpl; eventImpl.createInplace(bmqtst::TestHelperUtil::allocator(), @@ -271,17 +281,19 @@ static void test3_putMessageIteratorTest() while (i.nextMessage()) { const bmqa::Message* msg = &(i.message()); - ASSERT_EQ(msg->correlationId(), bmqt::CorrelationId(offset)); + BMQTST_ASSERT_EQ(msg->correlationId(), + bmqt::CorrelationId(offset)); bdlbb::Blob payload(&bufferFactory, bmqtst::TestHelperUtil::allocator()); int rc = msg->getData(&payload); - ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(rc, 0); // Content isn't the same. Length is. Why? - ASSERT(payload.length() == messages[offset].d_payload.length()); + BMQTST_ASSERT(payload.length() == + messages[offset].d_payload.length()); ++offset; } - ASSERT_EQ(offset, k_NUM_MSGS); + BMQTST_ASSERT_EQ(offset, k_NUM_MSGS); } } diff --git a/src/groups/bmq/bmqa/bmqa_messageeventbuilder.t.cpp b/src/groups/bmq/bmqa/bmqa_messageeventbuilder.t.cpp index 659d633b6..a19ff2ca9 100644 --- a/src/groups/bmq/bmqa/bmqa_messageeventbuilder.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_messageeventbuilder.t.cpp @@ -62,7 +62,7 @@ static void test2_testMessageEventSizeCount() // Start session BMQA_EXPECT_CALL(session, start()).returning(0); const int rc = session.start(); - ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(rc, 0); } bmqt::Uri uri(bmqtst::TestHelperUtil::allocator()); @@ -73,7 +73,7 @@ static void test2_testMessageEventSizeCount() bsl::string input("bmq://my.domain/queue", bmqtst::TestHelperUtil::allocator()); const int rc = bmqt::UriParser::parse(&uri, &error, input); - ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(rc, 0); } bmqt::CorrelationId queueCId = bmqt::CorrelationId::autoValue(); @@ -87,7 +87,7 @@ static void test2_testMessageEventSizeCount() const int rc = session.openQueue(&queueId, uri, bmqt::QueueFlags::e_WRITE); - ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(rc, 0); } // Stage 2: populate MessageEventBuilder @@ -95,8 +95,8 @@ static void test2_testMessageEventSizeCount() session.loadMessageEventBuilder(&builder); // Empty MessageEvent should contain at least its header - ASSERT(builder.messageEventSize() > 0); - ASSERT_EQ(0, builder.messageCount()); + BMQTST_ASSERT(builder.messageEventSize() > 0); + BMQTST_ASSERT_EQ(0, builder.messageCount()); const bsl::string payload("test payload", bmqtst::TestHelperUtil::allocator()); @@ -112,16 +112,16 @@ static void test2_testMessageEventSizeCount() // Make sure that 'messageEventSize' and 'messageCount' remain the same // before packing the message - ASSERT_EQ(messageEventSizeBefore, builder.messageEventSize()); - ASSERT_EQ(messageCountBefore, builder.messageCount()); + BMQTST_ASSERT_EQ(messageEventSizeBefore, builder.messageEventSize()); + BMQTST_ASSERT_EQ(messageCountBefore, builder.messageCount()); builder.packMessage(queueId); // Make sure that 'messageEventSize' and 'messageCount' increase // after packing the message - ASSERT_LT(messageEventSizeBefore, builder.messageEventSize()); - ASSERT_LT(messageCountBefore, builder.messageCount()); - ASSERT_EQ(i, builder.messageCount()); + BMQTST_ASSERT_LT(messageEventSizeBefore, builder.messageEventSize()); + BMQTST_ASSERT_LT(messageCountBefore, builder.messageCount()); + BMQTST_ASSERT_EQ(i, builder.messageCount()); } // Stage 3: start a new message but do not pack @@ -137,8 +137,8 @@ static void test2_testMessageEventSizeCount() // Make sure that 'messageEventSize' and 'messageCount' remain the same // since we do not pack the last started message - ASSERT_EQ(messageEventSizeFinal, builder.messageEventSize()); - ASSERT_EQ(messageCountFinal, builder.messageCount()); + BMQTST_ASSERT_EQ(messageEventSizeFinal, builder.messageEventSize()); + BMQTST_ASSERT_EQ(messageCountFinal, builder.messageCount()); // Stage 4: build MessageEvent // MessageEventBuilder switches from WRITE mode to READ: @@ -148,8 +148,8 @@ static void test2_testMessageEventSizeCount() } // We had non-packed Message before, make sure it was not added to the blob - ASSERT_EQ(messageEventSizeFinal, builder.messageEventSize()); - ASSERT_EQ(messageCountFinal, builder.messageCount()); + BMQTST_ASSERT_EQ(messageEventSizeFinal, builder.messageEventSize()); + BMQTST_ASSERT_EQ(messageCountFinal, builder.messageCount()); // Stage 5: reset MessageEventBuilder // MessageEventBuilder switches from READ mode to WRITE: @@ -157,8 +157,8 @@ static void test2_testMessageEventSizeCount() // Since we resetted the MessageEventBuilder, the currently built message // event is smaller than the populated one from the previous steps - ASSERT_LT(builder.messageEventSize(), messageEventSizeFinal); - ASSERT_EQ(0, builder.messageCount()); + BMQTST_ASSERT_LT(builder.messageEventSize(), messageEventSizeFinal); + BMQTST_ASSERT_EQ(0, builder.messageCount()); } // ============================================================================ diff --git a/src/groups/bmq/bmqa/bmqa_mocksession.cpp b/src/groups/bmq/bmqa/bmqa_mocksession.cpp index 6ca08d409..5433ec239 100644 --- a/src/groups/bmq/bmqa/bmqa_mocksession.cpp +++ b/src/groups/bmq/bmqa/bmqa_mocksession.cpp @@ -128,14 +128,6 @@ UriCorrIdToQueueMap& uriCorrIdToQueues(B& buffer) { return reinterpret_cast(*(buffer.buffer())); } - -/// Utility method to cast the `UriCorrIdToQueueMap` held by the -/// `bsls::AlignedBuffer` (represented by the type `B`). -template -const UriCorrIdToQueueMap& uriCorrIdToQueues(const B& buffer) -{ - return reinterpret_cast(*(buffer.buffer())); -} } // close unnamed namespace #define BMQA_CHECK_ARG(METHOD, ARGNAME, EXPECTED, ACTUAL, CALL) \ @@ -298,7 +290,12 @@ Event MockSessionUtil::createAckEvent(const bsl::vector& acks, implPtr = EventImplSp(new (*alloc) bmqimp::Event(g_bufferFactory_p, alloc), alloc); - bmqp::AckEventBuilder ackBuilder(bufferFactory, alloc); + // TODO: deprecate `createAckEvent` with bufferFactory arg and introduce + // another function with BlobSpPool arg. + BlobSpPool blobSpPool( + bmqp::BlobPoolUtil::createBlobPool(bufferFactory, allocator)); + + bmqp::AckEventBuilder ackBuilder(&blobSpPool, alloc); for (size_t i = 0; i != acks.size(); ++i) { const AckParams& params = acks[i]; const QueueImplSp& impQueue = reinterpret_cast( @@ -313,7 +310,7 @@ Event MockSessionUtil::createAckEvent(const bsl::vector& acks, } implPtr->configureAsMessageEvent( - bmqp::Event(&ackBuilder.blob(), alloc, true)); + bmqp::Event(ackBuilder.blob().get(), alloc, true)); for (size_t i = 0; i != acks.size(); ++i) { implPtr->addCorrelationId(acks[i].d_correlationId); } @@ -336,7 +333,12 @@ Event MockSessionUtil::createPushEvent( implPtr = EventImplSp(new (*alloc) bmqimp::Event(g_bufferFactory_p, alloc), alloc); - bmqp::PushEventBuilder pushBuilder(bufferFactory, alloc); + // TODO: deprecate `createPushEvent` with bufferFactory arg and introduce + // another function with BlobSpPool arg. + BlobSpPool blobSpPool( + bmqp::BlobPoolUtil::createBlobPool(bufferFactory, allocator)); + + bmqp::PushEventBuilder pushBuilder(&blobSpPool, alloc); for (size_t i = 0; i != pushEventParams.size(); ++i) { const QueueImplSp& queueImplPtr = reinterpret_cast( @@ -369,7 +371,7 @@ Event MockSessionUtil::createPushEvent( implPtr->addCorrelationId(bmqt::CorrelationId()); } - bmqp::Event bmqpEvent(&pushBuilder.blob(), alloc, true); + bmqp::Event bmqpEvent(pushBuilder.blob().get(), alloc, true); implPtr->configureAsMessageEvent(bmqpEvent); return event; @@ -946,6 +948,8 @@ int MockSession::start(const bsls::TimeInterval& timeout) MockSession::MockSession(const bmqt::SessionOptions& options, bslma::Allocator* allocator) : d_blobBufferFactory(1024, allocator) +, d_blobSpPool( + bmqp::BlobPoolUtil::createBlobPool(&d_blobBufferFactory, allocator)) , d_eventHandler_mp(0) , d_calls(allocator) , d_eventsAndJobs(allocator) @@ -990,6 +994,8 @@ MockSession::MockSession(bslma::ManagedPtr eventHandler, const bmqt::SessionOptions& options, bslma::Allocator* allocator) : d_blobBufferFactory(1024, allocator) +, d_blobSpPool( + bmqp::BlobPoolUtil::createBlobPool(&d_blobBufferFactory, allocator)) , d_eventHandler_mp(eventHandler) , d_calls(bslma::Default::allocator(allocator)) , d_eventsAndJobs(bslma::Default::allocator(allocator)) @@ -1514,7 +1520,7 @@ void MockSession::loadMessageEventBuilder(MessageEventBuilder* builder) g_bufferFactory_p, d_allocator_p); - eventImplSpRef->configureAsMessageEvent(&d_blobBufferFactory); + eventImplSpRef->configureAsMessageEvent(&d_blobSpPool); eventImplSpRef->setMessageCorrelationIdContainer( d_corrIdContainer_sp.get()); } @@ -1538,7 +1544,7 @@ void MockSession::loadConfirmEventBuilder(ConfirmEventBuilder* builder) } new (builderImplRef.d_buffer.buffer()) - bmqp::ConfirmEventBuilder(&d_blobBufferFactory, d_allocator_p); + bmqp::ConfirmEventBuilder(&d_blobSpPool, d_allocator_p); builderImplRef.d_builder_p = reinterpret_cast( builderImplRef.d_buffer.buffer()); diff --git a/src/groups/bmq/bmqa/bmqa_mocksession.h b/src/groups/bmq/bmqa/bmqa_mocksession.h index b9ba02dd8..cd7672f09 100644 --- a/src/groups/bmq/bmqa/bmqa_mocksession.h +++ b/src/groups/bmq/bmqa/bmqa_mocksession.h @@ -209,8 +209,10 @@ /// ``` /// void unitTest() /// { +/// bslma::Allocator* allocator = bmqtst::TestHelperUtil::allocator(); +/// /// // Create an event handler -/// EventHandler eventHandler(d_allocator_p); +/// EventHandler eventHandler(allocator); /// /// // The following static initializer method calls all the appropriate /// // static initializers of the underlying components needed for the @@ -218,16 +220,16 @@ /// // any case but if events need to be built outside the scope of the /// // creation of 'MockSession' you will need to explicitly invoke this /// // static initializer method. -/// bmqa::MockSession::initialize(s_allocator_p); +/// bmqa::MockSession::initialize(allocator); /// /// bslma::ManagedPtr handlerMp; /// handlerMp.load(&eventHandler, 0, bslma::ManagedPtrUtil::noOpDeleter); /// /// bmqa::MockSession mockSession(handlerMp, -/// bmqt::SessionOptions(d_allocator_p), -/// d_allocator_p); +/// bmqt::SessionOptions(allocator), +/// allocator); /// -/// bmqa::QueueId queueId(bmqt::CorrelationId(1), d_allocator_p); +/// bmqa::QueueId queueId(bmqt::CorrelationId(1), allocator); /// bmqt::CorrelationId corrId(1); /// /// // Expect a call to start and the call emits an 'e_CONNECTED' event. @@ -237,23 +239,24 @@ /// bmqt::SessionEventType::e_CONNECTED, /// 0, // statusCode /// "", // errorDescription -/// d_allocator_p)); +/// allocator)); /// /// // Make a call to startAsync and emit the event that is enqueued from /// // that call. -/// ASSERT_EQ(mockSession.startAsync(), 0); +/// BMQTST_ASSERT_EQ(mockSession.startAsync(), 0); /// /// // Emit our enqueued event. This fully sets up the session which is /// // now ready to use. Typically you would have some business logic on /// // 'e_CONNECTED' that makes your application ready to use. -/// ASSERT_EQ(mockSession.emitEvent(), true); +/// BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); /// /// // Our event handler internally just stores the event emitted, so pop /// // it out and examine. /// bmqa::SessionEvent startEvent(eventHandler.popSessionEvent()); /// -/// ASSERT_EQ(startEvent.type(), bmqt::SessionEventType::e_CONNECTED); -/// ASSERT_EQ(startEvent.status Code(), 0); +/// BMQTST_ASSERT_EQ(startEvent.type(), +/// bmqt::SessionEventType::e_CONNECTED); +/// BMQTST_ASSERT_EQ(startEvent.status Code(), 0); /// /// // Create the uri to your queue as you would in your application. /// const bmqt::Uri uri("bmq://my.domain/queue"); @@ -292,16 +295,16 @@ /// queueId1, /// bmqt::OpenQueueResult::e_TIMEOUT, // statusCode /// "Local Timeout", // errorDescription -/// d_allocator_p); +/// allocator); /// mockSession.enqueueEvent(openQueueResult); /// /// // We just enqueued a 'bmqa::OpenQueueStatus' to be emitted. We can /// // emit it using 'emitEvent'. -/// ASSERT_EQ(mockSession.emitEvent(), true); +/// BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); /// /// // Pop out this event from the handler and examine it. /// bmqa::OpenQueueStatus result = eventHandler.popOpenQueueStatus(); -/// ASSERT_EQ(result, openQueueResult); +/// BMQTST_ASSERT_EQ(result, openQueueResult); /// /// // On emission of 'bmqa::OpenQueueStatus', the queue is fully open and /// // we can now post to it. @@ -317,17 +320,17 @@ /// // been elided for brevity. /// /// // Now that the event has been built we can 'post' it to BMQ. -/// ASSERT_EQ(mockSession.post(builder.messageEvent()), 0); +/// BMQTST_ASSERT_EQ(mockSession.post(builder.messageEvent()), 0); /// /// // Simply creating a blob buffer factory on the stack to be used by /// // 'createAckEvent'. Typically you would have one for the component. -/// bdlbb::PooledBlobBufferFactory bufferFactory(4 * 1024, d_allocator_p); +/// bdlbb::PooledBlobBufferFactory bufferFactory(4 * 1024, allocator); /// /// // The method 'createAckEvent' takes a vector of 'AckParams' to /// // specify multiple acks per event, but here we are only acknowledging /// // 1 message. Specify a positive ack with 'e_SUCCESS' here but you /// // can specify any from 'bmqt::AckResult::Enum'. -/// bsl::vector acks(d_allocator_p); +/// bsl::vector acks(allocator); /// acks.emplace_back(bmqt::AckResult::e_SUCCESS, /// bmqt::CorrelationId(1), /// bmqt::MessageGUID(), // Real GUID needed if you want @@ -339,17 +342,18 @@ /// mockSession.enqueueEvent(bmqa::MockSessionUtil::createAckEvent( /// acks, /// &bufferFactory, -/// d_allocator_p)); +/// allocator)); /// /// // Emit the enqueued ack event. -/// ASSERT_EQ(mockSession.emitEvent(), true); +/// BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); /// /// // As we did earlier, pop it out and examine. /// bmqa::MessageEvent ackEvent(eventHandler.popMessageEvent()); -/// ASSERT_EQ(ackEvent.type(), bmqt::MessageEventType::e_ACK); +/// BMQTST_ASSERT_EQ(ackEvent.type(), bmqt::MessageEventType::e_ACK); /// bmqa::MessageIterator mIter = ackEvent.messageIterator(); /// mIter.nextMessage(); -/// ASSERT_EQ(mIter.message().ackStatus(), bmqt::AckResult::e_SUCCESS); +/// BMQTST_ASSERT_EQ(mIter.message().ackStatus(), +/// bmqt::AckResult::e_SUCCESS); /// /// // This is a simple test. After posting our message and receiving the /// // ack, we are now shutting down our application. Therefore we expect @@ -366,13 +370,14 @@ /// 0, // statusCode /// "", // errorDescription /// d_allocator_p)); -/// ASSERT_EQ(mockSession.emitEvent(), true); +/// BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); /// /// // Our event handler internally just stores the event emitted, so pop /// // it out and examine. /// bmqa::SessionEvent stopEvent(eventHandler.popSessionEvent()); -/// ASSERT_EQ(stopEvent.type(), bmqt::SessionEventType::e_DISCONNECTED); -/// ASSERT_EQ(stopEvent.statusCode(), 0); +/// BMQTST_ASSERT_EQ(stopEvent.type(), +/// bmqt::SessionEventType::e_DISCONNECTED); +/// BMQTST_ASSERT_EQ(stopEvent.statusCode(), 0); /// /// // The corresponding pendant operation of the 'initialize' which would /// // need to be called only if 'initialize' was explicitly called. @@ -396,9 +401,11 @@ /// ``` /// void unitTest() /// { +/// bslma::Allocator* allocator = bmqtst::TestHelperUtil::allocator(); +/// /// // MockSession created without an eventHandler. -/// bmqa::MockSession mockSession(bmqt::SessionOptions(d_allocator_p), -/// d_allocator_p); +/// bmqa::MockSession mockSession(bmqt::SessionOptions(allocator), +/// allocator); /// /// // The following static initializer method calls all the appropriate /// // static initializers of the underlying components needed for the @@ -406,7 +413,7 @@ /// // any case but if events need to be built outside the scope of the /// // creation of 'MockSession' you will need to explicitly invoke this /// // static initializer method. -/// // bmqa::MockSession::initialize(s_allocator_p); +/// // bmqa::MockSession::initialize(allocator); /// /// // Create simple queueIds and corrIds /// bmqa::QueueId queueId(1); @@ -421,7 +428,7 @@ /// /// // Simply creating a blob buffer factory on the stack to be used by /// // 'createAckEvent'. Typically you would have one for the component. -/// bdlbb::PooledBlobBufferFactory bufferFactory(4 * 1024, d_allocator_p); +/// bdlbb::PooledBlobBufferFactory bufferFactory(4 * 1024, allocator); /// /// // We then expect that 'nextEvent' will be called to return the /// // 'e_CONNECTED' event from the broker @@ -431,7 +438,7 @@ /// bmqt::CorrelationId::autoValue(), /// 0, // errorCode /// "", // errorDescription -/// d_allocator_p)); +/// allocator)); /// // Note that we use an 'autoValue' for correlationId because it's /// // irrelevant for a 'CONNECTED' event. /// @@ -448,14 +455,14 @@ /// queueId, /// bmqt::OpenQueueResult::e_SUCCESS, // statusCode /// "", // errorDescription -/// d_allocator_p); +/// allocator); /// BMQA_EXPECT_CALL(mockSession, openQueueSync(&queueId, uri, flags)) /// .returning(expectedResult); /// /// // Build our incoming message event. /// bsl::vector pushMsgs( -/// d_allocator_p); -/// bdlbb::Blob payload(&bufferFactory, d_allocator_p); +/// allocator); +/// bdlbb::Blob payload(&bufferFactory, allocator); /// bdlbb::BlobUtil::append(&payload, "hello", 6); /// /// const char guidHex[] = "00000000000000000000000000000001"; @@ -473,7 +480,7 @@ /// bmqa::Event pushMsgEvent = bmqa::MockSessionUtil::createPushEvent( /// pushMsgs, /// &bufferFactory, -/// d_allocator_p); +/// allocator); /// BMQA_EXPECT_CALL(mockSession, nextEvent(bsls::TimeInterval())) /// .returning(pushMsgEvent); /// @@ -488,30 +495,31 @@ /// // 'startAsync' is the first call. We expect it to return 0 and we /// // expect 'nextEvent' to return the 'e_CONNECTED' session event. /// int rc = mockSession.startAsync(); -/// ASSERT_EQ(rc, 0); +/// BMQTST_ASSERT_EQ(rc, 0); /// bmqa::SessionEvent startEvent = mockSession.nextEvent( /// bsls::TimeInterval()) /// .sessionEvent(); -/// ASSERT_EQ(startEvent.type(), bmqt::SessionEventType::e_CONNECTED); -/// ASSERT_EQ(startEvent.statusCode(), 0); -/// ASSERT_EQ(startEvent.errorDescription(), ""); +/// BMQTST_ASSERT_EQ(startEvent.type(), +/// bmqt::SessionEventType::e_CONNECTED); +/// BMQTST_ASSERT_EQ(startEvent.statusCode(), 0); +/// BMQTST_ASSERT_EQ(startEvent.errorDescription(), ""); /// /// // Next we expect a call to 'openQueue' to open the queue. /// bmqa::OpenQueueStatus result = mockSession.openQueueSync(&queueId, /// uri, /// flags); -/// ASSERT_EQ(result, expectedResult); +/// BMQTST_ASSERT_EQ(result, expectedResult); /// /// // Now our call to 'nextEvent' will generate a push message from the /// // broker, which we will then go on to confirm. /// bmqa::MessageEvent pushMsgEvt(mockSession.nextEvent( /// bsls::TimeInterval()) /// .messageEvent()); -/// ASSERT_EQ(pushMsgEvt.type(), bmqt::MessageEventType::e_PUSH); +/// BMQTST_ASSERT_EQ(pushMsgEvt.type(), bmqt::MessageEventType::e_PUSH); /// /// // Now that we have received a push message which has yet to be /// // confirmed, we can confirm that 1 unconfirmed message exists. -/// ASSERT_EQ(mockSession.unconfirmedMessages(), 1U); +/// BMQTST_ASSERT_EQ(mockSession.unconfirmedMessages(), 1U); /// /// // Since there is only 1 message in our message event, we dont have to /// // iterate over the event but in reality you will want to iterate over @@ -519,14 +527,14 @@ /// bmqa::MessageIterator mIter = pushMsgEvt.messageIterator(); /// mIter.nextMessage(); /// confirmBuilder.addMessageConfirmation(mIter.message()); -/// ASSERT_EQ(confirmBuilder.messageCount(), 1); +/// BMQTST_ASSERT_EQ(confirmBuilder.messageCount(), 1); /// /// // Confirm the messages using the builder that has been populated. /// rc = mockSession.confirmMessages(&confirmBuilder); -/// ASSERT_EQ(rc, 0); +/// BMQTST_ASSERT_EQ(rc, 0); /// /// // Voila! We now have no unconfirmed messages. -/// ASSERT_EQ(mockSession.unconfirmedMessages(), 0u); +/// BMQTST_ASSERT_EQ(mockSession.unconfirmedMessages(), 0u); /// // 'stop' has been elided for brevity and is analogous to 'start' /// /// // The corresponding pendant operation of the 'initialize' which would @@ -556,6 +564,7 @@ #include #include #include +#include #include #include #include @@ -607,6 +616,13 @@ struct MockSessionUtil { private: // PRIVATE TYPES + /// Pool of shared pointers to Blobs + typedef bdlcc::SharedObjectPool< + bdlbb::Blob, + bdlcc::ObjectPoolFunctors::DefaultCreator, + bdlcc::ObjectPoolFunctors::RemoveAll > + BlobSpPool; + /// Event impl shared pointer to access /// the pimpl of `bmqa::Event`. typedef bsl::shared_ptr EventImplSp; @@ -749,6 +765,8 @@ struct MockSessionUtil { /// Mechanism to mock a `bmqa::Session` class MockSession : public AbstractSession { public: + // TYPES + // CLASS METHODS /// Perform a one time initialization needed by components used in @@ -798,6 +816,13 @@ class MockSession : public AbstractSession { // PRIVATE TYPES + /// Pool of shared pointers to Blobs + typedef bdlcc::SharedObjectPool< + bdlbb::Blob, + bdlcc::ObjectPoolFunctors::DefaultCreator, + bdlcc::ObjectPoolFunctors::RemoveAll > + BlobSpPool; + /// Aligned buffer holding the two key hash map typedef bsls::AlignedBuffer TwoKeyHashMapBuffer; @@ -1007,9 +1032,12 @@ class MockSession : public AbstractSession { // DATA - /// Buffer factory + /// Buffer factory used to build Blobs with `d_blobSpPool` bdlbb::PooledBlobBufferFactory d_blobBufferFactory; + /// Pool of shared pointers to blobs + BlobSpPool d_blobSpPool; + /// Event handler (set only in asynchronous mode) bslma::ManagedPtr d_eventHandler_mp; diff --git a/src/groups/bmq/bmqa/bmqa_mocksession.t.cpp b/src/groups/bmq/bmqa/bmqa_mocksession.t.cpp index 7e25c03a2..30472c2b7 100644 --- a/src/groups/bmq/bmqa/bmqa_mocksession.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_mocksession.t.cpp @@ -281,16 +281,17 @@ static void test1_staticMethods() bmqtst::TestHelperUtil::allocator()); bmqa::SessionEvent sessionEvent = event.sessionEvent(); - ASSERT_EQ(sessionEvent.type(), bmqt::SessionEventType::e_CONNECTED); - ASSERT_EQ(sessionEvent.statusCode(), 0); - ASSERT_EQ(sessionEvent.errorDescription(), errorDescription); - ASSERT_EQ(sessionEvent.correlationId(), bmqt::CorrelationId(1)); + BMQTST_ASSERT_EQ(sessionEvent.type(), + bmqt::SessionEventType::e_CONNECTED); + BMQTST_ASSERT_EQ(sessionEvent.statusCode(), 0); + BMQTST_ASSERT_EQ(sessionEvent.errorDescription(), errorDescription); + BMQTST_ASSERT_EQ(sessionEvent.correlationId(), bmqt::CorrelationId(1)); } { PVV("Create Queue Session Event using Session Event Method"); - ASSERT_FAIL(bmqa::MockSessionUtil::createSessionEvent( + BMQTST_ASSERT_FAIL(bmqa::MockSessionUtil::createSessionEvent( bmqt::SessionEventType::e_QUEUE_OPEN_RESULT, bmqt::CorrelationId(1), 0, @@ -319,13 +320,14 @@ static void test1_staticMethods() bmqtst::TestHelperUtil::allocator()); bmqa::MessageEvent ackEvent = event.messageEvent(); - ASSERT_EQ(ackEvent.type(), bmqt::MessageEventType::e_ACK); + BMQTST_ASSERT_EQ(ackEvent.type(), bmqt::MessageEventType::e_ACK); bmqa::MessageIterator mIter = ackEvent.messageIterator(); mIter.nextMessage(); - ASSERT_EQ(mIter.message().ackStatus(), bmqt::AckResult::e_SUCCESS); - ASSERT_EQ(mIter.message().queueId(), queueId); - ASSERT_EQ(mIter.message().correlationId(), corrId); + BMQTST_ASSERT_EQ(mIter.message().ackStatus(), + bmqt::AckResult::e_SUCCESS); + BMQTST_ASSERT_EQ(mIter.message().queueId(), queueId); + BMQTST_ASSERT_EQ(mIter.message().correlationId(), corrId); } { @@ -344,11 +346,11 @@ static void test1_staticMethods() bmqtst::TestHelperUtil::allocator()); bmqa::SessionEvent openQueueEvent = event.sessionEvent(); - ASSERT_EQ(openQueueEvent.type(), - bmqt::SessionEventType::e_QUEUE_OPEN_RESULT); - ASSERT_EQ(openQueueEvent.statusCode(), 0); - ASSERT_EQ(openQueueEvent.errorDescription(), ""); - ASSERT_EQ(openQueueEvent.correlationId(), corrId); + BMQTST_ASSERT_EQ(openQueueEvent.type(), + bmqt::SessionEventType::e_QUEUE_OPEN_RESULT); + BMQTST_ASSERT_EQ(openQueueEvent.statusCode(), 0); + BMQTST_ASSERT_EQ(openQueueEvent.errorDescription(), ""); + BMQTST_ASSERT_EQ(openQueueEvent.correlationId(), corrId); } { @@ -378,20 +380,20 @@ static void test1_staticMethods() bmqa::MessageEvent pushMsgEvt = event.messageEvent(); - ASSERT_EQ(pushMsgEvt.type(), bmqt::MessageEventType::e_PUSH); + BMQTST_ASSERT_EQ(pushMsgEvt.type(), bmqt::MessageEventType::e_PUSH); bmqa::MessageIterator mIter = pushMsgEvt.messageIterator(); mIter.nextMessage(); - ASSERT_EQ(mIter.message().queueId(), queueId); - ASSERT_EQ(mIter.message().messageGUID(), guid); - ASSERT_EQ(mIter.message().dataSize(), 6); + BMQTST_ASSERT_EQ(mIter.message().queueId(), queueId); + BMQTST_ASSERT_EQ(mIter.message().messageGUID(), guid); + BMQTST_ASSERT_EQ(mIter.message().dataSize(), 6); bmqa::MessageProperties out; - ASSERT_EQ(mIter.message().loadProperties(&out), 0); + BMQTST_ASSERT_EQ(mIter.message().loadProperties(&out), 0); - ASSERT_EQ(out.totalSize(), properties.totalSize()); - ASSERT_EQ(out.getPropertyAsInt32("x"), - properties.getPropertyAsInt32("x")); + BMQTST_ASSERT_EQ(out.totalSize(), properties.totalSize()); + BMQTST_ASSERT_EQ(out.getPropertyAsInt32("x"), + properties.getPropertyAsInt32("x")); } bmqp::ProtocolUtil::shutdown(); @@ -413,22 +415,22 @@ static void test2_call() { PVV("Incorrect call"); BMQA_EXPECT_CALL(mockSession, start()).returning(0); - ASSERT_FAIL(mockSession.stop()); - ASSERT_EQ(mockSession.start(), 0); + BMQTST_ASSERT_FAIL(mockSession.stop()); + BMQTST_ASSERT_EQ(mockSession.start(), 0); } { PVV("Empty expected call queue"); - ASSERT_FAIL(mockSession.startAsync()); + BMQTST_ASSERT_FAIL(mockSession.startAsync()); } { PVV("Incorrect arguments"); BMQA_EXPECT_CALL(mockSession, startAsync(bsls::TimeInterval(10))) .returning(0); - ASSERT_FAIL(mockSession.startAsync(bsls::TimeInterval(1))); + BMQTST_ASSERT_FAIL(mockSession.startAsync(bsls::TimeInterval(1))); // To clear the expected queue. - ASSERT_EQ(mockSession.startAsync(bsls::TimeInterval(10)), 0); + BMQTST_ASSERT_EQ(mockSession.startAsync(bsls::TimeInterval(10)), 0); } { @@ -452,7 +454,7 @@ static void test2_call() mockSession_sp.clear(); // Our mockSession reference is also invalid at this point. - ASSERT_EQ(eventHandler.d_assertsInvoked, 1u); + BMQTST_ASSERT_EQ(eventHandler.d_assertsInvoked, 1u); } } @@ -526,21 +528,22 @@ static void test3_queueManagement() typedef bsl::shared_ptr& QueueImplPtr; QueueImplPtr implPtr = reinterpret_cast(queueId1); - ASSERT_EQ(implPtr->uri(), uri1); - ASSERT_EQ(implPtr->correlationId(), corrId1); + BMQTST_ASSERT_EQ(implPtr->uri(), uri1); + BMQTST_ASSERT_EQ(implPtr->correlationId(), corrId1); - ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_OPENING_OPN); + BMQTST_ASSERT_EQ(implPtr->state(), + bmqimp::QueueState::e_OPENING_OPN); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); bmqa::OpenQueueStatus result = eventHandler.popResult(); - ASSERT_EQ(result.queueId(), openQueueResult.queueId()); - ASSERT_EQ(result.result(), openQueueResult.result()); - ASSERT_EQ(result.errorDescription(), - openQueueResult.errorDescription()); + BMQTST_ASSERT_EQ(result.queueId(), openQueueResult.queueId()); + BMQTST_ASSERT_EQ(result.result(), openQueueResult.result()); + BMQTST_ASSERT_EQ(result.errorDescription(), + openQueueResult.errorDescription()); - ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_CLOSED); + BMQTST_ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_CLOSED); } { @@ -564,21 +567,22 @@ static void test3_queueManagement() typedef bsl::shared_ptr& QueueImplPtr; QueueImplPtr implPtr = reinterpret_cast(queueId1); - ASSERT_EQ(implPtr->uri(), uri1); - ASSERT_EQ(implPtr->correlationId(), corrId1); + BMQTST_ASSERT_EQ(implPtr->uri(), uri1); + BMQTST_ASSERT_EQ(implPtr->correlationId(), corrId1); - ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_OPENING_OPN); + BMQTST_ASSERT_EQ(implPtr->state(), + bmqimp::QueueState::e_OPENING_OPN); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); bmqa::OpenQueueStatus result = eventHandler.popResult(); - ASSERT_EQ(result.result(), 0); - ASSERT_EQ(result.errorDescription(), ""); - ASSERT_EQ(result.queueId().correlationId(), corrId1); + BMQTST_ASSERT_EQ(result.result(), 0); + BMQTST_ASSERT_EQ(result.errorDescription(), ""); + BMQTST_ASSERT_EQ(result.queueId().correlationId(), corrId1); - ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_OPENED); + BMQTST_ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_OPENED); } } @@ -589,22 +593,24 @@ static void test3_queueManagement() { PVVV("Valid queue by uri"); bmqa::QueueId queueIdFound(bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(mockSession.getQueueId(&queueIdFound, uri1), 0); - ASSERT_EQ(queueIdFound, queueId1); + BMQTST_ASSERT_EQ(mockSession.getQueueId(&queueIdFound, uri1), 0); + BMQTST_ASSERT_EQ(queueIdFound, queueId1); } { PVVV("Valid queue by uri"); bmqa::QueueId queueIdFound(bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(mockSession.getQueueId(&queueIdFound, corrId1), 0); - ASSERT_EQ(queueIdFound, queueId1); + BMQTST_ASSERT_EQ(mockSession.getQueueId(&queueIdFound, corrId1), + 0); + BMQTST_ASSERT_EQ(queueIdFound, queueId1); } { PVVV("Registered but unused queue"); bmqa::QueueId queueIdFound(bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(mockSession.getQueueId(&queueIdFound, uri2), -1); - ASSERT_EQ(mockSession.getQueueId(&queueIdFound, corrId2), -1); + BMQTST_ASSERT_EQ(mockSession.getQueueId(&queueIdFound, uri2), -1); + BMQTST_ASSERT_EQ(mockSession.getQueueId(&queueIdFound, corrId2), + -1); } { @@ -620,14 +626,16 @@ static void test3_queueManagement() // Close queue and then attempt to get queue BMQA_EXPECT_CALL(mockSession, closeQueueSync(&queueId1)) .returning(closeResult1); - ASSERT_EQ(mockSession.closeQueueSync(&queueId1), closeResult1); - ASSERT_EQ(closeResult1.queueId(), queueId1); - ASSERT_EQ(closeResult1.result(), - bmqt::CloseQueueResult::e_SUCCESS); + BMQTST_ASSERT_EQ(mockSession.closeQueueSync(&queueId1), + closeResult1); + BMQTST_ASSERT_EQ(closeResult1.queueId(), queueId1); + BMQTST_ASSERT_EQ(closeResult1.result(), + bmqt::CloseQueueResult::e_SUCCESS); bmqa::QueueId queueIdFound(bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(mockSession.getQueueId(&queueIdFound, uri1), -1); - ASSERT_EQ(mockSession.getQueueId(&queueIdFound, corrId1), -1); + BMQTST_ASSERT_EQ(mockSession.getQueueId(&queueIdFound, uri1), -1); + BMQTST_ASSERT_EQ(mockSession.getQueueId(&queueIdFound, corrId1), + -1); // Close queue successfully and then attempt to get queue bmqa::CloseQueueStatus closeResult2 = @@ -639,10 +647,12 @@ static void test3_queueManagement() BMQA_EXPECT_CALL(mockSession, closeQueueSync(&queueId1)) .returning(closeResult2); - ASSERT_EQ(mockSession.closeQueueSync(&queueId1), closeResult2); + BMQTST_ASSERT_EQ(mockSession.closeQueueSync(&queueId1), + closeResult2); - ASSERT_EQ(mockSession.getQueueId(&queueIdFound, uri1), -1); - ASSERT_EQ(mockSession.getQueueId(&queueIdFound, corrId1), -1); + BMQTST_ASSERT_EQ(mockSession.getQueueId(&queueIdFound, uri1), -1); + BMQTST_ASSERT_EQ(mockSession.getQueueId(&queueIdFound, corrId1), + -1); } } @@ -672,23 +682,23 @@ static void test3_queueManagement() openQueueSync(&queueId1, uri1, bmqt::QueueFlags::e_READ)) .returning(testOpenQueueResult); - ASSERT_EQ(mockSession.openQueueSync(&queueId1, - uri1, - bmqt::QueueFlags::e_READ), - testOpenQueueResult); + BMQTST_ASSERT_EQ(mockSession.openQueueSync(&queueId1, + uri1, + bmqt::QueueFlags::e_READ), + testOpenQueueResult); typedef bsl::shared_ptr& QueueImplPtr; QueueImplPtr implPtr = reinterpret_cast(queueId1); - ASSERT_EQ(implPtr->uri(), uri1); - ASSERT_EQ(implPtr->correlationId(), corrId1); - ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_OPENED); + BMQTST_ASSERT_EQ(implPtr->uri(), uri1); + BMQTST_ASSERT_EQ(implPtr->correlationId(), corrId1); + BMQTST_ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_OPENED); bmqa::QueueId queueIdFound(bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(mockSession.getQueueId(&queueIdFound, uri1), 0); + BMQTST_ASSERT_EQ(mockSession.getQueueId(&queueIdFound, uri1), 0); - ASSERT(queueId1 == queueIdFound); - ASSERT_NE(queueId1, savedQueueId); + BMQTST_ASSERT(queueId1 == queueIdFound); + BMQTST_ASSERT_NE(queueId1, savedQueueId); bmqa::CloseQueueStatus closeResult1 = bmqa::MockSessionUtil::createCloseQueueStatus( @@ -700,7 +710,7 @@ static void test3_queueManagement() // Close queue and then attempt to get queue BMQA_EXPECT_CALL(mockSession, closeQueueSync(&queueId1)) .returning(closeResult1); - ASSERT_EQ(mockSession.closeQueueSync(&queueId1), closeResult1); + BMQTST_ASSERT_EQ(mockSession.closeQueueSync(&queueId1), closeResult1); } } @@ -742,24 +752,24 @@ static void test4_queueManagementSync() "", bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(mockSession.openQueueAsync(&queueId1, uri1, 10), 0); + BMQTST_ASSERT_EQ(mockSession.openQueueAsync(&queueId1, uri1, 10), 0); typedef bsl::shared_ptr& QueueImplPtr; QueueImplPtr implPtr = reinterpret_cast(queueId1); - ASSERT_EQ(implPtr->uri(), uri1); - ASSERT_EQ(implPtr->correlationId(), corrId1); - ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_OPENING_OPN); + BMQTST_ASSERT_EQ(implPtr->uri(), uri1); + BMQTST_ASSERT_EQ(implPtr->correlationId(), corrId1); + BMQTST_ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_OPENING_OPN); bmqa::SessionEvent openQueueEvent = mockSession.nextEvent().sessionEvent(); - ASSERT_EQ(openQueueEvent.type(), - bmqt::SessionEventType::e_QUEUE_OPEN_RESULT); - ASSERT_EQ(openQueueEvent.statusCode(), 1); - ASSERT_EQ(openQueueEvent.errorDescription(), ""); - ASSERT_EQ(openQueueEvent.correlationId(), corrId1); + BMQTST_ASSERT_EQ(openQueueEvent.type(), + bmqt::SessionEventType::e_QUEUE_OPEN_RESULT); + BMQTST_ASSERT_EQ(openQueueEvent.statusCode(), 1); + BMQTST_ASSERT_EQ(openQueueEvent.errorDescription(), ""); + BMQTST_ASSERT_EQ(openQueueEvent.correlationId(), corrId1); - ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_CLOSED); + BMQTST_ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_CLOSED); } { @@ -775,23 +785,23 @@ static void test4_queueManagementSync() "", bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(mockSession.openQueueAsync(&queueId1, uri1, 10), 0); + BMQTST_ASSERT_EQ(mockSession.openQueueAsync(&queueId1, uri1, 10), 0); typedef bsl::shared_ptr& QueueImplPtr; QueueImplPtr implPtr = reinterpret_cast(queueId1); - ASSERT_EQ(implPtr->uri(), uri1); - ASSERT_EQ(implPtr->correlationId(), corrId1); - ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_OPENING_OPN); + BMQTST_ASSERT_EQ(implPtr->uri(), uri1); + BMQTST_ASSERT_EQ(implPtr->correlationId(), corrId1); + BMQTST_ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_OPENING_OPN); bmqa::SessionEvent openQueueEvent = mockSession.nextEvent().sessionEvent(); - ASSERT_EQ(openQueueEvent.type(), - bmqt::SessionEventType::e_QUEUE_OPEN_RESULT); - ASSERT_EQ(openQueueEvent.statusCode(), 0); - ASSERT_EQ(openQueueEvent.errorDescription(), ""); - ASSERT_EQ(openQueueEvent.correlationId(), corrId1); + BMQTST_ASSERT_EQ(openQueueEvent.type(), + bmqt::SessionEventType::e_QUEUE_OPEN_RESULT); + BMQTST_ASSERT_EQ(openQueueEvent.statusCode(), 0); + BMQTST_ASSERT_EQ(openQueueEvent.errorDescription(), ""); + BMQTST_ASSERT_EQ(openQueueEvent.correlationId(), corrId1); - ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_OPENED); + BMQTST_ASSERT_EQ(implPtr->state(), bmqimp::QueueState::e_OPENED); } } @@ -852,9 +862,9 @@ static void test5_confirmingMessages() &bufferFactory, bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); - ASSERT_EQ(mockSession.unconfirmedMessages(), 3u); + BMQTST_ASSERT_EQ(mockSession.unconfirmedMessages(), 3u); bmqa::MessageEvent messageEvent = eventHandler.popMessageEvent(); { PVV("Confirm push message"); @@ -888,26 +898,26 @@ static void test5_confirmingMessages() mIter.nextMessage(); int rc = confirmBuilder.addMessageConfirmation(mIter.message()); - ASSERT_EQ(rc, 0); - ASSERT_EQ(confirmBuilder.messageCount(), 1); + BMQTST_ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(confirmBuilder.messageCount(), 1); // we know the guid is invalid so we say the return value is -1. BMQA_EXPECT_CALL(mockSession, confirmMessages(&confirmBuilder)) .returning(bmqt::GenericResult::e_INVALID_ARGUMENT); rc = mockSession.confirmMessages(&confirmBuilder); - ASSERT_EQ(rc, bmqt::GenericResult::e_INVALID_ARGUMENT); + BMQTST_ASSERT_EQ(rc, bmqt::GenericResult::e_INVALID_ARGUMENT); // we know the guid is invalid so we say the return value is -1. BMQA_EXPECT_CALL(mockSession, confirmMessage(mIter.message())) .returning(bmqt::GenericResult::e_INVALID_ARGUMENT); rc = mockSession.confirmMessage(mIter.message()); - ASSERT_EQ(rc, bmqt::GenericResult::e_INVALID_ARGUMENT); + BMQTST_ASSERT_EQ(rc, bmqt::GenericResult::e_INVALID_ARGUMENT); // Finally ensure that no messages were confirmed. (3 messages were // consumed/received from the broker) - ASSERT_EQ(mockSession.unconfirmedMessages(), 3u); + BMQTST_ASSERT_EQ(mockSession.unconfirmedMessages(), 3u); } { @@ -920,13 +930,13 @@ static void test5_confirmingMessages() mIter.nextMessage(); confirmBuilder.addMessageConfirmation(mIter.message()); - ASSERT_EQ(confirmBuilder.messageCount(), 1); + BMQTST_ASSERT_EQ(confirmBuilder.messageCount(), 1); BMQA_EXPECT_CALL(mockSession, confirmMessages(&confirmBuilder)) .returning(0); int rc = mockSession.confirmMessages(&confirmBuilder); - ASSERT_EQ(rc, 0); - ASSERT_EQ(mockSession.unconfirmedMessages(), 2u); + BMQTST_ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(mockSession.unconfirmedMessages(), 2u); } { @@ -940,14 +950,14 @@ static void test5_confirmingMessages() mIter.nextMessage(); confirmBuilder.addMessageConfirmation(mIter.message()); - ASSERT_EQ(confirmBuilder.messageCount(), 1); + BMQTST_ASSERT_EQ(confirmBuilder.messageCount(), 1); BMQA_EXPECT_CALL(mockSession, confirmMessages(&confirmBuilder)) .returning(0); int rc = mockSession.confirmMessages(&confirmBuilder); - ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(rc, 0); - ASSERT_EQ(mockSession.unconfirmedMessages(), 2u); + BMQTST_ASSERT_EQ(mockSession.unconfirmedMessages(), 2u); } { @@ -964,8 +974,8 @@ static void test5_confirmingMessages() BMQA_EXPECT_CALL(mockSession, confirmMessage(mIter.message())) .returning(0); int rc = mockSession.confirmMessage(mIter.message()); - ASSERT_EQ(rc, 0); - ASSERT_EQ(mockSession.unconfirmedMessages(), 1u); + BMQTST_ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(mockSession.unconfirmedMessages(), 1u); } } } @@ -1043,74 +1053,74 @@ static void test6_runThrough() .returning(0) .emitting(testEvent); int rc = mockSession.start(); - ASSERT_EQ(rc, 0); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, startAsync()) .returning(0) .emitting(testEvent); rc = mockSession.startAsync(); - ASSERT_EQ(rc, 0); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, stop()).emitting(testEvent); mockSession.stop(); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, stopAsync()).emitting(testEvent); mockSession.stopAsync(); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, finalizeStop()).emitting(testEvent); mockSession.finalizeStop(); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, openQueue(&queueId, uri, 0)) .returning(0) .emitting(testEvent); rc = mockSession.openQueue(&queueId, uri, 0); - ASSERT_EQ(rc, 0); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, closeQueue(&queueId)) .returning(0) .emitting(testEvent); rc = mockSession.closeQueue(&queueId); - ASSERT_EQ(rc, 0); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, openQueueAsync(&queueId, uri, 0)) .returning(0) .emitting(testEvent); rc = mockSession.openQueueAsync(&queueId, uri, 0); - ASSERT_EQ(rc, 0); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, closeQueueAsync(&queueId)) .returning(0) .emitting(testEvent); rc = mockSession.closeQueueAsync(&queueId); - ASSERT_EQ(rc, 0); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, closeQueueAsync(&queueId, closeQueueCallback)) .emitting(testCloseQueueResult); mockSession.closeQueueAsync(&queueId, closeQueueCallback); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, openQueueAsync(&queueId, uri, 0, openQueueCallback)) .emitting(testOpenQueueResult); mockSession.openQueueAsync(&queueId, uri, 0, openQueueCallback); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, configureQueue(&queueId)) .returning(0) .emitting(testEvent); rc = mockSession.configureQueue(&queueId); - ASSERT_EQ(rc, 0); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, configureQueueSync(&queueId, @@ -1118,18 +1128,18 @@ static void test6_runThrough() bsls::TimeInterval())) .returning(testConfigureQueueResult) .emitting(testEvent); - ASSERT_EQ(mockSession.configureQueueSync(&queueId, - bmqt::QueueOptions(), - bsls::TimeInterval()), - testConfigureQueueResult); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(mockSession.configureQueueSync(&queueId, + bmqt::QueueOptions(), + bsls::TimeInterval()), + testConfigureQueueResult); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, configureQueueAsync(&queueId)) .returning(0) .emitting(testEvent); rc = mockSession.configureQueueAsync(&queueId); - ASSERT_EQ(rc, 0); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, configureQueueAsync(&queueId, @@ -1139,14 +1149,14 @@ static void test6_runThrough() mockSession.configureQueueAsync(&queueId, bmqt::QueueOptions(), configureQueueCallback); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); BMQA_EXPECT_CALL(mockSession, post(bmqa::MessageEvent())) .returning(0) .emitting(testEvent); rc = mockSession.post(bmqa::MessageEvent()); - ASSERT_EQ(rc, 0); - ASSERT_EQ(mockSession.emitEvent(), true); + BMQTST_ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(mockSession.emitEvent(), true); } { @@ -1188,23 +1198,23 @@ static void test6_runThrough() BMQA_EXPECT_CALL(mockSession, confirmMessage(mIter.message())) .returning(0); int rc = mockSession.confirmMessage(mIter.message()); - ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(rc, 0); BMQA_EXPECT_CALL(mockSession, confirmMessage(mIter.message().confirmationCookie())) .returning(0); rc = mockSession.confirmMessage(mIter.message()); - ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(rc, 0); // Create confirm builder and confirm messages bmqa::ConfirmEventBuilder confirmBuilder; mockSession.loadConfirmEventBuilder(&confirmBuilder); rc = confirmBuilder.addMessageConfirmation(mIter.message()); - ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(rc, 0); BMQA_EXPECT_CALL(mockSession, confirmMessages(&confirmBuilder)) .returning(0); rc = mockSession.confirmMessages(&confirmBuilder); - ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(rc, 0); } { @@ -1220,10 +1230,10 @@ static void test6_runThrough() // removed from the two key hash map yet and can still be looked up. bmqa::QueueId foundId; int rc = mockSession.getQueueId(&foundId, uri); - ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(rc, 0); rc = mockSession.getQueueId(&foundId, corrId); - ASSERT_EQ(rc, 0); + BMQTST_ASSERT_EQ(rc, 0); } // Clear the handler since we dont care about the events emitted @@ -1274,77 +1284,81 @@ static void test7_postAndAccess() bmqa::Message& bmqMessage = builder.startMessage(); bmqMessage.setDataRef(&payload1); - ASSERT_EQ(builder.packMessage(queueId), 0); + BMQTST_ASSERT_EQ(builder.packMessage(queueId), 0); bmqMessage = builder.startMessage(); bmqMessage.setDataRef(&payload2); - ASSERT_EQ(builder.packMessage(queueId), 0); + BMQTST_ASSERT_EQ(builder.packMessage(queueId), 0); bmqMessage = builder.startMessage(); bmqMessage.setDataRef(&payload3); - ASSERT_EQ(builder.packMessage(queueId), 0); + BMQTST_ASSERT_EQ(builder.packMessage(queueId), 0); bmqa::MessageEvent retrievedPostedEvent; - ASSERT_EQ(mockSession.popPostedEvent(&retrievedPostedEvent), false); + BMQTST_ASSERT_EQ(mockSession.popPostedEvent(&retrievedPostedEvent), false); bmqa::MessageEvent postedEvent(builder.messageEvent()); BMQA_EXPECT_CALL(mockSession, post(builder.messageEvent())).returning(0); - ASSERT_EQ(mockSession.post(postedEvent), 0); + BMQTST_ASSERT_EQ(mockSession.post(postedEvent), 0); - ASSERT_EQ(mockSession.popPostedEvent(&retrievedPostedEvent), true); + BMQTST_ASSERT_EQ(mockSession.popPostedEvent(&retrievedPostedEvent), true); // Please see description of 'compareEvents' for additional details on // messageEvent comparison. // NOTE: Comparison is implementation specific. - ASSERT_EQ(EventHandler::compareEvents(retrievedPostedEvent, postedEvent), - true); + BMQTST_ASSERT_EQ(EventHandler::compareEvents(retrievedPostedEvent, + postedEvent), + true); - ASSERT_EQ(mockSession.popPostedEvent(&retrievedPostedEvent), false); + BMQTST_ASSERT_EQ(mockSession.popPostedEvent(&retrievedPostedEvent), false); // Append another 2 events builder.reset(); bmqMessage = builder.startMessage(); bmqMessage.setDataRef(&payload1); - ASSERT_EQ(builder.packMessage(queueId), 0); + BMQTST_ASSERT_EQ(builder.packMessage(queueId), 0); bmqMessage = builder.startMessage(); bmqMessage.setDataRef(&payload2); - ASSERT_EQ(builder.packMessage(queueId), 0); + BMQTST_ASSERT_EQ(builder.packMessage(queueId), 0); bmqMessage = builder.startMessage(); bmqMessage.setDataRef(&payload3); - ASSERT_EQ(builder.packMessage(queueId), 0); + BMQTST_ASSERT_EQ(builder.packMessage(queueId), 0); bmqMessage = builder.startMessage(); bmqMessage.setDataRef(&payload4); - ASSERT_EQ(builder.packMessage(queueId), 0); + BMQTST_ASSERT_EQ(builder.packMessage(queueId), 0); bmqa::MessageEvent postedEvent2(builder.messageEvent()); bmqa::MessageEvent postedEvent3(builder.messageEvent()); BMQA_EXPECT_CALL(mockSession, post(postedEvent2)).returning(0); - ASSERT_EQ(mockSession.post(postedEvent2), 0); + BMQTST_ASSERT_EQ(mockSession.post(postedEvent2), 0); BMQA_EXPECT_CALL(mockSession, post(postedEvent3)).returning(0); - ASSERT_EQ(mockSession.post(postedEvent3), 0); + BMQTST_ASSERT_EQ(mockSession.post(postedEvent3), 0); bmqa::MessageEvent retrievedPostedEvent2; bmqa::MessageEvent retrievedPostedEvent3; // ASSERT that the compare fails for different events - ASSERT_EQ(EventHandler::compareEvents(retrievedPostedEvent2, postedEvent), - false); + BMQTST_ASSERT_EQ(EventHandler::compareEvents(retrievedPostedEvent2, + postedEvent), + false); - ASSERT_EQ(mockSession.popPostedEvent(&retrievedPostedEvent2), true); - ASSERT_EQ(EventHandler::compareEvents(retrievedPostedEvent2, postedEvent2), - true); + BMQTST_ASSERT_EQ(mockSession.popPostedEvent(&retrievedPostedEvent2), true); + BMQTST_ASSERT_EQ(EventHandler::compareEvents(retrievedPostedEvent2, + postedEvent2), + true); - ASSERT_EQ(mockSession.popPostedEvent(&retrievedPostedEvent3), true); - ASSERT_EQ(EventHandler::compareEvents(retrievedPostedEvent3, postedEvent3), - true); + BMQTST_ASSERT_EQ(mockSession.popPostedEvent(&retrievedPostedEvent3), true); + BMQTST_ASSERT_EQ(EventHandler::compareEvents(retrievedPostedEvent3, + postedEvent3), + true); // We are out of posted messages again. - ASSERT_EQ(mockSession.popPostedEvent(&retrievedPostedEvent), false); + BMQTST_ASSERT_EQ(mockSession.popPostedEvent(&retrievedPostedEvent), false); eventHandler.clearEvents(); @@ -1396,12 +1410,12 @@ static void test8_postBlockedToSuspendedQueue() // Ensure that the message cannot be packed. bmqa::Message& bmqMessage = builder.startMessage(); bmqMessage.setDataRef(&payload); - ASSERT_EQ(builder.packMessage(queueId), - bmqt::EventBuilderResult::e_QUEUE_SUSPENDED); + BMQTST_ASSERT_EQ(builder.packMessage(queueId), + bmqt::EventBuilderResult::e_QUEUE_SUSPENDED); // Unsuspend the queue, and try again. implPtr->setIsSuspended(false); - ASSERT_EQ(builder.packMessage(queueId), 0); + BMQTST_ASSERT_EQ(builder.packMessage(queueId), 0); eventHandler.clearEvents(); // Ensure that the builder is clear to ensure that the blob held by the diff --git a/src/groups/bmq/bmqa/bmqa_openqueuestatus.t.cpp b/src/groups/bmq/bmqa/bmqa_openqueuestatus.t.cpp index beefb5cc1..81e1c5163 100644 --- a/src/groups/bmq/bmqa/bmqa_openqueuestatus.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_openqueuestatus.t.cpp @@ -57,10 +57,10 @@ static void test1_breathingTest() PV("Default Constructor"); { bmqa::OpenQueueStatus obj(bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(bool(obj), true); - ASSERT_EQ(obj.result(), bmqt::OpenQueueResult::e_SUCCESS); - ASSERT_EQ(obj.errorDescription(), - bsl::string("", bmqtst::TestHelperUtil::allocator())); + BMQTST_ASSERT_EQ(bool(obj), true); + BMQTST_ASSERT_EQ(obj.result(), bmqt::OpenQueueResult::e_SUCCESS); + BMQTST_ASSERT_EQ(obj.errorDescription(), + bsl::string("", bmqtst::TestHelperUtil::allocator())); } PV("Valued Constructor"); @@ -79,10 +79,10 @@ static void test1_breathingTest() errorDescription, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(bool(obj), false); - ASSERT_EQ(obj.queueId(), queueId); - ASSERT_EQ(obj.result(), result); - ASSERT_EQ(obj.errorDescription(), errorDescription); + BMQTST_ASSERT_EQ(bool(obj), false); + BMQTST_ASSERT_EQ(obj.queueId(), queueId); + BMQTST_ASSERT_EQ(obj.result(), result); + BMQTST_ASSERT_EQ(obj.errorDescription(), errorDescription); } PV("Copy Constructor"); @@ -102,10 +102,10 @@ static void test1_breathingTest() bmqtst::TestHelperUtil::allocator()); bmqa::OpenQueueStatus obj2(obj1, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(bool(obj2), bool(obj1)); - ASSERT_EQ(obj1.queueId(), obj2.queueId()); - ASSERT_EQ(obj1.result(), obj2.result()); - ASSERT_EQ(obj1.errorDescription(), obj2.errorDescription()); + BMQTST_ASSERT_EQ(bool(obj2), bool(obj1)); + BMQTST_ASSERT_EQ(obj1.queueId(), obj2.queueId()); + BMQTST_ASSERT_EQ(obj1.result(), obj2.result()); + BMQTST_ASSERT_EQ(obj1.errorDescription(), obj2.errorDescription()); } PV("Assignment Operator"); @@ -126,10 +126,10 @@ static void test1_breathingTest() bmqa::OpenQueueStatus obj2(bmqtst::TestHelperUtil::allocator()); obj2 = obj1; - ASSERT_EQ(bool(obj1), bool(obj2)); - ASSERT_EQ(obj1.queueId(), obj2.queueId()); - ASSERT_EQ(obj1.result(), obj2.result()); - ASSERT_EQ(obj1.errorDescription(), obj2.errorDescription()); + BMQTST_ASSERT_EQ(bool(obj1), bool(obj2)); + BMQTST_ASSERT_EQ(obj1.queueId(), obj2.queueId()); + BMQTST_ASSERT_EQ(obj1.result(), obj2.result()); + BMQTST_ASSERT_EQ(obj1.errorDescription(), obj2.errorDescription()); } } @@ -172,7 +172,7 @@ static void test2_comparison() bmqtst::TestHelperUtil::allocator()); bmqa::OpenQueueStatus obj2(obj1, bmqtst::TestHelperUtil::allocator()); - ASSERT(obj1 == obj2); + BMQTST_ASSERT(obj1 == obj2); } PV("Inequality"); @@ -197,7 +197,7 @@ static void test2_comparison() errorDescription, bmqtst::TestHelperUtil::allocator()); - ASSERT(obj1 != obj2); + BMQTST_ASSERT(obj1 != obj2); } } @@ -253,13 +253,13 @@ static void test3_print() // operator<< out << obj; - ASSERT_EQ(out.str(), expected); + BMQTST_ASSERT_EQ(out.str(), expected); // Print out.reset(); obj.print(out, 0, -1); - ASSERT_EQ(out.str(), expected); + BMQTST_ASSERT_EQ(out.str(), expected); } // ============================================================================ diff --git a/src/groups/bmq/bmqa/bmqa_queueid.t.cpp b/src/groups/bmq/bmqa/bmqa_queueid.t.cpp index fdfc9cf59..d92f5f3e0 100644 --- a/src/groups/bmq/bmqa/bmqa_queueid.t.cpp +++ b/src/groups/bmq/bmqa/bmqa_queueid.t.cpp @@ -64,7 +64,7 @@ static void test1_breathingTest() PV("Default Constructor"); { bmqa::QueueId obj(bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(obj.isValid(), false); + BMQTST_ASSERT_EQ(obj.isValid(), false); } PV("Valued Constructor - correlationId"); @@ -73,11 +73,12 @@ static void test1_breathingTest() const bmqt::CorrelationId corrId(id); bmqa::QueueId obj(corrId, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(obj.correlationId(), corrId); - ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); - ASSERT_EQ(obj.uri(), bmqt::Uri(bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(obj.options(), k_NULL_OPTIONS); - ASSERT_EQ(obj.isValid(), false); + BMQTST_ASSERT_EQ(obj.correlationId(), corrId); + BMQTST_ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); + BMQTST_ASSERT_EQ(obj.uri(), + bmqt::Uri(bmqtst::TestHelperUtil::allocator())); + BMQTST_ASSERT_EQ(obj.options(), k_NULL_OPTIONS); + BMQTST_ASSERT_EQ(obj.isValid(), false); } PV("Valued Constructor - numeric"); @@ -85,11 +86,12 @@ static void test1_breathingTest() const bsls::Types::Int64 id = 5; bmqa::QueueId obj(id, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(obj.correlationId(), bmqt::CorrelationId(id)); - ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); - ASSERT_EQ(obj.uri(), bmqt::Uri(bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(obj.options(), k_NULL_OPTIONS); - ASSERT_EQ(obj.isValid(), false); + BMQTST_ASSERT_EQ(obj.correlationId(), bmqt::CorrelationId(id)); + BMQTST_ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); + BMQTST_ASSERT_EQ(obj.uri(), + bmqt::Uri(bmqtst::TestHelperUtil::allocator())); + BMQTST_ASSERT_EQ(obj.options(), k_NULL_OPTIONS); + BMQTST_ASSERT_EQ(obj.isValid(), false); } PV("Valued Constructor - void ptr"); @@ -98,11 +100,12 @@ static void test1_breathingTest() void* ptr = static_cast(const_cast(buffer)); bmqa::QueueId obj(ptr, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(obj.correlationId(), bmqt::CorrelationId(ptr)); - ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); - ASSERT_EQ(obj.uri(), bmqt::Uri(bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(obj.options(), k_NULL_OPTIONS); - ASSERT_EQ(obj.isValid(), false); + BMQTST_ASSERT_EQ(obj.correlationId(), bmqt::CorrelationId(ptr)); + BMQTST_ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); + BMQTST_ASSERT_EQ(obj.uri(), + bmqt::Uri(bmqtst::TestHelperUtil::allocator())); + BMQTST_ASSERT_EQ(obj.options(), k_NULL_OPTIONS); + BMQTST_ASSERT_EQ(obj.isValid(), false); } PV("Valued Constructor - shared ptr to void"); @@ -113,11 +116,12 @@ static void test1_breathingTest() sptr.createInplace(bmqtst::TestHelperUtil::allocator(), k_VALUE); bmqa::QueueId obj(sptr, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(obj.correlationId(), bmqt::CorrelationId(sptr)); - ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); - ASSERT_EQ(obj.uri(), bmqt::Uri(bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(obj.options(), k_NULL_OPTIONS); - ASSERT_EQ(obj.isValid(), false); + BMQTST_ASSERT_EQ(obj.correlationId(), bmqt::CorrelationId(sptr)); + BMQTST_ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); + BMQTST_ASSERT_EQ(obj.uri(), + bmqt::Uri(bmqtst::TestHelperUtil::allocator())); + BMQTST_ASSERT_EQ(obj.options(), k_NULL_OPTIONS); + BMQTST_ASSERT_EQ(obj.isValid(), false); } PV("Copy Constructor"); @@ -126,11 +130,11 @@ static void test1_breathingTest() bmqa::QueueId obj1(id, bmqtst::TestHelperUtil::allocator()); bmqa::QueueId obj2(obj1, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(obj1.correlationId(), obj2.correlationId()); - ASSERT_EQ(obj1.flags(), obj2.flags()); - ASSERT_EQ(obj1.uri(), obj2.uri()); - ASSERT_EQ(obj1.options(), obj2.options()); - ASSERT_EQ(obj1.isValid(), obj2.isValid()); + BMQTST_ASSERT_EQ(obj1.correlationId(), obj2.correlationId()); + BMQTST_ASSERT_EQ(obj1.flags(), obj2.flags()); + BMQTST_ASSERT_EQ(obj1.uri(), obj2.uri()); + BMQTST_ASSERT_EQ(obj1.options(), obj2.options()); + BMQTST_ASSERT_EQ(obj1.isValid(), obj2.isValid()); } PV("Assignment Operator"); @@ -140,11 +144,11 @@ static void test1_breathingTest() bmqa::QueueId obj1(id, bmqtst::TestHelperUtil::allocator()); bmqa::QueueId obj2(bmqtst::TestHelperUtil::allocator()); obj2 = obj1; - ASSERT_EQ(obj1.correlationId(), obj2.correlationId()); - ASSERT_EQ(obj1.flags(), obj2.flags()); - ASSERT_EQ(obj1.uri(), obj2.uri()); - ASSERT_EQ(obj1.options(), obj2.options()); - ASSERT_EQ(obj1.isValid(), obj2.isValid()); + BMQTST_ASSERT_EQ(obj1.correlationId(), obj2.correlationId()); + BMQTST_ASSERT_EQ(obj1.flags(), obj2.flags()); + BMQTST_ASSERT_EQ(obj1.uri(), obj2.uri()); + BMQTST_ASSERT_EQ(obj1.options(), obj2.options()); + BMQTST_ASSERT_EQ(obj1.isValid(), obj2.isValid()); } PV("Uri Method"); @@ -153,11 +157,12 @@ static void test1_breathingTest() const char k_QUEUE_URL[] = "bmq://ts.trades.myapp.~bt/my.queue?id=foo"; bmqa::QueueId obj(id, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(obj.correlationId(), bmqt::CorrelationId(id)); - ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); - ASSERT_EQ(obj.uri(), bmqt::Uri(bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(obj.options(), k_NULL_OPTIONS); - ASSERT_EQ(obj.isValid(), false); + BMQTST_ASSERT_EQ(obj.correlationId(), bmqt::CorrelationId(id)); + BMQTST_ASSERT_EQ(obj.flags(), bmqt::QueueFlagsUtil::empty()); + BMQTST_ASSERT_EQ(obj.uri(), + bmqt::Uri(bmqtst::TestHelperUtil::allocator())); + BMQTST_ASSERT_EQ(obj.options(), k_NULL_OPTIONS); + BMQTST_ASSERT_EQ(obj.isValid(), false); // Convert to bmqimp::Queue bsl::shared_ptr& queue = @@ -165,11 +170,11 @@ static void test1_breathingTest() // Set uri to impl object const bmqt::Uri uri(k_QUEUE_URL, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(uri.isValid(), true); + BMQTST_ASSERT_EQ(uri.isValid(), true); queue->setUri(uri); - ASSERT_EQ(obj.uri().asString(), k_QUEUE_URL); + BMQTST_ASSERT_EQ(obj.uri().asString(), k_QUEUE_URL); } } @@ -200,14 +205,14 @@ static void test2_comparison() bmqa::QueueId obj1(k_ID, bmqtst::TestHelperUtil::allocator()); bmqa::QueueId obj2(k_ID, bmqtst::TestHelperUtil::allocator()); - ASSERT_NE(obj1, obj2); + BMQTST_ASSERT_NE(obj1, obj2); } PV("Equality"); { // Different defaults are never equal - ASSERT_NE(bmqa::QueueId(bmqtst::TestHelperUtil::allocator()), - bmqa::QueueId(bmqtst::TestHelperUtil::allocator())); + BMQTST_ASSERT_NE(bmqa::QueueId(bmqtst::TestHelperUtil::allocator()), + bmqa::QueueId(bmqtst::TestHelperUtil::allocator())); // Assignment makes equal const bsls::Types::Int64 k_ID1 = 5; @@ -218,7 +223,7 @@ static void test2_comparison() BSLS_ASSERT_OPT(obj1 != obj2); obj1 = obj2; - ASSERT_EQ(obj1, obj2); + BMQTST_ASSERT_EQ(obj1, obj2); } } diff --git a/src/groups/bmq/bmqa/bmqa_session.cpp b/src/groups/bmq/bmqa/bmqa_session.cpp index 46b95f64c..719af4f13 100644 --- a/src/groups/bmq/bmqa/bmqa_session.cpp +++ b/src/groups/bmq/bmqa/bmqa_session.cpp @@ -787,7 +787,7 @@ MessageEventBuilder Session::createMessageEventBuilder() eventImplSpRef = d_impl.d_application_mp->brokerSession().createEvent(); eventImplSpRef->configureAsMessageEvent( - d_impl.d_application_mp->bufferFactory()); + d_impl.d_application_mp->blobSpPool()); return builder; } @@ -814,7 +814,7 @@ void Session::loadMessageEventBuilder(MessageEventBuilder* builder) eventImplSpRef = d_impl.d_application_mp->brokerSession().createEvent(); eventImplSpRef->configureAsMessageEvent( - d_impl.d_application_mp->bufferFactory()); + d_impl.d_application_mp->blobSpPool()); } void Session::loadConfirmEventBuilder(ConfirmEventBuilder* builder) @@ -837,7 +837,7 @@ void Session::loadConfirmEventBuilder(ConfirmEventBuilder* builder) } new (builderImplRef.d_buffer.buffer()) - bmqp::ConfirmEventBuilder(d_impl.d_application_mp->bufferFactory(), + bmqp::ConfirmEventBuilder(d_impl.d_application_mp->blobSpPool(), d_impl.d_allocator_p); builderImplRef.d_builder_p = reinterpret_cast( diff --git a/src/groups/bmq/bmqc/bmqc_array.t.cpp b/src/groups/bmq/bmqc/bmqc_array.t.cpp index 00b91d679..c788d9690 100644 --- a/src/groups/bmq/bmqc/bmqc_array.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_array.t.cpp @@ -143,12 +143,12 @@ static void test1_breathingTest() ObjType obj(bmqtst::TestHelperUtil::allocator()); const ObjType& constObj = obj; - ASSERT_EQ(true, obj.empty()); - ASSERT_EQ(0UL, obj.size()); - ASSERT_EQ(bmqtst::TestHelperUtil::allocator(), - obj.get_allocator().mechanism()); - ASSERT_EQ(true, obj.begin() == obj.end()); - ASSERT_EQ(true, constObj.begin() == constObj.end()); + BMQTST_ASSERT_EQ(true, obj.empty()); + BMQTST_ASSERT_EQ(0UL, obj.size()); + BMQTST_ASSERT_EQ(bmqtst::TestHelperUtil::allocator(), + obj.get_allocator().mechanism()); + BMQTST_ASSERT_EQ(true, obj.begin() == obj.end()); + BMQTST_ASSERT_EQ(true, constObj.begin() == constObj.end()); } { @@ -162,26 +162,26 @@ static void test1_breathingTest() obj.push_back(TestType(i, bmqtst::TestHelperUtil::allocator())); } - ASSERT_EQ(false, obj.empty()); - ASSERT_EQ(static_cast(k_NB_ITEMS), obj.size()); - ASSERT_EQ(true, obj.begin() != obj.end()); + BMQTST_ASSERT_EQ(false, obj.empty()); + BMQTST_ASSERT_EQ(static_cast(k_NB_ITEMS), obj.size()); + BMQTST_ASSERT_EQ(true, obj.begin() != obj.end()); for (int idx = 0, i = 1; idx < k_NB_ITEMS; ++idx, ++i) { - ASSERT_EQ_D(idx, i, obj[idx].valueAsInt()); - ASSERT_EQ_D(idx, i, constObj[idx].valueAsInt()); + BMQTST_ASSERT_EQ_D(idx, i, obj[idx].valueAsInt()); + BMQTST_ASSERT_EQ_D(idx, i, constObj[idx].valueAsInt()); } int i = 1; for (ObjType::iterator it = obj.begin(); it != obj.end(); ++it, ++i) { - ASSERT_EQ_D(i, it->valueAsInt(), i); - ASSERT_EQ_D(i, (*it).valueAsInt(), i); + BMQTST_ASSERT_EQ_D(i, it->valueAsInt(), i); + BMQTST_ASSERT_EQ_D(i, (*it).valueAsInt(), i); } i = 1; for (ObjType::const_iterator it = constObj.begin(); it != constObj.end(); ++it, ++i) { - ASSERT_EQ_D(i, it->valueAsInt(), i); - ASSERT_EQ_D(i, (*it).valueAsInt(), i); + BMQTST_ASSERT_EQ_D(i, it->valueAsInt(), i); + BMQTST_ASSERT_EQ_D(i, (*it).valueAsInt(), i); } } @@ -199,69 +199,69 @@ static void test1_breathingTest() int i = 1; for (ObjType::iterator it = obj.begin(); it != obj.end(); it += 1, ++i) { - ASSERT_EQ_D(i, it->valueAsInt(), i); - ASSERT_EQ_D(i, (*it).valueAsInt(), i); + BMQTST_ASSERT_EQ_D(i, it->valueAsInt(), i); + BMQTST_ASSERT_EQ_D(i, (*it).valueAsInt(), i); } // Iterator operator-= i = k_NB_ITEMS; for (ObjType::iterator it = obj.end(); i > 0; --i) { it -= 1; - ASSERT_EQ_D(i, it->valueAsInt(), i); - ASSERT_EQ_D(i, (*it).valueAsInt(), i); + BMQTST_ASSERT_EQ_D(i, it->valueAsInt(), i); + BMQTST_ASSERT_EQ_D(i, (*it).valueAsInt(), i); } { // Misc. iterator expressions ObjType::iterator it = obj.begin(); - ASSERT_EQ(it->valueAsInt(), 1); - ASSERT_EQ((++it)->valueAsInt(), 2); - ASSERT_EQ((--it)->valueAsInt(), 1); - ASSERT_EQ(it[0].valueAsInt(), 1); + BMQTST_ASSERT_EQ(it->valueAsInt(), 1); + BMQTST_ASSERT_EQ((++it)->valueAsInt(), 2); + BMQTST_ASSERT_EQ((--it)->valueAsInt(), 1); + BMQTST_ASSERT_EQ(it[0].valueAsInt(), 1); ObjType::iterator it2 = it++; - ASSERT_EQ(it2->valueAsInt(), 1); - ASSERT_EQ(it->valueAsInt(), 2); - ASSERT(it != it2); - ASSERT(it > it2); - ASSERT(it >= it2); - ASSERT(it2 <= it); - ASSERT(it2 < it); - ASSERT(it == it2 + 1); - ASSERT(it == 1 + it2); - ASSERT(it - 1 == it2); - ASSERT(it - it2 == 1); - ASSERT(it[0] == it2[1]); + BMQTST_ASSERT_EQ(it2->valueAsInt(), 1); + BMQTST_ASSERT_EQ(it->valueAsInt(), 2); + BMQTST_ASSERT(it != it2); + BMQTST_ASSERT(it > it2); + BMQTST_ASSERT(it >= it2); + BMQTST_ASSERT(it2 <= it); + BMQTST_ASSERT(it2 < it); + BMQTST_ASSERT(it == it2 + 1); + BMQTST_ASSERT(it == 1 + it2); + BMQTST_ASSERT(it - 1 == it2); + BMQTST_ASSERT(it - it2 == 1); + BMQTST_ASSERT(it[0] == it2[1]); ObjType::iterator it3 = --it; - ASSERT_EQ(it3->valueAsInt(), 1); - ASSERT_EQ(it2->valueAsInt(), 1); - ASSERT(it == it3); - ASSERT(it >= it3); - ASSERT(it <= it3); - ASSERT(it + 1 == 1 + it); - ASSERT(it3 + 1 == 1 + it3); - ASSERT(it + 1 == it3 + 1); - ASSERT(it - it3 == 0); - ASSERT(it3 - it == 0); - ASSERT(it[2] == it3[2]); - ASSERT(*it++ == *it3); + BMQTST_ASSERT_EQ(it3->valueAsInt(), 1); + BMQTST_ASSERT_EQ(it2->valueAsInt(), 1); + BMQTST_ASSERT(it == it3); + BMQTST_ASSERT(it >= it3); + BMQTST_ASSERT(it <= it3); + BMQTST_ASSERT(it + 1 == 1 + it); + BMQTST_ASSERT(it3 + 1 == 1 + it3); + BMQTST_ASSERT(it + 1 == it3 + 1); + BMQTST_ASSERT(it - it3 == 0); + BMQTST_ASSERT(it3 - it == 0); + BMQTST_ASSERT(it[2] == it3[2]); + BMQTST_ASSERT(*it++ == *it3); } { // const-iterator ObjType::const_iterator it = obj.begin(); - ASSERT_EQ(it->valueAsInt(), 1); - ASSERT_EQ((++it)->valueAsInt(), 2); - ASSERT_EQ((--it)->valueAsInt(), 1); + BMQTST_ASSERT_EQ(it->valueAsInt(), 1); + BMQTST_ASSERT_EQ((++it)->valueAsInt(), 2); + BMQTST_ASSERT_EQ((--it)->valueAsInt(), 1); ObjType::const_iterator it2 = it++; - ASSERT_EQ(it2->valueAsInt(), 1); - ASSERT_EQ(it->valueAsInt(), 2); + BMQTST_ASSERT_EQ(it2->valueAsInt(), 1); + BMQTST_ASSERT_EQ(it->valueAsInt(), 2); ObjType::const_iterator it3 = --it; - ASSERT_EQ(it3->valueAsInt(), 1); - ASSERT_EQ(it2->valueAsInt(), 1); + BMQTST_ASSERT_EQ(it3->valueAsInt(), 1); + BMQTST_ASSERT_EQ(it2->valueAsInt(), 1); } } @@ -273,9 +273,9 @@ static void test1_breathingTest() ObjType obj(k_NB_ITEMS, TestType(1, bmqtst::TestHelperUtil::allocator()), bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(false, obj.empty()); - ASSERT_EQ(static_cast(k_NB_ITEMS), obj.size()); - ASSERT_EQ( + BMQTST_ASSERT_EQ(false, obj.empty()); + BMQTST_ASSERT_EQ(static_cast(k_NB_ITEMS), obj.size()); + BMQTST_ASSERT_EQ( k_NB_ITEMS, bsl::count(obj.begin(), obj.end(), @@ -292,9 +292,9 @@ static void test1_breathingTest() bmqtst::TestHelperUtil::allocator()); ObjType obj(v.begin(), v.end(), bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(false, obj.empty()); - ASSERT_EQ(static_cast(k_NB_ITEMS), obj.size()); - ASSERT_EQ( + BMQTST_ASSERT_EQ(false, obj.empty()); + BMQTST_ASSERT_EQ(static_cast(k_NB_ITEMS), obj.size()); + BMQTST_ASSERT_EQ( k_NB_ITEMS, bsl::count(obj.begin(), obj.end(), @@ -313,23 +313,23 @@ static void test1_breathingTest() } ObjType objCopy(obj, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(false, objCopy.empty()); - ASSERT_EQ(static_cast(k_NB_ITEMS), objCopy.size()); - ASSERT_EQ(true, objCopy.begin() != objCopy.end()); + BMQTST_ASSERT_EQ(false, objCopy.empty()); + BMQTST_ASSERT_EQ(static_cast(k_NB_ITEMS), objCopy.size()); + BMQTST_ASSERT_EQ(true, objCopy.begin() != objCopy.end()); int i = 1; for (ObjType::iterator it = objCopy.begin(); it != objCopy.end(); ++it) { - ASSERT_EQ_D(i, it->valueAsInt(), i); + BMQTST_ASSERT_EQ_D(i, it->valueAsInt(), i); ++i; } objCopy.clear(); - ASSERT_EQ(true, objCopy.empty()); - ASSERT_EQ(0UL, objCopy.size()); - ASSERT_EQ(true, objCopy.begin() == objCopy.end()); + BMQTST_ASSERT_EQ(true, objCopy.empty()); + BMQTST_ASSERT_EQ(0UL, objCopy.size()); + BMQTST_ASSERT_EQ(true, objCopy.begin() == objCopy.end()); - ASSERT_EQ(static_cast(k_NB_ITEMS), obj.size()); + BMQTST_ASSERT_EQ(static_cast(k_NB_ITEMS), obj.size()); } { @@ -349,21 +349,21 @@ static void test1_breathingTest() obj2.push_back(TestType(i, bmqtst::TestHelperUtil::allocator())); } - ASSERT_EQ(false, obj2.empty()); - ASSERT_EQ(static_cast(k_NB_ITEMS_2), obj2.size()); - ASSERT_EQ(true, obj2.begin() != obj2.end()); + BMQTST_ASSERT_EQ(false, obj2.empty()); + BMQTST_ASSERT_EQ(static_cast(k_NB_ITEMS_2), obj2.size()); + BMQTST_ASSERT_EQ(true, obj2.begin() != obj2.end()); // Self assignment obj1 = obj1; - ASSERT_EQ(false, obj1.empty()); - ASSERT_EQ(static_cast(k_NB_ITEMS_1), obj1.size()); - ASSERT_EQ(true, obj1.begin() != obj1.end()); + BMQTST_ASSERT_EQ(false, obj1.empty()); + BMQTST_ASSERT_EQ(static_cast(k_NB_ITEMS_1), obj1.size()); + BMQTST_ASSERT_EQ(true, obj1.begin() != obj1.end()); obj2 = obj1; - ASSERT_EQ(false, obj2.empty()); - ASSERT_EQ(static_cast(k_NB_ITEMS_1), obj2.size()); - ASSERT_EQ(true, obj2.begin() != obj2.end()); + BMQTST_ASSERT_EQ(false, obj2.empty()); + BMQTST_ASSERT_EQ(static_cast(k_NB_ITEMS_1), obj2.size()); + BMQTST_ASSERT_EQ(true, obj2.begin() != obj2.end()); } { @@ -374,11 +374,11 @@ static void test1_breathingTest() for (int i = 1; i <= 2 * k_STATIC_LEN; ++i) { obj.push_back(TestType(i, bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(1, obj.front().valueAsInt()); - ASSERT_EQ(i, obj.back().valueAsInt()); + BMQTST_ASSERT_EQ(1, obj.front().valueAsInt()); + BMQTST_ASSERT_EQ(i, obj.back().valueAsInt()); - ASSERT_EQ(1, constObj.front().valueAsInt()); - ASSERT_EQ(i, constObj.back().valueAsInt()); + BMQTST_ASSERT_EQ(1, constObj.front().valueAsInt()); + BMQTST_ASSERT_EQ(i, constObj.back().valueAsInt()); } } @@ -395,11 +395,11 @@ static void test1_breathingTest() TestType("a", bmqtst::TestHelperUtil::allocator())); } - ASSERT_EQ(k_NB_ITEMS, TestType::s_numAliveInstances); + BMQTST_ASSERT_EQ(k_NB_ITEMS, TestType::s_numAliveInstances); obj.clear(); - ASSERT_EQ(0, TestType::s_numAliveInstances); + BMQTST_ASSERT_EQ(0, TestType::s_numAliveInstances); } { @@ -416,11 +416,11 @@ static void test1_breathingTest() TestType("b", bmqtst::TestHelperUtil::allocator())); } - ASSERT_EQ(150, TestType::s_numAliveInstances); + BMQTST_ASSERT_EQ(150, TestType::s_numAliveInstances); obj2 = obj1; - ASSERT_EQ(100, TestType::s_numAliveInstances); + BMQTST_ASSERT_EQ(100, TestType::s_numAliveInstances); } { @@ -437,11 +437,11 @@ static void test1_breathingTest() TestType("b", bmqtst::TestHelperUtil::allocator())); } - ASSERT_EQ(150, TestType::s_numAliveInstances); + BMQTST_ASSERT_EQ(150, TestType::s_numAliveInstances); obj1 = obj2; - ASSERT_EQ(200, TestType::s_numAliveInstances); + BMQTST_ASSERT_EQ(200, TestType::s_numAliveInstances); } { @@ -453,11 +453,11 @@ static void test1_breathingTest() TestType("a", bmqtst::TestHelperUtil::allocator())); } - ASSERT_EQ(50, TestType::s_numAliveInstances); + BMQTST_ASSERT_EQ(50, TestType::s_numAliveInstances); bmqtst::TestHelperUtil::allocator()->deleteObject(obj); - ASSERT_EQ(0, TestType::s_numAliveInstances); + BMQTST_ASSERT_EQ(0, TestType::s_numAliveInstances); } } } @@ -481,14 +481,14 @@ static void test2_outOfBoundValidation() const ObjType& constObj = obj; // non-const - ASSERT_SAFE_FAIL(obj.front()); - ASSERT_SAFE_FAIL(obj.back()); - ASSERT_SAFE_FAIL(obj[0]); + BMQTST_ASSERT_SAFE_FAIL(obj.front()); + BMQTST_ASSERT_SAFE_FAIL(obj.back()); + BMQTST_ASSERT_SAFE_FAIL(obj[0]); // const - ASSERT_SAFE_FAIL(constObj.front()); - ASSERT_SAFE_FAIL(constObj.back()); - ASSERT_SAFE_FAIL(constObj[0]); + BMQTST_ASSERT_SAFE_FAIL(constObj.front()); + BMQTST_ASSERT_SAFE_FAIL(constObj.back()); + BMQTST_ASSERT_SAFE_FAIL(constObj[0]); // insert some items const int k_NB_ITEMS = 5; @@ -496,7 +496,7 @@ static void test2_outOfBoundValidation() obj.push_back(TestType(i, bmqtst::TestHelperUtil::allocator())); } - ASSERT_SAFE_FAIL(constObj[k_NB_ITEMS + 1]); + BMQTST_ASSERT_SAFE_FAIL(constObj[k_NB_ITEMS + 1]); static_cast(constObj); } @@ -518,17 +518,17 @@ static void test3_noMemoryAllocation() ObjType obj(&ta); - ASSERT_EQ(ta.numBlocksInUse(), 0); + BMQTST_ASSERT_EQ(ta.numBlocksInUse(), 0); // Add up to k_STATIC_LEN, no allocations for (int i = 1; i <= k_STATIC_LEN; ++i) { obj.push_back(TestType(i, bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(ta.numBlocksInUse(), 0); + BMQTST_ASSERT_EQ(ta.numBlocksInUse(), 0); } // Adding one more, allocation" obj.push_back(TestType(0, bmqtst::TestHelperUtil::allocator())); - ASSERT_NE(ta.numBlocksInUse(), 0); + BMQTST_ASSERT_NE(ta.numBlocksInUse(), 0); } static void test4_reserve() @@ -556,7 +556,7 @@ static void test4_reserve() for (int i = 1; i <= k_CAPACITY; ++i) { obj.push_back(TestType(i, bmqtst::TestHelperUtil::allocator())); } - ASSERT_EQ(ta.numAllocations(), numAllocations); + BMQTST_ASSERT_EQ(ta.numAllocations(), numAllocations); } static void test5_resize() @@ -579,20 +579,20 @@ static void test5_resize() // 1) Resize to static length obj.resize(k_STATIC_LEN, TestType(1, bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(obj.size(), static_cast(k_STATIC_LEN)); - ASSERT_EQ(TestType::s_numAliveInstances, k_STATIC_LEN); - ASSERT_EQ(ta.numAllocations(), numAllocations); + BMQTST_ASSERT_EQ(obj.size(), static_cast(k_STATIC_LEN)); + BMQTST_ASSERT_EQ(TestType::s_numAliveInstances, k_STATIC_LEN); + BMQTST_ASSERT_EQ(ta.numAllocations(), numAllocations); // 2) Resize to half the static length obj.resize(k_STATIC_LEN / 2, TestType(2, bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(obj.size(), static_cast(k_STATIC_LEN / 2)); - ASSERT_EQ(TestType::s_numAliveInstances, k_STATIC_LEN / 2); - ASSERT_EQ(ta.numAllocations(), numAllocations); + BMQTST_ASSERT_EQ(obj.size(), static_cast(k_STATIC_LEN / 2)); + BMQTST_ASSERT_EQ(TestType::s_numAliveInstances, k_STATIC_LEN / 2); + BMQTST_ASSERT_EQ(ta.numAllocations(), numAllocations); for (size_t i = 0; i < obj.size(); ++i) { - ASSERT_EQ_D(i, obj[i].valueAsInt(), 1); + BMQTST_ASSERT_EQ_D(i, obj[i].valueAsInt(), 1); } // k_FULL_LENGTH exercises both static and dynamic parts of 'bmqc_array'. @@ -602,34 +602,34 @@ static void test5_resize() obj.resize(2 * k_STATIC_LEN, TestType(3, bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(obj.size(), static_cast(k_FULL_LEN)); - ASSERT_EQ(TestType::s_numAliveInstances, 2 * k_STATIC_LEN); - ASSERT_EQ(ta.numAllocations(), numAllocations + 1); + BMQTST_ASSERT_EQ(obj.size(), static_cast(k_FULL_LEN)); + BMQTST_ASSERT_EQ(TestType::s_numAliveInstances, 2 * k_STATIC_LEN); + BMQTST_ASSERT_EQ(ta.numAllocations(), numAllocations + 1); for (size_t i = 0; i < k_FULL_LEN; ++i) { const int expected = (i < (k_STATIC_LEN / 2)) ? 1 : 3; - ASSERT_EQ_D(i, obj[i].valueAsInt(), expected); + BMQTST_ASSERT_EQ_D(i, obj[i].valueAsInt(), expected); } // 4) Again resize to twice the static length (i.e. same size) obj.resize(k_FULL_LEN, TestType(4, bmqtst::TestHelperUtil::allocator())); - ASSERT_EQ(obj.size(), static_cast(k_FULL_LEN)); - ASSERT_EQ(TestType::s_numAliveInstances, 2 * k_STATIC_LEN); - ASSERT_EQ(ta.numAllocations(), numAllocations + 1); + BMQTST_ASSERT_EQ(obj.size(), static_cast(k_FULL_LEN)); + BMQTST_ASSERT_EQ(TestType::s_numAliveInstances, 2 * k_STATIC_LEN); + BMQTST_ASSERT_EQ(ta.numAllocations(), numAllocations + 1); for (size_t i = 0; i < k_FULL_LEN; ++i) { const int expected = (i < (k_STATIC_LEN / 2)) ? 1 : 3; - ASSERT_EQ_D(i, obj[i].valueAsInt(), expected); + BMQTST_ASSERT_EQ_D(i, obj[i].valueAsInt(), expected); } // 5) Resize to zero obj.resize(0, TestType(5, bmqtst::TestHelperUtil::allocator())); - ASSERT(obj.empty()); - ASSERT_EQ(obj.size(), 0UL); - ASSERT_EQ(TestType::s_numAliveInstances, 0); - ASSERT_EQ(ta.numAllocations(), numAllocations + 1); + BMQTST_ASSERT(obj.empty()); + BMQTST_ASSERT_EQ(obj.size(), 0UL); + BMQTST_ASSERT_EQ(TestType::s_numAliveInstances, 0); + BMQTST_ASSERT_EQ(ta.numAllocations(), numAllocations + 1); } static void test6_assign() @@ -660,9 +660,9 @@ static void test6_assign() obj.assign(srcVec.begin(), srcVec.end()); // Verify - ASSERT_EQ(obj.size(), srcVec.size()); + BMQTST_ASSERT_EQ(obj.size(), srcVec.size()); for (size_t i = 0; i < obj.size(); ++i) { - ASSERT_EQ_D(i, obj[i].valueAsInt(), srcVec[i].valueAsInt()); + BMQTST_ASSERT_EQ_D(i, obj[i].valueAsInt(), srcVec[i].valueAsInt()); } } @@ -692,7 +692,7 @@ static void test7_algorithms() // Verify: {1, 2, ..., 30} for (int i = 0; i <= 30; ++i) { - ASSERT_EQ_D(i, obj[i].valueAsInt(), i); + BMQTST_ASSERT_EQ_D(i, obj[i].valueAsInt(), i); } } } @@ -716,7 +716,7 @@ static void test8_allocatorProp() ObjType obj(&ta); obj.push_back(TestType(0, &ta)); - ASSERT_EQ(true, obj.back().d_allocator_p != &ta); + BMQTST_ASSERT_EQ(true, obj.back().d_allocator_p != &ta); } { @@ -727,7 +727,7 @@ static void test8_allocatorProp() bmqc::Array obj(&ta); obj.push_back("foo"); - ASSERT_EQ(true, obj.back().get_allocator().mechanism() == &ta); + BMQTST_ASSERT_EQ(true, obj.back().get_allocator().mechanism() == &ta); } } @@ -751,18 +751,20 @@ static void test9_copyAssignDifferentStaticLength() { ObjType obj(rhs, &ta); - ASSERT_EQ(obj.size(), 2u); - ASSERT_EQ(obj.capacity(), 10u); - ASSERT_EQ(true, bsl::equal(obj.begin(), obj.end(), rhs.begin())); + BMQTST_ASSERT_EQ(obj.size(), 2u); + BMQTST_ASSERT_EQ(obj.capacity(), 10u); + BMQTST_ASSERT_EQ(true, + bsl::equal(obj.begin(), obj.end(), rhs.begin())); } rhs.resize(42, TestType(2)); { ObjType obj(rhs, &ta); - ASSERT_EQ(obj.size(), 42u); - ASSERT_EQ(obj.capacity(), 42u); - ASSERT_EQ(true, bsl::equal(obj.begin(), obj.end(), rhs.begin())); + BMQTST_ASSERT_EQ(obj.size(), 42u); + BMQTST_ASSERT_EQ(obj.capacity(), 42u); + BMQTST_ASSERT_EQ(true, + bsl::equal(obj.begin(), obj.end(), rhs.begin())); } } @@ -776,9 +778,10 @@ static void test9_copyAssignDifferentStaticLength() { ObjType obj(&ta); obj = rhs; - ASSERT_EQ(obj.size(), 2u); - ASSERT_EQ(obj.capacity(), 10u); - ASSERT_EQ(true, bsl::equal(obj.begin(), obj.end(), rhs.begin())); + BMQTST_ASSERT_EQ(obj.size(), 2u); + BMQTST_ASSERT_EQ(obj.capacity(), 10u); + BMQTST_ASSERT_EQ(true, + bsl::equal(obj.begin(), obj.end(), rhs.begin())); } rhs.resize(42, TestType(2)); @@ -786,9 +789,10 @@ static void test9_copyAssignDifferentStaticLength() { ObjType obj(&ta); obj = rhs; - ASSERT_EQ(obj.size(), 42u); - ASSERT_EQ(obj.capacity(), 42u); - ASSERT_EQ(true, bsl::equal(obj.begin(), obj.end(), rhs.begin())); + BMQTST_ASSERT_EQ(obj.size(), 42u); + BMQTST_ASSERT_EQ(obj.capacity(), 42u); + BMQTST_ASSERT_EQ(true, + bsl::equal(obj.begin(), obj.end(), rhs.begin())); } } @@ -801,18 +805,20 @@ static void test9_copyAssignDifferentStaticLength() { ObjType obj(rhs, &ta); - ASSERT_EQ(obj.size(), 2u); - ASSERT_EQ(obj.capacity(), 10u); - ASSERT_EQ(true, bsl::equal(obj.begin(), obj.end(), rhs.begin())); + BMQTST_ASSERT_EQ(obj.size(), 2u); + BMQTST_ASSERT_EQ(obj.capacity(), 10u); + BMQTST_ASSERT_EQ(true, + bsl::equal(obj.begin(), obj.end(), rhs.begin())); } rhs.resize(42, TestType(2)); { ObjType obj(rhs, &ta); - ASSERT_EQ(obj.size(), 42u); - ASSERT_EQ(obj.capacity(), 42u); - ASSERT_EQ(true, bsl::equal(obj.begin(), obj.end(), rhs.begin())); + BMQTST_ASSERT_EQ(obj.size(), 42u); + BMQTST_ASSERT_EQ(obj.capacity(), 42u); + BMQTST_ASSERT_EQ(true, + bsl::equal(obj.begin(), obj.end(), rhs.begin())); } } @@ -826,9 +832,10 @@ static void test9_copyAssignDifferentStaticLength() { ObjType obj(&ta); obj = rhs; - ASSERT_EQ(obj.size(), 2u); - ASSERT_EQ(obj.capacity(), 10u); - ASSERT_EQ(true, bsl::equal(obj.begin(), obj.end(), rhs.begin())); + BMQTST_ASSERT_EQ(obj.size(), 2u); + BMQTST_ASSERT_EQ(obj.capacity(), 10u); + BMQTST_ASSERT_EQ(true, + bsl::equal(obj.begin(), obj.end(), rhs.begin())); } rhs.resize(42, TestType(2)); @@ -836,9 +843,10 @@ static void test9_copyAssignDifferentStaticLength() { ObjType obj(&ta); obj = rhs; - ASSERT_EQ(obj.size(), 42u); - ASSERT_EQ(obj.capacity(), 42u); - ASSERT_EQ(true, bsl::equal(obj.begin(), obj.end(), rhs.begin())); + BMQTST_ASSERT_EQ(obj.size(), 42u); + BMQTST_ASSERT_EQ(obj.capacity(), 42u); + BMQTST_ASSERT_EQ(true, + bsl::equal(obj.begin(), obj.end(), rhs.begin())); } } } @@ -863,9 +871,9 @@ static void test10_pushBackSelfRef() for (int i = 0; i < k_SIZE; ++i) { obj.push_back(TestType(i, bmqtst::TestHelperUtil::allocator())); } - ASSERT_PASS(obj.push_back(obj[k_STATIC_LEN])); - ASSERT_EQ(k_STATIC_LEN, obj[k_STATIC_LEN].valueAsInt()); - ASSERT_EQ(k_STATIC_LEN, obj[k_SIZE].valueAsInt()); + BMQTST_ASSERT_PASS(obj.push_back(obj[k_STATIC_LEN])); + BMQTST_ASSERT_EQ(k_STATIC_LEN, obj[k_STATIC_LEN].valueAsInt()); + BMQTST_ASSERT_EQ(k_STATIC_LEN, obj[k_SIZE].valueAsInt()); } } diff --git a/src/groups/bmq/bmqc/bmqc_monitoredqueue.t.cpp b/src/groups/bmq/bmqc/bmqc_monitoredqueue.t.cpp index eb61862bb..8d7efd786 100644 --- a/src/groups/bmq/bmqc/bmqc_monitoredqueue.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue.t.cpp @@ -87,7 +87,7 @@ static void test1_MonitoredQueueState_toAscii() ascii = bmqc::MonitoredQueueState::toAscii( bmqc::MonitoredQueueState::Enum(test.d_value)); - ASSERT_EQ_D(test.d_line, ascii, test.d_expected); + BMQTST_ASSERT_EQ_D(test.d_line, ascii, test.d_expected); } } @@ -145,20 +145,20 @@ static void test2_MonitoredQueueState_print() bsl::string expected(bmqtst::TestHelperUtil::allocator()); expected.assign(test.d_expected); expected.append("\n"); - ASSERT_EQ_D(test.d_line, out.str(), expected); + BMQTST_ASSERT_EQ_D(test.d_line, out.str(), expected); // operator<< out.reset(); out << obj; - ASSERT_EQ_D(test.d_line, out.str(), test.d_expected); + BMQTST_ASSERT_EQ_D(test.d_line, out.str(), test.d_expected); // 2. 'badbit' set out.reset(); out.setstate(bsl::ios_base::badbit); bmqc::MonitoredQueueState::print(out, obj, 0, -1); - ASSERT_EQ_D(test.d_line, out.str(), ""); + BMQTST_ASSERT_EQ_D(test.d_line, out.str(), ""); } } diff --git a/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccfixedqueue.t.cpp b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccfixedqueue.t.cpp index 74cfd3d49..89b2ae39a 100644 --- a/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccfixedqueue.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccfixedqueue.t.cpp @@ -167,34 +167,34 @@ static void test1_MonitoredQueue_breathingTest() k_QUEUE_SIZE, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); queue.setWatermarks(k_LOW_WATERMARK, k_HIGH_WATERMARK, k_HIGH_WATERMARK2); - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); - ASSERT_EQ(queue.lowWatermark(), k_LOW_WATERMARK); - ASSERT_EQ(queue.highWatermark(), k_HIGH_WATERMARK); - ASSERT_EQ(queue.highWatermark2(), k_HIGH_WATERMARK2); + BMQTST_ASSERT_EQ(queue.lowWatermark(), k_LOW_WATERMARK); + BMQTST_ASSERT_EQ(queue.highWatermark(), k_HIGH_WATERMARK); + BMQTST_ASSERT_EQ(queue.highWatermark2(), k_HIGH_WATERMARK2); // pushBack two items - ASSERT_EQ(queue.pushBack(1), 0); - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), 1); - ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.pushBack(1), 0); + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), 1); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); - ASSERT_EQ(queue.tryPushBack(2), 0); - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), 2); - ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.tryPushBack(2), 0); + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), 2); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); int item = -1; @@ -206,23 +206,23 @@ static void test1_MonitoredQueue_breathingTest() // // int item = -1; // const bsls::TimeInterval timeout = bsls::TimeInterval( // 0, 5 * bdlt::TimeUnitRatio::k_NANOSECONDS_PER_MILLISECOND); - // ASSERT_SAFE_FAIL(queue.timedPopFront(&item, timeout)); + // BMQTST_ASSERT_SAFE_FAIL(queue.timedPopFront(&item, timeout)); // (void)timeout; // prod-build compiler happiness // popfront two items item = -1; - ASSERT_EQ(queue.tryPopFront(&item), 0); - ASSERT_EQ(item, 1); - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), 1); - ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.tryPopFront(&item), 0); + BMQTST_ASSERT_EQ(item, 1); + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), 1); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); item = -1; queue.popFront(&item); - ASSERT_EQ(item, 2); - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(item, 2); + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); } { @@ -233,34 +233,34 @@ static void test1_MonitoredQueue_breathingTest() true, // supportTimedOperations bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); queue.setWatermarks(k_LOW_WATERMARK, k_HIGH_WATERMARK, k_HIGH_WATERMARK2); - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); - ASSERT_EQ(queue.lowWatermark(), k_LOW_WATERMARK); - ASSERT_EQ(queue.highWatermark(), k_HIGH_WATERMARK); - ASSERT_EQ(queue.highWatermark2(), k_HIGH_WATERMARK2); + BMQTST_ASSERT_EQ(queue.lowWatermark(), k_LOW_WATERMARK); + BMQTST_ASSERT_EQ(queue.highWatermark(), k_HIGH_WATERMARK); + BMQTST_ASSERT_EQ(queue.highWatermark2(), k_HIGH_WATERMARK2); // pushBack two items - ASSERT_EQ(queue.pushBack(1), 0); - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), 1); - ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.pushBack(1), 0); + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), 1); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); - ASSERT_EQ(queue.pushBack(2), 0); - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), 2); - ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.pushBack(2), 0); + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), 2); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); // popFront two items // 1. timedPopFront @@ -268,19 +268,19 @@ static void test1_MonitoredQueue_breathingTest() const bsls::TimeInterval timeout = bsls::TimeInterval( 0, 5 * bdlt::TimeUnitRatio::k_NANOSECONDS_PER_MILLISECOND); - ASSERT_EQ(queue.timedPopFront(&item, timeout), 0); - ASSERT_EQ(item, 1) - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), 1); - ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.timedPopFront(&item, timeout), 0); + BMQTST_ASSERT_EQ(item, 1) + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), 1); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); // 2. popFront item = -1; queue.popFront(&item); - ASSERT_EQ(item, 2); - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(item, 2); + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); } } @@ -326,21 +326,21 @@ static void test2_MonitoredQueue_reset() queue.tryPushBack(8); queue.tryPushBack(9); - ASSERT_EQ(queue.tryPushBack(10), -1); + BMQTST_ASSERT_EQ(queue.tryPushBack(10), -1); - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), k_QUEUE_SIZE); - ASSERT_EQ(queue.isEmpty(), false); - ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_QUEUE_FILLED); + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_QUEUE_FILLED); // 2. Reset the queue and verify that items were removed and state is reset // to an empty queue. queue.reset(); - ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); + BMQTST_ASSERT_EQ(queue.capacity(), k_QUEUE_SIZE); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); } BSLA_MAYBE_UNUSED diff --git a/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleconsumerqueue.t.cpp b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleconsumerqueue.t.cpp index 5187413e3..10dc5a590 100644 --- a/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleconsumerqueue.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_monitoredqueue_bdlccsingleconsumerqueue.t.cpp @@ -170,46 +170,46 @@ static void test1_MonitoredSingleConsumerQueue_breathingTest() k_QUEUE_SIZE, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); queue.setWatermarks(k_LOW_WATERMARK, k_HIGH_WATERMARK, k_HIGH_WATERMARK2); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); - ASSERT_EQ(queue.lowWatermark(), k_LOW_WATERMARK); - ASSERT_EQ(queue.highWatermark(), k_HIGH_WATERMARK); - ASSERT_EQ(queue.highWatermark2(), k_HIGH_WATERMARK2); + BMQTST_ASSERT_EQ(queue.lowWatermark(), k_LOW_WATERMARK); + BMQTST_ASSERT_EQ(queue.highWatermark(), k_HIGH_WATERMARK); + BMQTST_ASSERT_EQ(queue.highWatermark2(), k_HIGH_WATERMARK2); // pushBack two items - ASSERT_EQ(queue.pushBack(1), 0); - ASSERT_EQ(queue.numElements(), 1); - ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.pushBack(1), 0); + BMQTST_ASSERT_EQ(queue.numElements(), 1); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); - ASSERT_EQ(queue.tryPushBack(2), 0); - ASSERT_EQ(queue.numElements(), 2); - ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.tryPushBack(2), 0); + BMQTST_ASSERT_EQ(queue.numElements(), 2); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); // Verify timed popFront is undefined int item = -1; // popFront two items item = -1; - ASSERT_EQ(queue.tryPopFront(&item), 0); - ASSERT_EQ(item, 1); - ASSERT_EQ(queue.numElements(), 1); - ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.tryPopFront(&item), 0); + BMQTST_ASSERT_EQ(item, 1); + BMQTST_ASSERT_EQ(queue.numElements(), 1); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); item = -1; queue.popFront(&item); - ASSERT_EQ(item, 2); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(item, 2); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); } { @@ -221,30 +221,30 @@ static void test1_MonitoredSingleConsumerQueue_breathingTest() // supportTimedOperations bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); queue.setWatermarks(k_LOW_WATERMARK, k_HIGH_WATERMARK, k_HIGH_WATERMARK2); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); - ASSERT_EQ(queue.lowWatermark(), k_LOW_WATERMARK); - ASSERT_EQ(queue.highWatermark(), k_HIGH_WATERMARK); - ASSERT_EQ(queue.highWatermark2(), k_HIGH_WATERMARK2); + BMQTST_ASSERT_EQ(queue.lowWatermark(), k_LOW_WATERMARK); + BMQTST_ASSERT_EQ(queue.highWatermark(), k_HIGH_WATERMARK); + BMQTST_ASSERT_EQ(queue.highWatermark2(), k_HIGH_WATERMARK2); // pushBack two items - ASSERT_EQ(queue.pushBack(1), 0); - ASSERT_EQ(queue.numElements(), 1); - ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.pushBack(1), 0); + BMQTST_ASSERT_EQ(queue.numElements(), 1); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); - ASSERT_EQ(queue.pushBack(2), 0); - ASSERT_EQ(queue.numElements(), 2); - ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.pushBack(2), 0); + BMQTST_ASSERT_EQ(queue.numElements(), 2); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); // popFront two items // 1. timedPopFront @@ -252,17 +252,17 @@ static void test1_MonitoredSingleConsumerQueue_breathingTest() const bsls::TimeInterval timeout = bsls::TimeInterval( 0, 5 * bdlt::TimeUnitRatio::k_NANOSECONDS_PER_MILLISECOND); - ASSERT_EQ(queue.timedPopFront(&item, timeout), 0); - ASSERT_EQ(item, 1) - ASSERT_EQ(queue.numElements(), 1); - ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.timedPopFront(&item, timeout), 0); + BMQTST_ASSERT_EQ(item, 1) + BMQTST_ASSERT_EQ(queue.numElements(), 1); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); // 2. popFront item = -1; queue.popFront(&item); - ASSERT_EQ(item, 2); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(item, 2); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); } } @@ -309,18 +309,18 @@ static void test2_MonitoredSingleConsumerQueue_exceed_reset() queue.tryPushBack(8); queue.tryPushBack(9); - ASSERT_EQ(queue.tryPushBack(10), 0); + BMQTST_ASSERT_EQ(queue.tryPushBack(10), 0); - ASSERT_EQ(queue.numElements(), k_QUEUE_SIZE + 1); - ASSERT_EQ(queue.isEmpty(), false); + BMQTST_ASSERT_EQ(queue.numElements(), k_QUEUE_SIZE + 1); + BMQTST_ASSERT_EQ(queue.isEmpty(), false); // 2. Reset the queue and verify that items were removed and state is reset // to an empty queue. queue.reset(); - ASSERT_EQ(queue.numElements(), 0); - ASSERT_EQ(queue.isEmpty(), true); - ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); + BMQTST_ASSERT_EQ(queue.numElements(), 0); + BMQTST_ASSERT_EQ(queue.isEmpty(), true); + BMQTST_ASSERT_EQ(queue.state(), bmqc::MonitoredQueueState::e_NORMAL); } BSLA_MAYBE_UNUSED diff --git a/src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.t.cpp b/src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.t.cpp index 33af002bb..cf3737008 100644 --- a/src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_multiqueuethreadpool.t.cpp @@ -187,12 +187,12 @@ static void test1_breathingTest() bmqtst::TestHelperUtil::allocator()); MQTP mfqtp(config, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(mfqtp.isStarted(), false); - ASSERT_EQ(mfqtp.numQueues(), k_NUM_QUEUES); - ASSERT_EQ(mfqtp.isSingleThreaded(), false); - ASSERT_EQ(mfqtp.start(), 0); - ASSERT_NE(mfqtp.start(), 0); // MQTP has already been started - ASSERT_EQ(mfqtp.isStarted(), true); + BMQTST_ASSERT_EQ(mfqtp.isStarted(), false); + BMQTST_ASSERT_EQ(mfqtp.numQueues(), k_NUM_QUEUES); + BMQTST_ASSERT_EQ(mfqtp.isSingleThreaded(), false); + BMQTST_ASSERT_EQ(mfqtp.start(), 0); + BMQTST_ASSERT_NE(mfqtp.start(), 0); // MQTP has already been started + BMQTST_ASSERT_EQ(mfqtp.isStarted(), true); MQTP::Event* event = mfqtp.getUnmanagedEvent(); event->object() = 0; @@ -211,19 +211,19 @@ static void test1_breathingTest() mfqtp.enqueueEventOnAllQueues(event); mfqtp.stop(); - ASSERT_EQ(mfqtp.isStarted(), false); + BMQTST_ASSERT_EQ(mfqtp.isStarted(), false); - ASSERT_EQ(queueContextMap[0].size(), 2U); - ASSERT_EQ(queueContextMap[0][0], 0); - ASSERT_EQ(queueContextMap[0][1], 3); + BMQTST_ASSERT_EQ(queueContextMap[0].size(), 2U); + BMQTST_ASSERT_EQ(queueContextMap[0][0], 0); + BMQTST_ASSERT_EQ(queueContextMap[0][1], 3); - ASSERT_EQ(queueContextMap[0].size(), 2U); - ASSERT_EQ(queueContextMap[1][0], 1); - ASSERT_EQ(queueContextMap[1][1], 3); + BMQTST_ASSERT_EQ(queueContextMap[0].size(), 2U); + BMQTST_ASSERT_EQ(queueContextMap[1][0], 1); + BMQTST_ASSERT_EQ(queueContextMap[1][1], 3); - ASSERT_EQ(queueContextMap[0].size(), 2U); - ASSERT_EQ(queueContextMap[2][0], 2); - ASSERT_EQ(queueContextMap[2][1], 3); + BMQTST_ASSERT_EQ(queueContextMap[0].size(), 2U); + BMQTST_ASSERT_EQ(queueContextMap[2][0], 2); + BMQTST_ASSERT_EQ(queueContextMap[2][1], 3); threadPool.stop(); } @@ -543,4 +543,4 @@ int main(int argc, char* argv[]) } // ---------------------------------------------------------------------------- -// NOTICE: \ No newline at end of file +// NOTICE: diff --git a/src/groups/bmq/bmqc/bmqc_orderedhashmap.t.cpp b/src/groups/bmq/bmqc/bmqc_orderedhashmap.t.cpp index 26adbfa8f..6fb9c2de8 100644 --- a/src/groups/bmq/bmqc/bmqc_orderedhashmap.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_orderedhashmap.t.cpp @@ -129,34 +129,34 @@ static void test1_breathingTest() MyMapType map(bmqtst::TestHelperUtil::allocator()); const MyMapType& cmap = map; - ASSERT_EQ(true, map.begin() == map.end()); - ASSERT_EQ(true, cmap.begin() == cmap.end()); + BMQTST_ASSERT_EQ(true, map.begin() == map.end()); + BMQTST_ASSERT_EQ(true, cmap.begin() == cmap.end()); map.clear(); - ASSERT_EQ(0U, map.count(1)); - ASSERT_EQ(0U, map.erase(1)); - ASSERT_EQ(true, map.end() == map.find(1)); - ASSERT_EQ(true, cmap.empty()); - ASSERT_EQ(true, cmap.end() == cmap.find(1)); - ASSERT_EQ(0U, cmap.count(1)); - ASSERT_EQ(0U, cmap.size()); + BMQTST_ASSERT_EQ(0U, map.count(1)); + BMQTST_ASSERT_EQ(0U, map.erase(1)); + BMQTST_ASSERT_EQ(true, map.end() == map.find(1)); + BMQTST_ASSERT_EQ(true, cmap.empty()); + BMQTST_ASSERT_EQ(true, cmap.end() == cmap.find(1)); + BMQTST_ASSERT_EQ(0U, cmap.count(1)); + BMQTST_ASSERT_EQ(0U, cmap.size()); bsl::pair rc = map.insert(bsl::make_pair(1, s)); - ASSERT_EQ(true, rc.first != map.end()); - ASSERT_EQ(rc.second, true); - ASSERT_EQ(1U, rc.first->first); - ASSERT_EQ(s, rc.first->second); - ASSERT_EQ(1U, cmap.count(1)); + BMQTST_ASSERT_EQ(true, rc.first != map.end()); + BMQTST_ASSERT_EQ(rc.second, true); + BMQTST_ASSERT_EQ(1U, rc.first->first); + BMQTST_ASSERT_EQ(s, rc.first->second); + BMQTST_ASSERT_EQ(1U, cmap.count(1)); ConstIterType cit = cmap.find(1); - ASSERT_EQ(true, cmap.end() != cit); - ASSERT_EQ(1U, cmap.size()); - ASSERT_EQ(false, cmap.empty()); - ASSERT_EQ(1U, map.erase(1)); - ASSERT_EQ(true, map.begin() == map.end()); - ASSERT_EQ(true, cmap.begin() == cmap.end()); - ASSERT_EQ(true, cmap.end() == cmap.find(1)); + BMQTST_ASSERT_EQ(true, cmap.end() != cit); + BMQTST_ASSERT_EQ(1U, cmap.size()); + BMQTST_ASSERT_EQ(false, cmap.empty()); + BMQTST_ASSERT_EQ(1U, map.erase(1)); + BMQTST_ASSERT_EQ(true, map.begin() == map.end()); + BMQTST_ASSERT_EQ(true, cmap.begin() == cmap.end()); + BMQTST_ASSERT_EQ(true, cmap.end() == cmap.find(1)); } static void test2_impDetails_nextPrime() @@ -190,11 +190,11 @@ static void test2_impDetails_nextPrime() break; // RETURN } - ASSERT_EQ(isPrime(currPrime), true); - ASSERT_GT(currPrime, prevPrime); + BMQTST_ASSERT_EQ(isPrime(currPrime), true); + BMQTST_ASSERT_GT(currPrime, prevPrime); } - ASSERT_EQ(lastPrime, 0U); + BMQTST_ASSERT_EQ(lastPrime, 0U); } static void test3_insert() @@ -229,23 +229,23 @@ static void test3_insert() // Insert 1M elements for (size_t i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = map.insert(bsl::make_pair(i, i + 1)); - ASSERT_EQ_D(i, true, rc.second); - ASSERT_EQ_D(i, true, rc.first != map.end()); - ASSERT_EQ_D(i, i, rc.first->first); - ASSERT_EQ_D(i, (i + 1), rc.first->second); - ASSERT_EQ_D(i, true, 1.5 >= map.load_factor()); + BMQTST_ASSERT_EQ_D(i, true, rc.second); + BMQTST_ASSERT_EQ_D(i, true, rc.first != map.end()); + BMQTST_ASSERT_EQ_D(i, i, rc.first->first); + BMQTST_ASSERT_EQ_D(i, (i + 1), rc.first->second); + BMQTST_ASSERT_EQ_D(i, true, 1.5 >= map.load_factor()); } - ASSERT_EQ(map.size(), k_NUM_ELEMENTS); + BMQTST_ASSERT_EQ(map.size(), k_NUM_ELEMENTS); // Iterate and confirm { const MyMapType& cmap = map; size_t i = 0; for (ConstIterType cit = cmap.begin(); cit != cmap.end(); ++cit) { - ASSERT_EQ_D(i, true, i < k_NUM_ELEMENTS); - ASSERT_EQ_D(i, i, cit->first); - ASSERT_EQ_D(i, (i + 1), cit->second); + BMQTST_ASSERT_EQ_D(i, true, i < k_NUM_ELEMENTS); + BMQTST_ASSERT_EQ_D(i, i, cit->first); + BMQTST_ASSERT_EQ_D(i, (i + 1), cit->second); ++i; } } @@ -256,14 +256,14 @@ static void test3_insert() size_t i = k_NUM_ELEMENTS - 1; ConstIterType cit = --(cmap.end()); // last element for (; cit != cmap.begin(); --cit) { - ASSERT_EQ_D(i, true, i > 0); - ASSERT_EQ_D(i, i, cit->first); - ASSERT_EQ_D(i, (i + 1), cit->second); + BMQTST_ASSERT_EQ_D(i, true, i > 0); + BMQTST_ASSERT_EQ_D(i, i, cit->first); + BMQTST_ASSERT_EQ_D(i, (i + 1), cit->second); --i; } - ASSERT_EQ(true, cit == cmap.begin()); - ASSERT_EQ(cit->first, i); - ASSERT_EQ(cit->second, (i + 1)); + BMQTST_ASSERT_EQ(true, cit == cmap.begin()); + BMQTST_ASSERT_EQ(cit->first, i); + BMQTST_ASSERT_EQ(cit->second, (i + 1)); } } @@ -300,22 +300,22 @@ static void test4_rinsert() // Insert 1M elements for (int i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = map.rinsert(bsl::make_pair(i, i + 1)); - ASSERT_EQ_D(i, true, rc.second); - ASSERT_EQ_D(i, true, rc.first != map.end()); - ASSERT_EQ_D(i, i, rc.first->first); - ASSERT_EQ_D(i, (i + 1), rc.first->second); - ASSERT_EQ_D(i, true, 1.5 >= map.load_factor()); + BMQTST_ASSERT_EQ_D(i, true, rc.second); + BMQTST_ASSERT_EQ_D(i, true, rc.first != map.end()); + BMQTST_ASSERT_EQ_D(i, i, rc.first->first); + BMQTST_ASSERT_EQ_D(i, (i + 1), rc.first->second); + BMQTST_ASSERT_EQ_D(i, true, 1.5 >= map.load_factor()); } - ASSERT_EQ(map.size(), static_cast(k_NUM_ELEMENTS)); + BMQTST_ASSERT_EQ(map.size(), static_cast(k_NUM_ELEMENTS)); // Iterate and confirm { const MyMapType& cmap = map; int i = k_NUM_ELEMENTS - 1; for (ConstIterType cit = cmap.begin(); cit != cmap.end(); ++cit) { - ASSERT_EQ_D(i, i, cit->first); - ASSERT_EQ_D(i, (i + 1), cit->second); + BMQTST_ASSERT_EQ_D(i, i, cit->first); + BMQTST_ASSERT_EQ_D(i, (i + 1), cit->second); --i; } } @@ -326,14 +326,14 @@ static void test4_rinsert() int i = 0; ConstIterType cit = --(cmap.end()); // last element for (; cit != cmap.begin(); --cit) { - ASSERT_EQ_D(i, true, i < k_NUM_ELEMENTS); - ASSERT_EQ_D(i, i, cit->first); - ASSERT_EQ_D(i, (i + 1), cit->second); + BMQTST_ASSERT_EQ_D(i, true, i < k_NUM_ELEMENTS); + BMQTST_ASSERT_EQ_D(i, i, cit->first); + BMQTST_ASSERT_EQ_D(i, (i + 1), cit->second); ++i; } - ASSERT_EQ(true, cit == cmap.begin()); - ASSERT_EQ(i, cit->first); - ASSERT_EQ(cit->second, (i + 1)); + BMQTST_ASSERT_EQ(true, cit == cmap.begin()); + BMQTST_ASSERT_EQ(i, cit->first); + BMQTST_ASSERT_EQ(cit->second, (i + 1)); } } @@ -358,10 +358,10 @@ static void test5_insertEraseInsert() // Insert elements for (size_t i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = map.insert(bsl::make_pair(i, i + 1)); - ASSERT_EQ_D(i, rc.second, true); - ASSERT_EQ_D(i, true, rc.first != map.end()); - ASSERT_EQ_D(i, i, rc.first->first); - ASSERT_EQ_D(i, (i + 1), rc.first->second); + BMQTST_ASSERT_EQ_D(i, rc.second, true); + BMQTST_ASSERT_EQ_D(i, true, rc.first != map.end()); + BMQTST_ASSERT_EQ_D(i, i, rc.first->first); + BMQTST_ASSERT_EQ_D(i, (i + 1), rc.first->second); } // Iterate and confirm @@ -369,21 +369,21 @@ static void test5_insertEraseInsert() const MyMapType& cmap = map; size_t i = 0; for (ConstIterType cit = cmap.begin(); cit != cmap.end(); ++cit) { - ASSERT_EQ_D(i, true, i < k_NUM_ELEMENTS); - ASSERT_EQ_D(i, i, cit->first); - ASSERT_EQ_D(i, (i + 1), cit->second); + BMQTST_ASSERT_EQ_D(i, true, i < k_NUM_ELEMENTS); + BMQTST_ASSERT_EQ_D(i, i, cit->first); + BMQTST_ASSERT_EQ_D(i, (i + 1), cit->second); ++i; } } // Erase few elements for (size_t i = 0; i < k_NUM_ELEMENTS; i += k_STEP) { - ASSERT_EQ_D(i, 1U, map.erase(i)); + BMQTST_ASSERT_EQ_D(i, 1U, map.erase(i)); } // Find erased elements for (size_t i = 0; i < k_NUM_ELEMENTS; i += k_STEP) { - ASSERT_EQ_D(i, true, map.end() == map.find(i)); + BMQTST_ASSERT_EQ_D(i, true, map.end() == map.find(i)); } // Iterate and confirm @@ -391,9 +391,9 @@ static void test5_insertEraseInsert() const MyMapType& cmap = map; size_t i = 1; for (ConstIterType cit = cmap.begin(); cit != cmap.end(); ++cit) { - ASSERT_EQ_D(i, true, i < k_NUM_ELEMENTS); - ASSERT_EQ_D(i, i, cit->first); - ASSERT_EQ_D(i, (i + 1), cit->second); + BMQTST_ASSERT_EQ_D(i, true, i < k_NUM_ELEMENTS); + BMQTST_ASSERT_EQ_D(i, i, cit->first); + BMQTST_ASSERT_EQ_D(i, (i + 1), cit->second); ++i; if (i % k_STEP == 0) { ++i; @@ -404,10 +404,10 @@ static void test5_insertEraseInsert() // Insert elements which were erased earlier for (size_t i = 0; i < k_NUM_ELEMENTS; i += k_STEP) { RcType rc = map.insert(bsl::make_pair(i, i + 1)); - ASSERT_EQ_D(i, true, rc.second); - ASSERT_EQ_D(i, true, rc.first != map.end()); - ASSERT_EQ_D(i, i, rc.first->first); - ASSERT_EQ_D(i, (i + 1), rc.first->second); + BMQTST_ASSERT_EQ_D(i, true, rc.second); + BMQTST_ASSERT_EQ_D(i, true, rc.first != map.end()); + BMQTST_ASSERT_EQ_D(i, i, rc.first->first); + BMQTST_ASSERT_EQ_D(i, (i + 1), rc.first->second); } // Iterate and confirm @@ -417,9 +417,9 @@ static void test5_insertEraseInsert() // Iterate over original elements for (; it != map.end(); ++it) { - ASSERT_EQ_D(i, true, it != map.end()); - ASSERT_EQ_D(i, i, it->first); - ASSERT_EQ_D(i, (i + 1), it->second); + BMQTST_ASSERT_EQ_D(i, true, it != map.end()); + BMQTST_ASSERT_EQ_D(i, i, it->first); + BMQTST_ASSERT_EQ_D(i, (i + 1), it->second); if (it->first == (k_NUM_ELEMENTS - 1)) { ++it; break; @@ -432,13 +432,13 @@ static void test5_insertEraseInsert() // Iterate ove elements inserted after erase operation for (i = 0; i < k_NUM_ELEMENTS; i += k_STEP) { - ASSERT_EQ_D(i, true, it != map.end()); - ASSERT_EQ_D(i, i, it->first); - ASSERT_EQ_D(i, (i + 1), it->second); + BMQTST_ASSERT_EQ_D(i, true, it != map.end()); + BMQTST_ASSERT_EQ_D(i, i, it->first); + BMQTST_ASSERT_EQ_D(i, (i + 1), it->second); ++it; } - ASSERT_EQ(true, it == map.end()); + BMQTST_ASSERT_EQ(true, it == map.end()); } } @@ -455,37 +455,37 @@ static void test6_clear() typedef bsl::pair RcType; MyMapType map(bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(true, map.empty()); - ASSERT_EQ(true, map.begin() == map.end()); - ASSERT_EQ(0U, map.size()); - ASSERT_EQ(true, map.load_factor() == 0.0); + BMQTST_ASSERT_EQ(true, map.empty()); + BMQTST_ASSERT_EQ(true, map.begin() == map.end()); + BMQTST_ASSERT_EQ(0U, map.size()); + BMQTST_ASSERT_EQ(true, map.load_factor() == 0.0); map.clear(); - ASSERT_EQ(true, map.empty()); - ASSERT_EQ(true, map.begin() == map.end()); - ASSERT_EQ(0U, map.size()); - ASSERT_EQ(true, map.load_factor() == 0.0); + BMQTST_ASSERT_EQ(true, map.empty()); + BMQTST_ASSERT_EQ(true, map.begin() == map.end()); + BMQTST_ASSERT_EQ(0U, map.size()); + BMQTST_ASSERT_EQ(true, map.load_factor() == 0.0); const int k_NUM_ELEMENTS = 100; // Insert elements for (int i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = map.insert(bsl::make_pair(i, i + 1)); - ASSERT_EQ_D(i, rc.second, true); - ASSERT_EQ_D(i, true, rc.first != map.end()); - ASSERT_EQ_D(i, i, rc.first->first); - ASSERT_EQ_D(i, (i + 1), rc.first->second); + BMQTST_ASSERT_EQ_D(i, rc.second, true); + BMQTST_ASSERT_EQ_D(i, true, rc.first != map.end()); + BMQTST_ASSERT_EQ_D(i, i, rc.first->first); + BMQTST_ASSERT_EQ_D(i, (i + 1), rc.first->second); } - ASSERT_EQ(false, map.empty()); - ASSERT_EQ(true, map.begin() != map.end()); - ASSERT_EQ(static_cast(k_NUM_ELEMENTS), map.size()); + BMQTST_ASSERT_EQ(false, map.empty()); + BMQTST_ASSERT_EQ(true, map.begin() != map.end()); + BMQTST_ASSERT_EQ(static_cast(k_NUM_ELEMENTS), map.size()); map.clear(); - ASSERT_EQ(true, map.empty()); - ASSERT_EQ(true, map.begin() == map.end()); - ASSERT_EQ(0U, map.size()); - ASSERT_EQ(true, map.load_factor() == 0.0); + BMQTST_ASSERT_EQ(true, map.empty()); + BMQTST_ASSERT_EQ(true, map.begin() == map.end()); + BMQTST_ASSERT_EQ(0U, map.size()); + BMQTST_ASSERT_EQ(true, map.load_factor() == 0.0); } static void test7_erase() @@ -507,10 +507,10 @@ static void test7_erase() // Insert elements for (int i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = map.insert(bsl::make_pair(i, i)); - ASSERT_EQ_D(i, rc.second, true); - ASSERT_EQ_D(i, true, rc.first != map.end()); - ASSERT_EQ_D(i, i, rc.first->first); - ASSERT_EQ_D(i, i, rc.first->second); + BMQTST_ASSERT_EQ_D(i, rc.second, true); + BMQTST_ASSERT_EQ_D(i, true, rc.first != map.end()); + BMQTST_ASSERT_EQ_D(i, i, rc.first->first); + BMQTST_ASSERT_EQ_D(i, i, rc.first->second); } const MyMapType& cmap = map; @@ -519,8 +519,8 @@ static void test7_erase() map.erase(cit++); } - ASSERT_EQ(0U, map.size()); - ASSERT_EQ(true, map.empty()); + BMQTST_ASSERT_EQ(0U, map.size()); + BMQTST_ASSERT_EQ(true, map.empty()); } static void test8_eraseClear() @@ -545,11 +545,11 @@ static void test8_eraseClear() for (size_t i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = map.insert( bsl::make_pair(TestKeyType(i), TestValueType(i))); - ASSERT_EQ_D(i, rc.second, true); - ASSERT_EQ_D(i, true, rc.first != map.end()); + BMQTST_ASSERT_EQ_D(i, rc.second, true); + BMQTST_ASSERT_EQ_D(i, true, rc.first != map.end()); } - ASSERT_EQ(k_NUM_ELEMENTS, map.size()); + BMQTST_ASSERT_EQ(k_NUM_ELEMENTS, map.size()); // Reset static counters TestKeyType::s_numDeletions = 0; @@ -560,8 +560,8 @@ static void test8_eraseClear() map.erase(it++); } - ASSERT_EQ(TestKeyType::s_numDeletions, k_NUM_ELEMENTS); - ASSERT_EQ(TestValueType::s_numDeletions, k_NUM_ELEMENTS); + BMQTST_ASSERT_EQ(TestKeyType::s_numDeletions, k_NUM_ELEMENTS); + BMQTST_ASSERT_EQ(TestValueType::s_numDeletions, k_NUM_ELEMENTS); } static void test9_insertFailure() @@ -586,15 +586,15 @@ static void test9_insertFailure() // Insert elements for (size_t i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = map.insert(bsl::make_pair(i, i)); - ASSERT_EQ_D(i, true, rc.second); - ASSERT_EQ_D(i, true, rc.first != map.end()); + BMQTST_ASSERT_EQ_D(i, true, rc.second); + BMQTST_ASSERT_EQ_D(i, true, rc.first != map.end()); } // insert same keys again for (size_t i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = map.insert(bsl::make_pair(i, i)); - ASSERT_EQ_D(i, rc.second, false); - ASSERT_EQ_D(i, true, rc.first == map.find(i)); + BMQTST_ASSERT_EQ_D(i, rc.second, false); + BMQTST_ASSERT_EQ_D(i, true, rc.first == map.find(i)); } } @@ -619,23 +619,23 @@ static void test10_erasureIterator() // Insert elements for (size_t i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = map.insert(bsl::make_pair(i, i)); - ASSERT_EQ_D(i, rc.second, true); - ASSERT_EQ_D(i, true, rc.first != map.end()); + BMQTST_ASSERT_EQ_D(i, rc.second, true); + BMQTST_ASSERT_EQ_D(i, true, rc.first != map.end()); } // Find IterType iter = map.find(9000); - ASSERT_EQ(true, iter != map.end()); - ASSERT_EQ(iter->first, 9000U); + BMQTST_ASSERT_EQ(true, iter != map.end()); + BMQTST_ASSERT_EQ(iter->first, 9000U); // erase IterType it = map.erase(iter); - ASSERT_EQ(true, it != map.end()); - ASSERT_EQ(true, it == map.find(9001)); + BMQTST_ASSERT_EQ(true, it != map.end()); + BMQTST_ASSERT_EQ(true, it == map.find(9001)); size_t i = 9001; for (; it != map.end(); ++it) { - ASSERT_EQ_D(i, i, it->first); + BMQTST_ASSERT_EQ_D(i, i, it->first); ++i; } } @@ -668,8 +668,8 @@ static void test11_copyConstructor() // Insert elements for (size_t i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = m1p->insert(bsl::make_pair(i, i)); - ASSERT_EQ_D(i, rc.second, true); - ASSERT_EQ_D(i, true, rc.first != m1p->end()); + BMQTST_ASSERT_EQ_D(i, rc.second, true); + BMQTST_ASSERT_EQ_D(i, true, rc.first != m1p->end()); } MyMapType m2(*m1p, bmqtst::TestHelperUtil::allocator()); @@ -677,8 +677,8 @@ static void test11_copyConstructor() // Iterate and confirm size_t i = 0; for (ConstIterType cit = m2.begin(); cit != m2.end(); ++cit) { - ASSERT_EQ_D(i, cit->first, i); - ASSERT_EQ_D(i, cit->second, i); + BMQTST_ASSERT_EQ_D(i, cit->first, i); + BMQTST_ASSERT_EQ_D(i, cit->second, i); ++i; } @@ -687,8 +687,8 @@ static void test11_copyConstructor() i = 0; for (ConstIterType cit = m2.begin(); cit != m2.end(); ++cit) { - ASSERT_EQ_D(i, cit->first, i); - ASSERT_EQ_D(i, cit->second, i); + BMQTST_ASSERT_EQ_D(i, cit->first, i); + BMQTST_ASSERT_EQ_D(i, cit->second, i); ++i; } } @@ -722,8 +722,8 @@ static void test12_assignmentOperator() // Insert elements for (size_t i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = m1p->insert(bsl::make_pair(i, i)); - ASSERT_EQ_D(i, rc.second, true); - ASSERT_EQ_D(i, true, rc.first != m1p->end()); + BMQTST_ASSERT_EQ_D(i, rc.second, true); + BMQTST_ASSERT_EQ_D(i, true, rc.first != m1p->end()); } MyMapType m2(bmqtst::TestHelperUtil::allocator()); @@ -731,8 +731,8 @@ static void test12_assignmentOperator() // Insert elements for (size_t i = k_NUM_ELEMENTS; i > 0; --i) { RcType rc = m2.insert(bsl::make_pair(i, i)); - ASSERT_EQ_D(i, rc.second, true); - ASSERT_EQ_D(i, true, rc.first != m2.end()); + BMQTST_ASSERT_EQ_D(i, rc.second, true); + BMQTST_ASSERT_EQ_D(i, true, rc.first != m2.end()); } m2 = *m1p; @@ -740,8 +740,8 @@ static void test12_assignmentOperator() // Iterate and confirm size_t i = 0; for (ConstIterType cit = m2.begin(); cit != m2.end(); ++cit) { - ASSERT_EQ_D(i, cit->first, i); - ASSERT_EQ_D(i, cit->second, i); + BMQTST_ASSERT_EQ_D(i, cit->first, i); + BMQTST_ASSERT_EQ_D(i, cit->second, i); ++i; } @@ -749,8 +749,8 @@ static void test12_assignmentOperator() bmqtst::TestHelperUtil::allocator()->deleteObject(m1p); i = 0; for (ConstIterType cit = m2.begin(); cit != m2.end(); ++cit) { - ASSERT_EQ_D(i, cit->first, i); - ASSERT_EQ_D(i, cit->second, i); + BMQTST_ASSERT_EQ_D(i, cit->first, i); + BMQTST_ASSERT_EQ_D(i, cit->second, i); ++i; } } @@ -773,9 +773,9 @@ static void test13_previousEndIterator() MyMapType map(bmqtst::TestHelperUtil::allocator()); const MyMapType& cmap = map; - ASSERT_EQ(true, map.begin() == map.end()); - ASSERT_EQ(true, cmap.begin() == cmap.end()); - ASSERT_EQ(true, cmap.empty()); + BMQTST_ASSERT_EQ(true, map.begin() == map.end()); + BMQTST_ASSERT_EQ(true, cmap.begin() == cmap.end()); + BMQTST_ASSERT_EQ(true, cmap.empty()); IterType endIt = map.end(); ConstIterType endCit = cmap.end(); @@ -783,41 +783,41 @@ static void test13_previousEndIterator() int i = 0; bsl::pair rc = map.insert(bsl::make_pair(i, i * i)); - ASSERT_EQ(true, rc.first == endIt); - ASSERT_EQ(true, rc.first == endCit); + BMQTST_ASSERT_EQ(true, rc.first == endIt); + BMQTST_ASSERT_EQ(true, rc.first == endCit); - ASSERT_EQ(i, endIt->first); - ASSERT_EQ((i * i), endIt->second); + BMQTST_ASSERT_EQ(i, endIt->first); + BMQTST_ASSERT_EQ((i * i), endIt->second); ++i; for (; i < 10000; ++i) { endIt = map.end(); rc = map.insert(bsl::make_pair(i, i * i)); - ASSERT_EQ_D(i, true, rc.first == endIt); - ASSERT_EQ_D(i, i, endIt->first); - ASSERT_EQ_D(i, (i * i), endIt->second); + BMQTST_ASSERT_EQ_D(i, true, rc.first == endIt); + BMQTST_ASSERT_EQ_D(i, i, endIt->first); + BMQTST_ASSERT_EQ_D(i, (i * i), endIt->second); } // Erase last element map.erase(i - 1); - ASSERT_EQ((i - 2), (--map.end())->first); + BMQTST_ASSERT_EQ((i - 2), (--map.end())->first); endIt = map.end(); ++i; rc = map.insert(bsl::make_pair(i, i * i)); - ASSERT_EQ(true, rc.first == endIt); - ASSERT_EQ(i, endIt->first); - ASSERT_EQ((i * i), endIt->second); + BMQTST_ASSERT_EQ(true, rc.first == endIt); + BMQTST_ASSERT_EQ(i, endIt->first); + BMQTST_ASSERT_EQ((i * i), endIt->second); // rinsert an element, which doesn't affect end(). ++i; endIt = map.end(); rc = map.rinsert(bsl::make_pair(i, i * i)); - ASSERT_EQ(true, endIt == map.end()); + BMQTST_ASSERT_EQ(true, endIt == map.end()); ++i; rc = map.insert(bsl::make_pair(i, i * i)); - ASSERT_EQ(true, endIt == rc.first); - ASSERT_EQ(i, endIt->first); - ASSERT_EQ((i * i), endIt->second); + BMQTST_ASSERT_EQ(true, endIt == rc.first); + BMQTST_ASSERT_EQ(i, endIt->first); + BMQTST_ASSERT_EQ((i * i), endIt->second); } static void test14_localIterator() @@ -853,20 +853,20 @@ static void test14_localIterator() LocalIterType localIt = map.begin(bucket); LocalIterType localEndIt = map.end(bucket); - ASSERT_EQ(false, localIt == localEndIt); - ASSERT_EQ(localIt->first, key); - ASSERT_EQ(localIt->second, key * key); + BMQTST_ASSERT_EQ(false, localIt == localEndIt); + BMQTST_ASSERT_EQ(localIt->first, key); + BMQTST_ASSERT_EQ(localIt->second, key * key); ++localIt; - ASSERT_EQ(true, localIt == localEndIt); + BMQTST_ASSERT_EQ(true, localIt == localEndIt); ConstLocalIterType cLocalIt = cmap.begin(bucket); ConstLocalIterType cLocalEndIt = cmap.end(bucket); - ASSERT_EQ(false, cLocalIt == cLocalEndIt); - ASSERT_EQ(cLocalIt->first, key); - ASSERT_EQ(cLocalIt->second, key * key); + BMQTST_ASSERT_EQ(false, cLocalIt == cLocalEndIt); + BMQTST_ASSERT_EQ(cLocalIt->first, key); + BMQTST_ASSERT_EQ(cLocalIt->second, key * key); ++cLocalIt; - ASSERT_EQ(true, cLocalIt == cLocalEndIt); + BMQTST_ASSERT_EQ(true, cLocalIt == cLocalEndIt); // Add keys such that they all map to same bucket in the table, while // ensuring that table is not rehashed. @@ -880,8 +880,8 @@ static void test14_localIterator() key = originalKey; for (; localIt != localEndIt; ++localIt, key += bucketCount) { - ASSERT_EQ(localIt->first, key); - ASSERT_EQ(localIt->second, key * key); + BMQTST_ASSERT_EQ(localIt->first, key); + BMQTST_ASSERT_EQ(localIt->second, key * key); } } @@ -917,37 +917,41 @@ static void test15_eraseRange() // Insert elements for (size_t i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = map.insert(bsl::make_pair(i, i)); - ASSERT_EQ_D(i, rc.second, true); - ASSERT_EQ_D(i, true, rc.first != map.end()); - ASSERT_EQ_D(i, i, rc.first->first); - ASSERT_EQ_D(i, i, rc.first->second); + BMQTST_ASSERT_EQ_D(i, rc.second, true); + BMQTST_ASSERT_EQ_D(i, true, rc.first != map.end()); + BMQTST_ASSERT_EQ_D(i, i, rc.first->first); + BMQTST_ASSERT_EQ_D(i, i, rc.first->second); } - ASSERT_EQ(k_NUM_ELEMENTS, map.size()); + BMQTST_ASSERT_EQ(k_NUM_ELEMENTS, map.size()); - ASSERT(map.erase(map.begin(), map.begin()) == map.begin()); - ASSERT_EQ(k_NUM_ELEMENTS, map.size()); + BMQTST_ASSERT(map.erase(map.begin(), map.begin()) == map.begin()); + BMQTST_ASSERT_EQ(k_NUM_ELEMENTS, map.size()); - ASSERT(map.erase(map.end(), map.end()) == map.end()); - ASSERT_EQ(k_NUM_ELEMENTS, map.size()); + BMQTST_ASSERT(map.erase(map.end(), map.end()) == map.end()); + BMQTST_ASSERT_EQ(k_NUM_ELEMENTS, map.size()); ConstIterType second = ++map.begin(); - ASSERT(map.erase(map.begin(), second) == second); - ASSERT(map.begin() == second); - ASSERT_EQ(k_NUM_ELEMENTS - 1, map.size()); - ASSERT_EQ_D(1, 1U, map.begin()->first); - ASSERT_EQ_D(1, 1U, map.begin()->second); - - ASSERT(map.erase(--map.end(), map.end()) == map.end()); - ASSERT_EQ(k_NUM_ELEMENTS - 2, map.size()); - ASSERT_EQ_D(k_NUM_ELEMENTS - 2, k_NUM_ELEMENTS - 2, (--map.end())->first); - ASSERT_EQ_D(k_NUM_ELEMENTS - 2, k_NUM_ELEMENTS - 2, (--map.end())->second); - - ASSERT(map.erase(map.begin(), map.end()) == map.end()); - - ASSERT_EQ(0U, map.size()); - - ASSERT_EQ(true, map.empty()); + BMQTST_ASSERT(map.erase(map.begin(), second) == second); + BMQTST_ASSERT(map.begin() == second); + BMQTST_ASSERT_EQ(k_NUM_ELEMENTS - 1, map.size()); + BMQTST_ASSERT_EQ_D(1, 1U, map.begin()->first); + BMQTST_ASSERT_EQ_D(1, 1U, map.begin()->second); + + BMQTST_ASSERT(map.erase(--map.end(), map.end()) == map.end()); + BMQTST_ASSERT_EQ(k_NUM_ELEMENTS - 2, map.size()); + BMQTST_ASSERT_EQ_D(k_NUM_ELEMENTS - 2, + k_NUM_ELEMENTS - 2, + (--map.end())->first); + BMQTST_ASSERT_EQ_D(k_NUM_ELEMENTS - 2, + k_NUM_ELEMENTS - 2, + (--map.end())->second); + + BMQTST_ASSERT(map.erase(map.begin(), map.end()) == map.end()); + + BMQTST_ASSERT_EQ(0U, map.size()); + + BMQTST_ASSERT_EQ(true, map.empty()); } BSLA_MAYBE_UNUSED @@ -1028,8 +1032,8 @@ BSLA_MAYBE_UNUSED static void testN2_erasePerformanceOrdered() // Insert 1M elements for (size_t i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = map.insert(bsl::make_pair(i, i)); - ASSERT_EQ_D(i, i, rc.first->first); - ASSERT_EQ_D(i, i, rc.first->second); + BMQTST_ASSERT_EQ_D(i, i, rc.first->first); + BMQTST_ASSERT_EQ_D(i, i, rc.first->second); } // Iterate and erase @@ -1066,8 +1070,8 @@ BSLA_MAYBE_UNUSED static void testN2_erasePerformanceUnordered() // Insert 1M elements for (size_t i = 0; i < k_NUM_ELEMENTS; ++i) { RcType rc = map.insert(bsl::make_pair(i, i)); - ASSERT_EQ_D(i, i, rc.first->first); - ASSERT_EQ_D(i, i, rc.first->second); + BMQTST_ASSERT_EQ_D(i, i, rc.first->first); + BMQTST_ASSERT_EQ_D(i, i, rc.first->second); } // Iterate and erase @@ -1156,8 +1160,8 @@ testN2_erasePerformanceUnordered_GoogleBenchmark(benchmark::State& state) state.PauseTiming(); for (size_t i = 0; i < static_cast(state.range(0)); ++i) { RcType rc = map.insert(bsl::make_pair(i, i)); - ASSERT_EQ_D(i, i, rc.first->first); - ASSERT_EQ_D(i, i, rc.first->second); + BMQTST_ASSERT_EQ_D(i, i, rc.first->first); + BMQTST_ASSERT_EQ_D(i, i, rc.first->second); } // Iterate and erase IterType it = map.begin(); @@ -1186,8 +1190,8 @@ testN2_erasePerformanceOrdered_GoogleBenchmark(benchmark::State& state) state.PauseTiming(); for (size_t i = 0; i < static_cast(state.range(0)); ++i) { RcType rc = map.insert(bsl::make_pair(i, i)); - ASSERT_EQ_D(i, i, rc.first->first); - ASSERT_EQ_D(i, i, rc.first->second); + BMQTST_ASSERT_EQ_D(i, i, rc.first->first); + BMQTST_ASSERT_EQ_D(i, i, rc.first->second); } // Iterate and erase IterType it = map.begin(); diff --git a/src/groups/bmq/bmqc/bmqc_orderedhashmapwithhistory.t.cpp b/src/groups/bmq/bmqc/bmqc_orderedhashmapwithhistory.t.cpp index d034bd813..443e9e60a 100644 --- a/src/groups/bmq/bmqc/bmqc_orderedhashmapwithhistory.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_orderedhashmapwithhistory.t.cpp @@ -33,17 +33,17 @@ static void setup(ObjectUnderTest& obj, size_t total, int timeout) for (size_t key = 0; key < total; ++key) { bsl::pair rc = obj.insert(bsl::make_pair(key, key + 1), now); - ASSERT_EQ(true, rc.second); - ASSERT_EQ(true, rc.first != obj.end()); - ASSERT_EQ(true, rc.first == obj.begin() || key); - ASSERT_EQ(key, rc.first->first); - ASSERT_EQ(key + 1, rc.first->second); + BMQTST_ASSERT_EQ(true, rc.second); + BMQTST_ASSERT_EQ(true, rc.first != obj.end()); + BMQTST_ASSERT_EQ(true, rc.first == obj.begin() || key); + BMQTST_ASSERT_EQ(key, rc.first->first); + BMQTST_ASSERT_EQ(key + 1, rc.first->second); - ASSERT_EQ(key + 1, obj.size()); + BMQTST_ASSERT_EQ(key + 1, obj.size()); for (size_t i = 0; i <= key; ++i) { - ASSERT_EQ(true, obj.isInHistory(i)); - ASSERT_EQ(true, obj.find(i) != obj.end()); + BMQTST_ASSERT_EQ(true, obj.isInHistory(i)); + BMQTST_ASSERT_EQ(true, obj.find(i) != obj.end()); } now += timeout; } @@ -98,20 +98,20 @@ static void test2_eraseMiddleToEnd() // erase middle to end for (size_t key = HALF; key < TOTAL; ++key) { - ASSERT_EQ(true, obj.isInHistory(key)); + BMQTST_ASSERT_EQ(true, obj.isInHistory(key)); Iterator it = obj.find(key); - ASSERT_EQ(true, it != obj.end()); + BMQTST_ASSERT_EQ(true, it != obj.end()); obj.erase(it); // should be down by 1 - ASSERT_EQ(TOTAL + HALF - key - 1, obj.size()); + BMQTST_ASSERT_EQ(TOTAL + HALF - key - 1, obj.size()); for (size_t i = HALF; i <= key; ++i) { - ASSERT_EQ(true, obj.isInHistory(i)); - ASSERT_EQ(false, obj.find(i) != obj.end()); + BMQTST_ASSERT_EQ(true, obj.isInHistory(i)); + BMQTST_ASSERT_EQ(false, obj.find(i) != obj.end()); } } @@ -119,8 +119,8 @@ static void test2_eraseMiddleToEnd() bsls::Types::Int64 now = (HALF + 2) * timeout; for (size_t key = HALF; key < TOTAL; ++key, now += timeout) { obj.gc(now); - ASSERT_EQ(false, obj.isInHistory(key)); - ASSERT_EQ(false, obj.find(key) != obj.end()); + BMQTST_ASSERT_EQ(false, obj.isInHistory(key)); + BMQTST_ASSERT_EQ(false, obj.find(key) != obj.end()); } } @@ -152,21 +152,21 @@ static void test3_eraseMiddleToBegin() // erase end to middle for (size_t key = HALF; key-- > 0;) { - ASSERT_EQ(true, obj.isInHistory(key)); - ASSERT_EQ(true, obj.find(key) != obj.end()); + BMQTST_ASSERT_EQ(true, obj.isInHistory(key)); + BMQTST_ASSERT_EQ(true, obj.find(key) != obj.end()); Iterator it = obj.find(key); - ASSERT_EQ(true, it != obj.end()); + BMQTST_ASSERT_EQ(true, it != obj.end()); obj.erase(it); // should be down by 1 - ASSERT_EQ(key + HALF, obj.size()); + BMQTST_ASSERT_EQ(key + HALF, obj.size()); for (size_t i = HALF; i-- > key;) { - ASSERT_EQ(true, obj.isInHistory(i)); - ASSERT_EQ(false, obj.find(i) != obj.end()); + BMQTST_ASSERT_EQ(true, obj.isInHistory(i)); + BMQTST_ASSERT_EQ(false, obj.find(i) != obj.end()); } } @@ -174,8 +174,8 @@ static void test3_eraseMiddleToBegin() bsls::Types::Int64 now = 2 * timeout; for (size_t key = 0; key < HALF; ++key, now += timeout) { obj.gc(now); - ASSERT_EQ(false, obj.isInHistory(key)); - ASSERT_EQ(false, obj.find(key) != obj.end()); + BMQTST_ASSERT_EQ(false, obj.isInHistory(key)); + BMQTST_ASSERT_EQ(false, obj.find(key) != obj.end()); } } @@ -207,45 +207,45 @@ static void test4_gc() // erase end to middle for (size_t key = TOTAL; key-- > HALF;) { - ASSERT_EQ(true, obj.isInHistory(key)); - ASSERT_EQ(true, obj.find(key) != obj.end()); + BMQTST_ASSERT_EQ(true, obj.isInHistory(key)); + BMQTST_ASSERT_EQ(true, obj.find(key) != obj.end()); Iterator it = obj.find(key); - ASSERT_EQ(true, it != obj.end()); + BMQTST_ASSERT_EQ(true, it != obj.end()); obj.erase(it, 1 * timeout); // 'it' is not expired yet // should be down by 1 - ASSERT_EQ(key, obj.size()); + BMQTST_ASSERT_EQ(key, obj.size()); for (size_t i = TOTAL; i-- > key;) { - ASSERT_EQ(true, obj.isInHistory(i)); - ASSERT_EQ(false, obj.find(i) != obj.end()); + BMQTST_ASSERT_EQ(true, obj.isInHistory(i)); + BMQTST_ASSERT_EQ(false, obj.find(i) != obj.end()); } } // erase middle to begin for (size_t key = HALF; key-- > 0;) { - ASSERT_EQ(true, obj.isInHistory(key)); - ASSERT_EQ(true, obj.find(key) != obj.end()); + BMQTST_ASSERT_EQ(true, obj.isInHistory(key)); + BMQTST_ASSERT_EQ(true, obj.find(key) != obj.end()); Iterator it = obj.find(key); - ASSERT_EQ(true, it != obj.end()); + BMQTST_ASSERT_EQ(true, it != obj.end()); obj.erase(it, (TOTAL + 1) * timeout); // 'it' is expired // should be down by 1 - ASSERT_EQ(key, obj.size()); + BMQTST_ASSERT_EQ(key, obj.size()); for (size_t i = HALF; i-- > key;) { - ASSERT_EQ(false, obj.isInHistory(i)); - ASSERT_EQ(false, obj.find(i) != obj.end()); + BMQTST_ASSERT_EQ(false, obj.isInHistory(i)); + BMQTST_ASSERT_EQ(false, obj.find(i) != obj.end()); } } - ASSERT_EQ(0U, obj.size()); + BMQTST_ASSERT_EQ(0U, obj.size()); } static void test5_insertAfterEnd() @@ -273,14 +273,14 @@ static void test5_insertAfterEnd() Iterator begin = obj.begin(); Iterator end = obj.end(); - ASSERT(begin == end); + BMQTST_ASSERT(begin == end); setup(obj, 1, timeout); - ASSERT(begin == end); - ASSERT(end != obj.end()); - ASSERT_EQ(0U, end->first); // key - ASSERT_EQ(1U, end->second); // value + BMQTST_ASSERT(begin == end); + BMQTST_ASSERT(end != obj.end()); + BMQTST_ASSERT_EQ(0U, end->first); // key + BMQTST_ASSERT_EQ(1U, end->second); // value } static void test6_eraseThenGc() diff --git a/src/groups/bmq/bmqc/bmqc_twokeyhashmap.t.cpp b/src/groups/bmq/bmqc/bmqc_twokeyhashmap.t.cpp index 04b440d2b..6c1e7cc1c 100644 --- a/src/groups/bmq/bmqc/bmqc_twokeyhashmap.t.cpp +++ b/src/groups/bmq/bmqc/bmqc_twokeyhashmap.t.cpp @@ -198,7 +198,7 @@ static void test0_usageExample() map.insert("first", 1, "Hello"); // size - ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.size(), 1u); bsl::pair p = map.insert("second", 2, "World"); @@ -206,7 +206,7 @@ static void test0_usageExample() BSLS_ASSERT(p.first != map.end()); // size - ASSERT_EQ(map.size(), 2u); + BMQTST_ASSERT_EQ(map.size(), 2u); // find elements using 'findByKey()' methods { @@ -250,9 +250,9 @@ static void test0_usageExample() // clearing the map { map.clear(); - ASSERT_EQ(map.size(), 0u); - ASSERT(map.begin() == map.end()); - ASSERT(map.begin() == map.end()); + BMQTST_ASSERT_EQ(map.size(), 0u); + BMQTST_ASSERT(map.begin() == map.end()); + BMQTST_ASSERT(map.begin() == map.end()); } } @@ -295,12 +295,12 @@ static void test1_basicCreators() bmqc::TwoKeyHashMap, TestHasher > map(&alloc); - ASSERT_EQ(map.empty(), true); - ASSERT_EQ(map.size(), 0u); - ASSERT_EQ(map.begin() == map.end(), true); - ASSERT_EQ(map.hash1().id(), 0); - ASSERT_EQ(map.hash2().id(), 0); - ASSERT_EQ(map.allocator() == &alloc, true); + BMQTST_ASSERT_EQ(map.empty(), true); + BMQTST_ASSERT_EQ(map.size(), 0u); + BMQTST_ASSERT_EQ(map.begin() == map.end(), true); + BMQTST_ASSERT_EQ(map.hash1().id(), 0); + BMQTST_ASSERT_EQ(map.hash2().id(), 0); + BMQTST_ASSERT_EQ(map.allocator() == &alloc, true); } // 3. one-hasher constructor @@ -308,12 +308,12 @@ static void test1_basicCreators() bmqc::TwoKeyHashMap, TestHasher > map(TestHasher(1), &alloc); - ASSERT_EQ(map.empty(), true); - ASSERT_EQ(map.size(), 0u); - ASSERT_EQ(map.begin() == map.end(), true); - ASSERT_EQ(map.hash1().id(), 1); - ASSERT_EQ(map.hash2().id(), 0); - ASSERT_EQ(map.allocator() == &alloc, true); + BMQTST_ASSERT_EQ(map.empty(), true); + BMQTST_ASSERT_EQ(map.size(), 0u); + BMQTST_ASSERT_EQ(map.begin() == map.end(), true); + BMQTST_ASSERT_EQ(map.hash1().id(), 1); + BMQTST_ASSERT_EQ(map.hash2().id(), 0); + BMQTST_ASSERT_EQ(map.allocator() == &alloc, true); } // 4. two-hasher constructor @@ -321,12 +321,12 @@ static void test1_basicCreators() bmqc::TwoKeyHashMap, TestHasher > map(TestHasher(1), TestHasher(2), &alloc); - ASSERT_EQ(map.empty(), true); - ASSERT_EQ(map.size(), 0u); - ASSERT_EQ(map.begin() == map.end(), true); - ASSERT_EQ(map.hash1().id(), 1); - ASSERT_EQ(map.hash2().id(), 2); - ASSERT_EQ(map.allocator() == &alloc, true); + BMQTST_ASSERT_EQ(map.empty(), true); + BMQTST_ASSERT_EQ(map.size(), 0u); + BMQTST_ASSERT_EQ(map.begin() == map.end(), true); + BMQTST_ASSERT_EQ(map.hash1().id(), 1); + BMQTST_ASSERT_EQ(map.hash2().id(), 2); + BMQTST_ASSERT_EQ(map.allocator() == &alloc, true); } } @@ -374,13 +374,13 @@ static void test2_copyAndMove() original.insert(4, "forth", "value4"); original.insert(5, "fifth", "value5"); - ASSERT_EQ(original.size(), 5u); - ASSERT_EQ(original.findByKey1(1) != original.end() && - original.findByKey1(2) != original.end() && - original.findByKey1(3) != original.end() && - original.findByKey1(4) != original.end() && - original.findByKey1(5) != original.end(), - true); + BMQTST_ASSERT_EQ(original.size(), 5u); + BMQTST_ASSERT_EQ(original.findByKey1(1) != original.end() && + original.findByKey1(2) != original.end() && + original.findByKey1(3) != original.end() && + original.findByKey1(4) != original.end() && + original.findByKey1(5) != original.end(), + true); // 1. copy construction { @@ -388,27 +388,27 @@ static void test2_copyAndMove() Map copy(original, &alloc); // the copy's contents is identical to original's - ASSERT_EQ(copy.size(), 5u); + BMQTST_ASSERT_EQ(copy.size(), 5u); - ASSERT_EQ(copy.findByKey1(1) != copy.end() && - *original.findByKey1(1) == *copy.findByKey1(1), - true); + BMQTST_ASSERT_EQ(copy.findByKey1(1) != copy.end() && + *original.findByKey1(1) == *copy.findByKey1(1), + true); - ASSERT_EQ(copy.findByKey1(2) != copy.end() && - *original.findByKey1(2) == *copy.findByKey1(2), - true); + BMQTST_ASSERT_EQ(copy.findByKey1(2) != copy.end() && + *original.findByKey1(2) == *copy.findByKey1(2), + true); - ASSERT_EQ(copy.findByKey1(3) != copy.end() && - *original.findByKey1(3) == *copy.findByKey1(3), - true); + BMQTST_ASSERT_EQ(copy.findByKey1(3) != copy.end() && + *original.findByKey1(3) == *copy.findByKey1(3), + true); - ASSERT_EQ(copy.findByKey1(4) != copy.end() && - *original.findByKey1(4) == *copy.findByKey1(4), - true); + BMQTST_ASSERT_EQ(copy.findByKey1(4) != copy.end() && + *original.findByKey1(4) == *copy.findByKey1(4), + true); - ASSERT_EQ(copy.findByKey1(5) != copy.end() && - *original.findByKey1(5) == *copy.findByKey1(5), - true); + BMQTST_ASSERT_EQ(copy.findByKey1(5) != copy.end() && + *original.findByKey1(5) == *copy.findByKey1(5), + true); } // 2. move construction @@ -420,27 +420,27 @@ static void test2_copyAndMove() Map movedTo(bslmf::MovableRefUtil::move(movedFrom), &alloc); // the moved-to object contents is identical to original's - ASSERT_EQ(movedTo.size(), 5u); + BMQTST_ASSERT_EQ(movedTo.size(), 5u); - ASSERT_EQ(movedTo.findByKey1(1) != movedTo.end() && - *original.findByKey1(1) == *movedTo.findByKey1(1), - true); + BMQTST_ASSERT_EQ(movedTo.findByKey1(1) != movedTo.end() && + *original.findByKey1(1) == *movedTo.findByKey1(1), + true); - ASSERT_EQ(movedTo.findByKey1(2) != movedTo.end() && - *original.findByKey1(2) == *movedTo.findByKey1(2), - true); + BMQTST_ASSERT_EQ(movedTo.findByKey1(2) != movedTo.end() && + *original.findByKey1(2) == *movedTo.findByKey1(2), + true); - ASSERT_EQ(movedTo.findByKey1(3) != movedTo.end() && - *original.findByKey1(3) == *movedTo.findByKey1(3), - true); + BMQTST_ASSERT_EQ(movedTo.findByKey1(3) != movedTo.end() && + *original.findByKey1(3) == *movedTo.findByKey1(3), + true); - ASSERT_EQ(movedTo.findByKey1(4) != movedTo.end() && - *original.findByKey1(4) == *movedTo.findByKey1(4), - true); + BMQTST_ASSERT_EQ(movedTo.findByKey1(4) != movedTo.end() && + *original.findByKey1(4) == *movedTo.findByKey1(4), + true); - ASSERT_EQ(movedTo.findByKey1(5) != movedTo.end() && - *original.findByKey1(5) == *movedTo.findByKey1(5), - true); + BMQTST_ASSERT_EQ(movedTo.findByKey1(5) != movedTo.end() && + *original.findByKey1(5) == *movedTo.findByKey1(5), + true); } // 3. copy assignment @@ -450,33 +450,33 @@ static void test2_copyAndMove() // insert elements into copy copy.insert(1, "first", "value1"); copy.insert(999, "999-th", "value999"); - ASSERT_EQ(copy.size(), 2u); + BMQTST_ASSERT_EQ(copy.size(), 2u); // do copy copy = original; // the copy's contents is identical to original's - ASSERT_EQ(copy.size(), 5u); + BMQTST_ASSERT_EQ(copy.size(), 5u); - ASSERT_EQ(copy.findByKey1(1) != copy.end() && - *original.findByKey1(1) == *copy.findByKey1(1), - true); + BMQTST_ASSERT_EQ(copy.findByKey1(1) != copy.end() && + *original.findByKey1(1) == *copy.findByKey1(1), + true); - ASSERT_EQ(copy.findByKey1(2) != copy.end() && - *original.findByKey1(2) == *copy.findByKey1(2), - true); + BMQTST_ASSERT_EQ(copy.findByKey1(2) != copy.end() && + *original.findByKey1(2) == *copy.findByKey1(2), + true); - ASSERT_EQ(copy.findByKey1(3) != copy.end() && - *original.findByKey1(3) == *copy.findByKey1(3), - true); + BMQTST_ASSERT_EQ(copy.findByKey1(3) != copy.end() && + *original.findByKey1(3) == *copy.findByKey1(3), + true); - ASSERT_EQ(copy.findByKey1(4) != copy.end() && - *original.findByKey1(4) == *copy.findByKey1(4), - true); + BMQTST_ASSERT_EQ(copy.findByKey1(4) != copy.end() && + *original.findByKey1(4) == *copy.findByKey1(4), + true); - ASSERT_EQ(copy.findByKey1(5) != copy.end() && - *original.findByKey1(5) == *copy.findByKey1(5), - true); + BMQTST_ASSERT_EQ(copy.findByKey1(5) != copy.end() && + *original.findByKey1(5) == *copy.findByKey1(5), + true); } // 4. move assignment @@ -489,33 +489,33 @@ static void test2_copyAndMove() // insert elements into 'movedTo' movedTo.insert(1, "first", "value1"); movedTo.insert(999, "999-th", "value999"); - ASSERT_EQ(movedTo.size(), 2u); + BMQTST_ASSERT_EQ(movedTo.size(), 2u); // do move movedTo = bslmf::MovableRefUtil::move(movedFrom); // the moved-to object contents is identical to original's - ASSERT_EQ(movedTo.size(), 5u); + BMQTST_ASSERT_EQ(movedTo.size(), 5u); - ASSERT_EQ(movedTo.findByKey1(1) != movedTo.end() && - *original.findByKey1(1) == *movedTo.findByKey1(1), - true); + BMQTST_ASSERT_EQ(movedTo.findByKey1(1) != movedTo.end() && + *original.findByKey1(1) == *movedTo.findByKey1(1), + true); - ASSERT_EQ(movedTo.findByKey1(2) != movedTo.end() && - *original.findByKey1(2) == *movedTo.findByKey1(2), - true); + BMQTST_ASSERT_EQ(movedTo.findByKey1(2) != movedTo.end() && + *original.findByKey1(2) == *movedTo.findByKey1(2), + true); - ASSERT_EQ(movedTo.findByKey1(3) != movedTo.end() && - *original.findByKey1(3) == *movedTo.findByKey1(3), - true); + BMQTST_ASSERT_EQ(movedTo.findByKey1(3) != movedTo.end() && + *original.findByKey1(3) == *movedTo.findByKey1(3), + true); - ASSERT_EQ(movedTo.findByKey1(4) != movedTo.end() && - *original.findByKey1(4) == *movedTo.findByKey1(4), - true); + BMQTST_ASSERT_EQ(movedTo.findByKey1(4) != movedTo.end() && + *original.findByKey1(4) == *movedTo.findByKey1(4), + true); - ASSERT_EQ(movedTo.findByKey1(5) != movedTo.end() && - *original.findByKey1(5) == *movedTo.findByKey1(5), - true); + BMQTST_ASSERT_EQ(movedTo.findByKey1(5) != movedTo.end() && + *original.findByKey1(5) == *movedTo.findByKey1(5), + true); } } @@ -585,16 +585,16 @@ static void test3_insert() Map::iterator iterator1 = pair1.first; // element inserted - ASSERT_EQ(map.size(), 1u); - ASSERT_EQ(result1, Map::e_INSERTED); + BMQTST_ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(result1, Map::e_INSERTED); // returned iterator refers to the inserted element and is bound to the // first key - ASSERT_EQ(iterator1 == map.end(), false); - ASSERT_EQ(iterator1.keyIndex(), Map::e_FIRST_KEY); - ASSERT_EQ(iterator1->key1(), 1); - ASSERT_EQ(iterator1->key2(), "first"); - ASSERT_EQ(iterator1->value(), "value1"); + BMQTST_ASSERT_EQ(iterator1 == map.end(), false); + BMQTST_ASSERT_EQ(iterator1.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(iterator1->key1(), 1); + BMQTST_ASSERT_EQ(iterator1->key2(), "first"); + BMQTST_ASSERT_EQ(iterator1->value(), "value1"); // insert second element InsertPair pair2 = @@ -604,22 +604,22 @@ static void test3_insert() Map::iterator iterator2 = pair2.first; // element inserted - ASSERT_EQ(map.size(), 2u); - ASSERT_EQ(result2, Map::e_INSERTED); + BMQTST_ASSERT_EQ(map.size(), 2u); + BMQTST_ASSERT_EQ(result2, Map::e_INSERTED); // returned iterator refers to the inserted element and is bound to the // second key - ASSERT_EQ(iterator2 == map.end(), false); - ASSERT_EQ(iterator2.keyIndex(), Map::e_SECOND_KEY); - ASSERT_EQ(iterator2->key1(), 2); - ASSERT_EQ(iterator2->key2(), "second"); - ASSERT_EQ(iterator2->value(), "value2"); + BMQTST_ASSERT_EQ(iterator2 == map.end(), false); + BMQTST_ASSERT_EQ(iterator2.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(iterator2->key1(), 2); + BMQTST_ASSERT_EQ(iterator2->key2(), "second"); + BMQTST_ASSERT_EQ(iterator2->value(), "value2"); // the first element is intact - ASSERT_EQ(map.size(), 2u); - ASSERT_EQ(iterator1->key1(), 1); - ASSERT_EQ(iterator1->key2(), "first"); - ASSERT_EQ(iterator1->value(), "value1"); + BMQTST_ASSERT_EQ(map.size(), 2u); + BMQTST_ASSERT_EQ(iterator1->key1(), 1); + BMQTST_ASSERT_EQ(iterator1->key2(), "first"); + BMQTST_ASSERT_EQ(iterator1->value(), "value1"); } // 2. first key already exists @@ -636,19 +636,19 @@ static void test3_insert() map.insert(1, "second", "value2", Map::e_SECOND_KEY); // nothing inserted - ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.size(), 1u); // check returned values and that the map contents hasn't changed Map::InsertResult result = pair.second; Map::iterator iterator = pair.first; - ASSERT_EQ(result, Map::e_FIRST_KEY_EXISTS); + BMQTST_ASSERT_EQ(result, Map::e_FIRST_KEY_EXISTS); - ASSERT_EQ(iterator == map.end(), false); - ASSERT_EQ(iterator.keyIndex(), Map::e_FIRST_KEY); - ASSERT_EQ(iterator->key1(), 1); - ASSERT_EQ(iterator->key2(), "first"); - ASSERT_EQ(iterator->value(), "value1"); + BMQTST_ASSERT_EQ(iterator == map.end(), false); + BMQTST_ASSERT_EQ(iterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(iterator->key1(), 1); + BMQTST_ASSERT_EQ(iterator->key2(), "first"); + BMQTST_ASSERT_EQ(iterator->value(), "value1"); } // 3. second key already exists @@ -668,13 +668,13 @@ static void test3_insert() Map::InsertResult result = pair.second; Map::iterator iterator = pair.first; - ASSERT_EQ(result, Map::e_SECOND_KEY_EXISTS); + BMQTST_ASSERT_EQ(result, Map::e_SECOND_KEY_EXISTS); - ASSERT_EQ(iterator == map.end(), false); - ASSERT_EQ(iterator.keyIndex(), Map::e_SECOND_KEY); - ASSERT_EQ(iterator->key1(), 1); - ASSERT_EQ(iterator->key2(), "first"); - ASSERT_EQ(iterator->value(), "value1"); + BMQTST_ASSERT_EQ(iterator == map.end(), false); + BMQTST_ASSERT_EQ(iterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(iterator->key1(), 1); + BMQTST_ASSERT_EQ(iterator->key2(), "first"); + BMQTST_ASSERT_EQ(iterator->value(), "value1"); } // 4. check exception safety @@ -703,13 +703,13 @@ static void test3_insert() } // an exception was thrown - ASSERT_EQ(exceptionThrown, true); + BMQTST_ASSERT_EQ(exceptionThrown, true); // the map state hasn't changed - ASSERT_EQ(map.size(), 1u); - ASSERT_EQ(map.begin()->key1().value(), 0); - ASSERT_EQ(map.begin()->key2().value(), 0); - ASSERT_EQ(map.begin()->value().value(), 0); + BMQTST_ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.begin()->key1().value(), 0); + BMQTST_ASSERT_EQ(map.begin()->key2().value(), 0); + BMQTST_ASSERT_EQ(map.begin()->value().value(), 0); // try inserting another element, given that the second key copy // constructor throws @@ -724,13 +724,13 @@ static void test3_insert() } // an exception was thrown - ASSERT_EQ(exceptionThrown, true); + BMQTST_ASSERT_EQ(exceptionThrown, true); // the map state hasn't changed - ASSERT_EQ(map.size(), 1u); - ASSERT_EQ(map.begin()->key1().value(), 0); - ASSERT_EQ(map.begin()->key2().value(), 0); - ASSERT_EQ(map.begin()->value().value(), 0); + BMQTST_ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.begin()->key1().value(), 0); + BMQTST_ASSERT_EQ(map.begin()->key2().value(), 0); + BMQTST_ASSERT_EQ(map.begin()->value().value(), 0); // try inserting another element, given that the value copy // constructor throws @@ -745,13 +745,13 @@ static void test3_insert() } // an exception was thrown - ASSERT_EQ(exceptionThrown, true); + BMQTST_ASSERT_EQ(exceptionThrown, true); // the map state hasn't changed - ASSERT_EQ(map.size(), 1u); - ASSERT_EQ(map.begin()->key1().value(), 0); - ASSERT_EQ(map.begin()->key2().value(), 0); - ASSERT_EQ(map.begin()->value().value(), 0); + BMQTST_ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.begin()->key1().value(), 0); + BMQTST_ASSERT_EQ(map.begin()->key2().value(), 0); + BMQTST_ASSERT_EQ(map.begin()->value().value(), 0); } } @@ -812,7 +812,7 @@ static void test4_erase() map.insert(3, "third", "value3"); map.insert(4, "forth", "value4"); map.insert(5, "fifth", "value5"); - ASSERT_EQ(map.size(), 5u); + BMQTST_ASSERT_EQ(map.size(), 5u); // make a list of elements ordered according to the first key it = map.begin(Map::e_FIRST_KEY); @@ -834,9 +834,9 @@ static void test4_erase() // find element with first key equal to 3 Map::iterator erased = map.findByKey1(3); - ASSERT_EQ(erased == map.end(), false) - ASSERT_EQ(erased->key1(), 3); - ASSERT_EQ(erased.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(erased == map.end(), false) + BMQTST_ASSERT_EQ(erased->key1(), 3); + BMQTST_ASSERT_EQ(erased.keyIndex(), Map::e_FIRST_KEY); const Map::value_type* erased_p = &*erased; @@ -844,42 +844,52 @@ static void test4_erase() map.erase(erased); // element removed - ASSERT_EQ(map.size(), 4u); - ASSERT_EQ(map.findByKey1(3) == map.end(), true); + BMQTST_ASSERT_EQ(map.size(), 4u); + BMQTST_ASSERT_EQ(map.findByKey1(3) == map.end(), true); // order of remaining elements indexed by the first key hasn't changed it = map.begin(Map::e_FIRST_KEY); - ASSERT_EQ(elementsByKey1[0] == erased_p || elementsByKey1[0] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[0] == erased_p || + elementsByKey1[0] == &*it++, + true); - ASSERT_EQ(elementsByKey1[1] == erased_p || elementsByKey1[1] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[1] == erased_p || + elementsByKey1[1] == &*it++, + true); - ASSERT_EQ(elementsByKey1[2] == erased_p || elementsByKey1[2] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[2] == erased_p || + elementsByKey1[2] == &*it++, + true); - ASSERT_EQ(elementsByKey1[3] == erased_p || elementsByKey1[3] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[3] == erased_p || + elementsByKey1[3] == &*it++, + true); - ASSERT_EQ(elementsByKey1[4] == erased_p || elementsByKey1[4] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[4] == erased_p || + elementsByKey1[4] == &*it++, + true); // order of remaining elements indexed by the second key hasn't changed it = map.begin(Map::e_SECOND_KEY); - ASSERT_EQ(elementsByKey2[0] == erased_p || elementsByKey2[0] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[0] == erased_p || + elementsByKey2[0] == &*it++, + true); - ASSERT_EQ(elementsByKey2[1] == erased_p || elementsByKey2[1] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[1] == erased_p || + elementsByKey2[1] == &*it++, + true); - ASSERT_EQ(elementsByKey2[2] == erased_p || elementsByKey2[2] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[2] == erased_p || + elementsByKey2[2] == &*it++, + true); - ASSERT_EQ(elementsByKey2[3] == erased_p || elementsByKey2[3] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[3] == erased_p || + elementsByKey2[3] == &*it++, + true); - ASSERT_EQ(elementsByKey2[4] == erased_p || elementsByKey2[4] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[4] == erased_p || + elementsByKey2[4] == &*it++, + true); } // 2. erase by iterator bound to second key @@ -893,7 +903,7 @@ static void test4_erase() map.insert(3, "third", "value3"); map.insert(4, "forth", "value4"); map.insert(5, "fifth", "value5"); - ASSERT_EQ(map.size(), 5u); + BMQTST_ASSERT_EQ(map.size(), 5u); // make a list of elements ordered according to the first key it = map.begin(Map::e_FIRST_KEY); @@ -915,9 +925,9 @@ static void test4_erase() // find element with second key equal to "third" Map::iterator erased = map.findByKey2("third"); - ASSERT_EQ(erased == map.end(), false) - ASSERT_EQ(erased->key2(), "third"); - ASSERT_EQ(erased.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(erased == map.end(), false) + BMQTST_ASSERT_EQ(erased->key2(), "third"); + BMQTST_ASSERT_EQ(erased.keyIndex(), Map::e_SECOND_KEY); const Map::value_type* erased_p = &*erased; @@ -925,42 +935,52 @@ static void test4_erase() map.erase(erased); // element removed - ASSERT_EQ(map.size(), 4u); - ASSERT_EQ(map.findByKey2("third") == map.end(), true); + BMQTST_ASSERT_EQ(map.size(), 4u); + BMQTST_ASSERT_EQ(map.findByKey2("third") == map.end(), true); // order of remaining elements indexed by the first key hasn't changed it = map.begin(Map::e_FIRST_KEY); - ASSERT_EQ(elementsByKey1[0] == erased_p || elementsByKey1[0] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[0] == erased_p || + elementsByKey1[0] == &*it++, + true); - ASSERT_EQ(elementsByKey1[1] == erased_p || elementsByKey1[1] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[1] == erased_p || + elementsByKey1[1] == &*it++, + true); - ASSERT_EQ(elementsByKey1[2] == erased_p || elementsByKey1[2] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[2] == erased_p || + elementsByKey1[2] == &*it++, + true); - ASSERT_EQ(elementsByKey1[3] == erased_p || elementsByKey1[3] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[3] == erased_p || + elementsByKey1[3] == &*it++, + true); - ASSERT_EQ(elementsByKey1[4] == erased_p || elementsByKey1[4] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[4] == erased_p || + elementsByKey1[4] == &*it++, + true); // order of remaining elements indexed by the second key hasn't changed it = map.begin(Map::e_SECOND_KEY); - ASSERT_EQ(elementsByKey2[0] == erased_p || elementsByKey2[0] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[0] == erased_p || + elementsByKey2[0] == &*it++, + true); - ASSERT_EQ(elementsByKey2[1] == erased_p || elementsByKey2[1] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[1] == erased_p || + elementsByKey2[1] == &*it++, + true); - ASSERT_EQ(elementsByKey2[2] == erased_p || elementsByKey2[2] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[2] == erased_p || + elementsByKey2[2] == &*it++, + true); - ASSERT_EQ(elementsByKey2[3] == erased_p || elementsByKey2[3] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[3] == erased_p || + elementsByKey2[3] == &*it++, + true); - ASSERT_EQ(elementsByKey2[4] == erased_p || elementsByKey2[4] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[4] == erased_p || + elementsByKey2[4] == &*it++, + true); } // 3. check return value when erasing by an iterator bound to the first key @@ -974,7 +994,7 @@ static void test4_erase() map.insert(3, "third", "value3"); map.insert(4, "forth", "value4"); map.insert(5, "fifth", "value5"); - ASSERT_EQ(map.size(), 5u); + BMQTST_ASSERT_EQ(map.size(), 5u); while (!map.empty()) { // erase first element, as ordered by the first key @@ -982,8 +1002,9 @@ static void test4_erase() map.begin(Map::e_FIRST_KEY)); // 'erase()' returned an iterator to the next element - ASSERT_EQ(nextAfterErased == map.begin(Map::e_FIRST_KEY), true); - ASSERT_EQ(nextAfterErased.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(nextAfterErased == map.begin(Map::e_FIRST_KEY), + true); + BMQTST_ASSERT_EQ(nextAfterErased.keyIndex(), Map::e_FIRST_KEY); } } @@ -999,7 +1020,7 @@ static void test4_erase() map.insert(3, "third", "value3"); map.insert(4, "forth", "value4"); map.insert(5, "fifth", "value5"); - ASSERT_EQ(map.size(), 5u); + BMQTST_ASSERT_EQ(map.size(), 5u); while (!map.empty()) { // erase first element, as ordered by the second key @@ -1007,8 +1028,9 @@ static void test4_erase() map.begin(Map::e_SECOND_KEY)); // 'erase()' returned an iterator to the next element - ASSERT_EQ(nextAfterErased == map.begin(Map::e_SECOND_KEY), true); - ASSERT_EQ(nextAfterErased.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(nextAfterErased == map.begin(Map::e_SECOND_KEY), + true); + BMQTST_ASSERT_EQ(nextAfterErased.keyIndex(), Map::e_SECOND_KEY); } } } @@ -1056,7 +1078,7 @@ static void test5_eraseByKey1() map.insert(3, "third", "value3"); map.insert(4, "forth", "value4"); map.insert(5, "fifth", "value5"); - ASSERT_EQ(map.size(), 5u); + BMQTST_ASSERT_EQ(map.size(), 5u); // make a list of elements ordered according to the first key it = map.begin(Map::e_FIRST_KEY); @@ -1078,8 +1100,8 @@ static void test5_eraseByKey1() // find element with first key equal to 3 Map::iterator erased = map.findByKey1(3); - ASSERT_EQ(erased == map.end(), false) - ASSERT_EQ(erased->key1(), 3); + BMQTST_ASSERT_EQ(erased == map.end(), false) + BMQTST_ASSERT_EQ(erased->key1(), 3); const Map::value_type* erased_p = &*erased; @@ -1087,45 +1109,55 @@ static void test5_eraseByKey1() int eraseRc = map.eraseByKey1(3); // return value is 0 - ASSERT_EQ(eraseRc, 0); + BMQTST_ASSERT_EQ(eraseRc, 0); // element removed - ASSERT_EQ(map.size(), 4u); - ASSERT_EQ(map.findByKey1(3) == map.end(), true); + BMQTST_ASSERT_EQ(map.size(), 4u); + BMQTST_ASSERT_EQ(map.findByKey1(3) == map.end(), true); // order of remaining elements indexed by the first key hasn't changed it = map.begin(Map::e_FIRST_KEY); - ASSERT_EQ(elementsByKey1[0] == erased_p || elementsByKey1[0] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[0] == erased_p || + elementsByKey1[0] == &*it++, + true); - ASSERT_EQ(elementsByKey1[1] == erased_p || elementsByKey1[1] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[1] == erased_p || + elementsByKey1[1] == &*it++, + true); - ASSERT_EQ(elementsByKey1[2] == erased_p || elementsByKey1[2] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[2] == erased_p || + elementsByKey1[2] == &*it++, + true); - ASSERT_EQ(elementsByKey1[3] == erased_p || elementsByKey1[3] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[3] == erased_p || + elementsByKey1[3] == &*it++, + true); - ASSERT_EQ(elementsByKey1[4] == erased_p || elementsByKey1[4] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[4] == erased_p || + elementsByKey1[4] == &*it++, + true); // order of remaining elements indexed by the second key hasn't changed it = map.begin(Map::e_SECOND_KEY); - ASSERT_EQ(elementsByKey2[0] == erased_p || elementsByKey2[0] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[0] == erased_p || + elementsByKey2[0] == &*it++, + true); - ASSERT_EQ(elementsByKey2[1] == erased_p || elementsByKey2[1] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[1] == erased_p || + elementsByKey2[1] == &*it++, + true); - ASSERT_EQ(elementsByKey2[2] == erased_p || elementsByKey2[2] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[2] == erased_p || + elementsByKey2[2] == &*it++, + true); - ASSERT_EQ(elementsByKey2[3] == erased_p || elementsByKey2[3] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[3] == erased_p || + elementsByKey2[3] == &*it++, + true); - ASSERT_EQ(elementsByKey2[4] == erased_p || elementsByKey2[4] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[4] == erased_p || + elementsByKey2[4] == &*it++, + true); } // 2. erase by first key, which doesn't exist @@ -1136,19 +1168,19 @@ static void test5_eraseByKey1() // insert elements map.insert(1, "first", "value1"); - ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.size(), 1u); // try erasing by key that doesn't exist int eraseRc = map.eraseByKey1(2); // returned value is non-zero - ASSERT_NE(eraseRc, 0); + BMQTST_ASSERT_NE(eraseRc, 0); // the map is intact - ASSERT_EQ(map.size(), 1u); - ASSERT_EQ(map.begin()->key1(), 1); - ASSERT_EQ(map.begin()->key2(), "first"); - ASSERT_EQ(map.begin()->value(), "value1"); + BMQTST_ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.begin()->key1(), 1); + BMQTST_ASSERT_EQ(map.begin()->key2(), "first"); + BMQTST_ASSERT_EQ(map.begin()->value(), "value1"); } // 3. erase by first key, which exists, but throws on comparison @@ -1160,7 +1192,7 @@ static void test5_eraseByKey1() // insert elements map.insert(1, "first", "value1"); - ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.size(), 1u); bool exceptionThrown = false; @@ -1173,13 +1205,13 @@ static void test5_eraseByKey1() } // exception was thrown - ASSERT_EQ(exceptionThrown, true); + BMQTST_ASSERT_EQ(exceptionThrown, true); // the map is intact - ASSERT_EQ(map.size(), 1u); - ASSERT_EQ(map.begin()->key1().value(), 1); - ASSERT_EQ(map.begin()->key2(), "first"); - ASSERT_EQ(map.begin()->value(), "value1"); + BMQTST_ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.begin()->key1().value(), 1); + BMQTST_ASSERT_EQ(map.begin()->key2(), "first"); + BMQTST_ASSERT_EQ(map.begin()->value(), "value1"); } } @@ -1226,7 +1258,7 @@ static void test6_eraseByKey2() map.insert(3, "third", "value3"); map.insert(4, "forth", "value4"); map.insert(5, "fifth", "value5"); - ASSERT_EQ(map.size(), 5u); + BMQTST_ASSERT_EQ(map.size(), 5u); // make a list of elements ordered according to the first key it = map.begin(Map::e_FIRST_KEY); @@ -1248,8 +1280,8 @@ static void test6_eraseByKey2() // find element with second key equal to "third" Map::iterator erased = map.findByKey2("third"); - ASSERT_EQ(erased == map.end(), false) - ASSERT_EQ(erased->key2(), "third"); + BMQTST_ASSERT_EQ(erased == map.end(), false) + BMQTST_ASSERT_EQ(erased->key2(), "third"); const Map::value_type* erased_p = &*erased; @@ -1257,45 +1289,55 @@ static void test6_eraseByKey2() int eraseRc = map.eraseByKey2("third"); // return value is 0 - ASSERT_EQ(eraseRc, 0); + BMQTST_ASSERT_EQ(eraseRc, 0); // element removed - ASSERT_EQ(map.size(), 4u); - ASSERT_EQ(map.findByKey2("third") == map.end(), true); + BMQTST_ASSERT_EQ(map.size(), 4u); + BMQTST_ASSERT_EQ(map.findByKey2("third") == map.end(), true); // order of remaining elements indexed by the first key hasn't changed it = map.begin(Map::e_FIRST_KEY); - ASSERT_EQ(elementsByKey1[0] == erased_p || elementsByKey1[0] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[0] == erased_p || + elementsByKey1[0] == &*it++, + true); - ASSERT_EQ(elementsByKey1[1] == erased_p || elementsByKey1[1] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[1] == erased_p || + elementsByKey1[1] == &*it++, + true); - ASSERT_EQ(elementsByKey1[2] == erased_p || elementsByKey1[2] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[2] == erased_p || + elementsByKey1[2] == &*it++, + true); - ASSERT_EQ(elementsByKey1[3] == erased_p || elementsByKey1[3] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[3] == erased_p || + elementsByKey1[3] == &*it++, + true); - ASSERT_EQ(elementsByKey1[4] == erased_p || elementsByKey1[4] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey1[4] == erased_p || + elementsByKey1[4] == &*it++, + true); // order of remaining elements indexed by the second key hasn't changed it = map.begin(Map::e_SECOND_KEY); - ASSERT_EQ(elementsByKey2[0] == erased_p || elementsByKey2[0] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[0] == erased_p || + elementsByKey2[0] == &*it++, + true); - ASSERT_EQ(elementsByKey2[1] == erased_p || elementsByKey2[1] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[1] == erased_p || + elementsByKey2[1] == &*it++, + true); - ASSERT_EQ(elementsByKey2[2] == erased_p || elementsByKey2[2] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[2] == erased_p || + elementsByKey2[2] == &*it++, + true); - ASSERT_EQ(elementsByKey2[3] == erased_p || elementsByKey2[3] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[3] == erased_p || + elementsByKey2[3] == &*it++, + true); - ASSERT_EQ(elementsByKey2[4] == erased_p || elementsByKey2[4] == &*it++, - true); + BMQTST_ASSERT_EQ(elementsByKey2[4] == erased_p || + elementsByKey2[4] == &*it++, + true); } // 2. erase by second key, which doesn't exist @@ -1306,19 +1348,19 @@ static void test6_eraseByKey2() // insert elements map.insert(1, "first", "value1"); - ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.size(), 1u); // try erasing by key that doesn't exist int eraseRc = map.eraseByKey2("second"); // returned value is non-zero - ASSERT_NE(eraseRc, 0); + BMQTST_ASSERT_NE(eraseRc, 0); // the map is intact - ASSERT_EQ(map.size(), 1u); - ASSERT_EQ(map.begin()->key1(), 1); - ASSERT_EQ(map.begin()->key2(), "first"); - ASSERT_EQ(map.begin()->value(), "value1"); + BMQTST_ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.begin()->key1(), 1); + BMQTST_ASSERT_EQ(map.begin()->key2(), "first"); + BMQTST_ASSERT_EQ(map.begin()->value(), "value1"); } // 3. erase by second key, which exists, but throws on comparison @@ -1330,7 +1372,7 @@ static void test6_eraseByKey2() // insert elements map.insert("first", 1, "value1"); - ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.size(), 1u); bool exceptionThrown = false; @@ -1343,13 +1385,13 @@ static void test6_eraseByKey2() } // exception was thrown - ASSERT_EQ(exceptionThrown, true); + BMQTST_ASSERT_EQ(exceptionThrown, true); // the map is intact - ASSERT_EQ(map.size(), 1u); - ASSERT_EQ(map.begin()->key1(), "first"); - ASSERT_EQ(map.begin()->key2().value(), 1); - ASSERT_EQ(map.begin()->value(), "value1"); + BMQTST_ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.begin()->key1(), "first"); + BMQTST_ASSERT_EQ(map.begin()->key2().value(), 1); + BMQTST_ASSERT_EQ(map.begin()->value(), "value1"); } } @@ -1378,19 +1420,19 @@ static void test7_clear() map.insert(1, "first", "value1"); map.insert(2, "second", "value2"); map.insert(3, "third", "value3"); - ASSERT_EQ(map.size(), 3u); + BMQTST_ASSERT_EQ(map.size(), 3u); // do clear map.clear(); // the map is now empty - ASSERT_EQ(map.empty(), true); + BMQTST_ASSERT_EQ(map.empty(), true); // clear again map.clear(); // the map is still empty - ASSERT_EQ(map.empty(), true); + BMQTST_ASSERT_EQ(map.empty(), true); } static void test8_swap() @@ -1417,36 +1459,36 @@ static void test8_swap() // insert 1 element to map1 map1.insert(1, "first", "value1"); - ASSERT_EQ(map1.size(), 1u); + BMQTST_ASSERT_EQ(map1.size(), 1u); // insert 2 elements to map2 map2.insert(2, "second", "value2"); map2.insert(3, "third", "value3"); - ASSERT_EQ(map2.size(), 2u); + BMQTST_ASSERT_EQ(map2.size(), 2u); // swap maps swap(map1, map2); // map1 now have the contents of map2 - ASSERT_EQ(map1.size(), 2u); + BMQTST_ASSERT_EQ(map1.size(), 2u); - ASSERT_EQ((it = map1.findByKey1(2)) == map1.end(), false); - ASSERT_EQ(it->key1(), 2); - ASSERT_EQ(it->key2(), "second"); - ASSERT_EQ(it->value(), "value2"); + BMQTST_ASSERT_EQ((it = map1.findByKey1(2)) == map1.end(), false); + BMQTST_ASSERT_EQ(it->key1(), 2); + BMQTST_ASSERT_EQ(it->key2(), "second"); + BMQTST_ASSERT_EQ(it->value(), "value2"); - ASSERT_EQ((it = map1.findByKey1(3)) == map1.end(), false); - ASSERT_EQ(it->key1(), 3); - ASSERT_EQ(it->key2(), "third"); - ASSERT_EQ(it->value(), "value3"); + BMQTST_ASSERT_EQ((it = map1.findByKey1(3)) == map1.end(), false); + BMQTST_ASSERT_EQ(it->key1(), 3); + BMQTST_ASSERT_EQ(it->key2(), "third"); + BMQTST_ASSERT_EQ(it->value(), "value3"); // map2 now have the contents of map1 - ASSERT_EQ(map2.size(), 1u); + BMQTST_ASSERT_EQ(map2.size(), 1u); - ASSERT_EQ((it = map2.findByKey1(1)) == map2.end(), false); - ASSERT_EQ(it->key1(), 1); - ASSERT_EQ(it->key2(), "first"); - ASSERT_EQ(it->value(), "value1"); + BMQTST_ASSERT_EQ((it = map2.findByKey1(1)) == map2.end(), false); + BMQTST_ASSERT_EQ(it->key1(), 1); + BMQTST_ASSERT_EQ(it->key2(), "first"); + BMQTST_ASSERT_EQ(it->value(), "value1"); } static void test9_rangeObservers() @@ -1478,7 +1520,7 @@ static void test9_rangeObservers() // insert 1 element to nonEmptyMap nonEmptyMap.insert(1, "first", "value1"); - ASSERT_EQ(nonEmptyMap.size(), 1u); + BMQTST_ASSERT_EQ(nonEmptyMap.size(), 1u); const Map::value_type* element_p = &*nonEmptyMap.begin(); @@ -1486,164 +1528,164 @@ static void test9_rangeObservers() { // begin(), first key iterator = emptyMap.begin(Map::e_FIRST_KEY); - ASSERT_EQ(iterator == emptyMap.end(), true); - ASSERT_EQ(iterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(iterator == emptyMap.end(), true); + BMQTST_ASSERT_EQ(iterator.keyIndex(), Map::e_FIRST_KEY); // begin(), second key iterator = emptyMap.begin(Map::e_SECOND_KEY); - ASSERT_EQ(iterator == emptyMap.end(), true); - ASSERT_EQ(iterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(iterator == emptyMap.end(), true); + BMQTST_ASSERT_EQ(iterator.keyIndex(), Map::e_SECOND_KEY); // cbegin(), first key constIterator = emptyMap.cbegin(Map::e_FIRST_KEY); - ASSERT_EQ(constIterator == emptyMap.cend(), true); - ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(constIterator == emptyMap.cend(), true); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); // cbegin(), second key constIterator = emptyMap.cbegin(Map::e_SECOND_KEY); - ASSERT_EQ(constIterator == emptyMap.cend(), true); - ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(constIterator == emptyMap.cend(), true); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); // end(), first key iterator = emptyMap.end(Map::e_FIRST_KEY); - ASSERT_EQ(iterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(iterator.keyIndex(), Map::e_FIRST_KEY); // end(), second key iterator = emptyMap.end(Map::e_SECOND_KEY); - ASSERT_EQ(iterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(iterator.keyIndex(), Map::e_SECOND_KEY); // cend(), first key constIterator = emptyMap.cend(Map::e_FIRST_KEY); - ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); // cend(), second key constIterator = emptyMap.cend(Map::e_SECOND_KEY); - ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); } // non-const non-empty map { // begin(), first key iterator = nonEmptyMap.begin(Map::e_FIRST_KEY); - ASSERT_EQ(iterator == nonEmptyMap.end(), false); - ASSERT_EQ(iterator.keyIndex(), Map::e_FIRST_KEY); - ASSERT_EQ(*iterator == *element_p, true); + BMQTST_ASSERT_EQ(iterator == nonEmptyMap.end(), false); + BMQTST_ASSERT_EQ(iterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(*iterator == *element_p, true); // begin(), second key iterator = nonEmptyMap.begin(Map::e_SECOND_KEY); - ASSERT_EQ(iterator == nonEmptyMap.end(), false); - ASSERT_EQ(iterator.keyIndex(), Map::e_SECOND_KEY); - ASSERT_EQ(*iterator == *element_p, true); + BMQTST_ASSERT_EQ(iterator == nonEmptyMap.end(), false); + BMQTST_ASSERT_EQ(iterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(*iterator == *element_p, true); // cbegin(), first key constIterator = nonEmptyMap.cbegin(Map::e_FIRST_KEY); - ASSERT_EQ(constIterator == nonEmptyMap.cend(), false); - ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); - ASSERT_EQ(*constIterator == *element_p, true); + BMQTST_ASSERT_EQ(constIterator == nonEmptyMap.cend(), false); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(*constIterator == *element_p, true); // cbegin(), second key constIterator = nonEmptyMap.cbegin(Map::e_SECOND_KEY); - ASSERT_EQ(constIterator == nonEmptyMap.cend(), false); - ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); - ASSERT_EQ(*constIterator == *element_p, true); + BMQTST_ASSERT_EQ(constIterator == nonEmptyMap.cend(), false); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(*constIterator == *element_p, true); // end(), first key iterator = nonEmptyMap.end(Map::e_FIRST_KEY); - ASSERT_EQ(iterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(iterator.keyIndex(), Map::e_FIRST_KEY); // end(), second key iterator = nonEmptyMap.end(Map::e_SECOND_KEY); - ASSERT_EQ(iterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(iterator.keyIndex(), Map::e_SECOND_KEY); // cend(), first key constIterator = nonEmptyMap.cend(Map::e_FIRST_KEY); - ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); // cend(), second key constIterator = nonEmptyMap.cend(Map::e_SECOND_KEY); - ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); } // const empty map { // begin(), first key constIterator = bsl::cref(emptyMap).get().begin(Map::e_FIRST_KEY); - ASSERT_EQ(constIterator == emptyMap.end(), true); - ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(constIterator == emptyMap.end(), true); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); // begin(), second key constIterator = bsl::cref(emptyMap).get().begin(Map::e_SECOND_KEY); - ASSERT_EQ(constIterator == emptyMap.end(), true); - ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(constIterator == emptyMap.end(), true); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); // cbegin(), first key constIterator = bsl::cref(emptyMap).get().cbegin(Map::e_FIRST_KEY); - ASSERT_EQ(constIterator == emptyMap.cend(), true); - ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(constIterator == emptyMap.cend(), true); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); // cbegin(), second key constIterator = bsl::cref(emptyMap).get().cbegin(Map::e_SECOND_KEY); - ASSERT_EQ(constIterator == emptyMap.cend(), true); - ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(constIterator == emptyMap.cend(), true); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); // end(), first key constIterator = bsl::cref(emptyMap).get().end(Map::e_FIRST_KEY); - ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); // end(), second key constIterator = bsl::cref(emptyMap).get().end(Map::e_SECOND_KEY); - ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); // cend(), first key constIterator = bsl::cref(emptyMap).get().cend(Map::e_FIRST_KEY); - ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); // cend(), second key constIterator = bsl::cref(emptyMap).get().cend(Map::e_SECOND_KEY); - ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); } // const non-empty map { // begin(), first key constIterator = bsl::cref(nonEmptyMap).get().begin(Map::e_FIRST_KEY); - ASSERT_EQ(constIterator == nonEmptyMap.end(), false); - ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); - ASSERT_EQ(*constIterator == *element_p, true); + BMQTST_ASSERT_EQ(constIterator == nonEmptyMap.end(), false); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(*constIterator == *element_p, true); // begin(), second key constIterator = bsl::cref(nonEmptyMap).get().begin(Map::e_SECOND_KEY); - ASSERT_EQ(constIterator == nonEmptyMap.end(), false); - ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); - ASSERT_EQ(*constIterator == *element_p, true); + BMQTST_ASSERT_EQ(constIterator == nonEmptyMap.end(), false); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(*constIterator == *element_p, true); // cbegin(), first key constIterator = bsl::cref(nonEmptyMap).get().cbegin(Map::e_FIRST_KEY); - ASSERT_EQ(constIterator == nonEmptyMap.cend(), false); - ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); - ASSERT_EQ(*constIterator == *element_p, true); + BMQTST_ASSERT_EQ(constIterator == nonEmptyMap.cend(), false); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(*constIterator == *element_p, true); // cbegin(), second key constIterator = bsl::cref(nonEmptyMap).get().cbegin(Map::e_SECOND_KEY); - ASSERT_EQ(constIterator == nonEmptyMap.cend(), false); - ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); - ASSERT_EQ(*constIterator == *element_p, true); + BMQTST_ASSERT_EQ(constIterator == nonEmptyMap.cend(), false); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(*constIterator == *element_p, true); // end(), first key constIterator = bsl::cref(nonEmptyMap).get().end(Map::e_FIRST_KEY); - ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); // end(), second key constIterator = bsl::cref(nonEmptyMap).get().end(Map::e_SECOND_KEY); - ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); // cend(), first key constIterator = bsl::cref(nonEmptyMap).get().cend(Map::e_FIRST_KEY); - ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_FIRST_KEY); // cend(), second key constIterator = bsl::cref(nonEmptyMap).get().cend(Map::e_SECOND_KEY); - ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(constIterator.keyIndex(), Map::e_SECOND_KEY); } } @@ -1689,40 +1731,40 @@ static void test10_findByKey1() // insert elements map.insert(1, "first", "value1"); map.insert(2, "second", "value2"); - ASSERT_EQ(map.size(), 2u); + BMQTST_ASSERT_EQ(map.size(), 2u); // 1. non-const contained, key exists { Map::iterator it = map.findByKey1(1); - ASSERT_EQ(it == map.end(), false); - ASSERT_EQ(it.keyIndex(), Map::e_FIRST_KEY); - ASSERT_EQ(it->key1(), 1); - ASSERT_EQ(it->key2(), "first"); - ASSERT_EQ(it->value(), "value1"); + BMQTST_ASSERT_EQ(it == map.end(), false); + BMQTST_ASSERT_EQ(it.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(it->key1(), 1); + BMQTST_ASSERT_EQ(it->key2(), "first"); + BMQTST_ASSERT_EQ(it->value(), "value1"); } // 2. const contained, key exists { Map::const_iterator it = bsl::cref(map).get().findByKey1(2); - ASSERT_EQ(it == map.end(), false); - ASSERT_EQ(it.keyIndex(), Map::e_FIRST_KEY); - ASSERT_EQ(it->key1(), 2); - ASSERT_EQ(it->key2(), "second"); - ASSERT_EQ(it->value(), "value2"); + BMQTST_ASSERT_EQ(it == map.end(), false); + BMQTST_ASSERT_EQ(it.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(it->key1(), 2); + BMQTST_ASSERT_EQ(it->key2(), "second"); + BMQTST_ASSERT_EQ(it->value(), "value2"); } // 3. non-const contained, key doesn't exist { Map::iterator it = map.findByKey1(3); - ASSERT_EQ(it == map.end(), true); - ASSERT_EQ(it.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(it == map.end(), true); + BMQTST_ASSERT_EQ(it.keyIndex(), Map::e_FIRST_KEY); } // 4. const contained, key doesn't exist { Map::const_iterator it = bsl::cref(map).get().findByKey1(3); - ASSERT_EQ(it == map.end(), true); - ASSERT_EQ(it.keyIndex(), Map::e_FIRST_KEY); + BMQTST_ASSERT_EQ(it == map.end(), true); + BMQTST_ASSERT_EQ(it.keyIndex(), Map::e_FIRST_KEY); } } @@ -1768,40 +1810,40 @@ static void test11_findByKey2() // insert elements map.insert(1, "first", "value1"); map.insert(2, "second", "value2"); - ASSERT_EQ(map.size(), 2u); + BMQTST_ASSERT_EQ(map.size(), 2u); // 1. non-const contained, key exists { Map::iterator it = map.findByKey2("first"); - ASSERT_EQ(it == map.end(), false); - ASSERT_EQ(it.keyIndex(), Map::e_SECOND_KEY); - ASSERT_EQ(it->key1(), 1); - ASSERT_EQ(it->key2(), "first"); - ASSERT_EQ(it->value(), "value1"); + BMQTST_ASSERT_EQ(it == map.end(), false); + BMQTST_ASSERT_EQ(it.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(it->key1(), 1); + BMQTST_ASSERT_EQ(it->key2(), "first"); + BMQTST_ASSERT_EQ(it->value(), "value1"); } // 2. const contained, key exists { Map::const_iterator it = bsl::cref(map).get().findByKey2("second"); - ASSERT_EQ(it == map.end(), false); - ASSERT_EQ(it.keyIndex(), Map::e_SECOND_KEY); - ASSERT_EQ(it->key1(), 2); - ASSERT_EQ(it->key2(), "second"); - ASSERT_EQ(it->value(), "value2"); + BMQTST_ASSERT_EQ(it == map.end(), false); + BMQTST_ASSERT_EQ(it.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(it->key1(), 2); + BMQTST_ASSERT_EQ(it->key2(), "second"); + BMQTST_ASSERT_EQ(it->value(), "value2"); } // 3. non-const contained, key doesn't exist { Map::iterator it = map.findByKey2("third"); - ASSERT_EQ(it == map.end(), true); - ASSERT_EQ(it.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(it == map.end(), true); + BMQTST_ASSERT_EQ(it.keyIndex(), Map::e_SECOND_KEY); } // 4. const contained, key doesn't exist { Map::const_iterator it = bsl::cref(map).get().findByKey2("third"); - ASSERT_EQ(it == map.end(), true); - ASSERT_EQ(it.keyIndex(), Map::e_SECOND_KEY); + BMQTST_ASSERT_EQ(it == map.end(), true); + BMQTST_ASSERT_EQ(it.keyIndex(), Map::e_SECOND_KEY); } } @@ -1826,38 +1868,38 @@ static void test12_sizeObservers() bslma::TestAllocator alloc; Map map(&alloc); - ASSERT_EQ(map.empty(), true); - ASSERT_EQ(map.size(), 0u); + BMQTST_ASSERT_EQ(map.empty(), true); + BMQTST_ASSERT_EQ(map.size(), 0u); map.insert(1, "first", "value1"); - ASSERT_EQ(map.empty(), false); - ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.empty(), false); + BMQTST_ASSERT_EQ(map.size(), 1u); map.insert(2, "second", "value2"); - ASSERT_EQ(map.empty(), false); - ASSERT_EQ(map.size(), 2u); + BMQTST_ASSERT_EQ(map.empty(), false); + BMQTST_ASSERT_EQ(map.size(), 2u); map.insert(3, "third", "value2"); - ASSERT_EQ(map.empty(), false); - ASSERT_EQ(map.size(), 3u); + BMQTST_ASSERT_EQ(map.empty(), false); + BMQTST_ASSERT_EQ(map.size(), 3u); map.erase(map.begin()); - ASSERT_EQ(map.empty(), false); - ASSERT_EQ(map.size(), 2u); + BMQTST_ASSERT_EQ(map.empty(), false); + BMQTST_ASSERT_EQ(map.size(), 2u); map.erase(map.begin()); - ASSERT_EQ(map.empty(), false); - ASSERT_EQ(map.size(), 1u); + BMQTST_ASSERT_EQ(map.empty(), false); + BMQTST_ASSERT_EQ(map.size(), 1u); map.erase(map.begin()); - ASSERT_EQ(map.empty(), true); - ASSERT_EQ(map.size(), 0u); + BMQTST_ASSERT_EQ(map.empty(), true); + BMQTST_ASSERT_EQ(map.size(), 0u); } static void test13_equality() @@ -1886,19 +1928,19 @@ static void test13_equality() map1.insert(3, "third", "value3"); for (Map::const_iterator it = map1.cbegin(); it != map1.cend(); ++it) { - ASSERT(map1 != map2); + BMQTST_ASSERT(map1 != map2); map2.insert(it->key1(), it->key2(), it->value()); } - ASSERT(map1 == map2); + BMQTST_ASSERT(map1 == map2); while (!map1.empty()) { map1.erase(map1.begin()); - ASSERT(map1 != map2); + BMQTST_ASSERT(map1 != map2); } while (!map2.empty()) { - ASSERT(map1 != map2); + BMQTST_ASSERT(map1 != map2); map2.erase(map2.begin()); } - ASSERT(map1 == map2); + BMQTST_ASSERT(map1 == map2); } //============================================================================= diff --git a/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.h b/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.h index 4a44542a3..79e4122ba 100644 --- a/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.h +++ b/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.h @@ -39,20 +39,21 @@ /// Basic Usage Example ///------------------- // +// bslma::Allocator* allocator = bmqtst::TestHelperUtil::allocator(); +// // SimpleEvaluator evaluator; // bsl::string expression = "foo < 3 | bar > 4"; // -// CompilationContext compilationContext(s_allocator_p); +// CompilationContext compilationContext(allocator); // // if (int rc = evaluator.compile(expression, compilationContext)) { // bsl::cerr << compilationContext.lastErrorMessage() << "\n"; // // don't use evaluator // } // -// MockPropertiesReader reader(s_allocator_p); -// EvaluationContext evaluationContext(&reader, -// bmqtst::TestHelperUtil::allocator()); bool result = -// evaluator.evaluate(evaluationContext); +// MockPropertiesReader reader(allocator); +// EvaluationContext evaluationContext(&reader, allocator); +// bool result = evaluator.evaluate(evaluationContext); //.. // BDE diff --git a/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.t.cpp b/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.t.cpp index a2f97a630..de3fd963f 100644 --- a/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.t.cpp +++ b/src/groups/bmq/bmqeval/bmqeval_simpleevaluator.t.cpp @@ -88,10 +88,10 @@ static void testN1_SimpleEvaluator_GoogleBenchmark(benchmark::State& state) CompilationContext compilationContext(&localAllocator); SimpleEvaluator evaluator; - ASSERT(evaluator.compile("false || (i64_42==42 && s_foo==\"foo\")", - compilationContext) == 0); + BMQTST_ASSERT(evaluator.compile("false || (i64_42==42 && s_foo==\"foo\")", + compilationContext) == 0); - ASSERT_EQ(evaluator.evaluate(evaluationContext), true); + BMQTST_ASSERT_EQ(evaluator.evaluate(evaluationContext), true); //