aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-08 09:14:35 +0100
committerBenoit Giannangeli <benoit.giannangeli@boursorama.fr>2017-02-08 09:45:55 +0100
commit20846070c7809ac30a0aed3dbd4d04716e1ef1be (patch)
tree166a65df27fe78be34fdda1224eeadc8789872f1 /tests
parenta2031547aafbb07f6284cd10704435db23d9db60 (diff)
downloadfengari-20846070c7809ac30a0aed3dbd4d04716e1ef1be.tar.gz
fengari-20846070c7809ac30a0aed3dbd4d04716e1ef1be.tar.bz2
fengari-20846070c7809ac30a0aed3dbd4d04716e1ef1be.zip
OP_LT, OP_EQ, fixed bad sBx
Diffstat (limited to 'tests')
-rw-r--r--tests/lvm.js50
1 files changed, 49 insertions, 1 deletions
diff --git a/tests/lvm.js b/tests/lvm.js
index f826091..e2454eb 100644
--- a/tests/lvm.js
+++ b/tests/lvm.js
@@ -275,7 +275,7 @@ test('VARARG', function (t) {
test('LE, JMP', function (t) {
let luaCode = `
- local a, b = 1, 2
+ local a, b = 1, 1
return a >= b
`, vm;
@@ -291,7 +291,55 @@ test('LE, JMP', function (t) {
t.strictEqual(
vm.L.stack[vm.L.top - 1].value,
+ true,
+ "Program output is correct"
+ );
+});
+
+
+test('LT', function (t) {
+ let luaCode = `
+ local a, b = 1, 1
+
+ return a > b
+ `, vm;
+
+ t.plan(2);
+
+ t.comment("Running following code: \n" + luaCode);
+
+ t.doesNotThrow(function () {
+ vm = getVM(luaCode);
+ vm.execute();
+ }, "Program executed without errors");
+
+ t.strictEqual(
+ vm.L.stack[vm.L.top - 1].value,
false,
"Program output is correct"
);
+});
+
+
+test('EQ', function (t) {
+ let luaCode = `
+ local a, b = 1, 1
+
+ return a == b
+ `, vm;
+
+ t.plan(2);
+
+ t.comment("Running following code: \n" + luaCode);
+
+ t.doesNotThrow(function () {
+ vm = getVM(luaCode);
+ vm.execute();
+ }, "Program executed without errors");
+
+ t.strictEqual(
+ vm.L.stack[vm.L.top - 1].value,
+ true,
+ "Program output is correct"
+ );
}); \ No newline at end of file