Skip to content

Commit

Permalink
issue #198 tests for farray opcodes
Browse files Browse the repository at this point in the history
  • Loading branch information
dibyendumajumdar committed Nov 1, 2020
1 parent 487624c commit ea6c408
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions tests/comptests/16_farray.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
f = compiler.load([[
return function(arr: number[], i: integer, value: number)
arr[i] = value
end
]]
)
assert(f and type(f) == 'function')
z = f()
assert(z and type(z) == 'function')
x = table.numarray(10)
z(x, 1, 1.1)
assert(x[1] == 1.1)
z(x, 2, 2.2)
assert(x[1] == 1.1)
assert(x[2] == 2.2)
z(x, 11, 11.11)
assert(x[1] == 1.1)
assert(x[2] == 2.2)
assert(x[11] == 11.11)
z(x, 12, 12)
assert(x[12] == 12.0)

0 comments on commit ea6c408

Please sign in to comment.