2012-06-04 03:41:07 +02:00
|
|
|
#include <platform.h>
|
|
|
|
|
|
|
|
#include <kernel/types.h>
|
2012-05-19 20:26:46 +02:00
|
|
|
#include <kernel/item.h>
|
|
|
|
#include <kernel/region.h>
|
2014-12-30 23:34:24 +01:00
|
|
|
#include <kernel/terrain.h>
|
2012-05-19 20:26:46 +02:00
|
|
|
|
2012-06-04 03:41:07 +02:00
|
|
|
#include <util/language.h>
|
|
|
|
|
2012-05-31 04:17:08 +02:00
|
|
|
#include <CuTest.h>
|
2012-06-04 08:36:40 +02:00
|
|
|
#include <tests.h>
|
2012-05-19 20:26:46 +02:00
|
|
|
|
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();
|
2014-12-31 00:16:24 +01:00
|
|
|
init_resources();
|
2014-06-30 02:02:45 +02:00
|
|
|
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));
|
2017-09-02 17:36:09 +02:00
|
|
|
free_resources();
|
2014-06-30 02:02:45 +02:00
|
|
|
CuAssertPtrEquals(tc, 0, rt_find("stone"));
|
2014-12-31 00:16:24 +01:00
|
|
|
CuAssertPtrEquals(tc, 0, rt_find("peasant"));
|
2014-06-30 02:02:45 +02:00
|
|
|
rtype = rt_get_or_create("stone");
|
|
|
|
CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE));
|
2017-12-27 19:58:39 +01:00
|
|
|
test_teardown();
|
2014-06-25 04:51:06 +02:00
|
|
|
}
|
|
|
|
|
2012-05-19 20:26:46 +02:00
|
|
|
CuSuite *get_tests_suite(void)
|
|
|
|
{
|
2015-01-30 20:37:14 +01:00
|
|
|
CuSuite *suite = CuSuiteNew();
|
|
|
|
SUITE_ADD_TEST(suite, test_resources);
|
|
|
|
return suite;
|
2012-05-19 20:26:46 +02:00
|
|
|
}
|