aboutsummaryrefslogtreecommitdiff
path: root/tests/keeper.lua
diff options
context:
space:
mode:
Diffstat (limited to 'tests/keeper.lua')
-rw-r--r--tests/keeper.lua36
1 files changed, 18 insertions, 18 deletions
diff --git a/tests/keeper.lua b/tests/keeper.lua
index f566927..4742732 100644
--- a/tests/keeper.lua
+++ b/tests/keeper.lua
@@ -40,14 +40,14 @@ if true then
40 end 40 end
41 41
42 -- should succeed 42 -- should succeed
43 assert.failsnot(function() createLinda("zero", 0) end) 43 assert.failsnot(function() createLinda{name = "zero", group = 0} end)
44 assert.failsnot(function() createLinda("one", 1) end) 44 assert.failsnot(function() createLinda{name = "one", group = 1} end)
45 assert.failsnot(function() createLinda("two", 2) end) 45 assert.failsnot(function() createLinda{name = "two", group = 2} end)
46 assert.failsnot(function() createLinda("three", 3) end) 46 assert.failsnot(function() createLinda{name = "three", group = 3} end)
47 -- should fail (and not create the lindas) 47 -- should fail (and not create the lindas)
48 assert.fails(function() createLinda("minus 1", -1) end) 48 assert.fails(function() createLinda{name = "minus 1", group = -1} end)
49 assert.fails(function() createLinda("none") end) 49 assert.fails(function() createLinda{name = "none"} end)
50 assert.fails(function() createLinda("four", 4) end) 50 assert.fails(function() createLinda{name = "four", group = 4} end)
51 51
52end 52end
53-- should only collect the 4 successfully created lindas 53-- should only collect the 4 successfully created lindas
@@ -58,11 +58,11 @@ DONE()
58if true then 58if true then
59 PRINT "=========================================================================================" 59 PRINT "========================================================================================="
60 PRINT "Linda names test:" 60 PRINT "Linda names test:"
61 local unnamedLinda1 = lanes.linda(1) 61 local unnamedLinda1 = lanes.linda{group = 1}
62 local unnamedLinda2 = lanes.linda("", 2) 62 local unnamedLinda2 = lanes.linda{name = "", group = 2}
63 local veeeerrrryyyylooongNamedLinda3 = lanes.linda( "veeeerrrryyyylooongNamedLinda", 3) 63 local veeeerrrryyyylooongNamedLinda3 = lanes.linda{ name = "veeeerrrryyyylooongNamedLinda", group = 3}
64 assert(tostring(veeeerrrryyyylooongNamedLinda3) == "Linda: veeeerrrryyyylooongNamedLinda") 64 assert(tostring(veeeerrrryyyylooongNamedLinda3) == "Linda: veeeerrrryyyylooongNamedLinda")
65 local shortNamedLinda0 = lanes.linda( "short", 0) 65 local shortNamedLinda0 = lanes.linda{name = "short", group = 0}
66 assert(tostring(shortNamedLinda0) == "Linda: short") 66 assert(tostring(shortNamedLinda0) == "Linda: short")
67 PRINT(shortNamedLinda0, unnamedLinda1, unnamedLinda2, veeeerrrryyyylooongNamedLinda3) 67 PRINT(shortNamedLinda0, unnamedLinda1, unnamedLinda2, veeeerrrryyyylooongNamedLinda3)
68end 68end
@@ -74,12 +74,12 @@ DONE()
74if true then 74if true then
75 PRINT "=========================================================================================" 75 PRINT "========================================================================================="
76 PRINT "Linda GC test:" 76 PRINT "Linda GC test:"
77 local a = lanes.linda("A", 1) 77 local a = lanes.linda{name = "A", group = 1}
78 local b = lanes.linda("B", 2) 78 local b = lanes.linda{name = "B", group = 2}
79 local c = lanes.linda("C", 3) 79 local c = lanes.linda{name = "C", group = 3}
80 80
81 -- store lindas in each other and in themselves 81 -- store lindas in each other and in themselves
82 a:set("here", lanes.linda("temporary linda", 0)) 82 a:set("here", lanes.linda{name = "temporary linda", group = 0})
83 b:set("here", a, b, c) 83 b:set("here", a, b, c)
84 c:set("here", a, b, c) 84 c:set("here", a, b, c)
85 85
@@ -120,13 +120,13 @@ if true then
120 end 120 end
121 121
122 -- 122 --
123 local lindaA= lanes.linda( "A", 1) 123 local lindaA= lanes.linda{name = "A", group = 1}
124 local A= keeper( lindaA ) 124 local A= keeper( lindaA )
125 125
126 local lindaB= lanes.linda( "B", 2) 126 local lindaB= lanes.linda{name = "B", group = 2}
127 local B= keeper( lindaB ) 127 local B= keeper( lindaB )
128 128
129 local lindaC= lanes.linda( "C", 3) 129 local lindaC= lanes.linda{name = "C", group = 3}
130 local C= keeper( lindaC ) 130 local C= keeper( lindaC )
131 PRINT("Created", lindaA, lindaB, lindaC) 131 PRINT("Created", lindaA, lindaB, lindaC)
132 132