36 #include "config.h" |
36 #include "config.h" |
37 #include "suggestion.h" |
37 #include "suggestion.h" |
38 #include "testutils.h" |
38 #include "testutils.h" |
39 #include "testcorpus.h" |
39 #include "testcorpus.h" |
40 #include "setupsentry.h" |
40 #include "setupsentry.h" |
|
41 #include "std_log_result.h" |
41 |
42 |
42 // |
43 // |
43 // these constants are set so that a cpix_XXX entity should be |
44 // these constants are set so that a cpix_XXX entity should be |
44 // eligible for internal (transparent) release between the 2nd and 3rd |
45 // eligible for internal (transparent) release between the 2nd and 3rd |
45 // period (sleep) |
46 // period (sleep) |
139 // public (test) operations |
140 // public (test) operations |
140 // |
141 // |
141 void testCreateFileIdxDb(Itk::TestMgr * testMgr) |
142 void testCreateFileIdxDb(Itk::TestMgr * testMgr) |
142 { |
143 { |
143 using namespace std; |
144 using namespace std; |
144 |
145 char *xml_file = (char *)__FUNCTION__; |
|
146 assert_failed = 0; |
145 doCommonJobs(testMgr, |
147 doCommonJobs(testMgr, |
146 false); |
148 false); |
147 |
149 |
148 auto_ptr<FileIdxUtil> |
150 auto_ptr<FileIdxUtil> |
149 fiu(new FileIdxUtil); |
151 fiu(new FileIdxUtil); |
150 fiu->init(true); |
152 fiu->init(true); |
151 |
153 |
152 fileIdxUtil_ = fiu.release(); |
154 fileIdxUtil_ = fiu.release(); |
|
155 testResultXml(xml_file); |
153 } |
156 } |
154 |
157 |
155 |
158 |
156 void testCreateSmsIdxDb(Itk::TestMgr * testMgr) |
159 void testCreateSmsIdxDb(Itk::TestMgr * testMgr) |
157 { |
160 { |
158 using namespace std; |
161 using namespace std; |
|
162 char *xml_file = (char *)__FUNCTION__; |
|
163 assert_failed = 0; |
159 |
164 |
160 doCommonJobs(testMgr); |
165 doCommonJobs(testMgr); |
161 |
166 |
162 auto_ptr<SmsIdxUtil> |
167 auto_ptr<SmsIdxUtil> |
163 siu(new SmsIdxUtil); |
168 siu(new SmsIdxUtil); |
164 siu->init(true); |
169 siu->init(true); |
165 |
170 |
166 smsIdxUtil_ = siu.release(); |
171 smsIdxUtil_ = siu.release(); |
|
172 testResultXml(xml_file); |
167 } |
173 } |
168 |
174 |
169 |
175 |
170 void testAddSomeSms(Itk::TestMgr * testMgr) |
176 void testAddSomeSms(Itk::TestMgr * testMgr) |
171 { |
177 { |
|
178 char *xml_file = (char *)__FUNCTION__; |
|
179 assert_failed = 0; |
172 using namespace std; |
180 using namespace std; |
173 |
181 |
174 doCommonJobs(testMgr); |
182 doCommonJobs(testMgr); |
175 |
183 |
176 for (size_t i = 0; i < 5; ++i) |
184 for (size_t i = 0; i < 5; ++i) |
220 * hits = cpix_IdxSearcher_search(searcher_, |
231 * hits = cpix_IdxSearcher_search(searcher_, |
221 query_); |
232 query_); |
222 ITK_EXPECT(testMgr, |
233 ITK_EXPECT(testMgr, |
223 cpix_Succeeded(query_), |
234 cpix_Succeeded(query_), |
224 "Could not search with multisearcher"); |
235 "Could not search with multisearcher"); |
|
236 if( !cpix_Succeeded(query_)) |
|
237 { |
|
238 assert_failed = 1; |
|
239 } |
225 if (hits != NULL) |
240 if (hits != NULL) |
226 { |
241 { |
227 PrintHits(hits, |
242 PrintHits(hits, |
228 testMgr); |
243 testMgr); |
229 |
244 |
230 cpix_Hits_destroy(hits); |
245 cpix_Hits_destroy(hits); |
231 } |
246 } |
|
247 testResultXml(xml_file); |
232 } |
248 } |
233 |
249 |
234 |
250 |
235 void testAddSomeFile(Itk::TestMgr * testMgr) |
251 void testAddSomeFile(Itk::TestMgr * testMgr) |
236 { |
252 { |
|
253 char *xml_file = (char *)__FUNCTION__; |
|
254 assert_failed = 0; |
237 doCommonJobs(testMgr); |
255 doCommonJobs(testMgr); |
238 |
256 |
239 fileIdxUtil_->indexFile(FILE_TEST_CORPUS_PATH "\\en\\1.txt", |
257 fileIdxUtil_->indexFile(FILE_TEST_CORPUS_PATH "\\en\\1.txt", |
240 analyzer_, |
258 analyzer_, |
241 testMgr); |
259 testMgr); |
|
260 testResultXml(xml_file); |
242 } |
261 } |
243 |
262 |
244 |
263 |
245 void testReleaseAll(Itk::TestMgr * testMgr) |
264 void testReleaseAll(Itk::TestMgr * testMgr) |
246 { |
265 { |
|
266 char *xml_file = (char *)__FUNCTION__; |
|
267 assert_failed = 0; |
247 doCommonJobs(testMgr); |
268 doCommonJobs(testMgr); |
248 |
269 |
249 delete fileIdxUtil_; |
270 delete fileIdxUtil_; |
250 fileIdxUtil_ = NULL; |
271 fileIdxUtil_ = NULL; |
251 |
272 |
252 delete smsIdxUtil_; |
273 delete smsIdxUtil_; |
253 smsIdxUtil_ = NULL; |
274 smsIdxUtil_ = NULL; |
254 |
275 |
255 cpix_IdxSearcher_releaseDb(searcher_); |
276 cpix_IdxSearcher_releaseDb(searcher_); |
256 searcher_ = NULL; |
277 searcher_ = NULL; |
|
278 testResultXml(xml_file); |
257 } |
279 } |
258 |
280 |
259 |
281 |
260 private: |
282 private: |
261 // |
283 // |