This repository has been archived on 2024-02-21. You can view files and clone it, but cannot push or open issues or pull requests.
MainTree/core/tests/internal/entity-lookup/main.c

24 lines
676 B
C

#include <state.h>
#include <entity.h>
#include <stdio.h>
int main()
{
MtState *state = mt_initialize("Interface Test");;
MtEntity *entity = mt_summon(state);
MtEntity *looked_up_entity = mt_get_entity(state, entity->identifier);
if(entity != looked_up_entity)
{
printf("Failed looking up entity; the pointers don't match:\nOriginal: %p\nLooked Up: %p\nERROR!", (void *) entity, (void *) looked_up_entity);
mt_drop(entity);
mt_cleanup(state);
return -1;
}
puts("The entity which was looked up from the identifier does match the original. SUCCESS!");
mt_drop(entity);
mt_cleanup(state);
return 0;
}