Lexer: Migrated commify, ucFirst and lowerCase from text to Lexer
This commit is contained in:
@@ -37,7 +37,7 @@ Context context;
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int, char**)
|
||||
{
|
||||
UnitTest t (225);
|
||||
UnitTest t (198);
|
||||
|
||||
// Ensure environment has no influence.
|
||||
unsetenv ("TASKDATA");
|
||||
@@ -258,37 +258,6 @@ int main (int, char**)
|
||||
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 commify (const std::string& data)
|
||||
t.is (commify (""), "", "commify '' -> ''");
|
||||
t.is (commify ("1"), "1", "commify '1' -> '1'");
|
||||
t.is (commify ("12"), "12", "commify '12' -> '12'");
|
||||
t.is (commify ("123"), "123", "commify '123' -> '123'");
|
||||
t.is (commify ("1234"), "1,234", "commify '1234' -> '1,234'");
|
||||
t.is (commify ("12345"), "12,345", "commify '12345' -> '12,345'");
|
||||
t.is (commify ("123456"), "123,456", "commify '123456' -> '123,456'");
|
||||
t.is (commify ("1234567"), "1,234,567", "commify '1234567' -> '1,234,567'");
|
||||
t.is (commify ("12345678"), "12,345,678", "commify '12345678' -> '12,345,678'");
|
||||
t.is (commify ("123456789"), "123,456,789", "commify '123456789' -> '123,456,789'");
|
||||
t.is (commify ("1234567890"), "1,234,567,890", "commify '1234567890' -> '1,234,567,890'");
|
||||
t.is (commify ("1.0"), "1.0", "commify '1.0' -> '1.0'");
|
||||
t.is (commify ("12.0"), "12.0", "commify '12.0' -> '12.0'");
|
||||
t.is (commify ("123.0"), "123.0", "commify '123.0' -> '123.0'");
|
||||
t.is (commify ("1234.0"), "1,234.0", "commify '1234.0' -> '1,234.0'");
|
||||
t.is (commify ("12345.0"), "12,345.0", "commify '12345.0' -> '12,345.0'");
|
||||
t.is (commify ("123456.0"), "123,456.0", "commify '123456.0' -> '123,456.0'");
|
||||
t.is (commify ("1234567.0"), "1,234,567.0", "commify '1234567.0' -> '1,234,567.0'");
|
||||
t.is (commify ("12345678.0"), "12,345,678.0", "commify '12345678.0' -> '12,345,678.0'");
|
||||
t.is (commify ("123456789.0"), "123,456,789.0", "commify '123456789.0' -> '123,456,789.0'");
|
||||
t.is (commify ("1234567890.0"), "1,234,567,890.0", "commify '1234567890.0' -> '1,234,567,890.0'");
|
||||
t.is (commify ("pre"), "pre", "commify 'pre' -> 'pre'");
|
||||
t.is (commify ("pre1234"), "pre1,234", "commify 'pre1234' -> 'pre1,234'");
|
||||
t.is (commify ("1234post"), "1,234post", "commify '1234post' -> '1,234post'");
|
||||
t.is (commify ("pre1234post"), "pre1,234post", "commify 'pre1234post' -> 'pre1,234post'");
|
||||
|
||||
// std::string lowerCase (const std::string& input)
|
||||
t.is (lowerCase (""), "", "lowerCase '' -> ''");
|
||||
t.is (lowerCase ("pre01_:POST"), "pre01_:post", "lowerCase 'pre01_:POST' -> 'pre01_:post'");
|
||||
|
||||
// bool nontrivial (const std::string&);
|
||||
t.notok (nontrivial (""), "nontrivial '' -> false");
|
||||
t.notok (nontrivial (" "), "nontrivial ' ' -> false");
|
||||
|
||||
Reference in New Issue
Block a user