Unit Tests

- Inherited improved text.cpp unit tests from taskd.
This commit is contained in:
Paul Beckingham 2011-02-08 23:55:57 -05:00
parent 589c918f79
commit 3a7e620ce6

View file

@ -34,7 +34,7 @@ Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{
UnitTest t (208);
UnitTest t (213);
// void wrapText (std::vector <std::string>& lines, const std::string& text, const int width)
std::string text = "This is a test of the line wrapping code.";
@ -416,6 +416,13 @@ int main (int argc, char** argv)
// std::string format (double, int, int);
// std::string printable (const std::string&);
t.is (printable ("a\rb"), "a\\rb", "printable <carriage-return> -> \\r");
t.is (printable ("a\nb"), "a\\nb", "printable <newline> -> \\n");
t.is (printable ("a\fb"), "a\\fb", "printable <formfeed> -> \\f");
t.is (printable ("a\tb"), "a\\tb", "printable <tab> -> \\t");
t.is (printable ("a\vb"), "a\\vb", "printable <vertical-space> -> \\v");
return 0;
}