Skip to content

Commit

Permalink
issue #198 More tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dibyendumajumdar committed Nov 7, 2020
1 parent a82d42b commit 8cec4cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions tests/comptests/18_table.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
x = {}
f = compiler.load("x.a = 'Dibyendu' x[1] = 2")
assert(f and type(f) == 'function')
f()
assert(x.a == 'Dibyendu')
assert(x[1] == 2)
7 changes: 7 additions & 0 deletions tests/comptests/19_arith.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
adder = compiler.load('local a: number, b: number = 1.1, 2.2 return a+b')
assert(adder and type(adder) == 'function')
assert(math.abs(adder() - 3.3) < 1e-15)

mult = compiler.load('local a: number, b: number = 1.1, 2.2 return a*b')
assert(mult and type(mult) == 'function')
assert(math.abs(mult() - 2.42) < 1e-15)

0 comments on commit 8cec4cc

Please sign in to comment.