diff options
Diffstat (limited to 'test/reductions.tm')
| -rw-r--r-- | test/reductions.tm | 54 |
1 files changed, 18 insertions, 36 deletions
diff --git a/test/reductions.tm b/test/reductions.tm index 15c3d454..0d6ac463 100644 --- a/test/reductions.tm +++ b/test/reductions.tm @@ -1,54 +1,36 @@ struct Foo(x,y:Int) func main() - >> (+: [10, 20, 30]) - = 60 + assert (+: [10, 20, 30]) == 60 >> empty_ints : [Int] - >> (+: empty_ints) - = none + assert (+: empty_ints) == none - >> (+: [10, 20, 30]) or 0 - = 60 + assert (+: [10, 20, 30]) or 0 == 60 - >> (+: empty_ints) or 0 - = 0 + assert (+: empty_ints) or 0 == 0 - >> (_max_: [3, 5, 2, 1, 4]) - = 5 + assert (_max_: [3, 5, 2, 1, 4]) == 5 - >> (_max_.abs(): [1, -10, 5]) - = -10 + assert (_max_.abs(): [1, -10, 5]) == -10 - >> (_max_: [Foo(0, 0), Foo(1, 0), Foo(0, 10)])! - = Foo(x=1, y=0) - >> (_max_.y: [Foo(0, 0), Foo(1, 0), Foo(0, 10)])! - = Foo(x=0, y=10) - >> (_max_.y.abs(): [Foo(0, 0), Foo(1, 0), Foo(0, 10), Foo(0, -999)])! - = Foo(x=0, y=-999) + assert (_max_: [Foo(0, 0), Foo(1, 0), Foo(0, 10)])! == Foo(x=1, y=0) + assert (_max_.y: [Foo(0, 0), Foo(1, 0), Foo(0, 10)])! == Foo(x=0, y=10) + assert (_max_.y.abs(): [Foo(0, 0), Foo(1, 0), Foo(0, 10), Foo(0, -999)])! == Foo(x=0, y=-999) say("(or) and (and) have early out behavior:") - >> (or: i == 3 for i in 9999999999999999999999999999)! - = yes + assert (or: i == 3 for i in 9999999999999999999999999999)! == yes - >> (and: i < 10 for i in 9999999999999999999999999999)! - = no + assert (and: i < 10 for i in 9999999999999999999999999999)! == no - >> (<=: [1, 2, 2, 3, 4])! - = yes + assert (<=: [1, 2, 2, 3, 4])! == yes - >> (<=: empty_ints) - = none + assert (<=: empty_ints) == none - >> (<=: [5, 4, 3, 2, 1])! - = no + assert (<=: [5, 4, 3, 2, 1])! == no - >> (==: ["x", "y", "z"]) - = no - >> (==.length: ["x", "y", "z"]) - = yes - >> (+.length: ["x", "xy", "xyz"]) - = 6 + assert (==: ["x", "y", "z"]) == no + assert (==.length: ["x", "y", "z"]) == yes + assert (+.length: ["x", "xy", "xyz"]) == 6 - >> (+.abs(): [1, 2, -3]) - = 6 + assert (+.abs(): [1, 2, -3]) == 6 |
