searchengine/cpix/tsrc/cpixunittest/src/aggregatetests.cpp
changeset 3 ae3f1779f6da
parent 0 671dee74050a
child 24 65456528cac2
--- a/searchengine/cpix/tsrc/cpixunittest/src/aggregatetests.cpp	Fri May 14 16:57:37 2010 +0300
+++ b/searchengine/cpix/tsrc/cpixunittest/src/aggregatetests.cpp	Thu May 27 13:59:44 2010 +0300
@@ -32,6 +32,7 @@
 
 #include "testcorpus.h"
 
+#include "std_log_result.h"
 
 cpix_FieldDesc MultiFieldSchema[] = {
     
@@ -81,6 +82,7 @@
 };
 
 
+
 class MultiFieldIdxUtil : public FileIdxUtil
 {
 public:
@@ -346,11 +348,13 @@
     void testAddFiles(Itk::TestMgr * testMgr)
     {
         testMgr_ = testMgr;
-
+        char *xml_file = (char*)__FUNCTION__;
+        assert_failed = 0;
         Cpt::traverse(FILE_TEST_CORPUS_PATH "\\en",
                       this);
 
         util_->flush();
+        testResultXml(xml_file);
     }
 
 
@@ -358,45 +362,56 @@
     {
         const wchar_t
             * word = L"happy";
-
+            char *xml_file = (char*)__FUNCTION__;
+            assert_failed = 0;
         testSearchFor(testMgr,
                       word);
+        testResultXml(xml_file);
+        
     }
 
     void testSearchForImportant(Itk::TestMgr * testMgr)
     {
         const wchar_t
             * word = L"important";
-
+        char *xml_file = (char*)__FUNCTION__;
+        assert_failed = 0;
         testSearchFor(testMgr,
                       word);
+        testResultXml(xml_file);
     }
 
     void testSearchForHappening(Itk::TestMgr * testMgr)
     {
         const wchar_t
             * word = L"happening";
-
+        char *xml_file = (char*)__FUNCTION__;
+        assert_failed = 0;
         testSearchFor(testMgr,
                       word);
+        testResultXml(xml_file);
     }
 
     void testSearchForLook(Itk::TestMgr * testMgr)
     {
         const wchar_t
             * word = L"look";
-
+        char *xml_file = (char*)__FUNCTION__;
+        assert_failed = 0;
         testSearchFor(testMgr,
                       word);
+        testResultXml(xml_file);
     }
 
     void testSearchForChristmas(Itk::TestMgr * testMgr)
     {
         const wchar_t
             * word = L"christmas";
-
+        char *xml_file = (char*)__FUNCTION__;
+        assert_failed = 0;
         testSearchFor(testMgr,
                       word);
+        testResultXml(xml_file);
     }
 
 
@@ -405,7 +420,7 @@
     // private methods
     //
     void testSearchFor(Itk::TestMgr  * testMgr,
-                       const wchar_t * word)
+                       const wchar_t * word, int expected = 1)
     {
         wchar_t
             report[512];
@@ -430,6 +445,10 @@
                         cpix_Error_report(util_->idxDb()->err_,
                                           report,
                                           sizeof(report)/sizeof(wchar_t));
+                        if(expected)
+                            assert_failed = 1;
+                        else
+                            assert_failed = 0;  
                         ITK_EXPECT(testMgr,
                                    false,
                                    "Failed to search: %S",
@@ -444,7 +463,10 @@
                 cpix_Error_report(query->err_,
                                   report,
                                   sizeof(report)/sizeof(wchar_t));
-
+                if(expected)
+                    assert_failed = 1;
+                else
+                    assert_failed = 0;  
                 ITK_EXPECT(testMgr,
                            false,
                            "Failed to parse '%S': %S",