diff -r 6c1a2771f4b7 -r ae3f1779f6da searchengine/cpix/tsrc/cpixunittest/src/analysiswhitebox.cpp --- a/searchengine/cpix/tsrc/cpixunittest/src/analysiswhitebox.cpp Fri May 14 16:57:37 2010 +0300 +++ b/searchengine/cpix/tsrc/cpixunittest/src/analysiswhitebox.cpp Thu May 27 13:59:44 2010 +0300 @@ -27,6 +27,8 @@ #include "config.h" #include "testutils.h" +#include "std_log_result.h" + // For testing custom analyzer #include "CLucene.h" #include "CLucene\analysis\AnalysisHeader.h" @@ -66,7 +68,9 @@ void TestTokenization6(Itk::TestMgr * ) { - Cpix::AnalyzerExp::Tokenizer tokenizer; + char *xml_file = (char*)__FUNCTION__; + assert_failed = 0; + Cpix::AnalyzerExp::Tokenizer tokenizer; Tokens source(tokenizer, L"switch { " L"case '_docuid', '_mimetype': keywords;" @@ -76,13 +80,15 @@ WhiteSpaceFilter tokens(source); - while (tokens) PrintToken(tokens++); + while (tokens) PrintToken(tokens++); + testResultXml(xml_file); } void TestParsing(Itk::TestMgr* ) { Cpix::AnalyzerExp::Tokenizer tokenizer; - + char *xml_file = (char*)__FUNCTION__; + assert_failed = 0; Tokens source(tokenizer, L"foobar(zap, foo, 'bar', 'a', raboof)"); WhiteSpaceFilter tokens(source); Lexer lexer(tokens); @@ -112,16 +118,20 @@ printf("Invoke identifier: %S\n", (invoke->id()).c_str()); printf("%d parameters\n", invoke->params().size()); } catch (ParseException& e) { + assert_failed = 1; printf("ParseException: %S\n", e.wWhat()); } catch (LexException& e) { + assert_failed = 1; printf("LexException: %S\n", e.wWhat()); } + testResultXml(xml_file); } void TestSwitch(Itk::TestMgr* ) { Cpix::AnalyzerExp::Tokenizer tokenizer; - + char *xml_file = (char*)__FUNCTION__; + assert_failed = 0; const wchar_t* text; Tokens source(tokenizer, text = L"switch { " @@ -150,17 +160,22 @@ } } catch (ParseException& e) { // OBS wcout<lowercase"); @@ -277,6 +294,7 @@ TestCustomAnalyzer(testMgr, L"letter>lowercase>accent>stop(en)"); TestCustomAnalyzer(testMgr, L"letter>lowercase>stop('i', 'oh', 'nyt', 'näin')"); TestCustomAnalyzer(testMgr, L"letter>length(2, 4)"); + testResultXml(xml_file); } void TestAnalyzerWithField(Itk::TestMgr * , const wchar_t* definition, const wchar_t* field) @@ -298,7 +316,9 @@ void TestSwitchAnalyzers(Itk::TestMgr * testMgr) { - const wchar_t* sw = L"\n" + char *xml_file = (char*)__FUNCTION__; + assert_failed = 0; + const wchar_t* sw = L"\n" L"switch {\n" L" case '_docuid': keyword;\n" L" case '_appclass': whitespace>lowercase;\n" @@ -310,6 +330,7 @@ TestAnalyzerWithField(testMgr, sw, L"Title"); TestAnalyzerWithField(testMgr, sw, L"message"); TestAnalyzerWithField(testMgr, sw, L"field"); + testResultXml(xml_file); } @@ -318,14 +339,14 @@ using namespace Itk; SuiteTester - * analysisTests = new SuiteTester("whitebox"); + * analysisTests = new SuiteTester("analysiswhitebox"); analysisTests->add("analyzer", &TestCustomAnalyzers, "analyzer"); - analysisTests->add("switchAnalyzer", + analysisTests->add("switchanalyzer", &TestSwitchAnalyzers, - "switchAnalyzer"); + "switchanalyzer"); analysisTests->add("tokenization", TestTokenization6, "tokenization");