searchengine/cpix/tsrc/cpixunittest/src/negativetests.cpp
changeset 3 ae3f1779f6da
parent 2 6c1a2771f4b7
child 24 65456528cac2
--- a/searchengine/cpix/tsrc/cpixunittest/src/negativetests.cpp	Fri May 14 16:57:37 2010 +0300
+++ b/searchengine/cpix/tsrc/cpixunittest/src/negativetests.cpp	Thu May 27 13:59:44 2010 +0300
@@ -32,6 +32,7 @@
 #include "cpixdoc.h"
 #include "cpixsearch.h"
 #include "cpixidxdb.h"
+#include "std_log_result.h"
 
 #define TEST_DOCUMENT_QBASEAPPCLASS "@0:root test document"
 #define TEST_SAMPLE_QBASEAPPCLASS "@:root test sample"
@@ -270,6 +271,8 @@
 
 void testCreateDb(Itk::TestMgr* /*testMgr */)
 {
+    char *xml_file = (char *)__FUNCTION__;
+    assert_failed = 0;
     cpix_IdxDb   *itestDb_ = NULL, *inewDb_ = NULL;                
     cpix_Result  result;
     
@@ -286,6 +289,7 @@
     if (cpix_Failed(&result))
         {
         ITK_PANIC("Failed to open indexDb");
+        assert_failed = 1;
         }
      
      if ( itestDb_ ) 
@@ -300,10 +304,13 @@
             inewDb_ = 0;
          }
      cpix_IdxDb_undefineVolume(TEST_SAMPLE_QBASEAPPCLASS);
+     testResultXml(xml_file);
 }
 
 void testOpenDb(Itk::TestMgr * testMgr)
 {
+        char *xml_file = (char *)__FUNCTION__;
+        assert_failed = 0;
         cpix_Result  result;            
         cpix_IdxDb   *idxDb_ = NULL;
         
@@ -313,18 +320,22 @@
                                        cpix_IDX_CREATE);
         if(idxDb_ == NULL )
             {
-            ITK_MSG(testMgr, "Tried to open a database of undefined volume");             
+            ITK_MSG(testMgr, "Tried to open a database of undefined volume");
+            assert_failed = 1;
             }
         
         if (idxDb_) 
             {
                 cpix_IdxDb_releaseDb(idxDb_);
                 idxDb_ = 0; 
-            }        
+            }       
+        testResultXml(xml_file);
 }
 
 void testCorruptedIndex(Itk::TestMgr * testMgr)
 {
+     char *xml_file = (char *)__FUNCTION__;
+     assert_failed = 0;
      cpix_Analyzer * analyzer_ = NULL ;       
      cpix_IdxDb * iCrptDb1_ = NULL, *iCrptDb2_ = NULL;
      
@@ -370,7 +381,10 @@
      if(iCrptDb2_)
          hit_search2= search(&analyzer_,&iCrptDb2_, SEARCH_TERM);
      else
-         ITK_MSG(testMgr, "Corrupted database, search not possible");              
+         {
+         ITK_MSG(testMgr, "Corrupted database, search not possible");
+         assert_failed = 0;
+         }
      
      cleanUp(&analyzer_,&iCrptDb1_);
      
@@ -382,6 +396,7 @@
      
      cpix_IdxDb_undefineVolume(TEST_CORRUPTTEST1_QBASEAPPCLASS);
      cpix_IdxDb_undefineVolume(TEST_CORRUPTTEST2_QBASEAPPCLASS);
+     testResultXml(xml_file);
  }
 
 };