23 #include "ut_logspredictive12keytranslator.h" |
23 #include "ut_logspredictive12keytranslator.h" |
24 #include "ut_logspredictivelatin12keytranslator.h" |
24 #include "ut_logspredictivelatin12keytranslator.h" |
25 #include "ut_logspredictivethai12keytranslator.h" |
25 #include "ut_logspredictivethai12keytranslator.h" |
26 #include "ut_logscntentry.h" |
26 #include "ut_logscntentry.h" |
27 |
27 |
28 #include "testresultxmlparser.h" |
28 #include "testrunner.h" |
29 |
|
30 |
|
31 #define UTEST_CLASS( tc )\ |
|
32 tc tc##_instance;\ |
|
33 QStringList tc##_args( #tc );\ |
|
34 resultFileName = QString("c:/") + QString( #tc ) + QString(".xml");\ |
|
35 tc##_args << "-xml" << "-o" << resultFileName;\ |
|
36 QTest::qExec(&tc##_instance, tc##_args);\ |
|
37 parser.parseAndPrintResults(resultFileName,true) |
|
38 |
|
39 |
29 |
40 |
30 |
41 int main(int argc, char *argv[]) |
31 int main(int argc, char *argv[]) |
42 { |
32 { |
43 bool promptOnExit(true); |
33 printf("Running tests...\n"); |
44 bool useQApplication(true); |
34 |
45 for (int i=0; i<argc; i++) { |
35 QApplication app(argc, argv); |
46 if (QString(argv[i]) == "-noprompt") |
36 QStringList args = app.arguments(); |
47 promptOnExit = false; |
37 QString combinedOutputFileName; |
48 else if (QString(argv[i]) == "-noqapp") |
38 for ( int i = 0; i < args.count(); i++ ){ |
49 useQApplication = false; |
39 QString arg = args.at(i); |
|
40 if ( arg == QString("-o") && i + 1 < args.count() ){ |
|
41 i++; |
|
42 combinedOutputFileName = args.at(i); |
|
43 } |
50 } |
44 } |
51 printf("Running tests...\n"); |
|
52 |
45 |
53 QApplication* app = 0; |
46 TestRunner testRunner("LogsCntFinder", combinedOutputFileName); |
54 if ( useQApplication ) |
|
55 app = new QApplication(argc, argv); |
|
56 |
47 |
57 TestResultXmlParser parser; |
48 UT_LogsPredictiveTranslator ut_logsPredictiveTranslator; |
58 QString resultFileName; |
49 testRunner.runTests(ut_logsPredictiveTranslator); |
59 |
50 |
60 UTEST_CLASS( UT_LogsPredictiveTranslator ); |
51 UT_LogsPredictive12KeyTranslator ut_logsPredictive12KeyTranslator; |
61 UTEST_CLASS( UT_LogsPredictive12KeyTranslator ); |
52 testRunner.runTests(ut_logsPredictive12KeyTranslator); |
62 UTEST_CLASS( UT_LogsPredictiveLatin12KeyTranslator ); |
|
63 UTEST_CLASS( UT_LogsPredictiveThai12KeyTranslator ); |
|
64 UTEST_CLASS( UT_LogsCntEntry ); |
|
65 UTEST_CLASS( UT_LogsCntFinder ); |
|
66 |
53 |
67 if (promptOnExit) { |
54 UT_LogsPredictiveLatin12KeyTranslator ut_logsPredictiveLatin12KeyTranslator; |
68 printf("Press any key...\n"); |
55 testRunner.runTests(ut_logsPredictiveLatin12KeyTranslator); |
69 getchar(); |
56 |
70 } |
57 UT_LogsPredictiveThai12KeyTranslator ut_logsPredictiveThai12KeyTranslator; |
71 delete app; |
58 testRunner.runTests(ut_logsPredictiveThai12KeyTranslator); |
|
59 |
|
60 UT_LogsCntEntry ut_logsCntEntry; |
|
61 testRunner.runTests(ut_logsCntEntry); |
|
62 |
|
63 UT_LogsCntFinder ut_logsCntFinder; |
|
64 testRunner.runTests(ut_logsCntFinder); |
|
65 |
|
66 testRunner.printResults(); |
|
67 |
72 return 0; |
68 return 0; |
73 } |
69 } |
74 |
70 |
75 |
71 |
76 |
72 |