forked from github/server
a little bit of test coverage for rt_find
This commit is contained in:
parent
504a70a9c6
commit
f47f83ceca
4 changed files with 36 additions and 0 deletions
|
@ -104,6 +104,7 @@
|
||||||
<ClCompile Include="kernel\faction.c" />
|
<ClCompile Include="kernel\faction.c" />
|
||||||
<ClCompile Include="kernel\group.c" />
|
<ClCompile Include="kernel\group.c" />
|
||||||
<ClCompile Include="kernel\item.c" />
|
<ClCompile Include="kernel\item.c" />
|
||||||
|
<ClCompile Include="kernel\item_test.c" />
|
||||||
<ClCompile Include="kernel\magic.c" />
|
<ClCompile Include="kernel\magic.c" />
|
||||||
<ClCompile Include="kernel\message.c" />
|
<ClCompile Include="kernel\message.c" />
|
||||||
<ClCompile Include="kernel\move.c" />
|
<ClCompile Include="kernel\move.c" />
|
||||||
|
|
|
@ -307,6 +307,9 @@
|
||||||
<ClCompile Include="kernel\building_test.c">
|
<ClCompile Include="kernel\building_test.c">
|
||||||
<Filter>kernel</Filter>
|
<Filter>kernel</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="kernel\item_test.c">
|
||||||
|
<Filter>kernel</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="kernel\alchemy.h">
|
<ClInclude Include="kernel\alchemy.h">
|
||||||
|
|
30
src/kernel/item_test.c
Normal file
30
src/kernel/item_test.c
Normal 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;
|
||||||
|
}
|
|
@ -9,6 +9,7 @@
|
||||||
#include <util/quicklist_test.c>
|
#include <util/quicklist_test.c>
|
||||||
#include <util/umlaut_test.c>
|
#include <util/umlaut_test.c>
|
||||||
#include <kernel/move_test.c>
|
#include <kernel/move_test.c>
|
||||||
|
#include <kernel/item_test.c>
|
||||||
#include <kernel/ship_test.c>
|
#include <kernel/ship_test.c>
|
||||||
#include <kernel/building_test.c>
|
#include <kernel/building_test.c>
|
||||||
#include <kernel/spell_test.c>
|
#include <kernel/spell_test.c>
|
||||||
|
@ -45,6 +46,7 @@ int RunAllTests(void)
|
||||||
CuSuiteAddSuite(suite, get_umlaut_suite());
|
CuSuiteAddSuite(suite, get_umlaut_suite());
|
||||||
CuSuiteAddSuite(suite, get_curse_suite());
|
CuSuiteAddSuite(suite, get_curse_suite());
|
||||||
CuSuiteAddSuite(suite, get_market_suite());
|
CuSuiteAddSuite(suite, get_market_suite());
|
||||||
|
CuSuiteAddSuite(suite, get_item_suite());
|
||||||
CuSuiteAddSuite(suite, get_move_suite());
|
CuSuiteAddSuite(suite, get_move_suite());
|
||||||
CuSuiteAddSuite(suite, get_reports_suite());
|
CuSuiteAddSuite(suite, get_reports_suite());
|
||||||
CuSuiteAddSuite(suite, get_ship_suite());
|
CuSuiteAddSuite(suite, get_ship_suite());
|
||||||
|
|
Loading…
Reference in a new issue