This commit is contained in:
jez 2006-10-11 22:51:04 +00:00
parent 8463ce21c2
commit c12723cfb7
60 changed files with 63 additions and 17 deletions

View file

@ -1,7 +1,7 @@
ACLOCAL_AMFLAGS = -I m4 ACLOCAL_AMFLAGS = -I m4
SUBDIRS= src test examples SUBDIRS= src tests examples
install-data-local: install-data-local:
@echo "------------------------------------------------------------" @echo "------------------------------------------------------------"
@ -22,7 +22,7 @@ uninstall-local:
do rm -rf "$(includedir)/$$dir"; \ do rm -rf "$(includedir)/$$dir"; \
done done
DIST_SUBDIRS= src test examples DIST_SUBDIRS= src tests examples
EXTRA_DIST=vs7 \ EXTRA_DIST=vs7 \
include \ include \
src/SAX/wrappers/saxexpat.cpp \ src/SAX/wrappers/saxexpat.cpp \
@ -36,3 +36,7 @@ dist-hook:
pkgconfigdir = src/pkgconfig pkgconfigdir = src/pkgconfig
pkgconfig_DATA = arabica.pc pkgconfig_DATA = arabica.pc
test:
cd tests && make test;
cd ..

View file

@ -22,10 +22,10 @@ ARABICA_CHECK_CODECVT_SPECIALISATIONS
AC_OUTPUT(Makefile \ AC_OUTPUT(Makefile \
arabica.pc \ arabica.pc \
src/Makefile \ src/Makefile \
test/Makefile \ tests/Makefile \
test/DOM/Makefile \ tests/DOM/Makefile \
test/SAX2DOM/Makefile \ tests/SAX2DOM/Makefile \
test/XPath/Makefile \ tests/XPath/Makefile \
examples/Makefile \ examples/Makefile \
examples/SAX/Makefile \ examples/SAX/Makefile \
examples/DOM/Makefile \ examples/DOM/Makefile \

View file

@ -31,12 +31,21 @@ void TestRunner::run(int ac, const char **av)
{ {
string testCase; string testCase;
int numberOfTests = 0; int numberOfTests = 0;
int opt = 0;
for(int i = 1; i < ac; i++) for(int i = 1; i < ac; i++)
{ {
if(string(av[i]) == "-wait") if(string(av[i]) == "-wait")
{ {
m_wait = true; m_wait = true;
++opt;
continue;
}
if(string(av[i]) == "-q")
{
verbose_ = false;
++opt;
continue; continue;
} }
@ -56,6 +65,7 @@ void TestRunner::run(int ac, const char **av)
{ {
if((*it).first == testCase) if((*it).first == testCase)
{ {
if(verbose_)
cout << (*it).first << std::endl; cout << (*it).first << std::endl;
testToRun = (*it).second; testToRun = (*it).second;
run(testToRun); run(testToRun);
@ -71,11 +81,12 @@ void TestRunner::run(int ac, const char **av)
} }
} // for ... } // for ...
if(ac == 1) if((ac-opt) == 1)
{ {
// run everything // run everything
for(mappings::iterator it = m_mappings.begin(); it != m_mappings.end(); ++it) for(mappings::iterator it = m_mappings.begin(); it != m_mappings.end(); ++it)
{ {
if(verbose_)
cout << (*it).first << std::endl; cout << (*it).first << std::endl;
run((*it).second); run((*it).second);
} }
@ -105,8 +116,8 @@ TestRunner::~TestRunner ()
void TestRunner::run(Test *test) void TestRunner::run(Test *test)
{ {
TextTestResult result; TextTestResult result(verbose_);
test->run (&result); test->run (&result);
cout << result << endl; cout << result;
} // run } // run

View file

@ -7,6 +7,7 @@
class TestRunner class TestRunner
{ {
protected: protected:
bool verbose_;
bool m_wait; bool m_wait;
std::vector<std::pair<std::string,Test *> > m_mappings; std::vector<std::pair<std::string,Test *> > m_mappings;

View file

@ -9,6 +9,7 @@ using namespace std;
void TextTestResult::addError (Test *test, CppUnitException *e) void TextTestResult::addError (Test *test, CppUnitException *e)
{ {
TestResult::addError (test, e); TestResult::addError (test, e);
if(verbose_)
cerr << "E" << endl; cerr << "E" << endl;
} }
@ -16,15 +17,15 @@ void TextTestResult::addError (Test *test, CppUnitException *e)
void TextTestResult::addFailure (Test *test, CppUnitException *e) void TextTestResult::addFailure (Test *test, CppUnitException *e)
{ {
TestResult::addFailure (test, e); TestResult::addFailure (test, e);
if(verbose_)
cerr << "F" << endl; cerr << "F" << endl;
} }
void TextTestResult::startTest (Test *test) void TextTestResult::startTest (Test *test)
{ {
TestResult::startTest (test); TestResult::startTest (test);
if(verbose_)
cerr << "."; cerr << ".";
} }
@ -87,14 +88,18 @@ void TextTestResult::print (ostream& stream)
printHeader (stream); printHeader (stream);
printErrors (stream); printErrors (stream);
printFailures (stream); printFailures (stream);
if(verbose_ || !wasSuccessful())
cout << endl;
} }
void TextTestResult::printHeader (ostream& stream) void TextTestResult::printHeader (ostream& stream)
{ {
if (wasSuccessful ()) if (wasSuccessful ())
{
if(verbose_)
cout << endl << "OK (" << runTests () << " tests)" << endl; cout << endl << "OK (" << runTests () << " tests)" << endl;
}
else else
cout << endl cout << endl
<< "!!!FAILURES!!!" << endl << "!!!FAILURES!!!" << endl

View file

@ -9,6 +9,7 @@
class TextTestResult : public TestResult class TextTestResult : public TestResult
{ {
public: public:
TextTestResult(bool verbose) : verbose_(verbose) { }
virtual void addError (Test *test, CppUnitException *e); virtual void addError (Test *test, CppUnitException *e);
virtual void addFailure (Test *test, CppUnitException *e); virtual void addFailure (Test *test, CppUnitException *e);
virtual void startTest (Test *test); virtual void startTest (Test *test);
@ -17,6 +18,8 @@ public:
virtual void printFailures (std::ostream& stream); virtual void printFailures (std::ostream& stream);
virtual void printHeader (std::ostream& stream); virtual void printHeader (std::ostream& stream);
private:
bool verbose_;
}; };

View file

@ -52,3 +52,9 @@ dom_test_wide_LDADD = $(LIBARABICA)
INCLUDES = -I$(top_srcdir)/include $(PARSER_HEADERS) $(BOOST_CPPFLAGS) INCLUDES = -I$(top_srcdir)/include $(PARSER_HEADERS) $(BOOST_CPPFLAGS)
test:
@for p in $(bin_PROGRAMS); do \
echo Running $$p; \
./$$p -q; \
done

View file

@ -8,3 +8,9 @@ endif
install: install:
echo "Nothing to install here" echo "Nothing to install here"
test:
@for p in $(SUBDIRS); do \
cd $$p && make test; \
cd ..; \
done

View file

@ -34,3 +34,8 @@ sax2dom_test_LDADD = $(LIBARABICA)
INCLUDES = -I$(top_srcdir)/include $(PARSER_HEADERS) $(BOOST_CPPFLAGS) INCLUDES = -I$(top_srcdir)/include $(PARSER_HEADERS) $(BOOST_CPPFLAGS)
test:
@for p in $(bin_PROGRAMS); do \
echo Running $$p; \
./$$p -q; \
done

View file

@ -54,3 +54,8 @@ xpath_test_wide_LDADD = $(LIBARABICA)
INCLUDES = -I$(top_srcdir)/include $(PARSER_HEADERS) $(BOOST_CPPFLAGS) INCLUDES = -I$(top_srcdir)/include $(PARSER_HEADERS) $(BOOST_CPPFLAGS)
test:
@for p in $(bin_PROGRAMS); do \
echo Running $$p; \
./$$p -q; \
done