summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsanine <sanine.not@pm.me>2022-06-16 22:27:08 -0500
committersanine <sanine.not@pm.me>2022-06-16 22:27:08 -0500
commit2c566f629c3ddb0bee6e338ee6b691480c7dd280 (patch)
tree6610a42d3094a441edd101f712bd138bc0d41622 /src
parent2cdda7ca1276b7f8cc3c235262aa5d9a1204d954 (diff)
add mock_**queue macros
Diffstat (limited to 'src')
-rw-r--r--src/gl/window.c1
-rw-r--r--src/gl/window.test.c4
-rw-r--r--src/test/honey-test.h6
3 files changed, 10 insertions, 1 deletions
diff --git a/src/gl/window.c b/src/gl/window.c
index c81c041..80d636d 100644
--- a/src/gl/window.c
+++ b/src/gl/window.c
@@ -5,5 +5,6 @@
int gl_init(lua_State *L)
{
+ glfwInit();
return 0;
}
diff --git a/src/gl/window.test.c b/src/gl/window.test.c
index 0dc255b..33b52a4 100644
--- a/src/gl/window.test.c
+++ b/src/gl/window.test.c
@@ -14,7 +14,7 @@ int mock_glfwInit()
lily_mock_call(mock_glfwInit_data, NULL);
int result;
- lily_dequeue(mock_glfwInit_data->values, int, &result);
+ mock_dequeue(mock_glfwInit, int, &result);
return result;
}
@@ -37,6 +37,8 @@ void gl_init_succeeds()
USE_MOCK(mock_glfwInit);
lua_State *L = luaL_newstate();
+ /* queue success */
+ mock_enqueue(mock_glfwInit, int, GLFW_TRUE);
lua_pushcfunction(L, gl_init);
int error = lua_pcall(L, 0, 0, 0);
diff --git a/src/test/honey-test.h b/src/test/honey-test.h
index a31bcff..5ac5b8f 100644
--- a/src/test/honey-test.h
+++ b/src/test/honey-test.h
@@ -7,6 +7,12 @@
lily_mock_t * name ## _data = NULL; \
void name
+#define mock_enqueue(name, type, data) \
+ lily_enqueue(name ## _data->values, type, data)
+
+#define mock_dequeue(name, type, data) \
+ lily_dequeue(name ## _data->values, type, data)
+
#define CLEAN_MOCK(name) \
do { \
if (name ## _data != NULL) { \