diff --git a/Makefile.am b/Makefile.am index 3b030c3f..c2a34bd5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,7 +1,7 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS= src test examples +SUBDIRS= src tests examples install-data-local: @echo "------------------------------------------------------------" @@ -22,7 +22,7 @@ uninstall-local: do rm -rf "$(includedir)/$$dir"; \ done -DIST_SUBDIRS= src test examples +DIST_SUBDIRS= src tests examples EXTRA_DIST=vs7 \ include \ src/SAX/wrappers/saxexpat.cpp \ @@ -36,3 +36,7 @@ dist-hook: pkgconfigdir = src/pkgconfig pkgconfig_DATA = arabica.pc +test: + cd tests && make test; + cd .. + diff --git a/configure.ac b/configure.ac index e0a20ada..f65f729b 100644 --- a/configure.ac +++ b/configure.ac @@ -22,10 +22,10 @@ ARABICA_CHECK_CODECVT_SPECIALISATIONS AC_OUTPUT(Makefile \ arabica.pc \ src/Makefile \ - test/Makefile \ - test/DOM/Makefile \ - test/SAX2DOM/Makefile \ - test/XPath/Makefile \ + tests/Makefile \ + tests/DOM/Makefile \ + tests/SAX2DOM/Makefile \ + tests/XPath/Makefile \ examples/Makefile \ examples/SAX/Makefile \ examples/DOM/Makefile \ diff --git a/test/CppUnit/TestRunner.cpp b/tests/CppUnit/TestRunner.cpp similarity index 87% rename from test/CppUnit/TestRunner.cpp rename to tests/CppUnit/TestRunner.cpp index 63b04d63..49852e1d 100644 --- a/test/CppUnit/TestRunner.cpp +++ b/tests/CppUnit/TestRunner.cpp @@ -31,12 +31,21 @@ void TestRunner::run(int ac, const char **av) { string testCase; int numberOfTests = 0; + int opt = 0; for(int i = 1; i < ac; i++) { if(string(av[i]) == "-wait") { m_wait = true; + ++opt; + continue; + } + + if(string(av[i]) == "-q") + { + verbose_ = false; + ++opt; continue; } @@ -56,7 +65,8 @@ void TestRunner::run(int ac, const char **av) { if((*it).first == testCase) { - cout << (*it).first << std::endl; + if(verbose_) + cout << (*it).first << std::endl; testToRun = (*it).second; run(testToRun); } @@ -71,12 +81,13 @@ void TestRunner::run(int ac, const char **av) } } // for ... - if(ac == 1) + if((ac-opt) == 1) { // run everything for(mappings::iterator it = m_mappings.begin(); it != m_mappings.end(); ++it) { - cout << (*it).first << std::endl; + if(verbose_) + cout << (*it).first << std::endl; run((*it).second); } return; @@ -105,8 +116,8 @@ TestRunner::~TestRunner () void TestRunner::run(Test *test) { - TextTestResult result; + TextTestResult result(verbose_); test->run (&result); - cout << result << endl; + cout << result; } // run diff --git a/test/CppUnit/TestRunner.hpp b/tests/CppUnit/TestRunner.hpp similarity index 96% rename from test/CppUnit/TestRunner.hpp rename to tests/CppUnit/TestRunner.hpp index 1ae8f6e4..394d8b40 100644 --- a/test/CppUnit/TestRunner.hpp +++ b/tests/CppUnit/TestRunner.hpp @@ -7,6 +7,7 @@ class TestRunner { protected: + bool verbose_; bool m_wait; std::vector > m_mappings; diff --git a/test/CppUnit/framework/CppUnitException.h b/tests/CppUnit/framework/CppUnitException.h similarity index 100% rename from test/CppUnit/framework/CppUnitException.h rename to tests/CppUnit/framework/CppUnitException.h diff --git a/test/CppUnit/framework/Guards.h b/tests/CppUnit/framework/Guards.h similarity index 100% rename from test/CppUnit/framework/Guards.h rename to tests/CppUnit/framework/Guards.h diff --git a/test/CppUnit/framework/Test.h b/tests/CppUnit/framework/Test.h similarity index 100% rename from test/CppUnit/framework/Test.h rename to tests/CppUnit/framework/Test.h diff --git a/test/CppUnit/framework/TestCaller.h b/tests/CppUnit/framework/TestCaller.h similarity index 100% rename from test/CppUnit/framework/TestCaller.h rename to tests/CppUnit/framework/TestCaller.h diff --git a/test/CppUnit/framework/TestCase.cpp b/tests/CppUnit/framework/TestCase.cpp similarity index 100% rename from test/CppUnit/framework/TestCase.cpp rename to tests/CppUnit/framework/TestCase.cpp diff --git a/test/CppUnit/framework/TestCase.h b/tests/CppUnit/framework/TestCase.h similarity index 100% rename from test/CppUnit/framework/TestCase.h rename to tests/CppUnit/framework/TestCase.h diff --git a/test/CppUnit/framework/TestFailure.cpp b/tests/CppUnit/framework/TestFailure.cpp similarity index 100% rename from test/CppUnit/framework/TestFailure.cpp rename to tests/CppUnit/framework/TestFailure.cpp diff --git a/test/CppUnit/framework/TestFailure.h b/tests/CppUnit/framework/TestFailure.h similarity index 100% rename from test/CppUnit/framework/TestFailure.h rename to tests/CppUnit/framework/TestFailure.h diff --git a/test/CppUnit/framework/TestResult.cpp b/tests/CppUnit/framework/TestResult.cpp similarity index 100% rename from test/CppUnit/framework/TestResult.cpp rename to tests/CppUnit/framework/TestResult.cpp diff --git a/test/CppUnit/framework/TestResult.h b/tests/CppUnit/framework/TestResult.h similarity index 100% rename from test/CppUnit/framework/TestResult.h rename to tests/CppUnit/framework/TestResult.h diff --git a/test/CppUnit/framework/TestSuite.cpp b/tests/CppUnit/framework/TestSuite.cpp similarity index 100% rename from test/CppUnit/framework/TestSuite.cpp rename to tests/CppUnit/framework/TestSuite.cpp diff --git a/test/CppUnit/framework/TestSuite.h b/tests/CppUnit/framework/TestSuite.h similarity index 100% rename from test/CppUnit/framework/TestSuite.h rename to tests/CppUnit/framework/TestSuite.h diff --git a/test/CppUnit/framework/estring.h b/tests/CppUnit/framework/estring.h similarity index 100% rename from test/CppUnit/framework/estring.h rename to tests/CppUnit/framework/estring.h diff --git a/test/CppUnit/textui/TextTestResult.cpp b/tests/CppUnit/textui/TextTestResult.cpp similarity index 92% rename from test/CppUnit/textui/TextTestResult.cpp rename to tests/CppUnit/textui/TextTestResult.cpp index 5a327990..d3897125 100644 --- a/test/CppUnit/textui/TextTestResult.cpp +++ b/tests/CppUnit/textui/TextTestResult.cpp @@ -9,22 +9,23 @@ using namespace std; void TextTestResult::addError (Test *test, CppUnitException *e) { TestResult::addError (test, e); - cerr << "E" << endl; + if(verbose_) + cerr << "E" << endl; } void TextTestResult::addFailure (Test *test, CppUnitException *e) { TestResult::addFailure (test, e); - cerr << "F" << endl; - + if(verbose_) + cerr << "F" << endl; } void TextTestResult::startTest (Test *test) { TestResult::startTest (test); - cerr << "."; - + if(verbose_) + cerr << "."; } @@ -87,14 +88,18 @@ void TextTestResult::print (ostream& stream) printHeader (stream); printErrors (stream); printFailures (stream); - + if(verbose_ || !wasSuccessful()) + cout << endl; } void TextTestResult::printHeader (ostream& stream) { if (wasSuccessful ()) + { + if(verbose_) cout << endl << "OK (" << runTests () << " tests)" << endl; + } else cout << endl << "!!!FAILURES!!!" << endl diff --git a/test/CppUnit/textui/TextTestResult.h b/tests/CppUnit/textui/TextTestResult.h similarity index 90% rename from test/CppUnit/textui/TextTestResult.h rename to tests/CppUnit/textui/TextTestResult.h index be99170d..fd91324b 100644 --- a/test/CppUnit/textui/TextTestResult.h +++ b/tests/CppUnit/textui/TextTestResult.h @@ -9,6 +9,7 @@ class TextTestResult : public TestResult { public: + TextTestResult(bool verbose) : verbose_(verbose) { } virtual void addError (Test *test, CppUnitException *e); virtual void addFailure (Test *test, CppUnitException *e); virtual void startTest (Test *test); @@ -17,6 +18,8 @@ public: virtual void printFailures (std::ostream& stream); virtual void printHeader (std::ostream& stream); +private: + bool verbose_; }; diff --git a/test/DOM/Makefile.am b/tests/DOM/Makefile.am similarity index 96% rename from test/DOM/Makefile.am rename to tests/DOM/Makefile.am index a37b9018..cda31480 100644 --- a/test/DOM/Makefile.am +++ b/tests/DOM/Makefile.am @@ -52,3 +52,9 @@ dom_test_wide_LDADD = $(LIBARABICA) INCLUDES = -I$(top_srcdir)/include $(PARSER_HEADERS) $(BOOST_CPPFLAGS) +test: + @for p in $(bin_PROGRAMS); do \ + echo Running $$p; \ + ./$$p -q; \ + done + diff --git a/test/DOM/dom_test_suite.hpp b/tests/DOM/dom_test_suite.hpp similarity index 100% rename from test/DOM/dom_test_suite.hpp rename to tests/DOM/dom_test_suite.hpp diff --git a/test/DOM/main.cpp b/tests/DOM/main.cpp similarity index 100% rename from test/DOM/main.cpp rename to tests/DOM/main.cpp diff --git a/test/DOM/main_silly.cpp b/tests/DOM/main_silly.cpp similarity index 100% rename from test/DOM/main_silly.cpp rename to tests/DOM/main_silly.cpp diff --git a/test/DOM/main_wide.cpp b/tests/DOM/main_wide.cpp similarity index 100% rename from test/DOM/main_wide.cpp rename to tests/DOM/main_wide.cpp diff --git a/test/DOM/test_Attribute.h b/tests/DOM/test_Attribute.h similarity index 100% rename from test/DOM/test_Attribute.h rename to tests/DOM/test_Attribute.h diff --git a/test/DOM/test_CDATA.hpp b/tests/DOM/test_CDATA.hpp similarity index 100% rename from test/DOM/test_CDATA.hpp rename to tests/DOM/test_CDATA.hpp diff --git a/test/DOM/test_CharacterData.hpp b/tests/DOM/test_CharacterData.hpp similarity index 100% rename from test/DOM/test_CharacterData.hpp rename to tests/DOM/test_CharacterData.hpp diff --git a/test/DOM/test_DOMImplementation.h b/tests/DOM/test_DOMImplementation.h similarity index 100% rename from test/DOM/test_DOMImplementation.h rename to tests/DOM/test_DOMImplementation.h diff --git a/test/DOM/test_Document.h b/tests/DOM/test_Document.h similarity index 100% rename from test/DOM/test_Document.h rename to tests/DOM/test_Document.h diff --git a/test/DOM/test_DocumentFragment.h b/tests/DOM/test_DocumentFragment.h similarity index 100% rename from test/DOM/test_DocumentFragment.h rename to tests/DOM/test_DocumentFragment.h diff --git a/test/DOM/test_DocumentType.h b/tests/DOM/test_DocumentType.h similarity index 100% rename from test/DOM/test_DocumentType.h rename to tests/DOM/test_DocumentType.h diff --git a/test/DOM/test_Element.h b/tests/DOM/test_Element.h similarity index 100% rename from test/DOM/test_Element.h rename to tests/DOM/test_Element.h diff --git a/test/DOM/test_ProcessingInstruction.h b/tests/DOM/test_ProcessingInstruction.h similarity index 100% rename from test/DOM/test_ProcessingInstruction.h rename to tests/DOM/test_ProcessingInstruction.h diff --git a/test/DOM/test_Siblings.h b/tests/DOM/test_Siblings.h similarity index 100% rename from test/DOM/test_Siblings.h rename to tests/DOM/test_Siblings.h diff --git a/test/DOM/test_Text.hpp b/tests/DOM/test_Text.hpp similarity index 100% rename from test/DOM/test_Text.hpp rename to tests/DOM/test_Text.hpp diff --git a/test/Makefile.am b/tests/Makefile.am similarity index 61% rename from test/Makefile.am rename to tests/Makefile.am index c18d9fb8..9d73ce9f 100644 --- a/test/Makefile.am +++ b/tests/Makefile.am @@ -8,3 +8,9 @@ endif install: echo "Nothing to install here" + +test: + @for p in $(SUBDIRS); do \ + cd $$p && make test; \ + cd ..; \ + done diff --git a/test/SAX/FilterTest.cpp b/tests/SAX/FilterTest.cpp similarity index 100% rename from test/SAX/FilterTest.cpp rename to tests/SAX/FilterTest.cpp diff --git a/test/SAX2DOM/Makefile.am b/tests/SAX2DOM/Makefile.am similarity index 94% rename from test/SAX2DOM/Makefile.am rename to tests/SAX2DOM/Makefile.am index 0306793e..1298dcdb 100755 --- a/test/SAX2DOM/Makefile.am +++ b/tests/SAX2DOM/Makefile.am @@ -34,3 +34,8 @@ sax2dom_test_LDADD = $(LIBARABICA) INCLUDES = -I$(top_srcdir)/include $(PARSER_HEADERS) $(BOOST_CPPFLAGS) +test: + @for p in $(bin_PROGRAMS); do \ + echo Running $$p; \ + ./$$p -q; \ + done diff --git a/test/SAX2DOM/SAX2DOM_test.dsp b/tests/SAX2DOM/SAX2DOM_test.dsp similarity index 100% rename from test/SAX2DOM/SAX2DOM_test.dsp rename to tests/SAX2DOM/SAX2DOM_test.dsp diff --git a/test/SAX2DOM/main.cpp b/tests/SAX2DOM/main.cpp similarity index 100% rename from test/SAX2DOM/main.cpp rename to tests/SAX2DOM/main.cpp diff --git a/test/SAX2DOM/test_SAX.h b/tests/SAX2DOM/test_SAX.h similarity index 100% rename from test/SAX2DOM/test_SAX.h rename to tests/SAX2DOM/test_SAX.h diff --git a/test/XPath/Makefile.am b/tests/XPath/Makefile.am similarity index 96% rename from test/XPath/Makefile.am rename to tests/XPath/Makefile.am index 2a471265..c91f978b 100755 --- a/test/XPath/Makefile.am +++ b/tests/XPath/Makefile.am @@ -54,3 +54,8 @@ xpath_test_wide_LDADD = $(LIBARABICA) INCLUDES = -I$(top_srcdir)/include $(PARSER_HEADERS) $(BOOST_CPPFLAGS) +test: + @for p in $(bin_PROGRAMS); do \ + echo Running $$p; \ + ./$$p -q; \ + done diff --git a/test/XPath/arithmetic_test.hpp b/tests/XPath/arithmetic_test.hpp similarity index 100% rename from test/XPath/arithmetic_test.hpp rename to tests/XPath/arithmetic_test.hpp diff --git a/test/XPath/attr_value_test.hpp b/tests/XPath/attr_value_test.hpp similarity index 100% rename from test/XPath/attr_value_test.hpp rename to tests/XPath/attr_value_test.hpp diff --git a/test/XPath/axis_enumerator_test.hpp b/tests/XPath/axis_enumerator_test.hpp similarity index 100% rename from test/XPath/axis_enumerator_test.hpp rename to tests/XPath/axis_enumerator_test.hpp diff --git a/test/XPath/execute_test.hpp b/tests/XPath/execute_test.hpp similarity index 100% rename from test/XPath/execute_test.hpp rename to tests/XPath/execute_test.hpp diff --git a/test/XPath/expression_test.hpp b/tests/XPath/expression_test.hpp similarity index 100% rename from test/XPath/expression_test.hpp rename to tests/XPath/expression_test.hpp diff --git a/test/XPath/logical_test.hpp b/tests/XPath/logical_test.hpp similarity index 100% rename from test/XPath/logical_test.hpp rename to tests/XPath/logical_test.hpp diff --git a/test/XPath/main.cpp b/tests/XPath/main.cpp similarity index 100% rename from test/XPath/main.cpp rename to tests/XPath/main.cpp diff --git a/test/XPath/main_silly.cpp b/tests/XPath/main_silly.cpp similarity index 100% rename from test/XPath/main_silly.cpp rename to tests/XPath/main_silly.cpp diff --git a/test/XPath/main_wide.cpp b/tests/XPath/main_wide.cpp similarity index 100% rename from test/XPath/main_wide.cpp rename to tests/XPath/main_wide.cpp diff --git a/test/XPath/match_test.hpp b/tests/XPath/match_test.hpp similarity index 100% rename from test/XPath/match_test.hpp rename to tests/XPath/match_test.hpp diff --git a/test/XPath/node_test_test.hpp b/tests/XPath/node_test_test.hpp similarity index 100% rename from test/XPath/node_test_test.hpp rename to tests/XPath/node_test_test.hpp diff --git a/test/XPath/parse_test.hpp b/tests/XPath/parse_test.hpp similarity index 100% rename from test/XPath/parse_test.hpp rename to tests/XPath/parse_test.hpp diff --git a/test/XPath/relational_test.hpp b/tests/XPath/relational_test.hpp similarity index 100% rename from test/XPath/relational_test.hpp rename to tests/XPath/relational_test.hpp diff --git a/test/XPath/step_test.hpp b/tests/XPath/step_test.hpp similarity index 100% rename from test/XPath/step_test.hpp rename to tests/XPath/step_test.hpp diff --git a/test/XPath/value_test.hpp b/tests/XPath/value_test.hpp similarity index 100% rename from test/XPath/value_test.hpp rename to tests/XPath/value_test.hpp diff --git a/test/XPath/xpath_test_suite.hpp b/tests/XPath/xpath_test_suite.hpp similarity index 100% rename from test/XPath/xpath_test_suite.hpp rename to tests/XPath/xpath_test_suite.hpp diff --git a/test/silly_string/silly_string.cpp b/tests/silly_string/silly_string.cpp similarity index 100% rename from test/silly_string/silly_string.cpp rename to tests/silly_string/silly_string.cpp diff --git a/test/silly_string/silly_string.hpp b/tests/silly_string/silly_string.hpp similarity index 100% rename from test/silly_string/silly_string.hpp rename to tests/silly_string/silly_string.hpp