searchengine/cpix/tsrc/cpixunittest/src/testutils.cpp
changeset 14 8bd192d47aaa
parent 3 ae3f1779f6da
child 24 65456528cac2
equal deleted inserted replaced
13:fcb2a58c181b 14:8bd192d47aaa
   149         }
   149         }
   150 
   150 
   151     cout << "Number of hits: " << hitCount << endl;
   151     cout << "Number of hits: " << hitCount << endl;
   152 
   152 
   153     cpix_Document
   153     cpix_Document
   154         doc;
   154         **doc;
       
   155     ALLOC_DOC(doc, 1);
   155 
   156 
   156     for (int32_t i = 0; i < hitCount; ++i)
   157     for (int32_t i = 0; i < hitCount; ++i)
   157         {
   158         {
   158             cpix_Hits_doc(hits,
   159             cpix_Hits_doc(hits,
   159                           i,
   160                           i,
   160                           &doc);
   161                           doc,
   161 
   162                           1);
   162             if (cpix_Failed(hits))
   163 
       
   164             if (cpix_Failed(hits) || (doc_Fetch_Failed(doc[0])))
   163                 {
   165                 {
   164                     ITK_EXPECT(testMgr,
   166                     ITK_EXPECT(testMgr,
   165                                false,
   167                                false,
   166                                "Failed to get doc %d",
   168                                "Failed to get doc %d",
   167                                i);
   169                                i);
   168                     cpix_ClearError(hits);
   170                     cpix_ClearError(hits);
   169                     break;
   171                     break;
   170                 }
   172                 }
   171             // OBS PrintHit(&doc,
   173             // OBS PrintHit(&doc,
   172             printHitFunc(&doc,
   174             printHitFunc(doc[0],
   173                          testMgr);
   175                          testMgr);
   174         }
   176         }
       
   177         
       
   178     FREE_DOC(doc, 1);
   175 }
   179 }
   176 
   180 
   177 
   181 
   178 
   182 
   179 
   183 
   327         }
   331         }
   328 
   332 
   329     cout << "Number of hits: " << hitCount << endl;
   333     cout << "Number of hits: " << hitCount << endl;
   330 
   334 
   331     cpix_Document
   335     cpix_Document
   332         doc;
   336         **doc;
       
   337     ALLOC_DOC(doc, 1);
   333 
   338 
   334     for (int32_t i = 0; i < hitCount; ++i)
   339     for (int32_t i = 0; i < hitCount; ++i)
   335         {
   340         {
   336             cpix_Hits_doc(hits,
   341             cpix_Hits_doc(hits,
   337                           i,
   342                           i,
   338                           &doc);
   343                           doc,
   339 
   344                           1);
   340             if (cpix_Failed(hits))
   345 
       
   346             if (cpix_Failed(hits) || (doc_Fetch_Failed(doc[0])))
   341                 {
   347                 {
   342                     if (allowFailure)
   348                     if (allowFailure)
   343                         {
   349                         {
   344                             printf("Failed to get doc %d - updated index?\n",
   350                             printf("Failed to get doc %d - updated index?\n",
   345                                    i);
   351                                    i);
   353                         }
   359                         }
   354 
   360 
   355                     cpix_ClearError(hits);
   361                     cpix_ClearError(hits);
   356                     break;
   362                     break;
   357                 }
   363                 }
   358             printHit(&doc,
   364             printHit(doc[0],
   359                         testMgr);
   365                         testMgr);
   360         }
   366         }
       
   367     FREE_DOC(doc, 1);
   361 }
   368 }
   362 
   369 
   363 
   370 
   364 cpix_IdxDb * IdxUtil::idxDb()
   371 cpix_IdxDb * IdxUtil::idxDb()
   365 {
   372 {