diff options
author | sanine <sanine.not@pm.me> | 2021-08-30 18:17:02 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2021-08-30 18:17:02 -0500 |
commit | 84a890dcc33b5c557fa570750960f20a6d239764 (patch) | |
tree | b44223942ceab60ef61df6612bd6ea95068c01f2 /src | |
parent | b198d914dba288c736973e38b6fde06b768b8587 (diff) |
remove C function tests
Diffstat (limited to 'src')
-rw-r--r-- | src/tests/hs_create_table_tests.c | 183 |
1 files changed, 3 insertions, 180 deletions
diff --git a/src/tests/hs_create_table_tests.c b/src/tests/hs_create_table_tests.c index c33454a..3428f90 100644 --- a/src/tests/hs_create_table_tests.c +++ b/src/tests/hs_create_table_tests.c @@ -1397,189 +1397,12 @@ TEST(create_table_func_light) /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * - * boolean keys + * C function keys * * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ -TEST(create_table_cfunc_bool) -{ - int oldtop = lua_gettop(L); - int index = hs_create_table - (L, hs_cfunc_bool(testfunc1, true), hs_cfunc_bool(testfunc2, true)); - mu_assert_equal(oldtop + 1, lua_gettop(L)); - mu_assert_equal(index, lua_gettop(L)); - mu_assert_equal(lua_type(L, index), LUA_TTABLE); - - loadkey_cfunc(index, testfunc1); - checkval_bool(true); - loadkey_cfunc(index, testfunc2); - checkval_bool(true); - return 0; -} - -TEST(create_table_cfunc_int) -{ - int oldtop = lua_gettop(L); - int index = hs_create_table - (L, hs_cfunc_int(testfunc1, 15), hs_cfunc_int(testfunc2, 25)); - mu_assert_equal(oldtop + 1, lua_gettop(L)); - mu_assert_equal(index, lua_gettop(L)); - mu_assert_equal(lua_type(L, index), LUA_TTABLE); - - loadkey_cfunc(index, testfunc1); - checkval_int(15); - loadkey_cfunc(index, testfunc2); - checkval_int(25); - return 0; -} - -TEST(create_table_cfunc_num) -{ - int oldtop = lua_gettop(L); - int index = hs_create_table - (L, hs_cfunc_num(testfunc1, 2.718), hs_cfunc_num(testfunc2, 1.618)); - mu_assert_equal(oldtop + 1, lua_gettop(L)); - mu_assert_equal(index, lua_gettop(L)); - mu_assert_equal(lua_type(L, index), LUA_TTABLE); - - loadkey_cfunc(index, testfunc1); - checkval_num(2.718); - loadkey_cfunc(index, testfunc2); - checkval_num(1.618); - return 0; -} - -TEST(create_table_cfunc_str) -{ - int oldtop = lua_gettop(L); - int index = hs_create_table - (L, hs_cfunc_str(testfunc1, "hello"), hs_cfunc_str(testfunc2, "world")); - mu_assert_equal(oldtop + 1, lua_gettop(L)); - mu_assert_equal(index, lua_gettop(L)); - mu_assert_equal(lua_type(L, index), LUA_TTABLE); - - loadkey_cfunc(index, testfunc1); - checkval_str("hello"); - loadkey_cfunc(index, testfunc2); - checkval_str("world"); - return 0; -} - -TEST(create_table_cfunc_tbl) -{ - int oldtop = lua_gettop(L); - - lua_newtable(L); - store(value1); - lua_newtable(L); - store(value2); - - int index = hs_create_table - (L, hs_cfunc_tbl(testfunc1, value1), hs_cfunc_tbl(testfunc2, value2)); - mu_assert_equal(oldtop + 1, lua_gettop(L)); - mu_assert_equal(index, lua_gettop(L)); - mu_assert_equal(lua_type(L, index), LUA_TTABLE); - - load(value1); - load(value2); - - loadkey_cfunc(index, testfunc1); - checkval_tbl(value1); - loadkey_cfunc(index, testfunc2); - checkval_tbl(value2); - return 0; -} - -TEST(create_table_cfunc_func) -{ - int oldtop = lua_gettop(L); - - luaL_loadstring(L, "print('hello')"); - store(value1); - luaL_loadstring(L, "print('hello')"); - store(value2); - - int index = hs_create_table - (L, hs_cfunc_func(testfunc1, value1), hs_cfunc_func(testfunc2, value2)); - mu_assert_equal(oldtop + 1, lua_gettop(L)); - mu_assert_equal(index, lua_gettop(L)); - mu_assert_equal(lua_type(L, index), LUA_TTABLE); - - load(value1); - load(value2); - - loadkey_cfunc(index, testfunc1); - checkval_func(value1); - loadkey_cfunc(index, testfunc2); - checkval_func(value2); - return 0; -} - -TEST(create_table_cfunc_cfunc) -{ - - int oldtop = lua_gettop(L); - int index = hs_create_table - (L, hs_cfunc_cfunc(testfunc1, testfunc1), hs_cfunc_cfunc(testfunc2, testfunc2)); - mu_assert_equal(oldtop + 1, lua_gettop(L)); - mu_assert_equal(index, lua_gettop(L)); - mu_assert_equal(lua_type(L, index), LUA_TTABLE); - - loadkey_cfunc(index, testfunc1); - checkval_cfunc(testfunc1); - loadkey_cfunc(index, testfunc2); - checkval_cfunc(testfunc2); - return 0; -} - - -TEST(create_table_cfunc_user) -{ - int oldtop = lua_gettop(L); - - lua_newuserdata(L, sizeof(char)); - store(user1); - lua_newuserdata(L, sizeof(char)); - store(user2); - - int index = hs_create_table - (L, hs_cfunc_user(testfunc1, user1), hs_cfunc_user(testfunc2, user2)); - mu_assert_equal(oldtop + 1, lua_gettop(L)); - mu_assert_equal(index, lua_gettop(L)); - mu_assert_equal(lua_type(L, index), LUA_TTABLE); - - load(user1); - load(user2); - - loadkey_cfunc(index, testfunc1); - checkval_user(user1); - loadkey_cfunc(index, testfunc2); - checkval_user(user2); - return 0; -} - -TEST(create_table_cfunc_light) -{ - int a1 = 5; - void *light1 = (void *) &a1; - int a2 = 6; - void *light2 = (void *) &a2; - - int oldtop = lua_gettop(L); - int index = hs_create_table - (L, hs_cfunc_light(testfunc1, light1), hs_cfunc_light(testfunc2, light2)); - mu_assert_equal(oldtop + 1, lua_gettop(L)); - mu_assert_equal(index, lua_gettop(L)); - mu_assert_equal(lua_type(L, index), LUA_TTABLE); - - loadkey_cfunc(index, testfunc1); - checkval_light(light1); - loadkey_cfunc(index, testfunc2); - checkval_light(light2); - return 0; -} - +/* todo */ /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * @@ -2218,7 +2041,7 @@ void hs_create_table_tests() mu_run_test("create table with function keys and light userdata values", \ create_table_func_light); - /* C function keys */ + /* C function keys / mu_run_test("create table with C function keys and boolean values", create_table_cfunc_bool); mu_run_test("create table with C function keys and integer values", \ |