- Working towards arg date/duration eval.
This commit is contained in:
Paul Beckingham 2011-08-06 00:59:14 -04:00
parent e5ae145df2
commit ffa5bc43fe
9 changed files with 74 additions and 129 deletions

View file

@ -48,7 +48,7 @@ int convertDuration (const std::string& input)
int main (int argc, char** argv)
{
UnitTest t (628);
UnitTest t (629);
Duration d;
@ -570,6 +570,7 @@ int main (int argc, char** argv)
t.ok (d.valid ("0w"), "valid duration 0w");
t.ok (d.valid ("1 wks"), "valid duration 1 wks");
t.ok (d.valid ("1 wk"), "valid duration 1 wk");
t.ok (d.valid ("1wk"), "valid duration 1wk");
t.ok (d.valid ("1w"), "valid duration 1w");
t.ok (d.valid ("10 wks"), "valid duration 10 wks");
t.ok (d.valid ("10 wk"), "valid duration 10 wk");

View file

@ -35,7 +35,7 @@ Context context;
////////////////////////////////////////////////////////////////////////////////
int main (int argc, char** argv)
{
UnitTest t (258);
UnitTest t (262);
// 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.";
@ -155,6 +155,13 @@ int main (int argc, char** argv)
t.is (items[2], "bc", "split '-a-bc-def' '--' -> [2] 'bc'");
t.is (items[3], "def", "split '-a-bc-def' '--' -> [3] 'def'");
unsplit = "one\ntwo\nthree";
split (items, unsplit, "\n");
t.is (items.size (), (size_t) 3, "split 'one\\ntwo\\nthree' -> 'one', 'two', 'three'");
t.is (items[0], "one", "split 'one\\ntwo\\nthree' -> [0] 'one'");
t.is (items[1], "two", "split 'one\\ntwo\\nthree' -> [1] 'two'");
t.is (items[2], "three", "split 'one\\ntwo\\nthree' -> [2] 'three'");
// void splitq (std::vector<std::string>&, const std::string&, const char);
unsplit = "one 'two' '' 'three four' \"five six seven\" eight'nine ten'";
splitq (items, unsplit, ' ');