aboutsummaryrefslogtreecommitdiff
path: root/tests/structs.nl
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-02-24 15:32:02 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-02-24 15:32:02 -0500
commit0591d3db3a10f5b7e8788a856b708dd0c14a971e (patch)
treeee0b0ab83391bd1ee9b118d022d6ae16b6047604 /tests/structs.nl
parenta1593ad8e4bdbd5f821cf9006587f2ff97dd965f (diff)
Rename folder
Diffstat (limited to 'tests/structs.nl')
-rw-r--r--tests/structs.nl52
1 files changed, 0 insertions, 52 deletions
diff --git a/tests/structs.nl b/tests/structs.nl
deleted file mode 100644
index a9bb545f..00000000
--- a/tests/structs.nl
+++ /dev/null
@@ -1,52 +0,0 @@
-
-struct Pair(x,y:Int)
-struct Mixed(x:Int, str:Str)
-
-func test_literals()
- >> x := Pair(10, 20)
- = Pair(x=10, y=20)
- >> y := Pair(y=20, 10)
- = Pair(x=10, y=20)
- >> x == y
- = yes
- >> x == Pair(-1, -2)
- = no
-test_literals()
-
-func test_metamethods()
- >> x := Pair(10, 20)
- >> y := Pair(100, 200)
- >> x == y
- = no
- >> x == Pair(10, 20)
- = yes
- >> x == Pair(10, 30)
- = no
-
- >> x < Pair(11, 20)
- = yes
- >> t2 := {x=> "found"; default="missing"}
- >> t2[x]
- = "found"
- >> t2[y]
- = "missing"
-test_metamethods()
-
-func test_mixed()
- >> x := Mixed(10, "Hello")
- >> y := Mixed(99, "Hello")
- >> x == y
- = no
- >> x == Mixed(10, "Hello")
- = yes
- >> x == Mixed(10, "Bye")
- = no
- >> x < Mixed(11, "Hello")
- = yes
- >> t := {x=> "found"; default="missing"}
- >> t[x]
- = "found"
- >> t[y]
- = "missing"
-test_mixed()
-