searchengine/cpix/tsrc/cpixunittest/src/prematureqrytests.cpp
changeset 3 ae3f1779f6da
parent 0 671dee74050a
child 24 65456528cac2
equal deleted inserted replaced
2:6c1a2771f4b7 3:ae3f1779f6da
    17 #include "testutils.h"
    17 #include "testutils.h"
    18 #include "testcorpus.h"
    18 #include "testcorpus.h"
    19 #include "config.h"
    19 #include "config.h"
    20 #include "itk.h"
    20 #include "itk.h"
    21 #include "setupsentry.h"
    21 #include "setupsentry.h"
       
    22 #include "std_log_result.h"
    22 
    23 
    23 #include <iostream>
    24 #include <iostream>
    24 
    25 
    25 #include "cpixsearch.h"
    26 #include "cpixsearch.h"
    26 
    27 
   166     //
   167     //
   167     // test functions
   168     // test functions
   168     //
   169     //
   169     void testBeforeVolDefs(Itk::TestMgr * mgr)
   170     void testBeforeVolDefs(Itk::TestMgr * mgr)
   170     {
   171     {
       
   172         char *xml_file = (char*)__FUNCTION__;
       
   173         assert_failed = 0;
   171         printf("Before volume definitions\n");
   174         printf("Before volume definitions\n");
   172 
   175 
   173         qry(mgr,
   176         qry(mgr,
   174             false);
   177             false);
       
   178         testResultXml(xml_file);
   175     }
   179     }
   176 
   180 
   177 
   181 
   178     void testBeforeContentDefs(Itk::TestMgr * mgr)
   182     void testBeforeContentDefs(Itk::TestMgr * mgr)
   179     {
   183     {
   180         printf("Defining volumes\n");
   184         printf("Defining volumes\n");
       
   185         char *xml_file = (char*)__FUNCTION__;
       
   186         assert_failed = 0;
   181 
   187 
   182         cpix_Result
   188         cpix_Result
   183             result;
   189             result;
   184 
   190 
   185         for (const MVFTest * test = FilesAndVols;
   191         for (const MVFTest * test = FilesAndVols;
   198 
   204 
   199         printf("Defined volumes, but there are no indexes created yet\n");
   205         printf("Defined volumes, but there are no indexes created yet\n");
   200 
   206 
   201         qry(mgr,
   207         qry(mgr,
   202             true);
   208             true);
       
   209         testResultXml(xml_file);
   203     }
   210     }
   204 
   211 
   205 
   212 
   206     void testReady(Itk::TestMgr * mgr)
   213     void testReady(Itk::TestMgr * mgr)
   207     {
   214     {
   208         printf("Defining contents\n");
   215         printf("Defining contents\n");
   209 
   216         char *xml_file = (char*)__FUNCTION__;
       
   217         assert_failed = 0;
   210         const MVFTest
   218         const MVFTest
   211             * mvfTest = FilesAndVols;
   219             * mvfTest = FilesAndVols;
   212 
   220 
   213         for (; mvfTest->qualifiedBaseAppClass_ != NULL; ++mvfTest)
   221         for (; mvfTest->qualifiedBaseAppClass_ != NULL; ++mvfTest)
   214             {
   222             {
   232                        mvfTest->qualifiedBaseAppClass_);
   240                        mvfTest->qualifiedBaseAppClass_);
   233             }
   241             }
   234 
   242 
   235         qry(mgr,
   243         qry(mgr,
   236             true);
   244             true);
       
   245         testResultXml(xml_file);
   237     }
   246     }
   238 
   247 
   239 
   248 
   240 private:
   249 private:
   241     void cleanup()
   250     void cleanup()
   302                    (shouldSucceed && succeeded) 
   311                    (shouldSucceed && succeeded) 
   303                    || (!shouldSucceed && !succeeded),
   312                    || (!shouldSucceed && !succeeded),
   304                    "Querying idx should %s have succeeded and it did %s",
   313                    "Querying idx should %s have succeeded and it did %s",
   305                    shouldSucceed ? "" : "not",
   314                    shouldSucceed ? "" : "not",
   306                    succeeded ? "" : "not");
   315                    succeeded ? "" : "not");
       
   316         assert_failed = 1;
   307     }
   317     }
   308 
   318 
   309 
   319 
   310     void qrySearcher(Itk::TestMgr * mgr,
   320     void qrySearcher(Itk::TestMgr * mgr,
   311                      bool           shouldSucceed)
   321                      bool           shouldSucceed)
   351                    (shouldSucceed && succeeded) 
   361                    (shouldSucceed && succeeded) 
   352                    || (!shouldSucceed && !succeeded),
   362                    || (!shouldSucceed && !succeeded),
   353                    "Querying searcher should %s have succeeded and it did %s",
   363                    "Querying searcher should %s have succeeded and it did %s",
   354                    shouldSucceed ? "" : "not",
   364                    shouldSucceed ? "" : "not",
   355                    succeeded ? "" : "not");
   365                    succeeded ? "" : "not");
       
   366         assert_failed = 1;
   356     }
   367     }
   357 
   368 
   358 
   369 
   359 
   370 
   360     void qry(Itk::TestMgr * mgr,
   371     void qry(Itk::TestMgr * mgr,