Add string comparison operator overloads (#64)

This commit is contained in:
Max Graey
2018-04-04 22:50:40 +03:00
committed by Daniel Wirtz
parent 5e20bed09a
commit e790eb757f
4 changed files with 1656 additions and 190 deletions

File diff suppressed because it is too large Load Diff

View File

@ -3,6 +3,7 @@ import "allocator/arena";
// preliminary
var str: string = "hi, I'm a string";
var nullStr: String;
// exactly once in static memory
assert(changetype<usize>(str) == changetype<usize>("hi, I'm a string"));
@ -36,3 +37,26 @@ assert(parseFloat(".1foobar") == 0.1);
var c = "a" + "b";
assert(c == "ab");
assert(c != "a");
assert("" == "");
assert("" != nullStr);
assert("b" > "a");
assert("ba" > "a");
assert("ba" >= "aa");
assert("ba" > "ab");
assert(!("ba" < "ab"));
assert(!("b" < nullStr));
assert(!(nullStr < "b"));
assert("abc" > "");
assert("" < "abc");
assert("abc" >= "");
assert("" <= "abc");
assert(!("abc" < ""));
assert(!("" > "abc"));
assert(!("" < ""));
assert(!("" > ""));
assert("" >= "");
assert("" <= "");

File diff suppressed because it is too large Load Diff