From e262c9f3507f24bfcba430b6a45fad3968dfe38c Mon Sep 17 00:00:00 2001 From: Taylor Foxhall Date: Fri, 6 Dec 2024 17:19:37 -0500 Subject: [PATCH] Rename gtest conflicting test macros bmqtst provides several gtest-like compatibility macros, but this prevents us from using gtest or gmock directly because it uses the exact same names as the test macros from that library. Since we want to support at least using gmock in our tests, we rename them to avoid conflict. Signed-off-by: Taylor Foxhall --- ...qstoragetool_commandprocessorfactory.t.cpp | 3 +- .../m_bmqstoragetool_filemanagermock.h | 29 - ..._bmqstoragetool_journalfileprocessor.t.cpp | 124 +- ...m_bmqstoragetool_searchresultfactory.t.cpp | 2 +- .../bmqtool/m_bmqtool_inpututil.t.cpp | 20 +- .../bmq/bmqa/bmqa_abstractsession.t.cpp | 239 +- .../bmq/bmqa/bmqa_closequeuestatus.t.cpp | 40 +- .../bmq/bmqa/bmqa_configurequeuestatus.t.cpp | 40 +- src/groups/bmq/bmqa/bmqa_event.t.cpp | 16 +- src/groups/bmq/bmqa/bmqa_message.t.cpp | 181 +- src/groups/bmq/bmqa/bmqa_messageevent.t.cpp | 22 +- .../bmq/bmqa/bmqa_messageeventbuilder.t.cpp | 32 +- src/groups/bmq/bmqa/bmqa_mocksession.h | 52 +- src/groups/bmq/bmqa/bmqa_mocksession.t.cpp | 350 +-- .../bmq/bmqa/bmqa_openqueuestatus.t.cpp | 40 +- src/groups/bmq/bmqa/bmqa_queueid.t.cpp | 89 +- src/groups/bmq/bmqc/bmqc_array.t.cpp | 310 +-- src/groups/bmq/bmqc/bmqc_monitoredqueue.t.cpp | 8 +- .../bmqc_monitoredqueue_bdlccfixedqueue.t.cpp | 132 +- ...itoredqueue_bdlccsingleconsumerqueue.t.cpp | 100 +- .../bmq/bmqc/bmqc_multiqueuethreadpool.t.cpp | 34 +- src/groups/bmq/bmqc/bmqc_orderedhashmap.t.cpp | 388 +-- .../bmqc/bmqc_orderedhashmapwithhistory.t.cpp | 82 +- src/groups/bmq/bmqc/bmqc_twokeyhashmap.t.cpp | 844 +++--- .../bmq/bmqeval/bmqeval_simpleevaluator.t.cpp | 26 +- .../bmqex_bdlmteventschedulerexecutor.t.cpp | 48 +- .../bmqex_bdlmtfixedthreadpoolexecutor.t.cpp | 38 +- ...bdlmtmultiprioritythreadpoolexecutor.t.cpp | 42 +- ...ex_bdlmtmultiqueuethreadpoolexecutor.t.cpp | 96 +- .../bmqex/bmqex_bdlmtthreadpoolexecutor.t.cpp | 38 +- src/groups/bmq/bmqex/bmqex_bindutil.t.cpp | 32 +- .../bmq/bmqex/bmqex_executionpolicy.t.cpp | 142 +- .../bmq/bmqex/bmqex_executionutil.t.cpp | 329 +-- src/groups/bmq/bmqex/bmqex_executor.t.cpp | 210 +- .../bmq/bmqex/bmqex_executortraits.t.cpp | 30 +- src/groups/bmq/bmqex/bmqex_future.t.cpp | 257 +- src/groups/bmq/bmqex/bmqex_job.t.cpp | 8 +- src/groups/bmq/bmqex/bmqex_promise.t.cpp | 26 +- .../bmq/bmqex/bmqex_sequentialcontext.t.cpp | 76 +- src/groups/bmq/bmqex/bmqex_strand.t.cpp | 96 +- .../bmq/bmqex/bmqex_systemexecutor.t.cpp | 78 +- .../bmq/bmqimp/bmqimp_application.t.cpp | 37 +- .../bmq/bmqimp/bmqimp_brokersession.t.cpp | 2195 ++++++++-------- src/groups/bmq/bmqimp/bmqimp_event.t.cpp | 432 ++-- src/groups/bmq/bmqimp/bmqimp_eventqueue.h | 2 +- src/groups/bmq/bmqimp/bmqimp_eventqueue.t.cpp | 59 +- ...bmqimp_messagecorrelationidcontainer.t.cpp | 51 +- .../bmq/bmqimp/bmqimp_messagedumper.t.cpp | 420 +-- src/groups/bmq/bmqimp/bmqimp_queue.t.cpp | 143 +- .../bmq/bmqimp/bmqimp_queuemanager.t.cpp | 153 +- src/groups/bmq/bmqio/bmqio_channelutil.t.cpp | 119 +- src/groups/bmq/bmqio/bmqio_ntcchannel.t.cpp | 26 +- .../bmq/bmqio/bmqio_ntcchannelfactory.t.cpp | 66 +- .../bmqio_reconnectingchannelfactory.t.cpp | 113 +- src/groups/bmq/bmqio/bmqio_resolveutil.t.cpp | 24 +- .../bmqio/bmqio_resolvingchannelfactory.t.cpp | 28 +- .../bmq/bmqma/bmqma_countingallocator.t.cpp | 83 +- .../bmqma/bmqma_countingallocatorstore.t.cpp | 12 +- .../bmqma/bmqma_countingallocatorutil.t.cpp | 37 +- .../bmq/bmqp/bmqp_ackeventbuilder.t.cpp | 79 +- .../bmq/bmqp/bmqp_ackmessageiterator.t.cpp | 171 +- src/groups/bmq/bmqp/bmqp_compression.t.cpp | 52 +- .../bmq/bmqp/bmqp_confirmeventbuilder.t.cpp | 77 +- .../bmqp/bmqp_confirmmessageiterator.t.cpp | 119 +- .../bmq/bmqp/bmqp_controlmessageutil.t.cpp | 12 +- src/groups/bmq/bmqp/bmqp_crc32c.t.cpp | 160 +- src/groups/bmq/bmqp/bmqp_event.t.cpp | 208 +- src/groups/bmq/bmqp/bmqp_eventutil.t.cpp | 82 +- .../bmq/bmqp/bmqp_messageguidgenerator.t.cpp | 87 +- .../bmq/bmqp/bmqp_messageproperties.t.cpp | 499 ++-- src/groups/bmq/bmqp/bmqp_optionsview.t.cpp | 240 +- src/groups/bmq/bmqp/bmqp_optionutil.t.cpp | 90 +- src/groups/bmq/bmqp/bmqp_protocol.t.cpp | 690 ++--- src/groups/bmq/bmqp/bmqp_protocolutil.t.cpp | 222 +- .../bmq/bmqp/bmqp_pusheventbuilder.t.cpp | 539 ++-- .../bmq/bmqp/bmqp_pushmessageiterator.t.cpp | 405 +-- .../bmq/bmqp/bmqp_puteventbuilder.t.cpp | 1111 ++++---- .../bmq/bmqp/bmqp_putmessageiterator.t.cpp | 760 +++--- src/groups/bmq/bmqp/bmqp_queueid.t.cpp | 35 +- src/groups/bmq/bmqp/bmqp_queueutil.t.cpp | 67 +- .../bmq/bmqp/bmqp_recoveryeventbuilder.t.cpp | 163 +- .../bmqp/bmqp_recoverymessageiterator.t.cpp | 256 +- .../bmq/bmqp/bmqp_rejecteventbuilder.t.cpp | 77 +- .../bmq/bmqp/bmqp_rejectmessageiterator.t.cpp | 119 +- src/groups/bmq/bmqp/bmqp_requestmanager.t.cpp | 210 +- .../bmqp/bmqp_routingconfigurationutils.t.cpp | 54 +- .../bmq/bmqp/bmqp_schemaeventbuilder.t.cpp | 157 +- .../bmq/bmqp/bmqp_schemagenerator.t.cpp | 22 +- src/groups/bmq/bmqp/bmqp_schemalearner.t.cpp | 199 +- .../bmq/bmqp/bmqp_storageeventbuilder.t.cpp | 224 +- .../bmqp/bmqp_storagemessageiterator.t.cpp | 211 +- src/groups/bmq/bmqpi/bmqpi_dtcontext.t.cpp | 6 +- src/groups/bmq/bmqpi/bmqpi_dtspan.t.cpp | 6 +- src/groups/bmq/bmqpi/bmqpi_dttracer.t.cpp | 6 +- .../bmq/bmqpi/bmqpi_hosthealthmonitor.t.cpp | 6 +- src/groups/bmq/bmqsys/bmqsys_mocktime.t.cpp | 24 +- .../bmq/bmqsys/bmqsys_statmonitor.t.cpp | 148 +- .../bmqsys_statmonitorsnapshotrecorder.t.cpp | 96 +- src/groups/bmq/bmqsys/bmqsys_time.t.cpp | 36 +- .../bmqt/bmqt_compressionalgorithmtype.t.cpp | 6 +- src/groups/bmq/bmqt/bmqt_correlationid.t.cpp | 150 +- src/groups/bmq/bmqt/bmqt_encodingtype.t.cpp | 22 +- .../bmq/bmqt/bmqt_hosthealthstate.t.cpp | 22 +- .../bmq/bmqt/bmqt_messageeventtype.t.cpp | 20 +- src/groups/bmq/bmqt/bmqt_messageguid.t.cpp | 66 +- src/groups/bmq/bmqt/bmqt_propertytype.t.cpp | 22 +- src/groups/bmq/bmqt/bmqt_queueflags.t.cpp | 114 +- src/groups/bmq/bmqt/bmqt_queueoptions.t.cpp | 145 +- src/groups/bmq/bmqt/bmqt_resultcode.t.cpp | 75 +- .../bmq/bmqt/bmqt_sessioneventtype.t.cpp | 22 +- src/groups/bmq/bmqt/bmqt_sessionoptions.t.cpp | 71 +- src/groups/bmq/bmqt/bmqt_uri.t.cpp | 313 +-- src/groups/bmq/bmqt/bmqt_version.t.cpp | 68 +- .../bmq/bmqtsk/bmqtsk_logcontroller.t.cpp | 43 +- src/groups/bmq/bmqtst/bmqtst_blobtestutil.h | 14 +- .../bmq/bmqtst/bmqtst_blobtestutil.t.cpp | 44 +- .../bmq/bmqtst/bmqtst_scopedlogobserver.t.cpp | 48 +- src/groups/bmq/bmqtst/bmqtst_testhelper.h | 128 +- src/groups/bmq/bmqu/bmqu_atomicstate.t.cpp | 20 +- .../bmq/bmqu/bmqu_atomicvalidator.t.cpp | 52 +- src/groups/bmq/bmqu/bmqu_blob.t.cpp | 281 +- src/groups/bmq/bmqu/bmqu_blobiterator.t.cpp | 54 +- .../bmq/bmqu/bmqu_blobobjectproxy.t.cpp | 106 +- src/groups/bmq/bmqu/bmqu_memoutstream.t.cpp | 50 +- .../bmq/bmqu/bmqu_objectplaceholder.t.cpp | 40 +- src/groups/bmq/bmqu/bmqu_operationchain.t.cpp | 249 +- .../bmq/bmqu/bmqu_outstreamformatsaver.t.cpp | 8 +- src/groups/bmq/bmqu/bmqu_printutil.t.cpp | 24 +- .../bmq/bmqu/bmqu_samethreadchecker.t.cpp | 6 +- src/groups/bmq/bmqu/bmqu_sharedresource.t.cpp | 72 +- src/groups/bmq/bmqu/bmqu_stringutil.t.cpp | 61 +- .../bmq/bmqu/bmqu_throttledaction.t.cpp | 223 +- src/groups/bmq/bmqu/bmqu_tlsbool.t.cpp | 94 +- src/groups/bmq/bmqu/bmqu_weakmemfn.t.cpp | 93 +- src/groups/bmq/bmqvt/bmqvt_propertybag.h | 2 +- src/groups/bmq/bmqvt/bmqvt_propertybag.t.cpp | 57 +- .../bmq/bmqvt/bmqvt_rcdescriptionerror.t.cpp | 26 +- src/groups/bmq/bmqvt/bmqvt_valueorerror.t.cpp | 80 +- src/groups/mqb/mqba/mqba_adminsession.t.cpp | 12 +- src/groups/mqb/mqba/mqba_application.t.cpp | 2 +- src/groups/mqb/mqba/mqba_clientsession.t.cpp | 233 +- src/groups/mqb/mqba/mqba_dispatcher.t.cpp | 50 +- .../mqbblp/mqbblp_clusterstatemonitor.t.cpp | 238 +- .../mqbblp/mqbblp_messagegroupidmanager.t.cpp | 135 +- src/groups/mqb/mqbblp/mqbblp_pushstream.t.cpp | 32 +- .../mqbblp_queueconsumptionmonitor.t.cpp | 189 +- .../mqb/mqbblp/mqbblp_queueenginetester.h | 12 +- .../mqb/mqbblp/mqbblp_relayqueueengine.t.cpp | 351 +-- .../mqb/mqbblp/mqbblp_remotequeue.t.cpp | 133 +- .../mqb/mqbblp/mqbblp_rootqueueengine.t.cpp | 1408 +++++----- src/groups/mqb/mqbblp/mqbblp_routers.t.cpp | 158 +- .../mqb/mqbc/mqbc_clusterstateledger.t.cpp | 34 +- .../mqbc_clusterstateledgeriterator.t.cpp | 6 +- .../mqbc_clusterstateledgerprotocol.t.cpp | 43 +- .../mqbc/mqbc_clusterstateledgerutil.t.cpp | 135 +- .../mqb/mqbc/mqbc_clusterstatemanager.t.cpp | 345 +-- .../mqbc/mqbc_incoreclusterstateledger.t.cpp | 450 ++-- ...qbc_incoreclusterstateledgeriterator.t.cpp | 30 +- src/groups/mqb/mqbc/mqbc_storagemanager.t.cpp | 234 +- .../mqb/mqbc/test/mqbc_clusterstate.t.cpp | 2 +- .../mqb/mqbcfg/mqbcfg_brokerconfig.t.cpp | 8 +- .../mqbcfg_tcpinterfaceconfigvalidator.t.cpp | 31 +- src/groups/mqb/mqbcmd/mqbcmd_parseutil.t.cpp | 13 +- src/groups/mqb/mqbi/mqbi_queue.t.cpp | 26 +- src/groups/mqb/mqbi/mqbi_queueengine.t.cpp | 26 +- src/groups/mqb/mqbnet/mqbnet_channel.t.cpp | 82 +- src/groups/mqb/mqbnet/mqbnet_cluster.t.cpp | 28 +- .../mqb/mqbnet/mqbnet_dummysession.t.cpp | 10 +- src/groups/mqb/mqbnet/mqbnet_elector.t.cpp | 2301 +++++++++-------- .../mqbnet/mqbnet_multirequestmanager.t.cpp | 65 +- src/groups/mqb/mqbnet/mqbnet_negotiator.t.cpp | 34 +- src/groups/mqb/mqbnet/mqbnet_session.t.cpp | 12 +- .../mqb/mqbs/mqbs_datafileiterator.t.cpp | 90 +- src/groups/mqb/mqbs/mqbs_datastore.t.cpp | 54 +- .../mqb/mqbs/mqbs_filebackedstorage.t.cpp | 659 ++--- src/groups/mqb/mqbs/mqbs_fileset.t.cpp | 42 +- src/groups/mqb/mqbs/mqbs_filestore.t.cpp | 64 +- .../mqb/mqbs/mqbs_filestoreprotocol.t.cpp | 278 +- .../mqb/mqbs/mqbs_filestoreprotocolutil.t.cpp | 109 +- src/groups/mqb/mqbs/mqbs_filestoreset.t.cpp | 60 +- .../mqb/mqbs/mqbs_inmemorystorage.t.cpp | 566 ++-- .../mqb/mqbs/mqbs_journalfileiterator.t.cpp | 288 ++- .../mqb/mqbs/mqbs_mappedfiledescriptor.t.cpp | 40 +- src/groups/mqb/mqbs/mqbs_memoryblock.t.cpp | 28 +- .../mqb/mqbs/mqbs_memoryblockiterator.t.cpp | 174 +- src/groups/mqb/mqbs/mqbs_offsetptr.t.cpp | 8 +- .../mqb/mqbs/mqbs_qlistfileiterator.t.cpp | 217 +- .../mqb/mqbs/mqbs_storageprintutil.t.cpp | 4 +- src/groups/mqb/mqbs/mqbs_storageutil.t.cpp | 61 +- src/groups/mqb/mqbsi/mqbsi_ledger.t.cpp | 6 +- src/groups/mqb/mqbsi/mqbsi_log.t.cpp | 6 +- src/groups/mqb/mqbsl/mqbsl_inmemorylog.t.cpp | 280 +- src/groups/mqb/mqbsl/mqbsl_ledger.t.cpp | 882 ++++--- .../mqbsl/mqbsl_memorymappedondisklog.t.cpp | 341 +-- .../mqb/mqbsl/mqbsl_readwriteondisklog.t.cpp | 278 +- .../mqb/mqbstat/mqbstat_queuestats.t.cpp | 344 +-- .../mqb/mqbstat/mqbstat_statcontroller.t.cpp | 2 +- src/groups/mqb/mqbu/mqbu_capacitymeter.t.cpp | 58 +- src/groups/mqb/mqbu/mqbu_exit.t.cpp | 33 +- src/groups/mqb/mqbu/mqbu_loadbalancer.t.cpp | 60 +- .../mqb/mqbu/mqbu_messageguidutil.t.cpp | 42 +- .../mqb/mqbu/mqbu_resourceusagemonitor.t.cpp | 931 +++---- src/groups/mqb/mqbu/mqbu_storagekey.t.cpp | 105 +- 203 files changed, 16790 insertions(+), 15653 deletions(-) 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_filemanagermock.h b/src/applications/bmqstoragetool/m_bmqstoragetool_filemanagermock.h index c0084be13..804f0948f 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 { diff --git a/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.t.cpp b/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.t.cpp index b5fd76178..7bfe25df4 100644 --- a/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.t.cpp +++ b/src/applications/bmqstoragetool/m_bmqstoragetool_journalfileprocessor.t.cpp @@ -220,7 +220,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() @@ -288,7 +288,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() @@ -349,7 +349,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() @@ -433,7 +433,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() @@ -498,7 +498,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() @@ -562,7 +562,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() @@ -629,7 +629,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() @@ -690,7 +690,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() @@ -761,7 +761,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() @@ -836,7 +836,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() @@ -902,7 +902,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() @@ -965,8 +965,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 @@ -974,20 +974,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); } } @@ -1047,8 +1047,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); @@ -1115,8 +1115,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(); @@ -1124,8 +1124,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(); } @@ -1183,7 +1183,7 @@ static void test14_summaryTest() "Number of outstanding messages: 2\nOutstanding 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() @@ -1211,15 +1211,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); } }; @@ -1232,8 +1232,10 @@ static void test15_timestampSearchTest() journalFile.fileHeader(), false); // Move the iterator to the beginning of the file - ASSERT_EQ(journalFileIt.nextRecord(), 1); - ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, ts), 1); + BMQTST_ASSERT_EQ(journalFileIt.nextRecord(), 1); + BMQTST_ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, + ts), + 1); ResultChecker::check(journalFileIt, ts); } @@ -1247,35 +1249,43 @@ 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); - ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, ts1), 1); + BMQTST_ASSERT_GT(journalFileIt.recordHeader().timestamp(), ts1); + BMQTST_ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, + ts1), + 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); - ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, ts2), 1); + BMQTST_ASSERT_LT(journalFileIt.recordHeader().timestamp(), ts2); + BMQTST_ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, + ts2), + 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, ts1), 1); + BMQTST_ASSERT(journalFileIt.isReverseMode()); + BMQTST_ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, + ts1), + 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, ts2), 1); + BMQTST_ASSERT(journalFileIt.isReverseMode()); + BMQTST_ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, + ts2), + 1); ResultChecker::check(journalFileIt, ts2); } @@ -1288,11 +1298,13 @@ static void test15_timestampSearchTest() journalFile.fileHeader(), false); // Move the iterator to the beginning of the file - ASSERT_EQ(journalFileIt.nextRecord(), 1); - ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, ts), 0); - ASSERT_EQ(journalFileIt.recordIndex(), k_NUM_RECORDS - 1); - ASSERT_LT(journalFileIt.recordHeader().timestamp(), ts); - ASSERT(!journalFileIt.isReverseMode()); + BMQTST_ASSERT_EQ(journalFileIt.nextRecord(), 1); + BMQTST_ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, + ts), + 0); + BMQTST_ASSERT_EQ(journalFileIt.recordIndex(), k_NUM_RECORDS - 1); + BMQTST_ASSERT_LT(journalFileIt.recordHeader().timestamp(), ts); + BMQTST_ASSERT(!journalFileIt.isReverseMode()); } { @@ -1303,11 +1315,13 @@ static void test15_timestampSearchTest() journalFile.fileHeader(), false); // Move the iterator to the beginning of the file - ASSERT_EQ(journalFileIt.nextRecord(), 1); - ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, ts), 1); - ASSERT_EQ(journalFileIt.recordIndex(), 0U); - ASSERT_GT(journalFileIt.recordHeader().timestamp(), ts); - ASSERT(!journalFileIt.isReverseMode()); + BMQTST_ASSERT_EQ(journalFileIt.nextRecord(), 1); + BMQTST_ASSERT_EQ(m_bmqstoragetool::moveToLowerBound(&journalFileIt, + ts), + 1); + BMQTST_ASSERT_EQ(journalFileIt.recordIndex(), 0U); + BMQTST_ASSERT_GT(journalFileIt.recordHeader().timestamp(), ts); + BMQTST_ASSERT(!journalFileIt.isReverseMode()); } } 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_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 af2ecfb14..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 } @@ -188,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(&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, @@ -215,9 +217,9 @@ 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().get(), bmqtst::TestHelperUtil::allocator(), @@ -230,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() @@ -294,7 +296,7 @@ static void test3_messageProperties() // 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, @@ -303,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 = @@ -335,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 @@ -356,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); @@ -368,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 @@ -381,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); } } @@ -439,8 +441,8 @@ static void test4_subscriptionHandle() 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") { @@ -459,19 +461,19 @@ static void test4_subscriptionHandle() // Create PushEventBuilder 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 @@ -481,9 +483,9 @@ 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().get(), bmqtst::TestHelperUtil::allocator(), @@ -496,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") @@ -524,7 +527,7 @@ static void test4_subscriptionHandle() // Create PushEventBuilder 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( @@ -534,9 +537,9 @@ 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().get(), bmqtst::TestHelperUtil::allocator(), @@ -549,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") @@ -572,7 +575,7 @@ static void test4_subscriptionHandle() // Create PutEventBuilder bmqp::PutEventBuilder builder(&blobSpPool, bmqtst::TestHelperUtil::allocator()); - ASSERT_EQ(0, builder.messageCount()); + BMQTST_ASSERT_EQ(0, builder.messageCount()); // Add message builder.startMessage(); @@ -581,8 +584,8 @@ 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().get(), bmqtst::TestHelperUtil::allocator()); @@ -594,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") @@ -613,13 +616,13 @@ static void test4_subscriptionHandle() // Create AckEventBuilder 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().get(), bmqtst::TestHelperUtil::allocator()); @@ -631,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 54d29d2a1..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); } } @@ -205,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); } } @@ -250,7 +250,7 @@ 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().get(), @@ -281,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.h b/src/groups/bmq/bmqa/bmqa_mocksession.h index 04914df33..cd7672f09 100644 --- a/src/groups/bmq/bmqa/bmqa_mocksession.h +++ b/src/groups/bmq/bmqa/bmqa_mocksession.h @@ -243,19 +243,20 @@ /// /// // 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"); @@ -299,11 +300,11 @@ /// /// // 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. @@ -319,7 +320,7 @@ /// // 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. @@ -344,14 +345,15 @@ /// 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 @@ -367,14 +369,15 @@ /// bmqt::SessionEventType::e_DISCONNECTED, /// 0, // statusCode /// "", // errorDescription -/// allocator)); -/// ASSERT_EQ(mockSession.emitEvent(), true); +/// d_allocator_p)); +/// 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. @@ -492,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 @@ -523,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 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/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.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); //