equal
deleted
inserted
replaced
44 NULL |
44 NULL |
45 }; |
45 }; |
46 |
46 |
47 void TestUtf8(Itk::TestMgr * testMgr) |
47 void TestUtf8(Itk::TestMgr * testMgr) |
48 { |
48 { |
49 char *xml_file = (char*)__FUNCTION__; |
|
50 assert_failed = 0; |
|
51 cpix_Result |
49 cpix_Result |
52 result; |
50 result; |
53 |
51 |
54 cpix_IdxDb_dbgScrapAll(&result); |
52 cpix_IdxDb_dbgScrapAll(&result); |
55 |
53 |
63 |
61 |
64 cpix_Analyzer* analyzer = cpix_CreateSimpleAnalyzer(&result); |
62 cpix_Analyzer* analyzer = cpix_CreateSimpleAnalyzer(&result); |
65 |
63 |
66 if ( cpix_Failed( &result) ) |
64 if ( cpix_Failed( &result) ) |
67 { |
65 { |
68 assert_failed = 1; |
66 |
69 ITK_PANIC("Analyzer could not be created"); |
67 ITK_PANIC("Analyzer could not be created"); |
70 } |
68 } |
71 |
69 |
72 for (int i = 0; Utf8DocsToIndex[i]; i++) |
70 for (int i = 0; Utf8DocsToIndex[i]; i++) |
73 { |
71 { |
82 * queryParser = cpix_QueryParser_create(&result, |
80 * queryParser = cpix_QueryParser_create(&result, |
83 CONTENTS_FIELD, |
81 CONTENTS_FIELD, |
84 analyzer ); |
82 analyzer ); |
85 if (queryParser == NULL) |
83 if (queryParser == NULL) |
86 { |
84 { |
87 assert_failed = 1; |
85 |
88 cpix_Analyzer_destroy( analyzer ); |
86 cpix_Analyzer_destroy( analyzer ); |
89 ITK_PANIC("Could not create query parser"); |
87 ITK_PANIC("Could not create query parser"); |
90 } |
88 } |
91 |
89 |
92 cpix_Query* query = cpix_QueryParser_parse(queryParser, |
90 cpix_Query* query = cpix_QueryParser_parse(queryParser, |
93 UcsTermsToSearch[i]); |
91 UcsTermsToSearch[i]); |
94 if (cpix_Failed(queryParser) |
92 if (cpix_Failed(queryParser) |
95 || query == NULL) |
93 || query == NULL) |
96 { |
94 { |
97 assert_failed = 1; |
95 |
98 cpix_Analyzer_destroy(analyzer); |
96 cpix_Analyzer_destroy(analyzer); |
99 cpix_ClearError(queryParser); |
97 cpix_ClearError(queryParser); |
100 cpix_QueryParser_destroy(queryParser); |
98 cpix_QueryParser_destroy(queryParser); |
101 ITK_PANIC("Could not parse query string"); |
99 ITK_PANIC("Could not parse query string"); |
102 } |
100 } |
112 |
110 |
113 cpix_Hits_destroy( hits ); |
111 cpix_Hits_destroy( hits ); |
114 } |
112 } |
115 |
113 |
116 cpix_Analyzer_destroy( analyzer ); |
114 cpix_Analyzer_destroy( analyzer ); |
117 testResultXml(xml_file); |
115 |
118 } |
116 } |
119 |
117 |
120 Itk::TesterBase * CreateUtf8Tests() |
118 Itk::TesterBase * CreateUtf8Tests() |
121 { |
119 { |
122 using namespace Itk; |
120 using namespace Itk; |