214 |
214 |
215 // Confirm no crash and that access fails |
215 // Confirm no crash and that access fails |
216 |
216 |
217 printf("Accessing hits after closing... \n"); |
217 printf("Accessing hits after closing... \n"); |
218 cpix_Document |
218 cpix_Document |
219 doc; |
219 **doc; |
220 |
220 ALLOC_DOC(doc, 1); |
|
221 |
221 printf("doc #0: "); |
222 printf("doc #0: "); |
222 cpix_Hits_doc(hits, |
223 cpix_Hits_doc(hits, |
223 0, |
224 0, |
224 &doc); |
225 doc, |
|
226 1); |
|
227 if (doc[0]->ptr_ != NULL) { |
225 ITK_EXPECT( testMgr, |
228 ITK_EXPECT( testMgr, |
226 cpix_Succeeded( hits ), |
229 cpix_Succeeded( hits ), |
227 "Accessing hit(0) should succeeded for closed database (hits still holds a reference to its originator)." ); |
230 "Accessing hit(0) should succeeded for closed database (hits still holds a reference to its originator)." ); |
228 |
231 |
229 if (cpix_Failed(hits)) |
232 if (cpix_Failed(hits)) |
230 { |
233 { |
231 wchar_t |
234 wchar_t |
232 buf[256]; |
235 buf[256]; |
233 cpix_Error_report(hits->err_, |
236 cpix_Error_report(hits->err_, |
234 buf, |
237 buf, |
235 sizeof(buf) / sizeof(wchar_t)); |
238 sizeof(buf) / sizeof(wchar_t)); |
236 printf("%S\n", buf); |
239 printf("%S\n", buf); |
237 cpix_ClearError(hits); |
240 cpix_ClearError(hits); |
238 |
241 |
239 } |
242 } |
240 |
243 } |
|
244 FREE_DOC(doc, 1); |
|
245 |
|
246 |
|
247 ALLOC_DOC(doc, 1) |
241 printf("\ndoc #20: "); |
248 printf("\ndoc #20: "); |
242 cpix_Hits_doc(hits, |
249 cpix_Hits_doc(hits, |
243 20, |
250 20, |
244 &doc); |
251 doc, |
|
252 1); |
|
253 if (doc[0]->ptr_ != NULL) { |
245 ITK_EXPECT( testMgr, |
254 ITK_EXPECT( testMgr, |
246 cpix_Failed( hits ), |
255 cpix_Failed( hits ), |
247 "Accessing hit(20) should NOT succeeded for closed database (hits still holds a reference to its originator)." ); |
256 "Accessing hit(20) should NOT succeeded for closed database (hits still holds a reference to its originator)." ); |
248 |
257 |
249 if (cpix_Failed(hits)) |
258 if (cpix_Failed(hits)) |
250 { |
259 { |
251 wchar_t |
260 wchar_t |
252 buf[256]; |
261 buf[256]; |
253 cpix_Error_report(hits->err_, |
262 cpix_Error_report(hits->err_, |
254 buf, |
263 buf, |
255 sizeof(buf) / sizeof(wchar_t)); |
264 sizeof(buf) / sizeof(wchar_t)); |
256 printf("%S\n", buf); |
265 printf("%S\n", buf); |
257 cpix_ClearError(hits); |
266 cpix_ClearError(hits); |
258 assert_failed = 1; |
267 assert_failed = 1; |
259 } |
268 } |
|
269 } |
|
270 |
|
271 FREE_DOC(doc, 1) |
260 testResultXml(xml_file); |
272 testResultXml(xml_file); |
261 cpix_Hits_destroy( hits ); |
273 cpix_Hits_destroy( hits ); |
262 cpix_Query_destroy( query ); |
274 cpix_Query_destroy( query ); |
263 } |
275 } |
264 |
276 |