summaryrefslogtreecommitdiff
path: root/tests/test-suite/bitwise.js
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2018-01-11 23:33:34 +1100
committerdaurnimator <quae@daurnimator.com>2018-01-11 23:35:56 +1100
commita39f24f204a15cb4587e75b38424952fe444d9d2 (patch)
tree5047cd8b5b73bda87142405273c0dcc3203e71f4 /tests/test-suite/bitwise.js
parentb0b0b21f4394fabf41d6e3556f455a0a740f3f08 (diff)
downloadfengari-a39f24f204a15cb4587e75b38424952fe444d9d2.tar.gz
fengari-a39f24f204a15cb4587e75b38424952fe444d9d2.tar.bz2
fengari-a39f24f204a15cb4587e75b38424952fe444d9d2.zip
Move fengari specific things to src/fengaricore.js
String manipulation functions now get exposed on 'fengari' object itself at top level
Diffstat (limited to 'tests/test-suite/bitwise.js')
-rw-r--r--tests/test-suite/bitwise.js34
1 files changed, 17 insertions, 17 deletions
diff --git a/tests/test-suite/bitwise.js b/tests/test-suite/bitwise.js
index df57f15..17e3c84 100644
--- a/tests/test-suite/bitwise.js
+++ b/tests/test-suite/bitwise.js
@@ -5,7 +5,7 @@ const test = require('tape');
const lua = require('../../src/lua.js');
const lauxlib = require('../../src/lauxlib.js');
const lualib = require('../../src/lualib.js');
-
+const {to_luastring} = require("../../src/fengaricore.js");
const prefix = `
package.preload.bit32 = function () --{
@@ -176,7 +176,7 @@ test("[test-suite] bitwise: testing bitwise operations", function (t) {
-- embedded zeros
assert(not pcall(function () return "0xffffffffffffffff\\0" | 0 end))
`, L;
-
+
t.plan(2);
t.doesNotThrow(function () {
@@ -185,7 +185,7 @@ test("[test-suite] bitwise: testing bitwise operations", function (t) {
lualib.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, lua.to_luastring(prefix + luaCode));
+ lauxlib.luaL_loadstring(L, to_luastring(prefix + luaCode));
}, "Lua program loaded without error");
@@ -208,7 +208,7 @@ test("[test-suite] bitwise: testing bitwise library", function (t) {
assert(bit32.band() == bit32.band(0xffffffff))
assert(bit32.band(1,2) == 0)
`, L;
-
+
t.plan(2);
t.doesNotThrow(function () {
@@ -217,7 +217,7 @@ test("[test-suite] bitwise: testing bitwise library", function (t) {
lualib.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, lua.to_luastring(prefix + luaCode));
+ lauxlib.luaL_loadstring(L, to_luastring(prefix + luaCode));
}, "Lua program loaded without error");
@@ -285,7 +285,7 @@ test("[test-suite] bitwise: out-of-range numbers", function (t) {
assert(0x12345678 >> 32 == 0)
assert(0x12345678 >> -32 == 0x1234567800000000)
`, L;
-
+
t.plan(2);
t.doesNotThrow(function () {
@@ -294,7 +294,7 @@ test("[test-suite] bitwise: out-of-range numbers", function (t) {
lualib.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, lua.to_luastring(prefix + luaCode));
+ lauxlib.luaL_loadstring(L, to_luastring(prefix + luaCode));
}, "Lua program loaded without error");
@@ -340,7 +340,7 @@ test("[test-suite] bitwise: some special cases", function (t) {
assert(bit32.rshift(bit32.rshift(b, 4), -4) == bit32.band(b, bit32.bnot(0xf)))
end
`, L;
-
+
t.plan(2);
t.doesNotThrow(function () {
@@ -349,7 +349,7 @@ test("[test-suite] bitwise: some special cases", function (t) {
lualib.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, lua.to_luastring(prefix + luaCode));
+ lauxlib.luaL_loadstring(L, to_luastring(prefix + luaCode));
}, "Lua program loaded without error");
@@ -379,7 +379,7 @@ test("[test-suite] bitwise: for this test, use at most 24 bits (mantissa of a si
assert(not pcall(bit32.lshift, 45, print))
assert(not pcall(bit32.rshift, 45, print))
`, L;
-
+
t.plan(2);
t.doesNotThrow(function () {
@@ -388,7 +388,7 @@ test("[test-suite] bitwise: for this test, use at most 24 bits (mantissa of a si
lualib.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, lua.to_luastring(prefix + luaCode));
+ lauxlib.luaL_loadstring(L, to_luastring(prefix + luaCode));
}, "Lua program loaded without error");
@@ -422,7 +422,7 @@ test("[test-suite] bitwise: testing extract/replace", function (t) {
assert(bit32.replace(-1, 0, 31) == (1 << 31) - 1)
assert(bit32.replace(-1, 0, 1, 2) == (1 << 32) - 7)
`, L;
-
+
t.plan(2);
t.doesNotThrow(function () {
@@ -431,7 +431,7 @@ test("[test-suite] bitwise: testing extract/replace", function (t) {
lualib.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, lua.to_luastring(prefix + luaCode));
+ lauxlib.luaL_loadstring(L, to_luastring(prefix + luaCode));
}, "Lua program loaded without error");
@@ -449,7 +449,7 @@ test("[test-suite] bitwise: testing conversion of floats", function (t) {
assert(bit32.bor(3.0) == 3)
assert(bit32.bor(-4.0) == 0xfffffffc)
`, L;
-
+
t.plan(2);
t.doesNotThrow(function () {
@@ -458,7 +458,7 @@ test("[test-suite] bitwise: testing conversion of floats", function (t) {
lualib.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, lua.to_luastring(prefix + luaCode));
+ lauxlib.luaL_loadstring(L, to_luastring(prefix + luaCode));
}, "Lua program loaded without error");
@@ -480,7 +480,7 @@ test("[test-suite] bitwise: large floats and large-enough integers?", function (
assert(bit32.bor(-2.0^48 - 6.0) == 0xfffffffa)
end
`, L;
-
+
t.plan(2);
t.doesNotThrow(function () {
@@ -489,7 +489,7 @@ test("[test-suite] bitwise: large floats and large-enough integers?", function (
lualib.luaL_openlibs(L);
- lauxlib.luaL_loadstring(L, lua.to_luastring(prefix + luaCode));
+ lauxlib.luaL_loadstring(L, to_luastring(prefix + luaCode));
}, "Lua program loaded without error");