File Import

- Implemented all remaining import functionality.
This commit is contained in:
Paul Beckingham 2009-03-29 17:42:11 -04:00
parent 5f4563af2f
commit 25425614b1
6 changed files with 354 additions and 22 deletions

View file

@ -31,7 +31,7 @@
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{
UnitTest t (78);
UnitTest t (94);
// 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.";
@ -183,6 +183,24 @@ int main (int argc, char** argv)
t.is (trim (" \t xxx \t "), "\t xxx \t", "trim ' \\t xxx \\t ' -> '\\t xxx \\t'");
t.is (trim (" \t xxx \t ", " \t"), "xxx", "trim ' \\t xxx \\t ' -> 'xxx'");
// std::string unquoteText (const std::string& text)
t.is (unquoteText (""), "", "unquoteText '' -> ''");
t.is (unquoteText ("x"), "x", "unquoteText 'x' -> 'x'");
t.is (unquoteText ("'x"), "'x", "unquoteText ''x' -> ''x'");
t.is (unquoteText ("x'"), "x'", "unquoteText 'x'' -> 'x''");
t.is (unquoteText ("\"x"), "\"x", "unquoteText '\"x' -> '\"x'");
t.is (unquoteText ("x\""), "x\"", "unquoteText 'x\"' -> 'x\"'");
t.is (unquoteText ("''"), "", "unquoteText '''' -> ''");
t.is (unquoteText ("'''"), "'", "unquoteText ''''' -> '''");
t.is (unquoteText ("\"\""), "", "unquoteText '\"\"' -> ''");
t.is (unquoteText ("\"\"\""), "\"", "unquoteText '\"\"\"' -> '\"'");
t.is (unquoteText ("''''"), "''", "unquoteText '''''' -> ''''");
t.is (unquoteText ("\"\"\"\""), "\"\"", "unquoteText '\"\"\"\"' -> '\"\"'");
t.is (unquoteText ("'\"\"'"), "\"\"", "unquoteText '''\"\"' -> '\"\"'");
t.is (unquoteText ("\"''\""), "''", "unquoteText '\"''\"' -> ''''");
t.is (unquoteText ("'x'"), "x", "unquoteText ''x'' -> 'x'");
t.is (unquoteText ("\"x\""), "x", "unquoteText '\"x\"' -> 'x'");
// std::string commify (const std::string& data)
t.is (commify (""), "", "commify '' -> ''");
t.is (commify ("1"), "1", "commify '1' -> '1'");