server/src/tests.test.c

43 lines
1.4 KiB
C
Raw Normal View History

2012-06-04 03:41:07 +02:00
#include <platform.h>
#include <kernel/types.h>
#include <kernel/item.h>
#include <kernel/region.h>
#include <kernel/terrain.h>
2012-06-04 03:41:07 +02:00
#include <util/language.h>
#include <CuTest.h>
#include <tests.h>
2014-06-25 04:51:06 +02:00
static void test_resources(CuTest *tc) {
resource_type *rtype;
2016-09-08 08:12:26 +02:00
test_setup();
init_resources();
CuAssertPtrNotNull(tc, rt_find("hp"));
CuAssertPtrEquals(tc, rt_find("hp"), (void *)get_resourcetype(R_LIFE));
CuAssertPtrNotNull(tc, rt_find("peasant"));
CuAssertPtrEquals(tc, rt_find("peasant"), (void *)get_resourcetype(R_PEASANT));
CuAssertPtrNotNull(tc, rt_find("aura"));
CuAssertPtrEquals(tc, rt_find("aura"), (void *)get_resourcetype(R_AURA));
CuAssertPtrNotNull(tc, rt_find("permaura"));
CuAssertPtrEquals(tc, rt_find("permaura"), (void *)get_resourcetype(R_PERMAURA));
CuAssertPtrEquals(tc, 0, rt_find("stone"));
rtype = rt_get_or_create("stone");
CuAssertPtrEquals(tc, (void *)rtype, (void *)rt_find("stone"));
CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE));
2014-06-25 04:51:06 +02:00
test_cleanup();
CuAssertPtrEquals(tc, 0, rt_find("stone"));
CuAssertPtrEquals(tc, 0, rt_find("peasant"));
rtype = rt_get_or_create("stone");
CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE));
2014-06-25 04:51:06 +02:00
}
CuSuite *get_tests_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_resources);
return suite;
}