From 33f3eb1c5a489a1b0c7d508e6a42f0dbb20e3a1b Mon Sep 17 00:00:00 2001 From: sanine Date: Mon, 22 Aug 2022 09:08:59 -0500 Subject: add types to gl_buffer_data --- src/gl/gl.test.c | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 62 insertions(+), 7 deletions(-) (limited to 'src/gl/gl.test.c') diff --git a/src/gl/gl.test.c b/src/gl/gl.test.c index 9782caf..bab8529 100644 --- a/src/gl/gl.test.c +++ b/src/gl/gl.test.c @@ -67,10 +67,21 @@ void mock_glBufferData_(int target, size_t size, const void *data, int usage) }; lily_mock_store_call(mock_glBufferData, args); - size_t count = size/sizeof(float); - float *numbers = data; - for (int i=0; in_calls, 1); + int target; size_t size; int usage; + struct lily_mock_arg_t args[] = { + { sizeof(int), &target }, + { sizeof(size_t), &size }, + { sizeof(int), &usage } + }; + lily_mock_get_call(mock_glBufferData, args, 0); + lily_assert_int_equal(target, GL_ARRAY_BUFFER); + lily_assert_int_equal(size, 3*sizeof(float)); + lily_assert_int_equal(usage, GL_STATIC_DRAW); + + int n; + lily_get_value(mock_glBufferData, int, &n); + lily_assert_int_equal(n, 22); + lily_get_value(mock_glBufferData, int, &n); + lily_assert_int_equal(n, 33); + lily_get_value(mock_glBufferData, int, &n); + lily_assert_int_equal(n, 44); +} + void suite_gl() { lily_run_test(gl_init_succeeds); lily_run_test(gl_init_fails); lily_run_test(gl_terminate_works); - lily_run_test(gl_buffer_data_works); + lily_run_test(gl_buffer_float_works); + lily_run_test(gl_buffer_int_works); lily_mock_destroy(mock_glfwInit); lily_mock_destroy(mock_hs_throw_error); -- cgit v1.2.1