aboutsummaryrefslogtreecommitdiff
path: root/tests.snug
diff options
context:
space:
mode:
authorCamil Staps2023-06-20 22:13:40 +0200
committerCamil Staps2023-06-20 22:13:40 +0200
commit3a068f37f49b56efcb3bb2d99973bf3c4b4c9905 (patch)
tree50a841d28ab6582adbb82462a091bca7b872d273 /tests.snug
parentAdd automated tests (diff)
Add tests for function application
Diffstat (limited to 'tests.snug')
-rw-r--r--tests.snug18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests.snug b/tests.snug
index 8873481..698e71f 100644
--- a/tests.snug
+++ b/tests.snug
@@ -6,3 +6,21 @@
(Tuple a b)))
(test "printing tuples" : Tuple Int Int : (Tuple 1 2) "(1,2)")
+
+(fun id ((x : Int)) : Int :
+ x)
+(fun const ((x : Int) (y : Int)) : Int :
+ x)
+(fun tuple ((x : Int) (y : Int)) : Tuple Int Int :
+ Tuple x y)
+(fun swapped_tuple ((x : Int) (y : Int)) : Tuple Int Int :
+ Tuple y x)
+
+(test "function application (id)" : Int : (id 1) "1")
+(test "function application (id)" : Int : (id (id 2)) "2")
+(test "function application (id)" : Int : (id (id (id 3))) "3")
+(test "function application (const)" : Int : (const 1 2) "1")
+(test "function application (const)" : Int : (const (const 1 2) 3) "1")
+(test "function application (const)" : Int : (const 1 (const 2 3)) "1")
+(test "function application (tuple)" : Tuple Int Int : (tuple 10 20) "(10,20)")
+(test "function application (swapped_tuple)" : Tuple Int Int : (swapped_tuple 10 20) "(20,10)")