diff options
| author | sanine <sanine.not@pm.me> | 2022-09-22 22:38:45 -0500 | 
|---|---|---|
| committer | sanine <sanine.not@pm.me> | 2022-09-22 22:38:45 -0500 | 
| commit | 60732c9489c89df2057b7f981253447eb7ccee63 (patch) | |
| tree | 0e6164f59a3abfdcbe1f7b6c9d036d37a59f296d /src/import | |
| parent | dc6c3052e4df6eecd60ded1b913e7e6476eb9921 (diff) | |
test 3rd level of recursion
Diffstat (limited to 'src/import')
| -rw-r--r-- | src/import/import_node.test.c | 31 | 
1 files changed, 26 insertions, 5 deletions
| diff --git a/src/import/import_node.test.c b/src/import/import_node.test.c index 4d5c9ef..7c498a8 100644 --- a/src/import/import_node.test.c +++ b/src/import/import_node.test.c @@ -38,6 +38,14 @@ void test_push_node()  	nodeB.mNumMeshes = 2;  	nodeB.mChildren = NULL; +	/* third layer nodes */ +	struct aiNode nodeC; +	struct aiNode *a_children[] = { &nodeC }; +	nodeA.mChildren = a_children; +	nodeC.mMeshes = meshes + 7; +	nodeC.mNumMeshes = 1; +	nodeC.mChildren = NULL; +  	/* push */  	int top = lua_gettop(L);  	push_node(L, &root); @@ -69,6 +77,7 @@ void test_push_node()  	/* check children */  	lua_getfield(L, nodetbl, "children"); +	lily_assert_int_equal(lua_objlen(L, -1), 2);  	int childrentbl = lua_gettop(L);  	lily_assert_int_equal(lua_type(L, -1), LUA_TTABLE); @@ -88,10 +97,6 @@ void test_push_node()  	lily_assert_int_equal(lua_tointeger(L, -1), 5);  	lua_pop(L, 2); -	lua_getfield(L, atbl, "children"); -	lily_assert_int_equal(lua_type(L, -1), LUA_TNIL); -	lua_pop(L, 2); -  	lua_rawgeti(L, childrentbl, 2);  	lily_assert_int_equal(lua_type(L, -1), LUA_TTABLE);  	int btbl = lua_gettop(L); @@ -110,7 +115,23 @@ void test_push_node()  	lua_getfield(L, btbl, "children");  	lily_assert_int_equal(lua_type(L, -1), LUA_TNIL); -	lua_pop(L, 2); +	lua_pop(L, 1); + +	/* check layer 3 */ +	lua_getfield(L, atbl, "children"); +	childrentbl = lua_gettop(L); +	lily_assert_int_equal(lua_type(L, -1), LUA_TTABLE); +	lily_assert_int_equal(lua_objlen(L, -1), 1); + +	lua_rawgeti(L, childrentbl, 1); +	lily_assert_int_equal(lua_type(L, -1), LUA_TTABLE); +	int ctbl = lua_gettop(L); +	lua_getfield(L, ctbl, "meshes"); +	lily_assert_int_equal(lua_type(L, -1), LUA_TTABLE); +	lily_assert_int_equal(lua_objlen(L, -1), 1); +	lua_rawgeti(L, -1, 1); +	lily_assert_int_equal(lua_type(L, -1), LUA_TNUMBER); +	lily_assert_int_equal(lua_tointeger(L, -1), 8);  	lua_close(L);  } | 
