本文整理汇总了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);
}
示例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());
}
示例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));
}
示例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));
}
示例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);
}
示例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;
}
示例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;
}
示例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) ;
}
示例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));
}
示例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);
}
示例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"));
}
示例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);
}
示例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( ) );
}
示例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)));
}
示例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;
}