a little bit of test coverage for rt_find

This commit is contained in:
Enno Rehling 2012-05-19 00:18:23 -07:00
parent 504a70a9c6
commit f47f83ceca
4 changed files with 36 additions and 0 deletions

View file

@ -104,6 +104,7 @@
<ClCompile Include="kernel\faction.c" />
<ClCompile Include="kernel\group.c" />
<ClCompile Include="kernel\item.c" />
<ClCompile Include="kernel\item_test.c" />
<ClCompile Include="kernel\magic.c" />
<ClCompile Include="kernel\message.c" />
<ClCompile Include="kernel\move.c" />

View file

@ -307,6 +307,9 @@
<ClCompile Include="kernel\building_test.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\item_test.c">
<Filter>kernel</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="kernel\alchemy.h">

30
src/kernel/item_test.c Normal file
View file

@ -0,0 +1,30 @@
#include <platform.h>
#include <kernel/item.h>
#include <cutest/CuTest.h>
#include <tests.h>
void test_resource_type(CuTest * tc)
{
resource_type *rtype, *rherp;
const char *names[2] = { 0 , 0 };
CuAssertPtrEquals(tc, 0, rt_find("herpderp"));
names[0] = "herpderp";
rtype = new_resourcetype(names, NULL, RTF_NONE);
names[0] = "herp";
rherp = new_resourcetype(names, NULL, RTF_NONE);
names[0] = "herpes";
rtype = new_resourcetype(names, NULL, RTF_NONE);
CuAssertPtrEquals(tc, rherp, rt_find("herp"));
}
CuSuite *get_item_suite(void)
{
CuSuite *suite = CuSuiteNew();
SUITE_ADD_TEST(suite, test_resource_type);
return suite;
}

View file

@ -9,6 +9,7 @@
#include <util/quicklist_test.c>
#include <util/umlaut_test.c>
#include <kernel/move_test.c>
#include <kernel/item_test.c>
#include <kernel/ship_test.c>
#include <kernel/building_test.c>
#include <kernel/spell_test.c>
@ -45,6 +46,7 @@ int RunAllTests(void)
CuSuiteAddSuite(suite, get_umlaut_suite());
CuSuiteAddSuite(suite, get_curse_suite());
CuSuiteAddSuite(suite, get_market_suite());
CuSuiteAddSuite(suite, get_item_suite());
CuSuiteAddSuite(suite, get_move_suite());
CuSuiteAddSuite(suite, get_reports_suite());
CuSuiteAddSuite(suite, get_ship_suite());