--- a/searchengine/cpix/tsrc/cpixunittest/src/randomtest.cpp Tue Oct 05 13:15:12 2010 +0530
+++ b/searchengine/cpix/tsrc/cpixunittest/src/randomtest.cpp Fri Oct 15 12:09:28 2010 +0530
@@ -428,7 +428,7 @@
}
if(!valid)
{
- assert_failed = 1;
+
}
}
@@ -477,7 +477,7 @@
}
if ( !found )
{
- assert_failed = 1;
+
ITK_MSG( testMgr, "Failed content %d", item );
}
@@ -491,7 +491,7 @@
}
else
{
- assert_failed = 1;
+
ITK_MSG( testMgr, "Content asserting is unreliable for item not in index" );
}
cpix_Hits_destroy( hits );
@@ -500,7 +500,7 @@
}
else
{
- assert_failed = 1;
+
ITK_MSG( testMgr, "Creating query failed for %S", queryText.str().c_str() );
}
}
@@ -594,7 +594,7 @@
tracedTermsFreq_[i] );
if(matches != tracedTermsFreq_[i])
{
- assert_failed = 1;
+
}
}
}
@@ -623,8 +623,6 @@
"RandomSeed",
"%d",
randomSeed_);
- char *xml_file = (char*)__FUNCTION__;
- assert_failed = 0;
indexRandoms(testMgr, 50);
assertIndexedState(testMgr);
@@ -642,7 +640,7 @@
// OBS if ( !( valid &= validState( testMgr, item = indexRandom( testMgr ) ) ) )
if (!valid)
{
- assert_failed = 1;
+
ITK_MSG( testMgr, "Indexing item %d had failed", item );
goto mainloop_exit;
// double break
@@ -659,7 +657,7 @@
// OBS if ( !( valid &= validState( testMgr, item = deleteRandom( testMgr ) ) ) )
if (!valid)
{
- assert_failed = 1;
+
ITK_MSG( testMgr, "Deleting item %d had failed", item );
goto mainloop_exit; // double break
}
@@ -668,16 +666,14 @@
deleteRandoms(testMgr, 50);
mainloop_exit:
- testResultXml(xml_file);
+
ITK_ASSERT( testMgr, valid, "Operations were not succesful" );
}
void RandomTest::testDeleteAll(Itk::TestMgr* testMgr)
{
indexRandoms(testMgr, 50);
- assertIndexedState(testMgr);
- char *xml_file = (char*)__FUNCTION__;
- assert_failed = 0;
+ assertIndexedState(testMgr);;
vector<int> deleted;
for (int i = 0; i < 50; i++)
{
@@ -691,19 +687,17 @@
valid = valid && validState( testMgr, deleted[i] );
if ( !( valid ) )
{
- assert_failed = 1;
+
ITK_MSG( testMgr, "Deleting item %d had failed", deleted[i] );
break;
}
}
- testResultXml(xml_file);
+
ITK_ASSERT( testMgr, valid, "Deletes were not succesful" );
}
void RandomTest::testContent(Itk::TestMgr* testMgr)
{
- char *xml_file = (char*)__FUNCTION__;
- assert_failed = 0;
for (int i = 0; i < 10; i++)
{
int item = indexRandom(testMgr);
@@ -714,15 +708,13 @@
// clean up
deleteRandoms( testMgr, 10 );
idxUtil_->flush();
- testResultXml(xml_file);
+
}
void RandomTest::testPersistence(Itk::TestMgr* testMgr)
{
indexRandoms(testMgr, 20);
assertIndexedState(testMgr);
- char *xml_file = (char*)__FUNCTION__;
- assert_failed = 0;
idxUtil_->reload();
assertIndexedState(testMgr);
@@ -741,19 +733,17 @@
valid = valid && validState( testMgr, deleted[i] );
if ( !( valid ) )
{
- assert_failed = 1;
+
ITK_MSG( testMgr, "Deleting item %d had failed", deleted[i] );
break;
}
}
ITK_ASSERT( testMgr, valid, "Deletes were not succesful" );
- testResultXml(xml_file);
+
}
void RandomTest::testSearches(Itk::TestMgr* testMgr)
{
- char *xml_file = (char*)__FUNCTION__;
- assert_failed = 0;
traceTerm(testMgr, L"happy");
traceTerm(testMgr, L"people");
traceTerm(testMgr, L"come");
@@ -779,12 +769,10 @@
assertTracedTerms( testMgr );
untraceTerms(testMgr);
- testResultXml(xml_file);
+
}
void RandomTest::testCreatedIndex(Itk::TestMgr* testMgr) {
- char *xml_file = (char*)__FUNCTION__;
- assert_failed = 0;
int item = indexRandom( testMgr );
idxUtil_->flush();
assertState( testMgr, item );
@@ -816,9 +804,9 @@
"There should not have been an item to delete");
if(!cpix_Succeeded(idxUtil_->idxDb()) || deleted != 0)
{
- assert_failed = 1;
+
}
- testResultXml(xml_file);
+
}