forked from github/server
testing resource caching
This commit is contained in:
parent
dc8a8cdd71
commit
9d24c3c291
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue