mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Tests: Added longestWord, longestLine tests
This commit is contained in:
parent
0e859d668c
commit
35c9394a92
1 changed files with 12 additions and 1 deletions
|
@ -31,7 +31,7 @@
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
int main (int, char**)
|
int main (int, char**)
|
||||||
{
|
{
|
||||||
UnitTest t (29);
|
UnitTest t (36);
|
||||||
|
|
||||||
// void split (std::vector<std::string>& results, const std::string& input, const char delimiter)
|
// void split (std::vector<std::string>& results, const std::string& input, const char delimiter)
|
||||||
std::string unsplit = "";
|
std::string unsplit = "";
|
||||||
|
@ -61,6 +61,17 @@ int main (int, char**)
|
||||||
t.is (items[2], "bc", "split '-a-bc-def' '-' -> [2] 'bc'");
|
t.is (items[2], "bc", "split '-a-bc-def' '-' -> [2] 'bc'");
|
||||||
t.is (items[3], "def", "split '-a-bc-def' '-' -> [3] 'def'");
|
t.is (items[3], "def", "split '-a-bc-def' '-' -> [3] 'def'");
|
||||||
|
|
||||||
|
// int longestWord (const std::string&)
|
||||||
|
t.is (longestWord (" "), 0, "longestWord ( ) --> 0");
|
||||||
|
t.is (longestWord ("this is a test"), 4, "longestWord (this is a test) --> 4");
|
||||||
|
t.is (longestWord ("this is a better test"), 6, "longestWord (this is a better test) --> 6");
|
||||||
|
t.is (longestWord ("house Çirçös clown"), 6, "longestWord (Çirçös) --> 6");
|
||||||
|
|
||||||
|
// int longestLine (const std::string&)
|
||||||
|
t.is (longestLine ("one two three four"), 18, "longestLine (one two three four) --> 18");
|
||||||
|
t.is (longestLine ("one\ntwo three four"), 14, "longestLine (one\\ntwo three four) --> 14");
|
||||||
|
t.is (longestLine ("one\ntwo\nthree\nfour"), 5, "longestLine (one\\ntwo\\nthree\\nfour) --> 5");
|
||||||
|
|
||||||
// std::string format (char);
|
// std::string format (char);
|
||||||
t.is (format ('A'), "A", "format ('A') -> A");
|
t.is (format ('A'), "A", "format ('A') -> A");
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue