arabica/tests/XSLT/main.cpp

99 lines
3.8 KiB
C++
Raw Normal View History

#ifdef _MSC_VER
#pragma warning(disable : 4250)
#endif
#include <iostream>
#include <string>
#include <sstream>
2008-06-04 22:32:06 +02:00
#include <map>
///////////////////////////////////////////////
#include "../CppUnit/TestRunner.hpp"
#include "../CppUnit/framework/Test.h"
#include "../CppUnit/framework/TestCase.h"
#include "../CppUnit/framework/TestSuite.h"
// #include "scope_test.hpp"
#include "xslt_test.hpp"
2008-06-04 22:32:06 +02:00
std::set<std::string> parse_tests_to_run(int argc, const char* argv[]);
void add_tests(TestRunner& runner, Loader& loader, const std::set<std::string>& wanted, const char** test_names);
void add_arabica_tests(TestRunner& runner, Loader& loader, const std::set<std::string>& wanted, const char** test_names);
const char* xalan_tests[] = {"attribvaltemplate", "axes", "boolean", "conditional",
"conflictres", "copy", "dflt", "expression", "extend",
/*"idkey",*/ "impincl", "lre", "match", "math",
"mdocs", "message", "modes", "namedtemplate",
"namespace", "node", /*"numberformat",*/ /*"numbering",*/
"output", "position", "predicate", "processorinfo", "reluri",
"select", "sort", "string", "variable", "ver", "whitespace", 0};
2008-08-03 09:51:00 +02:00
const char* msft_tests[] = { "AVTs", /*"AttributeSets",*/ "Attributes", "BVTs",
2008-06-04 22:32:06 +02:00
"Comment", "Completeness", "ConflictResolution", "Copying",
"Elements", "Errors", "Fallback", "ForEach", /*"FormatNumber",*/
2009-03-17 20:07:38 +01:00
"ForwardComp", "Import", "Keys", "Messages",
"Miscellaneous", "Modes", "NamedTemplates", "Namespace",
2008-08-09 11:34:14 +02:00
"Namespace-alias", "Namespace_XPath", /*"Number",*/
2008-06-04 22:32:06 +02:00
/*"Output",*/ "ProcessingInstruction", "RTF", "Sorting",
2008-08-09 22:03:36 +02:00
"Stylesheet", "Template", "Text", "Valueof",
2008-08-03 09:51:00 +02:00
"Variables", "Whitespaces", "XSLTFunctions", 0 };
2008-06-04 22:32:06 +02:00
2009-01-03 00:08:49 +01:00
const char* arabica_tests[] = { "attributes",
"errors", "include", "processing-instruction",
2008-08-09 22:03:36 +02:00
"stylesheet", "text", "variables", 0 };
2008-06-04 22:32:06 +02:00
int main(int argc, const char* argv[])
{
TestRunner runner;
2008-06-04 22:32:06 +02:00
std::set<std::string> tests_to_run = parse_tests_to_run(argc, argv);
// runner.addTest("ScopeTest", ScopeTest_suite<string_type, string_adaptor>());
2007-12-21 18:03:09 +01:00
Loader loader;
2008-06-04 22:32:06 +02:00
add_tests(runner, loader, tests_to_run, xalan_tests);
add_tests(runner, loader, tests_to_run, msft_tests);
add_arabica_tests(runner, loader, tests_to_run, arabica_tests);
runner.run(argc, argv);
return 77;
2008-06-04 22:32:06 +02:00
} // main
std::set<std::string> parse_tests_to_run(int argc, const char* argv[])
{
std::set<std::string> tests;
for(int a = 1; a != argc; ++a)
if(argv[a][0] != '-')
tests.insert(argv[a]);
2010-01-12 23:32:09 +01:00
else
{
if(std::string(argv[a]) == "-log")
++a; // skip next
} // if ...
2008-06-04 22:32:06 +02:00
return tests;
} // tests_to_run
void add_tests(TestRunner& runner, Loader& loader, const std::set<std::string>& wanted, const char** test_names)
{
std::set<std::string>::const_iterator end = wanted.end();
while(*test_names != 0)
{
if(wanted.empty() || (wanted.find(*test_names) != end))
runner.addTest(*test_names, loader.XSLTTest_suite(*test_names));
++test_names;
} // while ...
} // all_all_tests
void add_arabica_tests(TestRunner& runner, Loader& loader, const std::set<std::string>& wanted, const char** test_names)
{
std::set<std::string>::const_iterator end = wanted.end();
while(*test_names != 0)
{
if(wanted.empty() || (wanted.find(*test_names) != end))
runner.addTest(*test_names, loader.ArabicaTest_suite(*test_names));
++test_names;
} // while ...
} // all_all_tests