testing resource caching

This commit is contained in:
Enno Rehling 2014-06-24 19:51:06 -07:00
parent dc8a8cdd71
commit 9d24c3c291
1 changed files with 19 additions and 0 deletions

View File

@ -9,6 +9,24 @@
#include <CuTest.h>
#include <tests.h>
static void test_resources(CuTest *tc) {
const char *names[] = { "horse", "horse_p" };
resource_type *rtype;
test_cleanup();
CuAssertPtrEquals(tc, 0, rt_find("horse"));
rtype = new_resourcetype(names, 0, 0);
CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_HORSE));
rt_register(rtype);
CuAssertPtrEquals(tc, (void *)rtype, (void *)rt_find("horse"));
CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_HORSE));
test_cleanup();
CuAssertPtrEquals(tc, 0, rt_find("horse"));
rtype = new_resourcetype(names, 0, 0);
CuAssertPtrEquals(tc, 0, (void *)get_resourcetype(R_HORSE));
rt_register(rtype);
CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_HORSE));
}
static void test_recreate_world(CuTest * tc)
{
test_cleanup();
@ -50,6 +68,7 @@ static void test_recreate_world(CuTest * tc)
CuSuite *get_tests_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_resources);
SUITE_ADD_TEST(suite, test_recreate_world);
return suite;
}