fix(tests): Prevent compile error when no fixtures are defined.
All checks were successful
Ubuntu Cross to Win64 / Cross Compile with ming64 (1.4.0, ubuntu-latest) (push) Successful in 1m30s

This commit is contained in:
Kevin Trogant 2024-07-19 15:06:41 +02:00
parent ef69ceaf13
commit 9f94ac40ee

View File

@ -41,83 +41,6 @@ static rt_result NegRelPtrTest(void) {
return RT_SUCCESS;
}
#if 0
static rt_result SetupRenderListFixture(void) {
rt_result res = rtInitRuntime();
if (res != RT_SUCCESS)
return res;
rt_Renderer.s = "null";
rt_renderer_init_info info = {0};
rtInitGFX(&info);
return res;
}
static void TeardownRenderListFixture(void) {
rtShutdownGFX();
rtShutdownRuntime();
}
/* Check render list interface */
static rt_result PushRenderList(void) {
typedef struct {
int a;
float b;
} dummy_type;
rt_render_object_type type = rtRegisterRenderObjectType(sizeof(dummy_type), "DummyType");
rt_create_render_list_result list_res = rtCreateRenderList(type, 43);
if (!list_res.ok) {
return RT_INVALID_VALUE;
}
rt_render_list list = list_res.list;
dummy_type dummy = {42, 21.f};
rtPushRenderListEntry(&list, &dummy);
dummy_type check = RT_GET_RENDER_LIST_ELEMENT(list, dummy_type, 0);
if (check.a != dummy.a || check.b != dummy.b)
return RT_INVALID_VALUE;
return RT_SUCCESS;
}
static rt_result PushLongRenderList(void) {
typedef struct {
float p[3];
float v[3];
} dummy_type;
rt_render_object_type type = rtRegisterRenderObjectType(sizeof(dummy_type), "DummyType");
rt_create_render_list_result list_res = rtCreateRenderList(type, 43);
if (!list_res.ok)
return RT_INVALID_VALUE;
rt_render_list list = list_res.list;
for (uint32_t i = 0; i < 512; ++i) {
dummy_type dummy;
for (int j = 0; j < 3; ++j)
dummy.v[j] = dummy.p[j] = (float)i;
rtPushRenderListEntry(&list, &dummy);
dummy_type check = RT_GET_RENDER_LIST_ELEMENT(list, dummy_type, i);
for (int j = 0; j < 3; ++j) {
if (check.p[j] != (float)i || check.v[j] != (float)i)
return RT_INVALID_VALUE;
}
}
for (uint32_t i = 0; i < 512; ++i) {
dummy_type check = RT_GET_RENDER_LIST_ELEMENT(list, dummy_type, i);
for (int j = 0; j < 3; ++j) {
if (check.p[j] != (float)i || check.v[j] != (float)i)
return RT_INVALID_VALUE;
}
}
return RT_SUCCESS;
}
#endif
static rt_result HashTableBasics(void) {
{
uint64_t mem[128];
@ -158,6 +81,13 @@ static rt_result HashTableBasics(void) {
* Run all the test cases, output if they passed or failed.
*/
/* A null fixture to prevent an empty array. */
static rt_result NullFixtureSetup(void) {
return RT_SUCCESS;
}
static void NullFixtureTeardown(void) {
}
typedef rt_result rt_fixture_setup_fn(void);
typedef void rt_fixture_teardown_fn(void);
@ -185,8 +115,7 @@ typedef struct {
/* X-Macro to create named fixtures */
/* Add more fixtures here*/
#define TEST_FIXTURE_LIST
// TEST_FIXTURE(render_list_fixture, SetupRenderListFixture, TeardownRenderListFixture)
#define TEST_FIXTURE_LIST TEST_FIXTURE(NullFixture, NullFixtureSetup, NullFixtureTeardown)
#define TEST_FIXTURE(n, setup_fn, teardown_fn) \
rt_test_fixture n = {.name = #n, \