zecsy/tests/zecsy.c

53 lines
929 B
C
Raw Normal View History

2025-03-20 18:12:46 +03:00
#include <stdlib.h>
2025-03-19 21:08:58 +03:00
#define CLOVE_IMPLEMENTATION
#include <clove-unit.h>
2025-03-20 18:12:46 +03:00
#define ZECSY_IMPLEMENTATION
#include "../zecsy.h"
CLOVE_TEST(make_and_delete_empty_world)
{
world* w = NULL;
make_world(&w);
CLOVE_NOT_NULL(w);
CLOVE_SIZET_EQ(RESERVED_ENTITY_ID + 1, w->entity_id_counter);
CLOVE_SIZET_EQ(0, w->alive_entities);
destroy_world(&w);
CLOVE_NULL(w);
}
CLOVE_TEST(pass_null_to_world_free)
2025-03-19 21:08:58 +03:00
{
2025-03-20 18:12:46 +03:00
world* w = NULL;
destroy_world(&w);
CLOVE_NULL(w);
}
CLOVE_TEST(alive_entities)
{
world* w = NULL;
make_world(&w);
entity_id e = make_entity(w);
CLOVE_SIZET_NE(e, RESERVED_ENTITY_ID);
CLOVE_IS_TRUE(world_has_entity(w, e));
destroy_world(&w);
}
CLOVE_TEST(dead_entities)
{
world* w = NULL;
make_world(&w);
entity_id e = make_entity(w);
destroy_entity(w, e);
CLOVE_IS_FALSE(world_has_entity(w, e));
destroy_world(&w);
2025-03-19 21:08:58 +03:00
}
CLOVE_RUNNER()