strings reorg

This commit is contained in:
Adrian Mariano
2021-11-20 23:19:54 -05:00
parent 2e2dadefed
commit 590143ef07
3 changed files with 303 additions and 306 deletions

View File

@@ -273,34 +273,35 @@ module test_str_strip() {
assert(str_strip("abcdef ", " ") == "abcdef");
assert(str_strip(" abcdef ", " ") == "abcdef");
assert(str_strip(" abcdef ", " ") == "abcdef");
assert(str_strip("abcdef", " ",start=true) == "abcdef");
assert(str_strip(" abcdef", " ",start=true) == "abcdef");
assert(str_strip(" abcdef", " ",start=true) == "abcdef");
assert(str_strip("abcdef ", " ",start=true) == "abcdef ");
assert(str_strip("abcdef ", " ",start=true) == "abcdef ");
assert(str_strip(" abcdef ", " ",start=true) == "abcdef ");
assert(str_strip(" abcdef ", " ",start=true) == "abcdef ");
assert(str_strip("abcdef", " ",end=true) == "abcdef");
assert(str_strip(" abcdef", " ",end=true) == " abcdef");
assert(str_strip(" abcdef", " ",end=true) == " abcdef");
assert(str_strip("abcdef ", " ",end=true) == "abcdef");
assert(str_strip("abcdef ", " ",end=true) == "abcdef");
assert(str_strip(" abcdef ", " ",end=true) == " abcdef");
assert(str_strip(" abcdef ", " ",end=true) == " abcdef");
assert(str_strip("123abc321","12") == "3abc3");
assert(str_strip("123abc321","12",start=true,end=true) == "3abc3");
assert(str_strip("123abc321","12",start=true,end=false) == "3abc321");
assert(str_strip("123abc321","12",start=false,end=false) == "123abc321");
assert(str_strip("123abc321","12",start=false,end=true) == "123abc3");
assert(str_strip("123abc321","12",start=false) == "123abc3");
assert(str_strip("123abc321","12",start=true) == "3abc321");
assert(str_strip("123abc321","12",end=false) == "3abc321");
assert(str_strip("123abc321","12",end=true) == "123abc3");
assert(str_strip("abcde","abcde")=="");
assert(str_strip("","abc")=="");
}
test_str_strip();
module test_str_strip_leading() {
assert(str_strip_leading("abcdef", " ") == "abcdef");
assert(str_strip_leading(" abcdef", " ") == "abcdef");
assert(str_strip_leading(" abcdef", " ") == "abcdef");
assert(str_strip_leading("abcdef ", " ") == "abcdef ");
assert(str_strip_leading("abcdef ", " ") == "abcdef ");
assert(str_strip_leading(" abcdef ", " ") == "abcdef ");
assert(str_strip_leading(" abcdef ", " ") == "abcdef ");
}
test_str_strip_leading();
module test_str_strip_trailing() {
assert(str_strip_trailing("abcdef", " ") == "abcdef");
assert(str_strip_trailing(" abcdef", " ") == " abcdef");
assert(str_strip_trailing(" abcdef", " ") == " abcdef");
assert(str_strip_trailing("abcdef ", " ") == "abcdef");
assert(str_strip_trailing("abcdef ", " ") == "abcdef");
assert(str_strip_trailing(" abcdef ", " ") == " abcdef");
assert(str_strip_trailing(" abcdef ", " ") == " abcdef");
}
test_str_strip_trailing();
module test_substr() {
assert(substr("abcdefg",3,3) == "def");
assert(substr("abcdefg",2) == "cdefg");