forked from github/server
test building_effsize does what it does
This commit is contained in:
parent
bfb5a9b692
commit
deb39f6b8f
|
@ -515,6 +515,31 @@ static void test_cmp_castle_size(CuTest *tc) {
|
|||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_building_effsize(CuTest *tc) {
|
||||
building *b;
|
||||
building_type *btype;
|
||||
construction *cons;
|
||||
|
||||
test_setup();
|
||||
btype = bt_get_or_create("castle");
|
||||
cons = btype->construction = calloc(1, sizeof(construction));
|
||||
cons->maxsize = 5;
|
||||
cons = cons->improvement = calloc(1, sizeof(construction));
|
||||
cons->maxsize = 5;
|
||||
cons = cons->improvement = calloc(1, sizeof(construction));
|
||||
cons->maxsize = -1;
|
||||
b = test_create_building(test_create_region(0,0,0), btype);
|
||||
b->size = 1;
|
||||
CuAssertIntEquals(tc, 0, buildingeffsize(b, false));
|
||||
b->size = 5;
|
||||
CuAssertIntEquals(tc, 1, buildingeffsize(b, false));
|
||||
b->size = 10;
|
||||
CuAssertIntEquals(tc, 2, buildingeffsize(b, false));
|
||||
b->size = 20;
|
||||
CuAssertIntEquals(tc, 2, buildingeffsize(b, false));
|
||||
test_cleanup();
|
||||
}
|
||||
|
||||
CuSuite *get_building_suite(void)
|
||||
{
|
||||
CuSuite *suite = CuSuiteNew();
|
||||
|
@ -522,6 +547,7 @@ CuSuite *get_building_suite(void)
|
|||
SUITE_ADD_TEST(suite, test_register_building);
|
||||
SUITE_ADD_TEST(suite, test_btype_defaults);
|
||||
SUITE_ADD_TEST(suite, test_building_set_owner);
|
||||
SUITE_ADD_TEST(suite, test_building_effsize);
|
||||
SUITE_ADD_TEST(suite, test_buildingowner_resets_when_empty);
|
||||
SUITE_ADD_TEST(suite, test_buildingowner_goes_to_next_when_empty);
|
||||
SUITE_ADD_TEST(suite, test_buildingowner_goes_to_other_when_empty);
|
||||
|
|
Loading…
Reference in New Issue