summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-10-26 15:06:49 -0700
committerPixel <pixel@nobis-crew.org>2011-10-26 15:06:49 -0700
commit58327525051d0e282b4bc2d0d7ddd1bbad2e9b65 (patch)
treee2d524de47749521e1b8c032a5af512e82fb1c49 /tests
parente5804f2cb929083713c0082f39182a858c082587 (diff)
Adding Lua.
Diffstat (limited to 'tests')
-rw-r--r--tests/test-Lua.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/tests/test-Lua.cc b/tests/test-Lua.cc
new file mode 100644
index 0000000..86baffb
--- /dev/null
+++ b/tests/test-Lua.cc
@@ -0,0 +1,33 @@
+#include <Main.h>
+#include <BLua.h>
+
+BALAU_STARTUP;
+
+using namespace Balau;
+
+void MainTask::Do() {
+ Printer::log(M_STATUS, "Test::Lua running.");
+
+ Lua L;
+
+ // yeah, they really should be the same thing.
+ Assert(sizeof(L) == sizeof(lua_State *));
+
+ L.open_base();
+ L.open_table();
+ L.open_string();
+ L.open_math();
+ L.open_debug();
+ L.open_bit();
+ L.open_jit();
+
+ Assert(L.gettop() == 0);
+ L.load("return 42");
+ Assert(L.gettop() == 1);
+ int r = L.tonumber();
+ Assert(r == 42);
+ L.pop();
+ Assert(L.gettop() == 0);
+
+ Printer::log(M_STATUS, "Test::Lua passed.");
+}