//: C03:TrimTest.h // From "Thinking in C++, Volume 2", by Bruce Eckel & Chuck Allison. // (c) 1995-2004 MindView, Inc. All Rights Reserved. // See source code use permissions stated in the file 'License.txt', // distributed with the code package available at www.MindView.net. #ifndef TRIMTEST_H #define TRIMTEST_H #include "Trim.h" #include "../TestSuite/Test.h" class TrimTest : public TestSuite::Test { enum {NTESTS = 11}; static std::string s[NTESTS]; public: void testTrim() { test_(trim(s[0]) == "abcdefghijklmnop"); test_(trim(s[1]) == "abcdefghijklmnop"); test_(trim(s[2]) == "abcdefghijklmnop"); test_(trim(s[3]) == "a"); test_(trim(s[4]) == "ab"); test_(trim(s[5]) == "abc"); test_(trim(s[6]) == "a b c"); test_(trim(s[7]) == "a b c"); test_(trim(s[8]) == "a \t b \t c"); test_(trim(s[9]) == ""); test_(trim(s[10]) == ""); } void run() { testTrim(); } }; #endif // TRIMTEST_H ///:~