Creating the *real* autotest nest

git-svn-id: svn://ultimatepp.org/upp/trunk@7141 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-04-02 18:36:01 +00:00
parent dc9a464a45
commit 6d3aa8ba61
230 changed files with 9963 additions and 73 deletions

View file

@ -0,0 +1,37 @@
#include <Core/Core.h>
using namespace Upp;
void TestTrimLeft(String what, String s, String r)
{
for(int i = 0; i < 3; i++) {
ASSERT(TrimLeft(what, s) == r);
ASSERT(TrimLeft(~what, s) == r);
ASSERT(TrimLeft(~what, what.GetLength(), s) == r);
r = s;
what = i == 1 ? "<notfound\1>" : "";
}
}
void TestTrimRight(String what, String s, String r)
{
for(int i = 0; i < 3; i++) {
ASSERT(TrimRight(what, s) == r);
ASSERT(TrimRight(~what, s) == r);
ASSERT(TrimRight(~what, what.GetLength(), s) == r);
r = s;
what = i == 1 ? "<notfound\1>" : "";
}
}
CONSOLE_APP_MAIN
{
String h = "http://www.website.org";
DDUMP(TrimLeft("test", h));
DDUMP(TrimLeft("http://", h));
DDUMP(TrimRight("test", h));
DDUMP(TrimRight(".org", h));
TestTrimLeft("http://", "http://www.website.org", "www.website.org");
TestTrimRight(".org", "www.website.org", "www.website");
}