當前位置: 首頁>>代碼示例>>C++>>正文


C++ CPPUNIT_ASSERT_EQUAL_MESSAGE函數代碼示例

本文整理匯總了C++中CPPUNIT_ASSERT_EQUAL_MESSAGE函數的典型用法代碼示例。如果您正苦於以下問題:C++ CPPUNIT_ASSERT_EQUAL_MESSAGE函數的具體用法?C++ CPPUNIT_ASSERT_EQUAL_MESSAGE怎麽用?C++ CPPUNIT_ASSERT_EQUAL_MESSAGE使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了CPPUNIT_ASSERT_EQUAL_MESSAGE函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: testPresencePackageParser

   void testPresencePackageParser()
      {
         const char *package = 
            "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
            "<presence xmlns=\"urn:ietf:params:xml:ns:pidf\" entity=\"[email protected]\">\n"
            "<tuple id=\"1\">\n"
            "<status>\n"
            "<basic>open</basic>\n"
            "</status>\n"
            "<contact>tel:+0123456789</contact>\n"
            "</tuple>\n"
            "</presence>\n"
            ;
       
         SipPresenceEvent body("[email protected]", package);

         UtlString bodyString;
         int bodyLength;
       
         body.getBytes(&bodyString, &bodyLength);
         //printf("body = \n%s\n", bodyString.data());
       
         CPPUNIT_ASSERT(strcmp(bodyString.data(), package) == 0);

         int otherLength = body.getLength();
         CPPUNIT_ASSERT_EQUAL_MESSAGE("content length is not equal",
                                      bodyLength, otherLength);
      }
開發者ID:John-Chan,項目名稱:sipXtapi,代碼行數:28,代碼來源:SipPresenceEventTest.cpp

示例2: GetUniverse

void CloneObjectsTest::testCloneString() {
    VMString* orig = GetUniverse()->NewString("foobar");
    VMString* clone = orig->Clone();

    CPPUNIT_ASSERT((intptr_t)orig != (intptr_t)clone);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("class differs!!", orig->GetClass(),
            clone->GetClass());
    CPPUNIT_ASSERT_EQUAL_MESSAGE("objectSize differs!!", orig->GetObjectSize(),
            clone->GetObjectSize());
    //CPPUNIT_ASSERT_EQUAL_MESSAGE("numberOfFields differs!!", orig->numberOfFields, clone->numberOfFields);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("string differs!!!", orig->GetStdString(), clone->GetStdString());
    //CPPUNIT_ASSERT_MESSAGE("internal string was not copied", (intptr_t)orig->chars != (intptr_t)clone->chars);
    orig->chars[0] = 'm';
    CPPUNIT_ASSERT_MESSAGE("string differs!!!", orig->GetStdString() != clone->GetStdString());

}
開發者ID:SOM-st,項目名稱:SOMpp,代碼行數:16,代碼來源:CloneObjectsTest.cpp

示例3: createFolder

void ZipTest::test_replaceFile_WhenFileNotExistsOnFileSystem(){
    bool expected = false;
    std::string zipFileName = tempFolder + "/" + zipFileFor_deleteAndReplace;

    createFolder(zipFileName);
    copyFile(zipFileFor_deleteAndReplace, zipFileName);

    zip->open(zipFileName, OpenFlags::OpenExisting);
    std::string fileToReplace = folderNameInsideZip + "/file2.txt";
    bool actual = zip->replaceFile(notExistingFileName, fileToReplace);
    zip->close();

    CPPUNIT_ASSERT_EQUAL(expected, actual);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("count", 7, numFilesInZip(zipFileName));
    CPPUNIT_ASSERT_EQUAL_MESSAGE("contains", false, containsFile(zipFileName, fileToReplace));
}
開發者ID:flo2k,項目名稱:CppZip,代碼行數:16,代碼來源:ZipTest.cpp

示例4: pt

void KDTreeTestCase::checkInsert() {

    //this vector can't possibly be in the array because it
    //has a value above the _MAX_PT_VAL_
    std::vector<double> arr;
    arr.push_back(_MAX_PT_VAL_ * 2);
    for (int i=1; i<_N_; i++) {
        arr.push_back(i);
    }

    Point<_N_, double, std::string> pt(arr, "sup");

    size_t n = tree->size() + 1;
    tree->insert(pt);

    CPPUNIT_ASSERT_EQUAL_MESSAGE("check if size increased when adding a point",
            n, tree->size());

    CPPUNIT_ASSERT_MESSAGE("check if tree can insert point",
            tree->contains(pt));

    Point<_N_, double, std::string> pt_b(arr, "sup");
    emptyTree->insert(pt);

    CPPUNIT_ASSERT_MESSAGE("check inserting point into an empty tree",
            emptyTree->contains(pt));
}
開發者ID:juicedatom,項目名稱:KDTree,代碼行數:27,代碼來源:unitTests.cpp

示例5: stringset_to_strarr

void NutClientTest::test_stringset_to_strarr()
{
	std::set<std::string> strset;
	strset.insert("test");
	strset.insert("hello");
	strset.insert("world");

	strarr arr = stringset_to_strarr(strset);
	CPPUNIT_ASSERT_MESSAGE("stringset_to_strarr(...) result is null", arr!=NULL);

	std::set<std::string> res;

	char** ptr = arr;
	while(*ptr!=NULL)
	{
		res.insert(std::string(*ptr));
		ptr++;
	}

	CPPUNIT_ASSERT_EQUAL_MESSAGE("stringset_to_strarr(...) result has not 3 items", (size_t)3, res.size());
	CPPUNIT_ASSERT_MESSAGE("stringset_to_strarr(...) result has not item \"test\"", res.find("test")!=res.end());
	CPPUNIT_ASSERT_MESSAGE("stringset_to_strarr(...) result has not item \"hello\"", res.find("hello")!=res.end());
	CPPUNIT_ASSERT_MESSAGE("stringset_to_strarr(...) result has not item \"world\"", res.find("world")!=res.end());
	
	strarr_free(arr);
}
開發者ID:balooloo,項目名稱:nut,代碼行數:26,代碼來源:nutclienttest.cpp

示例6: CPPUNIT_ASSERT_EQUAL_MESSAGE

void ClusterAStarFactoryTest::newClusterAStarShouldReturnANewInstanceOfClusterAStar()
{	
	ClusterAStarFactory caf;
	ClusterAStar* ac = dynamic_cast<ClusterAStar*>(caf.newClusterAStar());
	CPPUNIT_ASSERT_EQUAL_MESSAGE("factory failed to return an instance of ClusterAStar", true, ac!=0);
	delete ac;
}
開發者ID:Elsopuro,項目名稱:ahastar,代碼行數:7,代碼來源:ClusterAStarFactoryTest.cpp

示例7: testCreators

    void testCreators()
    {
        PtCallEvent* pTempPtCallEvent;
        PtCallEvent* pTempPtCallEvent_1;
        PtCallEvent::PtEventId*   pTempPtEventId;

        pTempPtCallEvent = new PtCallEvent();
        pTempPtEventId = new PtEvent::PtEventId(PtEvent::PROVIDER_IN_SERVICE);
        pTempPtCallEvent->getId(*pTempPtEventId);
        CPPUNIT_ASSERT_EQUAL_MESSAGE("Should be invalid event", PtEvent::EVENT_INVALID, *pTempPtEventId);
        delete pTempPtEventId;
        delete pTempPtCallEvent;
                                                                                
        pTempPtCallEvent = new PtCallEvent(PtEvent::PROVIDER_IN_SERVICE);
        // mCallId is protected and no accessor method my be for better encapsulation
        // CPPUNIT_ASSERT_EQUAL_MESSAGE("callid label", 0, 
        //        strcmp(pTempPtCallEvent->mCallId, "callId"));
        delete pTempPtCallEvent;
                                                                                
        pTempPtCallEvent = new PtCallEvent(PtEvent::CALL_INVALID);
        pTempPtCallEvent_1 = new PtCallEvent(*pTempPtCallEvent);
        // mCallId is protected and no accessor method my be for better encapsulation
        // CPPUNIT_ASSERT_EQUAL_MESSAGE("callid label", 0, 
        //        strcmp(pTempPtCallEvent->mCallId, "callId"));
        delete pTempPtCallEvent;
        delete pTempPtCallEvent_1;
    }
開發者ID:John-Chan,項目名稱:sipXtapi,代碼行數:27,代碼來源:PtCallEventTest.cpp

示例8: check_Advancing_Operator_IntList

    void check_Advancing_Operator_IntList()
    {
        UtlSortedListIterator slIter(intList) ; 

        for (int i = 0 ; i < intListCount ; i++)
        {
            UtlContainable* uNext = slIter() ; 
            CPPUNIT_ASSERT_EQUAL_MESSAGE(testDataForIntList[i].testDescription, \
               testDataForIntList[i].item, uNext) ; 
        }
        // Verify that the iterator returns null after the last advancing has been called
        UtlContainable* uNext = slIter() ; 
       
        CPPUNIT_ASSERT_EQUAL_MESSAGE("Null is returned after all items have been " \
            "advanced ", (void*)NULL, (void*)uNext) ; 
    } 
開發者ID:John-Chan,項目名稱:sipXtapi,代碼行數:16,代碼來源:UtlSortedListIteratorTest.cpp

示例9: CPPUNIT_ASSERT_MESSAGE

void FilesystemTest::testFile() {
#ifdef _WIN32
	const string test_file = test_dir->Path() + "\\test-file.txt";
#else
	const string test_file = test_dir->Path() + "/test-file";
#endif

	CPPUNIT_ASSERT_MESSAGE(
		"inexistant file is file",
		!is_file(test_file));
	CPPUNIT_ASSERT_EQUAL_MESSAGE(
		"mtime of inexistant file should be zero",
		time_t(0), file_mtime(test_file));
	CPPUNIT_ASSERT_MESSAGE(
		"inexistant file is a directory",
		!is_dir(test_file));

	{ // create file
		ofstream file(test_file);
		file << "hello" << endl;
	}
	time_t now = time(nullptr);
	CPPUNIT_ASSERT_MESSAGE(
		"existing file not a file",
		is_file(test_file));
	CPPUNIT_ASSERT_MESSAGE(
		"mtime of existing file should be somewhere around now",
		// let's assume that creating the file takes less than five seconds
		abs(now - file_mtime(test_file) < 5));
	CPPUNIT_ASSERT_MESSAGE(
		"regular file is a directory",
		!is_dir(test_file));

	CPPUNIT_ASSERT_MESSAGE(
		"failed to remove test file",
		remove_file(test_file));

	CPPUNIT_ASSERT_MESSAGE(
		"removed file is still a file",
		!is_file(test_file));
	CPPUNIT_ASSERT_EQUAL_MESSAGE(
		"mtime of removed file should be zero",
		time_t(0), file_mtime(test_file));
	CPPUNIT_ASSERT_MESSAGE(
		"removed file became a directory",
		!is_dir(test_file));
}
開發者ID:HolySmoke86,項目名稱:blank,代碼行數:47,代碼來源:FilesystemTest.cpp

示例10: Map

void AnnotatedHierarchicalAStarTest::logStatsShouldRecordAllMetricsToStatsCollection()
{
	statCollection sc;
	Map *m = new Map(maplocation.c_str());
	AnnotatedClusterAbstraction* aca = new AnnotatedClusterAbstraction(m, new AnnotatedAStar(), TESTCLUSTERSIZE);
	AnnotatedClusterFactory* acfactory = new AnnotatedClusterFactory();
	aca->buildClusters(acfactory);
	aca->buildEntrances();

	node *start = aca->getNodeFromMap(1,5);
	node* goal = aca->getNodeFromMap(16,8);
	
	int capability = kGround;
	int size = 1;
	
	ahastar->setGraphAbstraction(aca);
	ahastar->setClearance(size);
	ahastar->setCapability(capability);
		
	path* p = ahastar->getPath(aca, start, goal);
	assert(p != 0);
	
	ahastar->logFinalStats(&sc);
	
	statValue result;
	int lookupResult = sc.lookupStat("nodesExpanded", ahastar->getName() , result);
	CPPUNIT_ASSERT_MESSAGE("couldn't find nodesExpanded metric in statsCollection", lookupResult != -1);
	CPPUNIT_ASSERT_EQUAL_MESSAGE("nodesExpanded metric in statsCollection doesn't match expected result", (long)ahastar->getNodesExpanded(), result.lval);

	lookupResult = sc.lookupStat("nodesTouched", ahastar->getName() , result);
	CPPUNIT_ASSERT_MESSAGE("couldn't find nodesTouched metric in statsCollection", lookupResult != -1);
	CPPUNIT_ASSERT_EQUAL_MESSAGE("nodesTouched metric in statsCollection doesn't match expected result", (long)ahastar->getNodesTouched(), result.lval);

	lookupResult = sc.lookupStat("peakMemory", ahastar->getName() , result);
	CPPUNIT_ASSERT_MESSAGE("couldn't find peakMemory metric in statsCollection", lookupResult != -1);
	CPPUNIT_ASSERT_EQUAL_MESSAGE("peakMemory metric in statsCollection doesn't match expected result", (long)ahastar->getPeakMemory(), result.lval);

	lookupResult = sc.lookupStat("searchTime", ahastar->getName() , result);
	CPPUNIT_ASSERT_MESSAGE("couldn't find searchTime metric in statsCollection", lookupResult != -1);
	CPPUNIT_ASSERT_EQUAL_MESSAGE("searchTime metric in statsCollection doesn't match expected result", (double)ahastar->getSearchTime(), result.fval);

	lookupResult = sc.lookupStat("insNodesExpanded", ahastar->getName() , result);
	CPPUNIT_ASSERT_MESSAGE("couldn't find nodesExpanded metric in statsCollection", lookupResult != -1);
	CPPUNIT_ASSERT_EQUAL_MESSAGE("nodesExpanded metric in statsCollection doesn't match expected result", (long)ahastar->getInsertNodesExpanded(), result.lval);

	lookupResult = sc.lookupStat("insNodesTouched", ahastar->getName() , result);
	CPPUNIT_ASSERT_MESSAGE("couldn't find nodesTouched metric in statsCollection", lookupResult != -1);
	CPPUNIT_ASSERT_EQUAL_MESSAGE("nodesTouched metric in statsCollection doesn't match expected result", (long)ahastar->getInsertNodesTouched(), result.lval);

	lookupResult = sc.lookupStat("insPeakMemory", ahastar->getName() , result);
	CPPUNIT_ASSERT_MESSAGE("couldn't find peakMemory metric in statsCollection", lookupResult != -1);
	CPPUNIT_ASSERT_EQUAL_MESSAGE("peakMemory metric in statsCollection doesn't match expected result", (long)ahastar->getInsertPeakMemory(), result.lval);

	lookupResult = sc.lookupStat("insSearchTime", ahastar->getName() , result);
	CPPUNIT_ASSERT_MESSAGE("couldn't find searchTime metric in statsCollection", lookupResult != -1);
	CPPUNIT_ASSERT_EQUAL_MESSAGE("searchTime metric in statsCollection doesn't match expected result", (double)ahastar->getInsertSearchTime(), result.fval);
}
開發者ID:Elsopuro,項目名稱:ahastar,代碼行數:57,代碼來源:AnnotatedHierarchicalAStarTest.cpp

示例11: CPPUNIT_ASSERT_EQUAL

void ZipTest::test_addFile_Content_WithSubFoldersFileName() {
    std::vector<unsigned char> content;
    content.push_back('a');
    content.push_back('z');
    content.push_back('7');

    bool expected = true;
    std::string zipFileName = tempFolder + "/" + zipFile;

    zip->open(zipFileName);
    bool actual = zip->addFile("folder/subfolder/test.txt", content);
    zip->close();

    CPPUNIT_ASSERT_EQUAL(expected, actual);
    CPPUNIT_ASSERT_EQUAL_MESSAGE("count", 1, numFilesInZip(zipFileName));
    CPPUNIT_ASSERT_EQUAL_MESSAGE("contains", true, containsFile(zipFileName, "folder/subfolder/test.txt"));
}
開發者ID:flo2k,項目名稱:CppZip,代碼行數:17,代碼來源:ZipTest.cpp

示例12: hpamap

void ClusterAStarTest::getPathReturnNullWhenStartOrGoalNull()
{	
	HPAClusterAbstraction hpamap(new Map(maplocation.c_str()), new HPAClusterFactory(), 
		new ClusterNodeFactory(), new EdgeFactory());
	hpamap.setClusterSize(TESTCLUSTERSIZE);

	ClusterAStar castar;
	castar.setGraphAbstraction(&hpamap);
		
	ClusterNode* n = getNode(0,0,hpamap);

	p = castar.getPath(&hpamap, NULL, n); 
	CPPUNIT_ASSERT_EQUAL_MESSAGE("getPath() failed to return null when start node is null", true, p == 0);

	p = castar.getPath(&hpamap, n, NULL); 
	CPPUNIT_ASSERT_EQUAL_MESSAGE("getPath() failed to return null when goal node is null", true, p == 0);
}
開發者ID:Elsopuro,項目名稱:ahastar,代碼行數:17,代碼來源:ClusterAStarTest.cpp

示例13: tt

 void ThreadTest::test_thread_run( void )
 {
     TThread tt(23);
     tt.start();
     tt.join();
     
     CPPUNIT_ASSERT_EQUAL_MESSAGE("thread result", 24, tt.get_iter( ) );
 }
開發者ID:mransan,項目名稱:maxmm,代碼行數:8,代碼來源:ThreadTest.cpp

示例14: TestEnumLANEndpointInstances

    void TestEnumLANEndpointInstances(void)
    {
        std::wstring errMsg;
        TestableContext context;
        StandardTestEnumerateInstances<mi::SCX_LANEndpoint_Class_Provider>(
            m_keyNamesLANE, context, CALL_LOCATION(errMsg));
        CPPUNIT_ASSERT_EQUAL_MESSAGE(ERROR_MESSAGE, 2u, context.Size());

        CPPUNIT_ASSERT_EQUAL_MESSAGE(ERROR_MESSAGE, L"eth0",
            context[0].GetKey(L"Name", CALL_LOCATION(errMsg)));
        CPPUNIT_ASSERT_EQUAL_MESSAGE(ERROR_MESSAGE, L"SCX_ComputerSystem",
            context[0].GetKey(L"SystemCreationClassName", CALL_LOCATION(errMsg)));
        CPPUNIT_ASSERT_EQUAL_MESSAGE(ERROR_MESSAGE, GetFQHostName(CALL_LOCATION(errMsg)),
            context[0].GetKey(L"SystemName", CALL_LOCATION(errMsg)));
        CPPUNIT_ASSERT_EQUAL_MESSAGE(ERROR_MESSAGE, L"SCX_LANEndpoint",
            context[0].GetKey(L"CreationClassName", CALL_LOCATION(errMsg)));
    }
開發者ID:Microsoft,項目名稱:SCXcore,代碼行數:17,代碼來源:networkprovider_test.cpp

示例15: ds1

// setBPtr
void FirstOrderLinearDSTest::testSetBPtr()
{
  std::cout << "--> Test: setBPtr." <<std::endl;
  SP::FirstOrderLinearDS ds1(new FirstOrderLinearDS(x0));
  ds1->setb(b0);
  CPPUNIT_ASSERT_EQUAL_MESSAGE("testSetBPtr : ", ds1->b() == b0, true);
  std::cout << "--> setBPtr test ended with success." <<std::endl;
}
開發者ID:radarsat1,項目名稱:siconos,代碼行數:9,代碼來源:FirstOrderLinearDSTest.cpp


注:本文中的CPPUNIT_ASSERT_EQUAL_MESSAGE函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。