diff options
author | sanine <sanine.not@pm.me> | 2022-06-16 22:20:56 -0500 |
---|---|---|
committer | sanine <sanine.not@pm.me> | 2022-06-16 22:20:56 -0500 |
commit | 2cdda7ca1276b7f8cc3c235262aa5d9a1204d954 (patch) | |
tree | 608806157c550da269d93e56fd7d5aca41a87573 /src/gl/window.test.c | |
parent | 38fc53f3ddb1e27457307dc8ac34c0d5e535a9c0 (diff) |
add initial window framework
Diffstat (limited to 'src/gl/window.test.c')
-rw-r--r-- | src/gl/window.test.c | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/gl/window.test.c b/src/gl/window.test.c new file mode 100644 index 0000000..0dc255b --- /dev/null +++ b/src/gl/window.test.c @@ -0,0 +1,45 @@ +#include <lua.h> +#include <lauxlib.h> +#include "test/honey-test.h" + +int mock_glfwInit(); +#define glfwInit mock_glfwInit +#include "gl/window.c" +#undef glfwInit + + +lily_mock_t *mock_glfwInit_data = NULL; +int mock_glfwInit() +{ + lily_mock_call(mock_glfwInit_data, NULL); + + int result; + lily_dequeue(mock_glfwInit_data->values, int, &result); + return result; +} + + +void gl_init_succeeds(); + +void suite_window() +{ + lily_run_test(gl_init_succeeds); + + CLEAN_MOCK(mock_glfwInit); +} + + +/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */ + + +void gl_init_succeeds() +{ + USE_MOCK(mock_glfwInit); + lua_State *L = luaL_newstate(); + + lua_pushcfunction(L, gl_init); + int error = lua_pcall(L, 0, 0, 0); + + lily_assert_int_equal(error, 0); + lily_assert_int_equal(mock_glfwInit_data->n_calls, 1); +} |