52 lines
929 B
C
52 lines
929 B
C
#include <stdlib.h>
|
|
#define CLOVE_IMPLEMENTATION
|
|
#include <clove-unit.h>
|
|
|
|
#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)
|
|
{
|
|
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);
|
|
}
|
|
|
|
CLOVE_RUNNER()
|