mirror of
https://github.com/GothenburgBitFactory/timewarrior.git
synced 2025-07-07 20:06:39 +02:00
Tests: Added ::leftJustify, ::rightJustify tests
This commit is contained in:
parent
4a2ac6f4fc
commit
201bf5ad21
1 changed files with 23 additions and 2 deletions
|
@ -31,7 +31,7 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
int main (int, char**)
|
||||
{
|
||||
UnitTest t (62);
|
||||
UnitTest t (76);
|
||||
|
||||
// void wrapText (std::vector <std::string>& lines, const std::string& text, const int width, bool hyphenate)
|
||||
std::string text = "This is a test of the line wrapping code.";
|
||||
|
@ -99,7 +99,6 @@ int main (int, char**)
|
|||
t.is (line, "AAAAAAAAA-", "extractLine hyphenated unbreakable line");
|
||||
t.diag (line);
|
||||
|
||||
|
||||
// void split (std::vector<std::string>& results, const std::string& input, const char delimiter)
|
||||
std::string unsplit = "";
|
||||
std::vector <std::string> items = split (unsplit, '-');
|
||||
|
@ -164,6 +163,28 @@ int main (int, char**)
|
|||
t.is (format (1.23456789, 8, 8), "1.2345679", "format (1.23456789, 8, 8) -> 1.2345679");
|
||||
t.is (format (2444238.56789, 12, 11), "2444238.5679", "format (2444238.56789, 12, 11) -> 2444238.5679");
|
||||
|
||||
// std::string leftJustify (const std::string&, const int);
|
||||
t.is (leftJustify (123, 3), "123", "leftJustify 123,3 -> '123'");
|
||||
t.is (leftJustify (123, 4), "123 ", "leftJustify 123,4 -> '123 '");
|
||||
t.is (leftJustify (123, 5), "123 ", "leftJustify 123,5 -> '123 '");
|
||||
|
||||
// std::string leftJustify (const std::string&, const int);
|
||||
t.is (leftJustify ("foo", 3), "foo", "leftJustify foo,3 -> 'foo'");
|
||||
t.is (leftJustify ("foo", 4), "foo ", "leftJustify foo,4 -> 'foo '");
|
||||
t.is (leftJustify ("foo", 5), "foo ", "leftJustify foo,5 -> 'foo '");
|
||||
t.is (leftJustify ("föo", 5), "föo ", "leftJustify föo,5 -> 'föo '");
|
||||
|
||||
// std::string rightJustify (const std::string&, const int);
|
||||
t.is (rightJustify (123, 3), "123", "rightJustify 123,3 -> '123'");
|
||||
t.is (rightJustify (123, 4), " 123", "rightJustify 123,4 -> ' 123'");
|
||||
t.is (rightJustify (123, 5), " 123", "rightJustify 123,5 -> ' 123'");
|
||||
|
||||
// std::string rightJustify (const std::string&, const int);
|
||||
t.is (rightJustify ("foo", 3), "foo", "rightJustify foo,3 -> 'foo'");
|
||||
t.is (rightJustify ("foo", 4), " foo", "rightJustify foo,4 -> ' foo'");
|
||||
t.is (rightJustify ("foo", 5), " foo", "rightJustify foo,5 -> ' foo'");
|
||||
t.is (rightJustify ("föo", 5), " föo", "rightJustify föo,5 -> ' föo'");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue