mirror of
https://github.com/jezhiggins/arabica
synced 2025-01-29 08:36:45 +01:00
reworked test builds to use Automakes built in check target
This commit is contained in:
parent
b02a3ddb62
commit
afe8903976
14 changed files with 163 additions and 250 deletions
|
@ -38,10 +38,6 @@ dist-hook:
|
|||
pkgconfigdir = src/pkgconfig
|
||||
pkgconfig_DATA = arabica.pc
|
||||
|
||||
test:
|
||||
@cd tests && make test;
|
||||
@cd ..
|
||||
|
||||
docs:
|
||||
doxygen doc/arabica.dox
|
||||
@echo "------------------------------------------------------------"
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
AC_INIT([Arabica], [Aug07], [jez@jezuk.co.uk])
|
||||
AC_INIT([Arabica], [Aug2007-pre], [jez@jezuk.co.uk])
|
||||
|
||||
AM_INIT_AUTOMAKE([1.9 tar-ustar])
|
||||
|
||||
|
@ -24,6 +24,7 @@ AC_CONFIG_FILES([Makefile])
|
|||
AC_CONFIG_FILES([arabica.pc])
|
||||
AC_CONFIG_FILES([src/Makefile])
|
||||
AC_CONFIG_FILES([tests/Makefile])
|
||||
AC_CONFIG_FILES([tests/CppUnit/Makefile])
|
||||
AC_CONFIG_FILES([tests/Utils/Makefile])
|
||||
AC_CONFIG_FILES([tests/SAX/Makefile])
|
||||
AC_CONFIG_FILES([tests/DOM/Makefile])
|
||||
|
|
32
tests/CppUnit/Makefile.am
Normal file
32
tests/CppUnit/Makefile.am
Normal file
|
@ -0,0 +1,32 @@
|
|||
|
||||
cppunit_sources = framework/CppUnitException.h \
|
||||
framework/estring.h \
|
||||
framework/Guards.h \
|
||||
framework/Test.h \
|
||||
framework/TestCaller.h \
|
||||
framework/TestCase.cpp \
|
||||
framework/TestCase.h \
|
||||
framework/TestFailure.cpp \
|
||||
framework/TestFailure.h \
|
||||
framework/TestResult.cpp \
|
||||
framework/TestResult.h \
|
||||
framework/TestSuite.cpp \
|
||||
framework/TestSuite.h \
|
||||
TestRunner.cpp \
|
||||
TestRunner.hpp \
|
||||
textui/TextTestResult.cpp \
|
||||
textui/TextTestResult.h
|
||||
|
||||
silly_string_sources = ../silly_string/silly_string.cpp \
|
||||
../silly_string/silly_string.hpp
|
||||
|
||||
check_LTLIBRARIES = libcppunit.la libsillystring.la
|
||||
|
||||
libcppunit_la_SOURCES= $(cppunit_sources)
|
||||
|
||||
libsillystring_la_SOURCES = $(silly_string_sources)
|
||||
libsillystring_la_CPPFLAGS = -I$(top_srcdir)/include
|
||||
|
||||
|
||||
|
||||
|
|
@ -19,12 +19,22 @@
|
|||
*/
|
||||
using namespace std;
|
||||
|
||||
|
||||
typedef pair<string, Test *> mapping;
|
||||
typedef vector<pair<string, Test *> > mappings;
|
||||
|
||||
void TestRunner::printBanner ()
|
||||
void run(const string& name, Test *test, bool verbose)
|
||||
{
|
||||
cout << "Usage: driver [-q] [ -wait ] testName, where name is the name of a test case class" << endl;
|
||||
if(verbose)
|
||||
cout << "Running " << name << endl;
|
||||
TextTestResult result(name, verbose);
|
||||
test->run (&result);
|
||||
cout << result;
|
||||
} // run
|
||||
|
||||
void printBanner ()
|
||||
{
|
||||
cout << "Usage: driver [-v] [ -wait ] testName, where name is the name of a test case class" << endl;
|
||||
} // printBanner
|
||||
|
||||
void TestRunner::run(int ac, const char **av)
|
||||
|
@ -42,9 +52,9 @@ void TestRunner::run(int ac, const char **av)
|
|||
continue;
|
||||
}
|
||||
|
||||
if(string(av[i]) == "-q")
|
||||
if(string(av[i]) == "-v")
|
||||
{
|
||||
verbose_ = false;
|
||||
verbose_ = true;
|
||||
++opt;
|
||||
continue;
|
||||
}
|
||||
|
@ -65,10 +75,8 @@ void TestRunner::run(int ac, const char **av)
|
|||
{
|
||||
if((*it).first == testCase)
|
||||
{
|
||||
if(verbose_)
|
||||
cout << (*it).first << std::endl;
|
||||
testToRun = (*it).second;
|
||||
run(testToRun);
|
||||
::run((*it).first, testToRun, verbose_);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -86,9 +94,7 @@ void TestRunner::run(int ac, const char **av)
|
|||
// run everything
|
||||
for(mappings::iterator it = m_mappings.begin(); it != m_mappings.end(); ++it)
|
||||
{
|
||||
if(verbose_)
|
||||
cout << (*it).first << std::endl;
|
||||
run((*it).second);
|
||||
::run((*it).first, (*it).second, verbose_);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
@ -114,10 +120,3 @@ TestRunner::~TestRunner ()
|
|||
delete it->second;
|
||||
} // ~TestRunner
|
||||
|
||||
void TestRunner::run(Test *test)
|
||||
{
|
||||
TextTestResult result(verbose_);
|
||||
test->run (&result);
|
||||
cout << result;
|
||||
} // run
|
||||
|
||||
|
|
|
@ -12,16 +12,12 @@ protected:
|
|||
std::vector<std::pair<std::string,Test *> > m_mappings;
|
||||
|
||||
public:
|
||||
TestRunner() : m_wait(false), verbose_(true) {}
|
||||
TestRunner() : m_wait(false), verbose_(false) {}
|
||||
~TestRunner();
|
||||
|
||||
void run(int ac, const char **av);
|
||||
void addTest(std::string name, Test *test)
|
||||
{ m_mappings.push_back(std::make_pair(name, test)); }
|
||||
|
||||
protected:
|
||||
void run(Test *test);
|
||||
void printBanner();
|
||||
}; // TestRunner;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -27,7 +27,8 @@ void TextTestResult::addFailure (Test *test, CppUnitException *e)
|
|||
void TextTestResult::addSkip (Test *test, CppUnitException *e)
|
||||
{
|
||||
TestResult::addSkip (test, e);
|
||||
cerr << "S" << endl;
|
||||
if(verbose_)
|
||||
cerr << "S" << endl;
|
||||
}
|
||||
|
||||
void TextTestResult::startTest (Test *test)
|
||||
|
@ -122,9 +123,10 @@ void TextTestResult::print (ostream& stream)
|
|||
printHeader (stream);
|
||||
printErrors (stream);
|
||||
printFailures (stream);
|
||||
printSkips (stream);
|
||||
if(verbose_)
|
||||
printSkips (stream);
|
||||
if(verbose_ || !wasSuccessful())
|
||||
cout << endl;
|
||||
cout << endl;
|
||||
}
|
||||
|
||||
|
||||
|
@ -134,6 +136,7 @@ void TextTestResult::printHeader (ostream& stream)
|
|||
{
|
||||
if(verbose_)
|
||||
{
|
||||
cout << endl << name_;
|
||||
if(testSkips())
|
||||
cout << endl << "OK (" << runTests () << " tests, with " << testSkips() << " skips)" << endl;
|
||||
else
|
||||
|
@ -142,6 +145,7 @@ void TextTestResult::printHeader (ostream& stream)
|
|||
}
|
||||
else
|
||||
cout << endl
|
||||
<< name_ << endl
|
||||
<< "!!!FAILURES!!!" << endl
|
||||
<< "Test Results:" << endl
|
||||
<< "Run: "
|
||||
|
@ -153,5 +157,4 @@ void TextTestResult::printHeader (ostream& stream)
|
|||
<< " Skips: "
|
||||
<< testSkips ()
|
||||
<< endl;
|
||||
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
class TextTestResult : public TestResult
|
||||
{
|
||||
public:
|
||||
TextTestResult(bool verbose) : verbose_(verbose) { }
|
||||
TextTestResult(const std::string& name, bool verbose) : name_(name), verbose_(verbose) { }
|
||||
virtual void addError (Test *test, CppUnitException *e);
|
||||
virtual void addFailure (Test *test, CppUnitException *e);
|
||||
virtual void addSkip (Test *test, CppUnitException *e);
|
||||
|
@ -21,6 +21,7 @@ public:
|
|||
virtual void printHeader (std::ostream& stream);
|
||||
|
||||
private:
|
||||
std::string name_;
|
||||
bool verbose_;
|
||||
};
|
||||
|
||||
|
|
|
@ -1,62 +1,43 @@
|
|||
|
||||
noinst_PROGRAMS = dom_test dom_test_silly
|
||||
check_PROGRAMS = dom_test dom_test_silly
|
||||
if HAS_STD_WSTRING
|
||||
noinst_PROGRAMS += dom_test_wide
|
||||
check_PROGRAMS += dom_test_wide
|
||||
endif
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include @PARSER_HEADERS@ $(BOOST_CPPFLAGS)
|
||||
LIBARABICA = $(top_builddir)/src/libarabica.la
|
||||
|
||||
cppunit_sources = ../CppUnit/framework/CppUnitException.h \
|
||||
../CppUnit/framework/estring.h \
|
||||
../CppUnit/framework/Guards.h \
|
||||
../CppUnit/framework/Test.h \
|
||||
../CppUnit/framework/TestCaller.h \
|
||||
../CppUnit/framework/TestCase.cpp \
|
||||
../CppUnit/framework/TestCase.h \
|
||||
../CppUnit/framework/TestFailure.cpp \
|
||||
../CppUnit/framework/TestFailure.h \
|
||||
../CppUnit/framework/TestResult.cpp \
|
||||
../CppUnit/framework/TestResult.h \
|
||||
../CppUnit/framework/TestSuite.cpp \
|
||||
../CppUnit/framework/TestSuite.h \
|
||||
../CppUnit/TestRunner.cpp \
|
||||
../CppUnit/TestRunner.hpp \
|
||||
../CppUnit/textui/TextTestResult.cpp \
|
||||
../CppUnit/textui/TextTestResult.h
|
||||
LIBSILLY = ../CppUnit/libsillystring.la
|
||||
TESTLIBS = $(LIBARABICA) ../CppUnit/libcppunit.la
|
||||
|
||||
test_sources = dom_test_suite.hpp \
|
||||
test_Attribute.h \
|
||||
test_CDATA.hpp \
|
||||
test_CharacterData.hpp \
|
||||
test_DOMImplementation.h \
|
||||
test_Document.h \
|
||||
test_DocumentFragment.h \
|
||||
test_DocumentType.h \
|
||||
test_Element.h \
|
||||
test_ProcessingInstruction.h \
|
||||
test_Siblings.h \
|
||||
test_Text.hpp \
|
||||
test_SAX2DOM.hpp \
|
||||
test_TreeWalker.hpp
|
||||
test_Attribute.h \
|
||||
test_CDATA.hpp \
|
||||
test_CharacterData.hpp \
|
||||
test_DOMImplementation.h \
|
||||
test_Document.h \
|
||||
test_DocumentFragment.h \
|
||||
test_DocumentType.h \
|
||||
test_Element.h \
|
||||
test_ProcessingInstruction.h \
|
||||
test_Siblings.h \
|
||||
test_Text.hpp \
|
||||
test_SAX2DOM.hpp \
|
||||
test_TreeWalker.hpp
|
||||
|
||||
dom_test_SOURCES = main.cpp $(cppunit_sources) $(test_sources)
|
||||
dom_test_LDADD = $(LIBARABICA)
|
||||
dom_test_DEPENDENCIES = $(LIBARABICA)
|
||||
dom_test_SOURCES = main.cpp \
|
||||
$(test_sources)
|
||||
dom_test_LDADD = $(TESTLIBS)
|
||||
dom_test_DEPENDENCIES = $(TESTLIBS)
|
||||
|
||||
dom_test_silly_SOURCES = main_silly.cpp $(cppunit_sources) $(test_sources) ../silly_string/silly_string.cpp ../silly_string/silly_string.hpp
|
||||
dom_test_silly_LDADD = $(LIBARABICA)
|
||||
dom_test_silly_DEPENDENCIES = $(LIBARABICA)
|
||||
dom_test_silly_SOURCES = main_silly.cpp \
|
||||
$(test_sources)
|
||||
dom_test_silly_LDADD = $(TESTLIBS) $(LIBSILLY)
|
||||
dom_test_silly_DEPENDENCIES = $(TESTLIBS) $(LIBSILLY)
|
||||
|
||||
dom_test_wide_SOURCES = main_wide.cpp $(cppunit_sources) $(test_sources)
|
||||
dom_test_wide_LDADD = $(LIBARABICA)
|
||||
dom_test_wide_DEPENDENCIES = $(LIBARABICA)
|
||||
dom_test_wide_SOURCES = main_wide.cpp \
|
||||
$(test_sources)
|
||||
dom_test_wide_LDADD = $(TESTLIBS)
|
||||
dom_test_wide_DEPENDENCIES = $(TESTLIBS)
|
||||
|
||||
|
||||
|
||||
test: $(noinst_PROGRAMS)
|
||||
@for p in $(noinst_PROGRAMS); do \
|
||||
echo Running $$p; \
|
||||
./$$p -q; \
|
||||
done
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
SUBDIRS = SAX Utils
|
||||
SUBDIRS = CppUnit Utils SAX
|
||||
if WANT_DOM
|
||||
SUBDIRS += DOM
|
||||
endif
|
||||
|
@ -9,8 +9,3 @@ endif
|
|||
install:
|
||||
echo "Nothing to install here"
|
||||
|
||||
test:
|
||||
@for p in $(SUBDIRS); do \
|
||||
cd $$p && make test; \
|
||||
cd ..; \
|
||||
done
|
||||
|
|
|
@ -1,59 +1,29 @@
|
|||
|
||||
noinst_PROGRAMS = filter_test filter_test_silly
|
||||
TESTS = filter_test filter_test_silly
|
||||
check_PROGRAMS = filter_test filter_test_silly
|
||||
if HAS_STD_WSTRING
|
||||
noinst_PROGRAMS += filter_test_wide
|
||||
TESTS +=filter_test_wide
|
||||
check_PROGRAMS += filter_test_wide
|
||||
endif
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include @PARSER_HEADERS@ $(BOOST_CPPFLAGS)
|
||||
LIBARABICA = $(top_builddir)/src/libarabica.la
|
||||
|
||||
cppunit_sources = ../CppUnit/framework/CppUnitException.h \
|
||||
../CppUnit/framework/estring.h \
|
||||
../CppUnit/framework/Guards.h \
|
||||
../CppUnit/framework/Test.h \
|
||||
../CppUnit/framework/TestCaller.h \
|
||||
../CppUnit/framework/TestCase.cpp \
|
||||
../CppUnit/framework/TestCase.h \
|
||||
../CppUnit/framework/TestFailure.cpp \
|
||||
../CppUnit/framework/TestFailure.h \
|
||||
../CppUnit/framework/TestResult.cpp \
|
||||
../CppUnit/framework/TestResult.h \
|
||||
../CppUnit/framework/TestSuite.cpp \
|
||||
../CppUnit/framework/TestSuite.h \
|
||||
../CppUnit/TestRunner.cpp \
|
||||
../CppUnit/TestRunner.hpp \
|
||||
../CppUnit/textui/TextTestResult.cpp \
|
||||
../CppUnit/textui/TextTestResult.h
|
||||
|
||||
silly_string_sources = ../silly_string/silly_string.cpp \
|
||||
../silly_string/silly_string.hpp
|
||||
LIBSILLY = ../CppUnit/libsillystring.la
|
||||
TESTLIBS = $(LIBARABICA) ../CppUnit/libcppunit.la
|
||||
|
||||
test_sources = test_WhitespaceStripper.hpp
|
||||
|
||||
filter_test_SOURCES = filter_test.cpp \
|
||||
$(cppunit_sources) \
|
||||
$(test_sources)
|
||||
filter_test_LDADD = $(LIBARABICA)
|
||||
filter_test_DEPENDENCIES = $(LIBARABICA)
|
||||
filter_test_LDADD = $(TESTLIBS)
|
||||
filter_test_DEPENDENCIES = $(TESTLIBS)
|
||||
|
||||
filter_test_silly_SOURCES = filter_test_silly.cpp \
|
||||
$(cppunit_sources) \
|
||||
$(test_sources) \
|
||||
$(silly_string_sources)
|
||||
filter_test_silly_LDADD = $(LIBARABICA)
|
||||
filter_test_silly_DEPENDENCIES = $(LIBARABICA)
|
||||
$(test_sources)
|
||||
filter_test_silly_LDADD = $(TESTLIBS) $(LIBSILLY)
|
||||
filter_test_silly_DEPENDENCIES = $(TESTLIBS) $(LIBSILLY)
|
||||
|
||||
filter_test_wide_SOURCES = filter_test_wide.cpp \
|
||||
$(cppunit_sources) \
|
||||
$(test_sources)
|
||||
filter_test_wide_LDADD = $(LIBARABICA)
|
||||
filter_test_wide_DEPENDENCIES = $(LIBARABICA)
|
||||
|
||||
test: $(noinst_PROGRAMS)
|
||||
@for p in $(noinst_PROGRAMS); do \
|
||||
echo Running $$p; \
|
||||
./$$p -q; \
|
||||
done
|
||||
$(test_sources)
|
||||
filter_test_wide_LDADD = $(TESTLIBS)
|
||||
filter_test_wide_DEPENDENCIES = $(TESTLIBS)
|
||||
|
||||
|
|
|
@ -1,35 +1,14 @@
|
|||
|
||||
noinst_PROGRAMS = utils_test utils_test_silly
|
||||
TESTS = utils_test utils_test_silly
|
||||
check_PROGRAMS = utils_test utils_test_silly
|
||||
if HAS_STD_WSTRING
|
||||
noinst_PROGRAMS += utils_test_wide
|
||||
TESTS += utils_test_wide
|
||||
check_PROGRAMS += utils_test_wide
|
||||
endif
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include @PARSER_HEADERS@ $(BOOST_CPPFLAGS)
|
||||
LIBARABICA = $(top_builddir)/src/libarabica.la
|
||||
|
||||
cppunit_sources = ../CppUnit/framework/CppUnitException.h \
|
||||
../CppUnit/framework/estring.h \
|
||||
../CppUnit/framework/Guards.h \
|
||||
../CppUnit/framework/Test.h \
|
||||
../CppUnit/framework/TestCaller.h \
|
||||
../CppUnit/framework/TestCase.cpp \
|
||||
../CppUnit/framework/TestCase.h \
|
||||
../CppUnit/framework/TestFailure.cpp \
|
||||
../CppUnit/framework/TestFailure.h \
|
||||
../CppUnit/framework/TestResult.cpp \
|
||||
../CppUnit/framework/TestResult.h \
|
||||
../CppUnit/framework/TestSuite.cpp \
|
||||
../CppUnit/framework/TestSuite.h \
|
||||
../CppUnit/TestRunner.cpp \
|
||||
../CppUnit/TestRunner.hpp \
|
||||
../CppUnit/textui/TextTestResult.cpp \
|
||||
../CppUnit/textui/TextTestResult.h
|
||||
|
||||
silly_string_sources = ../silly_string/silly_string.cpp \
|
||||
../silly_string/silly_string.hpp
|
||||
|
||||
LIBSILLY = ../CppUnit/libsillystring.la
|
||||
TESTLIBS = $(LIBARABICA) ../CppUnit/libcppunit.la
|
||||
|
||||
test_sources = util_test_suite.hpp \
|
||||
test_normalize_whitespace.hpp \
|
||||
|
@ -38,27 +17,17 @@ test_sources = util_test_suite.hpp \
|
|||
|
||||
|
||||
utils_test_SOURCES = utils_test.cpp \
|
||||
$(cppunit_sources) \
|
||||
$(test_sources)
|
||||
utils_test_LDADD = $(LIBARABICA)
|
||||
utils_test_DEPENDENCIES = $(LIBARABICA)
|
||||
$(test_sources)
|
||||
utils_test_LDADD = $(TESTLIBS)
|
||||
utils_test_DEPENDENCIES = $(TESTLIBS)
|
||||
|
||||
utils_test_silly_SOURCES = utils_test.cpp \
|
||||
$(cppunit_sources) \
|
||||
$(test_sources) \
|
||||
$(silly_string_sources)
|
||||
utils_test_silly_LDADD = $(LIBARABICA)
|
||||
utils_test_silly_DEPENDENCIES = $(LIBARABICA)
|
||||
utils_test_silly_SOURCES = utils_test_silly.cpp \
|
||||
$(test_sources)
|
||||
utils_test_silly_LDADD = $(TESTLIBS) $(LIBSILLY)
|
||||
utils_test_silly_DEPENDENCIES = $(TESTLIBS) $(LIBSILLY)
|
||||
|
||||
utils_test_wide_SOURCES = utils_test.cpp \
|
||||
$(cppunit_sources) \
|
||||
$(test_sources)
|
||||
utils_test_wide_LDADD = $(LIBARABICA)
|
||||
utils_test_wide_DEPENDENCIES = $(LIBARABICA)
|
||||
|
||||
test: $(noinst_PROGRAMS)
|
||||
@for p in $(noinst_PROGRAMS); do \
|
||||
echo Running $$p; \
|
||||
./$$p -q; \
|
||||
done
|
||||
utils_test_wide_SOURCES = utils_test_wide.cpp \
|
||||
$(test_sources)
|
||||
utils_test_wide_LDADD = $(TESTLIBS)
|
||||
utils_test_wide_DEPENDENCIES = $(TESTLIBS)
|
||||
|
||||
|
|
|
@ -21,44 +21,57 @@ class NormalizeWhitespaceTest : public TestCase
|
|||
void testNormalize1()
|
||||
{
|
||||
string_type s = SA::construct_from_utf8("hello");
|
||||
assertEquals("hello", Arabica::string::normalize_whitespace<string_type, string_adaptor>(s));
|
||||
string_type n = normalize(s);
|
||||
assertTrue(SA::construct_from_utf8("hello") == n);
|
||||
}
|
||||
|
||||
void testNormalize2()
|
||||
{
|
||||
string_type s = SA::construct_from_utf8("hello ");
|
||||
assertEquals("hello", Arabica::string::normalize_whitespace<string_type, string_adaptor>(s));
|
||||
string_type n = normalize(s);
|
||||
assertTrue(SA::construct_from_utf8("hello") == n);
|
||||
}
|
||||
|
||||
void testNormalize3()
|
||||
{
|
||||
string_type s = SA::construct_from_utf8(" hello");
|
||||
assertEquals("hello", Arabica::string::normalize_whitespace<string_type, string_adaptor>(s));
|
||||
string_type n = normalize(s);
|
||||
assertTrue(SA::construct_from_utf8("hello") == n);
|
||||
}
|
||||
|
||||
void testNormalize4()
|
||||
{
|
||||
string_type s = SA::construct_from_utf8(" hello ");
|
||||
assertEquals("hello", Arabica::string::normalize_whitespace<string_type, string_adaptor>(s));
|
||||
string_type n = normalize(s);
|
||||
assertTrue(SA::construct_from_utf8("hello") == n);
|
||||
}
|
||||
|
||||
void testNormalize5()
|
||||
{
|
||||
string_type s = SA::construct_from_utf8(" hello world ");
|
||||
assertEquals("hello world", Arabica::string::normalize_whitespace<string_type, string_adaptor>(s));
|
||||
string_type n = normalize(s);
|
||||
assertTrue(SA::construct_from_utf8("hello world") == n);
|
||||
}
|
||||
|
||||
void testNormalize6()
|
||||
{
|
||||
string_type s = SA::construct_from_utf8("\t\t\thello\tworld\t\t\t\t\t");
|
||||
assertEquals("hello world", Arabica::string::normalize_whitespace<string_type, string_adaptor>(s));
|
||||
string_type n = normalize(s);
|
||||
assertTrue(SA::construct_from_utf8("hello world") == n);
|
||||
}
|
||||
|
||||
void testNormalize7()
|
||||
{
|
||||
string_type s = SA::construct_from_utf8("\r\n h e l l o \t\r\n w \t o \t r l d ");
|
||||
assertEquals("h e l l o w o r l d", Arabica::string::normalize_whitespace<string_type, string_adaptor>(s));
|
||||
string_type n = normalize(s);
|
||||
assertTrue(SA::construct_from_utf8("h e l l o w o r l d") == n);
|
||||
}
|
||||
|
||||
private:
|
||||
string_type normalize(const string_type& s)
|
||||
{
|
||||
return Arabica::string::normalize_whitespace<string_type, string_adaptor>(s);
|
||||
} // normalize
|
||||
};
|
||||
|
||||
template<class string_type, class string_adaptor>
|
||||
|
|
|
@ -1,30 +1,14 @@
|
|||
|
||||
noinst_PROGRAMS = xpath_test xpath_test_silly
|
||||
check_PROGRAMS = xpath_test xpath_test_silly
|
||||
if HAS_STD_WSTRING
|
||||
noinst_PROGRAMS += xpath_test_wide
|
||||
check_PROGRAMS += xpath_test_wide
|
||||
endif
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include @PARSER_HEADERS@ @BOOST_CPPFLAGS@
|
||||
LIBARABICA = $(top_builddir)/src/libarabica.la
|
||||
|
||||
cppunit_sources = ../CppUnit/framework/CppUnitException.h \
|
||||
../CppUnit/framework/estring.h \
|
||||
../CppUnit/framework/Guards.h \
|
||||
../CppUnit/framework/Test.h \
|
||||
../CppUnit/framework/TestCaller.h \
|
||||
../CppUnit/framework/TestCase.cpp \
|
||||
../CppUnit/framework/TestCase.h \
|
||||
../CppUnit/framework/TestFailure.cpp \
|
||||
../CppUnit/framework/TestFailure.h \
|
||||
../CppUnit/framework/TestResult.cpp \
|
||||
../CppUnit/framework/TestResult.h \
|
||||
../CppUnit/framework/TestSuite.cpp \
|
||||
../CppUnit/framework/TestSuite.h \
|
||||
../CppUnit/TestRunner.cpp \
|
||||
../CppUnit/TestRunner.hpp \
|
||||
../CppUnit/textui/TextTestResult.cpp \
|
||||
../CppUnit/textui/TextTestResult.h
|
||||
|
||||
LIBSILLY = ../CppUnit/libsillystring.la
|
||||
TESTLIBS = $(LIBARABICA) ../CppUnit/libcppunit.la
|
||||
|
||||
test_sources = arithmetic_test.hpp \
|
||||
attr_value_test.hpp \
|
||||
|
@ -40,22 +24,18 @@ test_sources = arithmetic_test.hpp \
|
|||
value_test.hpp \
|
||||
xpath_test_suite.hpp
|
||||
|
||||
xpath_test_SOURCES = main.cpp $(cppunit_sources) $(test_sources)
|
||||
xpath_test_LDADD = $(LIBARABICA)
|
||||
xpath_test_DEPENDENCIES = $(LIBARABICA)
|
||||
xpath_test_SOURCES = main.cpp \
|
||||
$(test_sources)
|
||||
xpath_test_LDADD = $(TESTLIBS)
|
||||
xpath_test_DEPENDENCIES = $(TESTLIBS)
|
||||
|
||||
xpath_test_silly_SOURCES = main_silly.cpp $(cppunit_sources) $(test_sources) ../silly_string/silly_string.cpp
|
||||
xpath_test_silly_LDADD = $(LIBARABICA)
|
||||
xpath_test_silly_DEPENDENCIES = $(LIBARABICA)
|
||||
xpath_test_silly_SOURCES = main_silly.cpp \
|
||||
$(test_sources)
|
||||
xpath_test_silly_LDADD = $(TESTLIBS) $(LIBSILLY)
|
||||
xpath_test_silly_DEPENDENCIES = $(TESTLIBS) $(LIBSILLY)
|
||||
|
||||
xpath_test_wide_SOURCES = main_wide.cpp $(cppunit_sources) $(test_sources)
|
||||
xpath_test_wide_LDADD = $(LIBARABICA)
|
||||
xpath_test_wide_DEPENDENCIES = $(LIBARABICA)
|
||||
xpath_test_wide_SOURCES = main_wide.cpp \
|
||||
$(test_sources)
|
||||
xpath_test_wide_LDADD = $(TESTLIBS)
|
||||
xpath_test_wide_DEPENDENCIES = $(TESTLIBS)
|
||||
|
||||
|
||||
|
||||
test: $(noinst_PROGRAMS)
|
||||
@for p in $(noinst_PROGRAMS); do \
|
||||
echo Running $$p; \
|
||||
./$$p -q; \
|
||||
done
|
||||
|
|
|
@ -1,40 +1,17 @@
|
|||
|
||||
noinst_PROGRAMS = xslt_test
|
||||
check_PROGRAMS = xslt_test
|
||||
TESTS = $(check_PROGRAMS)
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include @PARSER_HEADERS@ @BOOST_CPPFLAGS@
|
||||
LIBARABICA = $(top_builddir)/src/libarabica.la
|
||||
|
||||
cppunit_sources = ../CppUnit/framework/CppUnitException.h \
|
||||
../CppUnit/framework/estring.h \
|
||||
../CppUnit/framework/Guards.h \
|
||||
../CppUnit/framework/Test.h \
|
||||
../CppUnit/framework/TestCaller.h \
|
||||
../CppUnit/framework/TestCase.cpp \
|
||||
../CppUnit/framework/TestCase.h \
|
||||
../CppUnit/framework/TestFailure.cpp \
|
||||
../CppUnit/framework/TestFailure.h \
|
||||
../CppUnit/framework/TestResult.cpp \
|
||||
../CppUnit/framework/TestResult.h \
|
||||
../CppUnit/framework/TestSuite.cpp \
|
||||
../CppUnit/framework/TestSuite.h \
|
||||
../CppUnit/TestRunner.cpp \
|
||||
../CppUnit/TestRunner.hpp \
|
||||
../CppUnit/textui/TextTestResult.cpp \
|
||||
../CppUnit/textui/TextTestResult.h
|
||||
|
||||
LIBSILLY = ../CppUnit/libsillystring.la
|
||||
TESTLIBS = $(LIBARABICA) ../CppUnit/libcppunit.la
|
||||
|
||||
test_sources = scope_test.hpp \
|
||||
xslt_test.hpp
|
||||
|
||||
xslt_test_SOURCES = main.cpp \
|
||||
$(cppunit_sources) \
|
||||
$(test_sources)
|
||||
xslt_test_LDADD = $(LIBARABICA)
|
||||
xslt_test_DEPENDENCIES = $(LIBARABICA)
|
||||
|
||||
test: $(noinst_PROGRAMS)
|
||||
@for p in $(noinst_PROGRAMS); do \
|
||||
echo Running $$p; \
|
||||
./$$p -q; \
|
||||
done
|
||||
xslt_test_LDADD = $(TESTLIBS)
|
||||
xslt_test_DEPENDENCIES = $(TESTLIBS)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue