--- a/searchengine/cpix/tsrc/cpixunittest/src/querytest.cpp Fri May 14 16:57:37 2010 +0300
+++ b/searchengine/cpix/tsrc/cpixunittest/src/querytest.cpp Thu May 27 13:59:44 2010 +0300
@@ -31,6 +31,7 @@
#include "testutils.h"
#include "suggestion.h"
+#include "std_log_result.h"
const char * docsToIndex[5] = {
CORPUS_PATH "\\query\\query1.txt",
@@ -135,6 +136,7 @@
}
if (queryParser == NULL)
{
+ assert_failed = 1;
cpix_Analyzer_destroy( analyzer );
ITK_PANIC("Could not create query parser");
}
@@ -146,6 +148,7 @@
if (cpix_Failed(queryParser)
|| query == NULL)
{
+ assert_failed = 1;
cpix_Analyzer_destroy(analyzer);
cpix_ClearError(queryParser);
cpix_QueryParser_destroy(queryParser);
@@ -169,7 +172,7 @@
}
else
{
-
+ assert_failed = 1;
ITK_MSG(testMgr, "Query %S, didnt return expected hits. Expected is %d hits. Returned is %d. Failed \n",qryStr,hitLen,hitsLength);
}
@@ -182,6 +185,8 @@
void CreatePlainQueryTest(Itk::TestMgr * testMgr)
{
+ char *xml_file = (char*)__FUNCTION__;
+ assert_failed = 0;
setupPlainQuery(testMgr);
testQuery(testMgr,L"Nokia", 2);
testQuery(testMgr,L"iNdia", 1);
@@ -215,11 +220,13 @@
testQuery(testMgr,L"NOT India", 1);
testQuery(testMgr,L"(india OR Mobile) AND Nokia", 2);
testQuery(testMgr,L"(india OR Mobile) AND Country", 1);
- // create_xml(val,__func__,__FILE__,__LINE__);
+ testResultXml(xml_file);
}
void CreatePrefixQueryTest(Itk::TestMgr * testMgr)
{
+ char *xml_file = (char*)__FUNCTION__;
+ assert_failed = 0;
setupPrefixQuery(testMgr);
testQuery(testMgr,L"$prefix(\"new-notes\")", 1);
testQuery(testMgr,L"$prefix(\"notes\")", 1);
@@ -261,11 +268,13 @@
testQuery(testMgr,L"$prefix(\"<lessthan\")", 1);
testQuery(testMgr,L"$prefix(\">greaterthan\")", 1);
testQuery(testMgr,L"$prefix(\"worked for motorola .\")", 1);
-
+ testResultXml(xml_file);
}
void CreatePrefixOptimiseQueryTest(Itk::TestMgr * testMgr)
{
+ char *xml_file = (char*)__FUNCTION__;
+ assert_failed = 0;
setupPrefixOptimiseQuery(testMgr);
testQuery(testMgr,L"i*", 3,LCPIX_DEFAULT_PREFIX );
testQuery(testMgr,L"in*", 2,LCPIX_DEFAULT_PREFIX );
@@ -288,17 +297,18 @@
testQuery(testMgr,L"ru*", 2,LCPIX_DEFAULT_PREFIX );
testQuery(testMgr,L"ra*", 2,LCPIX_DEFAULT_PREFIX );
testQuery(testMgr,L"ri*", 2,LCPIX_DEFAULT_PREFIX );
+ testResultXml(xml_file);
}
Itk::TesterBase * CreateQueryTests()
{
using namespace Itk;
- ContextTester
- * qryTests = new ContextTester("Query Tests", NULL);
+ SuiteTester
+ * qryTests = new SuiteTester("querytests");
- qryTests->add("PlainQueryTest", &CreatePlainQueryTest);
- qryTests->add("PrefixQueryTest", &CreatePrefixQueryTest);
- qryTests->add("PrefixOptimiseQueryTest", &CreatePrefixOptimiseQueryTest);
+ qryTests->add("plainquerytest", &CreatePlainQueryTest, "plainquerytest");
+ qryTests->add("prefixquerytest", &CreatePrefixQueryTest, "prefixquerytest");
+ qryTests->add("prefixoptimisequerytest", &CreatePrefixOptimiseQueryTest, "prefixoptimisequerytest");
return qryTests;
}