forked from github/server
add a test for attrib->nexttype.
fix gcc build.
This commit is contained in:
parent
8f57adaf5b
commit
b37e8ac138
2 changed files with 12 additions and 4 deletions
|
@ -14,6 +14,7 @@ extern "C" {
|
||||||
struct ship;
|
struct ship;
|
||||||
struct item_type;
|
struct item_type;
|
||||||
struct building_type;
|
struct building_type;
|
||||||
|
struct ship_type;
|
||||||
struct terrain_type;
|
struct terrain_type;
|
||||||
|
|
||||||
void test_cleanup(void);
|
void test_cleanup(void);
|
||||||
|
|
|
@ -17,20 +17,27 @@ static void test_attrib_new(CuTest * tc)
|
||||||
|
|
||||||
static void test_attrib_add(CuTest * tc)
|
static void test_attrib_add(CuTest * tc)
|
||||||
{
|
{
|
||||||
attrib_type at_test = { "test" };
|
attrib_type at_foo = { "foo" };
|
||||||
|
attrib_type at_bar = { "bar" };
|
||||||
attrib *a, *alist = 0;
|
attrib *a, *alist = 0;
|
||||||
CuAssertPtrNotNull(tc, (a = a_new(&at_test)));
|
CuAssertPtrNotNull(tc, (a = a_new(&at_foo)));
|
||||||
CuAssertPtrEquals(tc, a, a_add(&alist, a));
|
CuAssertPtrEquals(tc, a, a_add(&alist, a));
|
||||||
CuAssertPtrEquals(tc, a, alist);
|
CuAssertPtrEquals(tc, a, alist);
|
||||||
|
CuAssertPtrEquals(tc, 0, alist->nexttype);
|
||||||
|
|
||||||
CuAssertPtrNotNull(tc, (a = a_add(&alist, a_new(&at_test))));
|
CuAssertPtrNotNull(tc, (a = a_add(&alist, a_new(&at_foo))));
|
||||||
CuAssertPtrEquals(tc, alist->next, a);
|
CuAssertPtrEquals(tc, alist->next, a);
|
||||||
CuAssertPtrEquals(tc, alist->nexttype, a);
|
CuAssertPtrEquals(tc, 0, alist->nexttype);
|
||||||
|
|
||||||
|
CuAssertPtrNotNull(tc, (a = a_add(&alist, a_new(&at_bar))));
|
||||||
|
CuAssertPtrEquals(tc, alist->next->next, a);
|
||||||
|
CuAssertPtrEquals(tc, a, alist->nexttype);
|
||||||
}
|
}
|
||||||
|
|
||||||
CuSuite *get_attrib_suite(void)
|
CuSuite *get_attrib_suite(void)
|
||||||
{
|
{
|
||||||
CuSuite *suite = CuSuiteNew();
|
CuSuite *suite = CuSuiteNew();
|
||||||
SUITE_ADD_TEST(suite, test_attrib_new);
|
SUITE_ADD_TEST(suite, test_attrib_new);
|
||||||
|
SUITE_ADD_TEST(suite, test_attrib_add);
|
||||||
return suite;
|
return suite;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue