/** @file
$Id$
$Date$
$Author$
@copy © Marc Wäckerlin
@license LGPL, see file COPYING
$Log$
1 2 3 4 5 6 7 8
5678901234567890123456789012345678901234567890123456789012345678901234567890
*/
#include
#include
#include
#include
#include
#include
#include
class StringTest: public CppUnit::TestFixture {
public:
void Join() {
std::list l;
l<<"Hello"<<"World"<<"here"<<"I"<<"am";
CPPUNIT_ASSERT(mrw::join(l)=="Hello World here I am");
}
void Split() {
std::string text("Hello World here I am");
std::list a(mrw::split(text)), b;
b<<"Hello"<<"World"<<"here"<<"I"<<"am";
CPPUNIT_ASSERT(equal(a.begin(), a.end(), b.begin()));
}
CPPUNIT_TEST_SUITE(StringTest);
CPPUNIT_TEST(Join);
CPPUNIT_TEST(Split);
CPPUNIT_TEST_SUITE_END();
};
CPPUNIT_TEST_SUITE_REGISTRATION(StringTest);
int main(int argc, char** argv) try {
std::ofstream ofs((*argv+std::string(".xml")).c_str());
CppUnit::TextUi::TestRunner runner;
runner.setOutputter(new CppUnit::XmlOutputter(&runner.result(), ofs));
runner.addTest(CppUnit::TestFactoryRegistry::getRegistry().makeTest());
return runner.run() ? 0 : 1;
} catch (std::exception& e) {
std::cerr<<"***Exception: "<