aboutsummaryrefslogtreecommitdiffstats
path: root/bruiser/lua-scripts
diff options
context:
space:
mode:
authorbloodstalker <thabogre@gmail.com>2018-01-22 22:22:18 +0000
committerbloodstalker <thabogre@gmail.com>2018-01-22 22:22:18 +0000
commit3b7593cc12fdca0c6e42dccc30fd4c89faa1be39 (patch)
tree3a31073abca076704fd9254aacec89b9917530fe /bruiser/lua-scripts
parentxobj handling for int types and pointers is done.next is structs,unoins and a... (diff)
downloadmutator-3b7593cc12fdca0c6e42dccc30fd4c89faa1be39.tar.gz
mutator-3b7593cc12fdca0c6e42dccc30fd4c89faa1be39.zip
fixed some issues with the way bruiser handled integers, added some initial tests.
Diffstat (limited to 'bruiser/lua-scripts')
-rw-r--r--bruiser/lua-scripts/demo1.lua22
1 files changed, 22 insertions, 0 deletions
diff --git a/bruiser/lua-scripts/demo1.lua b/bruiser/lua-scripts/demo1.lua
index c5c9d27..75778d2 100644
--- a/bruiser/lua-scripts/demo1.lua
+++ b/bruiser/lua-scripts/demo1.lua
@@ -149,16 +149,38 @@ function main()
local add2_code = codeTableByName_number("'add2'")
local sub2_code = codeTableByName_number("'sub2'")
+ local adddouble_code = codeTableByName_number("'adddouble'")
+ local subdouble_code = codeTableByName_number("'subdouble'")
+ local triple_code = codeTableByName_number("'triple'")
printFuncSizes()
pwd()
xobjregister(add2_code, "add2")
xobjregister(sub2_code, "sub2")
+ xobjregister(adddouble_code, "adddouble")
+ xobjregister(subdouble_code, "subdouble")
+ xobjregister(triple_code, "triple")
a=xcall(2,{"uint32","uint32"},"uint32",0, {30,20})
print("call add result", a)
a=xcall(2,{"uint32", "uint32"},"uint32",1, {30,20})
print("call sub result", a)
+
+ arg1 = 100
+ arg2 = 200
+ a=xcall(2,{"sint32", "sint32"},"sint32",1, {arg1,arg2})
+ print("xcall returned:",a)
+ if a ~= -100 then print("test failed") end
+ a=xcall(2,{"double", "double"},"double",2, {333.333,222.222})
+ print("xcall returned:",a)
+ -- FIXME
+ if a ~= 555.555 then print("test failed") end
+ a=xcall(2,{"double", "double"},"double",3, {333.333,222.222})
+ print("xcall returned:",a)
+ if a ~= 111.111 then print("test failed") end
+ a=xcall(3,{"double", "double", "double"},"double",4, {333.333,222.222,111.111})
+ print("xcall returned:",a)
+ if a ~= 666.666 then print("test failed") end
end
main()