Lines Matching refs:raw
71 luaL_loadstring(raw(state), (std::string("return ") + symbol).c_str()); in is_available()
72 const bool ok = (lua_pcall(raw(state), 0, 1, 0) == 0 && in is_available()
73 !lua_isnil(raw(state), -1)); in is_available()
74 lua_pop(raw(state), 1); in is_available()
131 const int f1 = lua_tointeger(raw(state), lua_upvalueindex(1)); in cxx_multiply_closure()
132 const int f2 = lua_tointeger(raw(state), -1); in cxx_multiply_closure()
133 lua_pushinteger(raw(state), f1 * f2); in cxx_multiply_closure()
203 ATF_REQUIRE(luaL_dostring(raw(state), "test_variable = 3") == 0); in ATF_TEST_CASE_BODY()
205 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
206 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
215 ATF_REQUIRE(lua_isnil(raw(state), -1)); in ATF_TEST_CASE_BODY()
216 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
224 ATF_REQUIRE(luaL_dostring(raw(state), "global_variable = 'hello'") == 0); in ATF_TEST_CASE_BODY()
226 lua_pushstring(raw(state), "global_variable"); in ATF_TEST_CASE_BODY()
227 lua_gettable(raw(state), -2); in ATF_TEST_CASE_BODY()
228 ATF_REQUIRE(lua_isstring(raw(state), -1)); in ATF_TEST_CASE_BODY()
229 ATF_REQUIRE(std::strcmp("hello", lua_tostring(raw(state), -1)) == 0); in ATF_TEST_CASE_BODY()
230 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
238 luaL_openlibs(raw(state)); in ATF_TEST_CASE_BODY()
239 ATF_REQUIRE(luaL_dostring(raw(state), "meta = { foo = 567 }; " in ATF_TEST_CASE_BODY()
241 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
243 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
244 ATF_REQUIRE_EQ(567, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
245 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
253 luaL_openlibs(raw(state)); in ATF_TEST_CASE_BODY()
254 ATF_REQUIRE(luaL_dostring(raw(state), "meta = { foo = 567 }; " in ATF_TEST_CASE_BODY()
256 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
258 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
266 luaL_openlibs(raw(state)); in ATF_TEST_CASE_BODY()
267 ATF_REQUIRE(luaL_dostring(raw(state), "meta = { foo = 567 }; " in ATF_TEST_CASE_BODY()
269 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
271 ATF_REQUIRE(lua_istable(raw(state), -1)); in ATF_TEST_CASE_BODY()
272 lua_pushstring(raw(state), "foo"); in ATF_TEST_CASE_BODY()
273 lua_gettable(raw(state), -2); in ATF_TEST_CASE_BODY()
274 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
275 ATF_REQUIRE_EQ(567, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
276 lua_pop(raw(state), 3); in ATF_TEST_CASE_BODY()
284 luaL_openlibs(raw(state)); in ATF_TEST_CASE_BODY()
285 ATF_REQUIRE(luaL_dostring(raw(state), "meta = { foo = 567 }; " in ATF_TEST_CASE_BODY()
287 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
288 lua_pushinteger(raw(state), 5555); in ATF_TEST_CASE_BODY()
290 ATF_REQUIRE(lua_istable(raw(state), -1)); in ATF_TEST_CASE_BODY()
291 lua_pushstring(raw(state), "foo"); in ATF_TEST_CASE_BODY()
292 lua_gettable(raw(state), -2); in ATF_TEST_CASE_BODY()
293 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
294 ATF_REQUIRE_EQ(567, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
295 lua_pop(raw(state), 4); in ATF_TEST_CASE_BODY()
303 ATF_REQUIRE(luaL_dostring(raw(state), "t = {}") == 0); in ATF_TEST_CASE_BODY()
304 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
306 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
314 ATF_REQUIRE(luaL_dostring(raw(state), "t = { a = 1, bar = 234 }") == 0); in ATF_TEST_CASE_BODY()
315 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
316 lua_pushstring(raw(state), "bar"); in ATF_TEST_CASE_BODY()
318 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
319 ATF_REQUIRE_EQ(234, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
320 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
328 lua_pushnil(raw(state)); in ATF_TEST_CASE_BODY()
329 lua_pushinteger(raw(state), 1); in ATF_TEST_CASE_BODY()
331 ATF_REQUIRE_EQ(2, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
332 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
340 ATF_REQUIRE(luaL_dostring(raw(state), in ATF_TEST_CASE_BODY()
342 lua_getglobal(raw(state), "the_table"); in ATF_TEST_CASE_BODY()
343 lua_pushstring(raw(state), "baz"); in ATF_TEST_CASE_BODY()
345 ATF_REQUIRE(lua_isnil(raw(state), -1)); in ATF_TEST_CASE_BODY()
346 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
355 lua_pushinteger(raw(state), 3); in ATF_TEST_CASE_BODY()
357 lua_pushinteger(raw(state), 3); in ATF_TEST_CASE_BODY()
359 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
367 lua_pushinteger(raw(state), 1); in ATF_TEST_CASE_BODY()
368 lua_pushinteger(raw(state), 2); in ATF_TEST_CASE_BODY()
369 lua_pushinteger(raw(state), 3); in ATF_TEST_CASE_BODY()
370 lua_pushinteger(raw(state), 4); in ATF_TEST_CASE_BODY()
372 ATF_REQUIRE_EQ(3, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
373 ATF_REQUIRE_EQ(2, lua_tointeger(raw(state), -2)); in ATF_TEST_CASE_BODY()
374 ATF_REQUIRE_EQ(4, lua_tointeger(raw(state), -3)); in ATF_TEST_CASE_BODY()
375 ATF_REQUIRE_EQ(1, lua_tointeger(raw(state), -4)); in ATF_TEST_CASE_BODY()
376 lua_pop(raw(state), 4); in ATF_TEST_CASE_BODY()
392 lua_pushnil(raw(state)); in ATF_TEST_CASE_BODY()
394 lua_pushboolean(raw(state), 1); in ATF_TEST_CASE_BODY()
396 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
404 lua_pushboolean(raw(state), 1); in ATF_TEST_CASE_BODY()
406 lua_pushinteger(raw(state), 5); in ATF_TEST_CASE_BODY()
409 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
425 luaL_dostring(raw(state), "function my_func(a, b) return a + b; end"); in ATF_TEST_CASE_BODY()
427 lua_pushnil(raw(state)); in ATF_TEST_CASE_BODY()
429 lua_getglobal(raw(state), "my_func"); in ATF_TEST_CASE_BODY()
431 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
439 luaL_dostring(raw(state), "function my_func(a, b) return a + b; end"); in ATF_TEST_CASE_BODY()
441 lua_getglobal(raw(state), "my_func"); in ATF_TEST_CASE_BODY()
443 lua_pushinteger(raw(state), 5); in ATF_TEST_CASE_BODY()
446 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
462 lua_pushnil(raw(state)); in ATF_TEST_CASE_BODY()
464 lua_pushinteger(raw(state), 5); in ATF_TEST_CASE_BODY()
466 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
474 lua_pushnil(raw(state)); in ATF_TEST_CASE_BODY()
476 lua_pushinteger(raw(state), 5); in ATF_TEST_CASE_BODY()
479 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
495 lua_pushnil(raw(state)); in ATF_TEST_CASE_BODY()
497 lua_pushinteger(raw(state), 5); in ATF_TEST_CASE_BODY()
499 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
507 lua_pushnil(raw(state)); in ATF_TEST_CASE_BODY()
509 lua_pushinteger(raw(state), 5); in ATF_TEST_CASE_BODY()
512 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
528 lua_pushnil(raw(state)); in ATF_TEST_CASE_BODY()
530 lua_pushinteger(raw(state), 3); in ATF_TEST_CASE_BODY()
532 lua_pushstring(raw(state), "foo"); in ATF_TEST_CASE_BODY()
534 lua_pop(raw(state), 3); in ATF_TEST_CASE_BODY()
542 lua_pushinteger(raw(state), 3); in ATF_TEST_CASE_BODY()
544 lua_pushnil(raw(state)); in ATF_TEST_CASE_BODY()
547 lua_pushstring(raw(state), "foo"); in ATF_TEST_CASE_BODY()
551 lua_pop(raw(state), 3); in ATF_TEST_CASE_BODY()
567 luaL_dostring(raw(state), "t = {3, 4, 5}"); in ATF_TEST_CASE_BODY()
569 lua_pushstring(raw(state), "foo"); in ATF_TEST_CASE_BODY()
571 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
573 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
581 luaL_dostring(raw(state), "t = {3, 4, 5}"); in ATF_TEST_CASE_BODY()
583 lua_pushstring(raw(state), "foo"); in ATF_TEST_CASE_BODY()
585 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
588 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
605 lua_pushstring(raw(state), "foo"); in ATF_TEST_CASE_BODY()
607 lua_newuserdata(raw(state), 1234); in ATF_TEST_CASE_BODY()
609 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
618 lua_pushstring(raw(state), "foo"); in ATF_TEST_CASE_BODY()
620 lua_newuserdata(raw(state), 543); in ATF_TEST_CASE_BODY()
623 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
636 ATF_REQUIRE(lua_pcall(raw(state), 0, 0, 0) == 0); in ATF_TEST_CASE_BODY()
637 lua_getglobal(raw(state), "in_the_file"); in ATF_TEST_CASE_BODY()
638 ATF_REQUIRE(std::strcmp("oh yes", lua_tostring(raw(state), -1)) == 0); in ATF_TEST_CASE_BODY()
639 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
669 ATF_REQUIRE(lua_pcall(raw(state), 0, 1, 0) == 0); in ATF_TEST_CASE_BODY()
670 ATF_REQUIRE_EQ(5, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
671 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
688 ATF_REQUIRE_EQ(1, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
689 ATF_REQUIRE(lua_istable(raw(state), -1)); in ATF_TEST_CASE_BODY()
690 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
700 ATF_REQUIRE_EQ(1, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
701 ATF_REQUIRE(lua_isuserdata(raw(state), -1)); in ATF_TEST_CASE_BODY()
702 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
710 luaL_dostring(raw(state), "t = {}"); in ATF_TEST_CASE_BODY()
712 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
713 lua_pushstring(raw(state), "this is a dummy value"); in ATF_TEST_CASE_BODY()
714 lua_pushnil(raw(state)); in ATF_TEST_CASE_BODY()
716 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
724 luaL_dostring(raw(state), "t = {}; t[1] = 100; t[2] = 200"); in ATF_TEST_CASE_BODY()
726 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
727 lua_pushnil(raw(state)); in ATF_TEST_CASE_BODY()
730 ATF_REQUIRE_EQ(3, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
731 ATF_REQUIRE(lua_isnumber(raw(state), -2)); in ATF_TEST_CASE_BODY()
732 ATF_REQUIRE_EQ(1, lua_tointeger(raw(state), -2)); in ATF_TEST_CASE_BODY()
733 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
734 ATF_REQUIRE_EQ(100, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
735 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
738 ATF_REQUIRE_EQ(3, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
739 ATF_REQUIRE(lua_isnumber(raw(state), -2)); in ATF_TEST_CASE_BODY()
740 ATF_REQUIRE_EQ(2, lua_tointeger(raw(state), -2)); in ATF_TEST_CASE_BODY()
741 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
742 ATF_REQUIRE_EQ(200, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
743 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
746 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
784 luaL_loadstring(raw(state), "function mul(a, b) return a * b; end"); in ATF_TEST_CASE_BODY()
787 lua_pushstring(raw(state), "mul"); in ATF_TEST_CASE_BODY()
788 lua_gettable(raw(state), -2); in ATF_TEST_CASE_BODY()
789 lua_pushinteger(raw(state), 3); in ATF_TEST_CASE_BODY()
790 lua_pushinteger(raw(state), 5); in ATF_TEST_CASE_BODY()
792 ATF_REQUIRE_EQ(15, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
793 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
801 lua_pushnil(raw(state)); in ATF_TEST_CASE_BODY()
810 lua_pushinteger(raw(state), 10); in ATF_TEST_CASE_BODY()
811 lua_pushinteger(raw(state), 20); in ATF_TEST_CASE_BODY()
812 lua_pushinteger(raw(state), 30); in ATF_TEST_CASE_BODY()
814 ATF_REQUIRE_EQ(2, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
815 ATF_REQUIRE_EQ(20, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
816 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
824 lua_pushinteger(raw(state), 10); in ATF_TEST_CASE_BODY()
825 lua_pushinteger(raw(state), 20); in ATF_TEST_CASE_BODY()
826 lua_pushinteger(raw(state), 30); in ATF_TEST_CASE_BODY()
828 ATF_REQUIRE_EQ(1, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
829 ATF_REQUIRE_EQ(10, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
830 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
839 ATF_REQUIRE_EQ(1, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
840 ATF_REQUIRE(lua_toboolean(raw(state), -1)); in ATF_TEST_CASE_BODY()
842 ATF_REQUIRE_EQ(2, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
843 ATF_REQUIRE(!lua_toboolean(raw(state), -1)); in ATF_TEST_CASE_BODY()
844 ATF_REQUIRE(lua_toboolean(raw(state), -2)); in ATF_TEST_CASE_BODY()
845 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
855 lua_setglobal(raw(state), "cxx_multiply_closure"); in ATF_TEST_CASE_BODY()
857 ATF_REQUIRE(luaL_dostring(raw(state), in ATF_TEST_CASE_BODY()
859 ATF_REQUIRE_EQ(150, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
860 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
869 lua_setglobal(raw(state), "cxx_divide"); in ATF_TEST_CASE_BODY()
871 ATF_REQUIRE(luaL_dostring(raw(state), "return cxx_divide(17, 3)") == 0); in ATF_TEST_CASE_BODY()
872 ATF_REQUIRE_EQ(5, lua_tointeger(raw(state), -2)); in ATF_TEST_CASE_BODY()
873 ATF_REQUIRE_EQ(2, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
874 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
883 lua_setglobal(raw(state), "cxx_divide"); in ATF_TEST_CASE_BODY()
885 ATF_REQUIRE(luaL_dostring(raw(state), "return cxx_divide(15, 0)") != 0); in ATF_TEST_CASE_BODY()
886 ATF_REQUIRE_MATCH("Divisor is 0", lua_tostring(raw(state), -1)); in ATF_TEST_CASE_BODY()
887 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
896 lua_setglobal(raw(state), "cxx_divide"); in ATF_TEST_CASE_BODY()
898 ATF_REQUIRE(luaL_dostring(raw(state), "return cxx_divide(-3, -1)") != 0); in ATF_TEST_CASE_BODY()
899 ATF_REQUIRE_MATCH("Unhandled exception", lua_tostring(raw(state), -1)); in ATF_TEST_CASE_BODY()
900 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
909 lua_setglobal(raw(state), "fail"); in ATF_TEST_CASE_BODY()
911 ATF_REQUIRE(luaL_dostring(raw(state), "return fail(900)") != 0); in ATF_TEST_CASE_BODY()
912 ATF_REQUIRE_MATCH(std::string(900, 'A'), lua_tostring(raw(state), -1)); in ATF_TEST_CASE_BODY()
913 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
915 ATF_REQUIRE(luaL_dostring(raw(state), "return fail(8192)") != 0); in ATF_TEST_CASE_BODY()
916 ATF_REQUIRE_MATCH(std::string(900, 'A'), lua_tostring(raw(state), -1)); in ATF_TEST_CASE_BODY()
917 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
926 ATF_REQUIRE_EQ(1, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
927 ATF_REQUIRE_EQ(12, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
929 ATF_REQUIRE_EQ(2, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
930 ATF_REQUIRE_EQ(34, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
931 ATF_REQUIRE_EQ(12, lua_tointeger(raw(state), -2)); in ATF_TEST_CASE_BODY()
932 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
941 ATF_REQUIRE_EQ(1, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
942 ATF_REQUIRE(lua_isnil(raw(state), -1)); in ATF_TEST_CASE_BODY()
944 ATF_REQUIRE_EQ(2, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
945 ATF_REQUIRE(!lua_isnil(raw(state), -1)); in ATF_TEST_CASE_BODY()
946 ATF_REQUIRE(lua_isnil(raw(state), -2)); in ATF_TEST_CASE_BODY()
947 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
959 ATF_REQUIRE_EQ(1, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
960 ATF_REQUIRE_EQ(std::string("first"), lua_tostring(raw(state), -1)); in ATF_TEST_CASE_BODY()
964 ATF_REQUIRE_EQ(2, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
965 ATF_REQUIRE_EQ(std::string("second"), lua_tostring(raw(state), -1)); in ATF_TEST_CASE_BODY()
966 ATF_REQUIRE_EQ(std::string("first"), lua_tostring(raw(state), -2)); in ATF_TEST_CASE_BODY()
967 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
976 lua_pushinteger(raw(state), 10); in ATF_TEST_CASE_BODY()
977 lua_pushinteger(raw(state), 20); in ATF_TEST_CASE_BODY()
979 ATF_REQUIRE_EQ(3, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
980 ATF_REQUIRE_EQ(20, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
981 ATF_REQUIRE_EQ(20, lua_tointeger(raw(state), -2)); in ATF_TEST_CASE_BODY()
982 ATF_REQUIRE_EQ(10, lua_tointeger(raw(state), -3)); in ATF_TEST_CASE_BODY()
983 lua_pop(raw(state), 3); in ATF_TEST_CASE_BODY()
992 lua_pushinteger(raw(state), 10); in ATF_TEST_CASE_BODY()
993 lua_pushinteger(raw(state), 20); in ATF_TEST_CASE_BODY()
995 ATF_REQUIRE_EQ(3, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
996 ATF_REQUIRE_EQ(10, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
997 ATF_REQUIRE_EQ(20, lua_tointeger(raw(state), -2)); in ATF_TEST_CASE_BODY()
998 ATF_REQUIRE_EQ(10, lua_tointeger(raw(state), -3)); in ATF_TEST_CASE_BODY()
999 lua_pop(raw(state), 3); in ATF_TEST_CASE_BODY()
1008 luaL_openlibs(raw(state)); in ATF_TEST_CASE_BODY()
1010 raw(state), "t = {foo=123} ; setmetatable(t, {__index=1})") == 0); in ATF_TEST_CASE_BODY()
1011 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
1012 lua_pushstring(raw(state), "foo"); in ATF_TEST_CASE_BODY()
1014 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
1015 ATF_REQUIRE_EQ(123, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
1016 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
1025 luaL_openlibs(raw(state)); in ATF_TEST_CASE_BODY()
1027 raw(state), "t = {foo=123} ; setmetatable(t, {__index=1})") == 0); in ATF_TEST_CASE_BODY()
1028 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
1029 lua_pushinteger(raw(state), 9876); in ATF_TEST_CASE_BODY()
1030 lua_pushstring(raw(state), "foo"); in ATF_TEST_CASE_BODY()
1032 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
1033 ATF_REQUIRE_EQ(123, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
1034 ATF_REQUIRE_EQ(9876, lua_tointeger(raw(state), -2)); in ATF_TEST_CASE_BODY()
1035 lua_pop(raw(state), 3); in ATF_TEST_CASE_BODY()
1044 luaL_openlibs(raw(state)); in ATF_TEST_CASE_BODY()
1046 raw(state), "t = {} ; setmetatable(t, {__newindex=1})") == 0); in ATF_TEST_CASE_BODY()
1047 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
1048 lua_pushstring(raw(state), "foo"); in ATF_TEST_CASE_BODY()
1049 lua_pushinteger(raw(state), 345); in ATF_TEST_CASE_BODY()
1051 ATF_REQUIRE(luaL_dostring(raw(state), "return t.foo") == 0); in ATF_TEST_CASE_BODY()
1052 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
1053 ATF_REQUIRE_EQ(345, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
1054 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
1063 luaL_openlibs(raw(state)); in ATF_TEST_CASE_BODY()
1065 raw(state), "t = {} ; setmetatable(t, {__newindex=1})") == 0); in ATF_TEST_CASE_BODY()
1066 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
1067 lua_pushinteger(raw(state), 876); in ATF_TEST_CASE_BODY()
1068 lua_pushstring(raw(state), "foo"); in ATF_TEST_CASE_BODY()
1069 lua_pushinteger(raw(state), 345); in ATF_TEST_CASE_BODY()
1071 ATF_REQUIRE(luaL_dostring(raw(state), "return t.foo") == 0); in ATF_TEST_CASE_BODY()
1072 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
1073 ATF_REQUIRE_EQ(345, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
1074 ATF_REQUIRE_EQ(876, lua_tointeger(raw(state), -2)); in ATF_TEST_CASE_BODY()
1075 lua_pop(raw(state), 3); in ATF_TEST_CASE_BODY()
1083 lua_pushvalue(raw(state), lutok::registry_index); in ATF_TEST_CASE_BODY()
1084 lua_pushstring(raw(state), "custom_variable"); in ATF_TEST_CASE_BODY()
1085 lua_pushstring(raw(state), "custom value"); in ATF_TEST_CASE_BODY()
1086 lua_settable(raw(state), -3); in ATF_TEST_CASE_BODY()
1087 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
1088 ATF_REQUIRE(luaL_dostring(raw(state), in ATF_TEST_CASE_BODY()
1090 ATF_REQUIRE(lua_isboolean(raw(state), -1)); in ATF_TEST_CASE_BODY()
1091 ATF_REQUIRE(lua_toboolean(raw(state), -1)); in ATF_TEST_CASE_BODY()
1092 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
1100 lua_pushinteger(raw(state), 3); in ATF_TEST_CASE_BODY()
1102 ATF_REQUIRE(luaL_dostring(raw(state), "return test_variable + 1") == 0); in ATF_TEST_CASE_BODY()
1103 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
1104 ATF_REQUIRE_EQ(4, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
1105 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
1114 raw(state), in ATF_TEST_CASE_BODY()
1120 lua_getglobal(raw(state), "numbers"); in ATF_TEST_CASE_BODY()
1121 lua_getglobal(raw(state), "mt"); in ATF_TEST_CASE_BODY()
1123 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
1125 ATF_REQUIRE(luaL_dostring(raw(state), "return numbers + 2") == 0); in ATF_TEST_CASE_BODY()
1126 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
1127 ATF_REQUIRE_EQ(7, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
1128 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
1137 raw(state), in ATF_TEST_CASE_BODY()
1143 lua_getglobal(raw(state), "numbers"); in ATF_TEST_CASE_BODY()
1144 lua_pushinteger(raw(state), 1234); in ATF_TEST_CASE_BODY()
1145 lua_getglobal(raw(state), "mt"); in ATF_TEST_CASE_BODY()
1147 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
1149 ATF_REQUIRE(luaL_dostring(raw(state), "return numbers + 2") == 0); in ATF_TEST_CASE_BODY()
1150 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
1151 ATF_REQUIRE_EQ(7, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
1152 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
1160 ATF_REQUIRE(luaL_dostring(raw(state), "t = { a = 1, bar = 234 }") == 0); in ATF_TEST_CASE_BODY()
1161 lua_getglobal(raw(state), "t"); in ATF_TEST_CASE_BODY()
1163 lua_pushstring(raw(state), "bar"); in ATF_TEST_CASE_BODY()
1164 lua_pushstring(raw(state), "baz"); in ATF_TEST_CASE_BODY()
1166 ATF_REQUIRE_EQ(1, lua_gettop(raw(state))); in ATF_TEST_CASE_BODY()
1168 lua_pushstring(raw(state), "a"); in ATF_TEST_CASE_BODY()
1169 lua_gettable(raw(state), -2); in ATF_TEST_CASE_BODY()
1170 ATF_REQUIRE(lua_isnumber(raw(state), -1)); in ATF_TEST_CASE_BODY()
1171 ATF_REQUIRE_EQ(1, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
1172 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
1174 lua_pushstring(raw(state), "bar"); in ATF_TEST_CASE_BODY()
1175 lua_gettable(raw(state), -2); in ATF_TEST_CASE_BODY()
1176 ATF_REQUIRE(lua_isstring(raw(state), -1)); in ATF_TEST_CASE_BODY()
1177 ATF_REQUIRE_EQ(std::string("baz"), lua_tostring(raw(state), -1)); in ATF_TEST_CASE_BODY()
1178 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
1180 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
1188 lua_pushnil(raw(state)); in ATF_TEST_CASE_BODY()
1189 lua_pushinteger(raw(state), 1); in ATF_TEST_CASE_BODY()
1190 lua_pushinteger(raw(state), 2); in ATF_TEST_CASE_BODY()
1192 lua_pop(raw(state), 3); in ATF_TEST_CASE_BODY()
1200 lua_pushboolean(raw(state), 1); in ATF_TEST_CASE_BODY()
1202 lua_pushboolean(raw(state), 0); in ATF_TEST_CASE_BODY()
1204 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
1212 lua_pushboolean(raw(state), 0); in ATF_TEST_CASE_BODY()
1213 lua_pushboolean(raw(state), 1); in ATF_TEST_CASE_BODY()
1216 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
1224 lua_pushstring(raw(state), "34"); in ATF_TEST_CASE_BODY()
1226 lua_pushinteger(raw(state), 12); in ATF_TEST_CASE_BODY()
1228 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
1236 lua_pushinteger(raw(state), 12); in ATF_TEST_CASE_BODY()
1237 lua_pushstring(raw(state), "foobar"); in ATF_TEST_CASE_BODY()
1239 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
1247 lua_pushstring(raw(state), "foobar"); in ATF_TEST_CASE_BODY()
1249 lua_pushinteger(raw(state), 12); in ATF_TEST_CASE_BODY()
1251 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
1259 lua_pushstring(raw(state), "foobar"); in ATF_TEST_CASE_BODY()
1260 lua_pushinteger(raw(state), 12); in ATF_TEST_CASE_BODY()
1263 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
1273 lua_newuserdata(raw(state), sizeof(int))); in ATF_TEST_CASE_BODY()
1279 lua_pop(raw(state), 1); in ATF_TEST_CASE_BODY()
1289 lua_newuserdata(raw(state), sizeof(int))); in ATF_TEST_CASE_BODY()
1293 lua_pushinteger(raw(state), 3); in ATF_TEST_CASE_BODY()
1296 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()
1304 lua_pushinteger(raw(state), 25); in ATF_TEST_CASE_BODY()
1305 lua_pushinteger(raw(state), 30); in ATF_TEST_CASE_BODY()
1306 lua_pushcclosure(raw(state), c_get_upvalues, 2); in ATF_TEST_CASE_BODY()
1307 lua_setglobal(raw(state), "c_get_upvalues"); in ATF_TEST_CASE_BODY()
1309 ATF_REQUIRE(luaL_dostring(raw(state), in ATF_TEST_CASE_BODY()
1311 ATF_REQUIRE_EQ(25, lua_tointeger(raw(state), -2)); in ATF_TEST_CASE_BODY()
1312 ATF_REQUIRE_EQ(30, lua_tointeger(raw(state), -1)); in ATF_TEST_CASE_BODY()
1313 lua_pop(raw(state), 2); in ATF_TEST_CASE_BODY()