aboutsummaryrefslogtreecommitdiff
path: root/test/minmax.tm
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-03-07 12:18:01 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-03-07 12:18:01 -0500
commit6583221c0b46dd638e61a7b055c1b51922f38e7b (patch)
treeadc2029eb7ceb23609e5b834bd5d4d7b601864f4 /test/minmax.tm
parentfa66053e13c39e6f6a25db8f46b1e1f97ecce2fc (diff)
More tests
Diffstat (limited to 'test/minmax.tm')
-rw-r--r--test/minmax.tm26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/minmax.tm b/test/minmax.tm
new file mode 100644
index 00000000..58d9661d
--- /dev/null
+++ b/test/minmax.tm
@@ -0,0 +1,26 @@
+
+>> 3 _min_ 5
+= 3
+>> 5 _min_ 3
+= 3
+
+struct Foo(x:Int, y:Int)
+ func len(f:Foo)->Num
+ return Num.sqrt(f.x*f.x + f.y*f.y)
+
+>> Foo(5, 1) _min_ Foo(5, 999)
+= Foo(x=5, y=1)
+
+>> Foo(5, 999) _min_.x Foo(5, 1)
+= Foo(x=5, y=999)
+
+>> Foo(999, 1) _min_.y Foo(1, 10)
+= Foo(x=999, y=1)
+
+>> Foo(-999, -999) _max_:len() Foo(10, 10)
+= Foo(x=-999, y=-999)
+
+
+>> foos := [Foo(5, 1), Foo(5, 99), Foo(-999, -999)]
+>> (_max_) foos
+= Foo(x=5, y=99)