forked from github/server
Do not use 0 to mean NULL pointers.
This commit is contained in:
parent
0cc8adeeef
commit
a7b9f6dc3e
33 changed files with 226 additions and 224 deletions
2
clibs
2
clibs
|
@ -1 +1 @@
|
||||||
Subproject commit d86c8525489d7f11b7ba13e101bb59ecf160b871
|
Subproject commit 12139c7ce25e6731393f863e248ab16aa0578a3a
|
|
@ -45,16 +45,16 @@ static void test_herbsearch(CuTest * tc)
|
||||||
CuAssertPtrEquals(tc, u2, is_guarded(r, u));
|
CuAssertPtrEquals(tc, u2, is_guarded(r, u));
|
||||||
herbsearch(u, INT_MAX);
|
herbsearch(u, INT_MAX);
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error70"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error70"));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error59"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error59"));
|
||||||
test_clear_messages(f);
|
test_clear_messages(f);
|
||||||
|
|
||||||
setguard(u2, false);
|
setguard(u2, false);
|
||||||
CuAssertPtrEquals(tc, 0, is_guarded(r, u));
|
CuAssertPtrEquals(tc, NULL, is_guarded(r, u));
|
||||||
CuAssertPtrEquals(tc, 0, (void *)rherbtype(r));
|
CuAssertPtrEquals(tc, NULL, (void *)rherbtype(r));
|
||||||
herbsearch(u, INT_MAX);
|
herbsearch(u, INT_MAX);
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error108"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error108"));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error70"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error70"));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error59"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error59"));
|
||||||
test_clear_messages(f);
|
test_clear_messages(f);
|
||||||
|
|
||||||
rsetherbtype(r, itype);
|
rsetherbtype(r, itype);
|
||||||
|
@ -62,9 +62,9 @@ static void test_herbsearch(CuTest * tc)
|
||||||
CuAssertIntEquals(tc, 0, rherbs(r));
|
CuAssertIntEquals(tc, 0, rherbs(r));
|
||||||
herbsearch(u, INT_MAX);
|
herbsearch(u, INT_MAX);
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "researchherb_none"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "researchherb_none"));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error108"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error108"));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error70"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error70"));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error59"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error59"));
|
||||||
test_clear_messages(f);
|
test_clear_messages(f);
|
||||||
|
|
||||||
rsetherbs(r, 100);
|
rsetherbs(r, 100);
|
||||||
|
@ -73,10 +73,10 @@ static void test_herbsearch(CuTest * tc)
|
||||||
CuAssertIntEquals(tc, 99, rherbs(r));
|
CuAssertIntEquals(tc, 99, rherbs(r));
|
||||||
CuAssertIntEquals(tc, 1, i_get(u->items, itype));
|
CuAssertIntEquals(tc, 1, i_get(u->items, itype));
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "herbfound"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "herbfound"));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "researchherb_none"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "researchherb_none"));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error108"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error108"));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error70"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error70"));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error59"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error59"));
|
||||||
test_clear_messages(f);
|
test_clear_messages(f);
|
||||||
|
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
|
|
@ -36,20 +36,22 @@ int autostudy_init(scholar scholars[], int max_scholars, region *r)
|
||||||
for (u = r->units; u; u = u->next) {
|
for (u = r->units; u; u = u->next) {
|
||||||
keyword_t kwd = getkeyword(u->thisorder);
|
keyword_t kwd = getkeyword(u->thisorder);
|
||||||
if (kwd == K_AUTOSTUDY) {
|
if (kwd == K_AUTOSTUDY) {
|
||||||
if (long_order_allowed(u) && unit_can_study(u)) {
|
if (long_order_allowed(u)) {
|
||||||
scholar * st = scholars + nscholars;
|
if (unit_can_study(u)) {
|
||||||
init_order(u->thisorder, u->faction->locale);
|
scholar * st = scholars + nscholars;
|
||||||
st->sk = getskill(u->faction->locale);
|
init_order(u->thisorder, u->faction->locale);
|
||||||
st->level = effskill_study(u, st->sk);
|
st->sk = getskill(u->faction->locale);
|
||||||
st->learn = 0;
|
st->level = effskill_study(u, st->sk);
|
||||||
st->u = u;
|
st->learn = 0;
|
||||||
if (++nscholars == max_scholars) {
|
st->u = u;
|
||||||
log_fatal("you must increase MAXSCHOLARS");
|
if (++nscholars == max_scholars) {
|
||||||
|
log_fatal("you must increase MAXSCHOLARS");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder, "error_race_nolearn", "race",
|
||||||
|
u_race(u)));
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else {
|
|
||||||
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder, "error_race_nolearn", "race",
|
|
||||||
u_race(u)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ static void test_make_fighter(CuTest * tc)
|
||||||
af = make_fighter(b, au, as, false);
|
af = make_fighter(b, au, as, false);
|
||||||
|
|
||||||
CuAssertIntEquals(tc, 1, b->nfighters);
|
CuAssertIntEquals(tc, 1, b->nfighters);
|
||||||
CuAssertPtrEquals(tc, 0, af->building);
|
CuAssertPtrEquals(tc, NULL, af->building);
|
||||||
CuAssertPtrEquals(tc, as, af->side);
|
CuAssertPtrEquals(tc, as, af->side);
|
||||||
CuAssertIntEquals(tc, 0, af->run.hp);
|
CuAssertIntEquals(tc, 0, af->run.hp);
|
||||||
CuAssertIntEquals(tc, ST_BEHIND, af->status);
|
CuAssertIntEquals(tc, ST_BEHIND, af->status);
|
||||||
|
@ -216,7 +216,7 @@ static void test_defenders_get_building_bonus(CuTest * tc)
|
||||||
af = make_fighter(b, au, as, true);
|
af = make_fighter(b, au, as, true);
|
||||||
|
|
||||||
CuAssertPtrEquals(tc, bld, df->building);
|
CuAssertPtrEquals(tc, bld, df->building);
|
||||||
CuAssertPtrEquals(tc, 0, af->building);
|
CuAssertPtrEquals(tc, NULL, af->building);
|
||||||
|
|
||||||
dt.fighter = df;
|
dt.fighter = df;
|
||||||
dt.index = 0;
|
dt.index = 0;
|
||||||
|
@ -261,7 +261,7 @@ static void test_attackers_get_no_building_bonus(CuTest * tc)
|
||||||
as = make_side(b, au->faction, 0, 0, 0);
|
as = make_side(b, au->faction, 0, 0, 0);
|
||||||
af = make_fighter(b, au, as, true);
|
af = make_fighter(b, au, as, true);
|
||||||
|
|
||||||
CuAssertPtrEquals(tc, 0, af->building);
|
CuAssertPtrEquals(tc, NULL, af->building);
|
||||||
free_battle(b);
|
free_battle(b);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ static void test_building_bonus_respects_size(CuTest * tc)
|
||||||
df = make_fighter(b, du, as, false);
|
df = make_fighter(b, du, as, false);
|
||||||
|
|
||||||
CuAssertPtrEquals(tc, bld, af->building);
|
CuAssertPtrEquals(tc, bld, af->building);
|
||||||
CuAssertPtrEquals(tc, 0, df->building);
|
CuAssertPtrEquals(tc, NULL, df->building);
|
||||||
free_battle(b);
|
free_battle(b);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -357,7 +357,7 @@ static void test_tax_cmd(CuTest *tc) {
|
||||||
|
|
||||||
set_level(u, SK_TAXING, 1);
|
set_level(u, SK_TAXING, 1);
|
||||||
tax_cmd(u, ord, &taxorders);
|
tax_cmd(u, ord, &taxorders);
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(u->faction->msgs, "error_no_tax_skill"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(u->faction->msgs, "error_no_tax_skill"));
|
||||||
CuAssertPtrNotNull(tc, taxorders);
|
CuAssertPtrNotNull(tc, taxorders);
|
||||||
|
|
||||||
rsetmoney(r, 11);
|
rsetmoney(r, 11);
|
||||||
|
@ -415,8 +415,8 @@ static void test_maintain_buildings(CuTest *tc) {
|
||||||
b->flags = 0;
|
b->flags = 0;
|
||||||
maintain_buildings(r);
|
maintain_buildings(r);
|
||||||
CuAssertIntEquals(tc, BLD_MAINTAINED, fval(b, BLD_MAINTAINED));
|
CuAssertIntEquals(tc, BLD_MAINTAINED, fval(b, BLD_MAINTAINED));
|
||||||
CuAssertPtrEquals(tc, 0, f->msgs);
|
CuAssertPtrEquals(tc, NULL, f->msgs);
|
||||||
CuAssertPtrEquals(tc, 0, r->msgs);
|
CuAssertPtrEquals(tc, NULL, r->msgs);
|
||||||
|
|
||||||
req = calloc(2, sizeof(maintenance));
|
req = calloc(2, sizeof(maintenance));
|
||||||
req[0].number = 100;
|
req[0].number = 100;
|
||||||
|
@ -438,8 +438,8 @@ static void test_maintain_buildings(CuTest *tc) {
|
||||||
maintain_buildings(r);
|
maintain_buildings(r);
|
||||||
CuAssertIntEquals(tc, BLD_MAINTAINED, fval(b, BLD_MAINTAINED));
|
CuAssertIntEquals(tc, BLD_MAINTAINED, fval(b, BLD_MAINTAINED));
|
||||||
CuAssertIntEquals(tc, 0, i_get(u->items, itype));
|
CuAssertIntEquals(tc, 0, i_get(u->items, itype));
|
||||||
CuAssertPtrEquals(tc, 0, r->msgs);
|
CuAssertPtrEquals(tc, NULL, r->msgs);
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "maintenance_nowork"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "maintenance_nowork"));
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "maintenance"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "maintenance"));
|
||||||
test_clear_messagelist(&f->msgs);
|
test_clear_messagelist(&f->msgs);
|
||||||
|
|
||||||
|
@ -448,7 +448,7 @@ static void test_maintain_buildings(CuTest *tc) {
|
||||||
b->flags = 0;
|
b->flags = 0;
|
||||||
maintain_buildings(r);
|
maintain_buildings(r);
|
||||||
CuAssertIntEquals(tc, 0, fval(b, BLD_MAINTAINED));
|
CuAssertIntEquals(tc, 0, fval(b, BLD_MAINTAINED));
|
||||||
CuAssertPtrEquals(tc, 0, f->msgs);
|
CuAssertPtrEquals(tc, NULL, f->msgs);
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(r->msgs, "maintenance_noowner"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(r->msgs, "maintenance_noowner"));
|
||||||
test_clear_messagelist(&r->msgs);
|
test_clear_messagelist(&r->msgs);
|
||||||
|
|
||||||
|
|
|
@ -92,7 +92,7 @@ static void test_give_unit(CuTest * tc) {
|
||||||
give_unit(env.src, env.dst, NULL);
|
give_unit(env.src, env.dst, NULL);
|
||||||
CuAssertPtrEquals(tc, env.f2, env.src->faction);
|
CuAssertPtrEquals(tc, env.f2, env.src->faction);
|
||||||
CuAssertIntEquals(tc, 1, env.f2->newbies);
|
CuAssertIntEquals(tc, 1, env.f2->newbies);
|
||||||
CuAssertPtrEquals(tc, 0, env.f1->units);
|
CuAssertPtrEquals(tc, NULL, env.f1->units);
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(env.f1->msgs, "give_person"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(env.f1->msgs, "give_person"));
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(env.f2->msgs, "receive_person"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(env.f2->msgs, "receive_person"));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -304,7 +304,7 @@ static void test_give_men_requires_contact(CuTest * tc) {
|
||||||
ord = create_order(K_GIVE, env.f1->locale, "%s ALLES PERSONEN", itoa36(env.dst->no));
|
ord = create_order(K_GIVE, env.f1->locale, "%s ALLES PERSONEN", itoa36(env.dst->no));
|
||||||
test_clear_messages(env.f1);
|
test_clear_messages(env.f1);
|
||||||
give_cmd(env.src, ord);
|
give_cmd(env.src, ord);
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(env.f1->msgs, "give_person"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(env.f1->msgs, "give_person"));
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(env.f1->msgs, "feedback_no_contact"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(env.f1->msgs, "feedback_no_contact"));
|
||||||
|
|
||||||
msg_release(msg);
|
msg_release(msg);
|
||||||
|
@ -408,7 +408,7 @@ static void test_give_okay(CuTest * tc) {
|
||||||
setup_give(&env);
|
setup_give(&env);
|
||||||
|
|
||||||
config_set("rules.give.flags", "0");
|
config_set("rules.give.flags", "0");
|
||||||
CuAssertPtrEquals(tc, 0, check_give(env.src, env.dst, NULL));
|
CuAssertPtrEquals(tc, NULL, check_give(env.src, env.dst, NULL));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -451,7 +451,7 @@ static void test_give_new_unit(CuTest * tc) {
|
||||||
setup_give(&env);
|
setup_give(&env);
|
||||||
env.dst->number = 0;
|
env.dst->number = 0;
|
||||||
fset(env.dst, UFL_ISNEW);
|
fset(env.dst, UFL_ISNEW);
|
||||||
CuAssertPtrEquals(tc, 0, check_give(env.src, env.dst, NULL));
|
CuAssertPtrEquals(tc, NULL, check_give(env.src, env.dst, NULL));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,7 +29,7 @@ static void test_is_guarded(CuTest *tc) {
|
||||||
r = test_create_region(0, 0, NULL);
|
r = test_create_region(0, 0, NULL);
|
||||||
u1 = test_create_unit(test_create_faction(NULL), r);
|
u1 = test_create_unit(test_create_faction(NULL), r);
|
||||||
u2 = test_create_unit(test_create_faction(rc), r);
|
u2 = test_create_unit(test_create_faction(rc), r);
|
||||||
CuAssertPtrEquals(tc, 0, is_guarded(r, u1));
|
CuAssertPtrEquals(tc, NULL, is_guarded(r, u1));
|
||||||
setguard(u2, true);
|
setguard(u2, true);
|
||||||
CuAssertPtrEquals(tc, u2, is_guarded(r, u1));
|
CuAssertPtrEquals(tc, u2, is_guarded(r, u1));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
|
|
@ -71,8 +71,8 @@ static cJSON *export_a_region(CuTest * tc, const struct terrain_type *terrain, r
|
||||||
json = cJSON_Parse(buf);
|
json = cJSON_Parse(buf);
|
||||||
CuAssertPtrNotNull(tc, json);
|
CuAssertPtrNotNull(tc, json);
|
||||||
CuAssertIntEquals(tc, cJSON_Object, json->type);
|
CuAssertIntEquals(tc, cJSON_Object, json->type);
|
||||||
CuAssertPtrEquals(tc, 0, cJSON_GetObjectItem(json, "factions"));
|
CuAssertPtrEquals(tc, NULL, cJSON_GetObjectItem(json, "factions"));
|
||||||
CuAssertPtrEquals(tc, 0, cJSON_GetObjectItem(json, "units"));
|
CuAssertPtrEquals(tc, NULL, cJSON_GetObjectItem(json, "units"));
|
||||||
CuAssertPtrNotNull(tc, regs = cJSON_GetObjectItem(json, "regions"));
|
CuAssertPtrNotNull(tc, regs = cJSON_GetObjectItem(json, "regions"));
|
||||||
CuAssertIntEquals(tc, cJSON_Object, regs->type);
|
CuAssertIntEquals(tc, cJSON_Object, regs->type);
|
||||||
result = regs->child;
|
result = regs->child;
|
||||||
|
@ -111,7 +111,7 @@ static void test_export_ocean_region(CuTest * tc) {
|
||||||
test_setup();
|
test_setup();
|
||||||
terrain = test_create_terrain("ocean", SEA_REGION);
|
terrain = test_create_terrain("ocean", SEA_REGION);
|
||||||
json = export_a_region(tc, terrain, 0);
|
json = export_a_region(tc, terrain, 0);
|
||||||
CuAssertPtrEquals(tc, 0, cJSON_GetObjectItem(json, "name"));
|
CuAssertPtrEquals(tc, NULL, cJSON_GetObjectItem(json, "name"));
|
||||||
cJSON_Delete(json);
|
cJSON_Delete(json);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,14 +34,14 @@ static void test_alliance_make(CuTest *tc) {
|
||||||
CuAssertStrEquals(tc, "Hodor", al->name);
|
CuAssertStrEquals(tc, "Hodor", al->name);
|
||||||
CuAssertIntEquals(tc, 1, al->id);
|
CuAssertIntEquals(tc, 1, al->id);
|
||||||
CuAssertIntEquals(tc, 0, al->flags);
|
CuAssertIntEquals(tc, 0, al->flags);
|
||||||
CuAssertPtrEquals(tc, 0, al->members);
|
CuAssertPtrEquals(tc, NULL, al->members);
|
||||||
CuAssertPtrEquals(tc, 0, al->_leader);
|
CuAssertPtrEquals(tc, NULL, al->_leader);
|
||||||
CuAssertPtrEquals(tc, 0, al->allies);
|
CuAssertPtrEquals(tc, NULL, al->allies);
|
||||||
CuAssertPtrEquals(tc, al, findalliance(1));
|
CuAssertPtrEquals(tc, al, findalliance(1));
|
||||||
CuAssertPtrEquals(tc, al, alliances);
|
CuAssertPtrEquals(tc, al, alliances);
|
||||||
free_alliances();
|
free_alliances();
|
||||||
CuAssertPtrEquals(tc, 0, findalliance(1));
|
CuAssertPtrEquals(tc, NULL, findalliance(1));
|
||||||
CuAssertPtrEquals(tc, 0, alliances);
|
CuAssertPtrEquals(tc, NULL, alliances);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,8 +50,8 @@ static void test_alliance_join(CuTest *tc) {
|
||||||
alliance * al;
|
alliance * al;
|
||||||
|
|
||||||
setup_alliance(&fix);
|
setup_alliance(&fix);
|
||||||
CuAssertPtrEquals(tc, 0, fix.f1->alliance);
|
CuAssertPtrEquals(tc, NULL, fix.f1->alliance);
|
||||||
CuAssertPtrEquals(tc, 0, fix.f2->alliance);
|
CuAssertPtrEquals(tc, NULL, fix.f2->alliance);
|
||||||
al = makealliance(1, "Hodor");
|
al = makealliance(1, "Hodor");
|
||||||
setalliance(fix.f1, al);
|
setalliance(fix.f1, al);
|
||||||
CuAssertPtrEquals(tc, fix.f1, alliance_get_leader(al));
|
CuAssertPtrEquals(tc, fix.f1, alliance_get_leader(al));
|
||||||
|
@ -99,7 +99,7 @@ static void test_alliance_cmd(CuTest *tc) {
|
||||||
unit_addorder(u2, create_order(K_ALLIANCE, u1->faction->locale, "%s %s", alliance_kwd[ALLIANCE_JOIN], itoa36(42)));
|
unit_addorder(u2, create_order(K_ALLIANCE, u1->faction->locale, "%s %s", alliance_kwd[ALLIANCE_JOIN], itoa36(42)));
|
||||||
CuAssertTrue(tc, is_allied(u1->faction, u1->faction));
|
CuAssertTrue(tc, is_allied(u1->faction, u1->faction));
|
||||||
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
||||||
CuAssertPtrEquals(tc, 0, f_get_alliance(u1->faction));
|
CuAssertPtrEquals(tc, NULL, f_get_alliance(u1->faction));
|
||||||
alliance_cmd();
|
alliance_cmd();
|
||||||
al = f_get_alliance(u1->faction);
|
al = f_get_alliance(u1->faction);
|
||||||
CuAssertPtrNotNull(tc, al);
|
CuAssertPtrNotNull(tc, al);
|
||||||
|
@ -126,10 +126,10 @@ static void test_alliance_limits(CuTest *tc) {
|
||||||
unit_addorder(u1, create_order(K_ALLIANCE, u1->faction->locale, "%s %s", alliance_kwd[ALLIANCE_INVITE], itoa36(u2->faction->no)));
|
unit_addorder(u1, create_order(K_ALLIANCE, u1->faction->locale, "%s %s", alliance_kwd[ALLIANCE_INVITE], itoa36(u2->faction->no)));
|
||||||
unit_addorder(u2, create_order(K_ALLIANCE, u1->faction->locale, "%s %s", alliance_kwd[ALLIANCE_JOIN], itoa36(42)));
|
unit_addorder(u2, create_order(K_ALLIANCE, u1->faction->locale, "%s %s", alliance_kwd[ALLIANCE_JOIN], itoa36(42)));
|
||||||
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
||||||
CuAssertPtrEquals(tc, 0, f_get_alliance(u1->faction));
|
CuAssertPtrEquals(tc, NULL, f_get_alliance(u1->faction));
|
||||||
alliance_cmd();
|
alliance_cmd();
|
||||||
CuAssertPtrNotNull(tc, f_get_alliance(u1->faction));
|
CuAssertPtrNotNull(tc, f_get_alliance(u1->faction));
|
||||||
CuAssertPtrEquals(tc, 0, f_get_alliance(u2->faction));
|
CuAssertPtrEquals(tc, NULL, f_get_alliance(u2->faction));
|
||||||
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(u2->faction->msgs, "too_many_units_in_alliance"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(u2->faction->msgs, "too_many_units_in_alliance"));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -152,7 +152,7 @@ static void test_alliance_cmd_kick(CuTest *tc) {
|
||||||
CuAssertTrue(tc, is_allied(u1->faction, u2->faction));
|
CuAssertTrue(tc, is_allied(u1->faction, u2->faction));
|
||||||
alliance_cmd();
|
alliance_cmd();
|
||||||
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
||||||
CuAssertPtrEquals(tc, 0, f_get_alliance(u2->faction));
|
CuAssertPtrEquals(tc, NULL, f_get_alliance(u2->faction));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -168,10 +168,10 @@ static void test_alliance_cmd_no_invite(CuTest *tc) {
|
||||||
unit_addorder(u2, create_order(K_ALLIANCE, u1->faction->locale, "%s %s", alliance_kwd[ALLIANCE_JOIN], itoa36(42)));
|
unit_addorder(u2, create_order(K_ALLIANCE, u1->faction->locale, "%s %s", alliance_kwd[ALLIANCE_JOIN], itoa36(42)));
|
||||||
CuAssertTrue(tc, is_allied(u1->faction, u1->faction));
|
CuAssertTrue(tc, is_allied(u1->faction, u1->faction));
|
||||||
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
||||||
CuAssertPtrEquals(tc, 0, f_get_alliance(u1->faction));
|
CuAssertPtrEquals(tc, NULL, f_get_alliance(u1->faction));
|
||||||
alliance_cmd();
|
alliance_cmd();
|
||||||
CuAssertPtrNotNull(tc, f_get_alliance(u1->faction));
|
CuAssertPtrNotNull(tc, f_get_alliance(u1->faction));
|
||||||
CuAssertPtrEquals(tc, 0, f_get_alliance(u2->faction));
|
CuAssertPtrEquals(tc, NULL, f_get_alliance(u2->faction));
|
||||||
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
@ -193,7 +193,7 @@ static void test_alliance_cmd_leave(CuTest *tc) {
|
||||||
CuAssertTrue(tc, is_allied(u1->faction, u2->faction));
|
CuAssertTrue(tc, is_allied(u1->faction, u2->faction));
|
||||||
alliance_cmd();
|
alliance_cmd();
|
||||||
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
CuAssertTrue(tc, !is_allied(u1->faction, u2->faction));
|
||||||
CuAssertPtrEquals(tc, 0, f_get_alliance(u1->faction));
|
CuAssertPtrEquals(tc, NULL, f_get_alliance(u1->faction));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,8 @@ static void test_ally(CuTest * tc)
|
||||||
CuAssertPtrEquals(tc, f1, ally_find(al, f1)->faction);
|
CuAssertPtrEquals(tc, f1, ally_find(al, f1)->faction);
|
||||||
|
|
||||||
ally_remove(&al, f1);
|
ally_remove(&al, f1);
|
||||||
CuAssertPtrEquals(tc, 0, al);
|
CuAssertPtrEquals(tc, NULL, al);
|
||||||
CuAssertPtrEquals(tc, 0, ally_find(al, f1));
|
CuAssertPtrEquals(tc, NULL, ally_find(al, f1));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_ally_null(CuTest * tc)
|
static void test_ally_null(CuTest * tc)
|
||||||
|
@ -28,7 +28,7 @@ static void test_ally_null(CuTest * tc)
|
||||||
CuAssertPtrNotNull(tc, a1);
|
CuAssertPtrNotNull(tc, a1);
|
||||||
CuAssertPtrNotNull(tc, a2);
|
CuAssertPtrNotNull(tc, a2);
|
||||||
CuAssertPtrEquals(tc, a2, a1->next);
|
CuAssertPtrEquals(tc, a2, a1->next);
|
||||||
CuAssertPtrEquals(tc, 0, a2->next);
|
CuAssertPtrEquals(tc, NULL, a2->next);
|
||||||
free(a1);
|
free(a1);
|
||||||
free(a2);
|
free(a2);
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,11 +15,11 @@ static void test_attrib_new(CuTest * tc)
|
||||||
attrib_type at_test = { "test" };
|
attrib_type at_test = { "test" };
|
||||||
attrib * a;
|
attrib * a;
|
||||||
CuAssertPtrNotNull(tc, (a = a_new(&at_test)));
|
CuAssertPtrNotNull(tc, (a = a_new(&at_test)));
|
||||||
CuAssertPtrEquals(tc, 0, a->next);
|
CuAssertPtrEquals(tc, NULL, a->next);
|
||||||
CuAssertPtrEquals(tc, 0, a->nexttype);
|
CuAssertPtrEquals(tc, NULL, a->nexttype);
|
||||||
CuAssertPtrEquals(tc, (void *)a->type, (void *)&at_test);
|
CuAssertPtrEquals(tc, (void *)a->type, (void *)&at_test);
|
||||||
a_remove(&a, a);
|
a_remove(&a, a);
|
||||||
CuAssertPtrEquals(tc, 0, a);
|
CuAssertPtrEquals(tc, NULL, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_attrib_add(CuTest * tc)
|
static void test_attrib_add(CuTest * tc)
|
||||||
|
@ -51,7 +51,7 @@ static void test_attrib_remove_self(CuTest * tc) {
|
||||||
CuAssertPtrNotNull(tc, a_add(&alist, a_new(&at_foo)));
|
CuAssertPtrNotNull(tc, a_add(&alist, a_new(&at_foo)));
|
||||||
CuAssertPtrNotNull(tc, a = a_add(&alist, a_new(&at_foo)));
|
CuAssertPtrNotNull(tc, a = a_add(&alist, a_new(&at_foo)));
|
||||||
CuAssertPtrEquals(tc, a, alist->next);
|
CuAssertPtrEquals(tc, a, alist->next);
|
||||||
CuAssertPtrEquals(tc, 0, alist->nexttype);
|
CuAssertPtrEquals(tc, NULL, alist->nexttype);
|
||||||
CuAssertIntEquals(tc, 1, a_remove(&alist, alist));
|
CuAssertIntEquals(tc, 1, a_remove(&alist, alist));
|
||||||
CuAssertPtrEquals(tc, a, alist);
|
CuAssertPtrEquals(tc, a, alist);
|
||||||
a_removeall(&alist, NULL);
|
a_removeall(&alist, NULL);
|
||||||
|
@ -66,11 +66,11 @@ static void test_attrib_removeall(CuTest * tc) {
|
||||||
a_add(&alist, a_new(&at_foo));
|
a_add(&alist, a_new(&at_foo));
|
||||||
a_removeall(&alist, &at_foo);
|
a_removeall(&alist, &at_foo);
|
||||||
CuAssertPtrEquals(tc, a, alist);
|
CuAssertPtrEquals(tc, a, alist);
|
||||||
CuAssertPtrEquals(tc, 0, alist->next);
|
CuAssertPtrEquals(tc, NULL, alist->next);
|
||||||
a_add(&alist, a_new(&at_bar));
|
a_add(&alist, a_new(&at_bar));
|
||||||
a_add(&alist, a_new(&at_foo));
|
a_add(&alist, a_new(&at_foo));
|
||||||
a_removeall(&alist, NULL);
|
a_removeall(&alist, NULL);
|
||||||
CuAssertPtrEquals(tc, 0, alist);
|
CuAssertPtrEquals(tc, NULL, alist);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_attrib_remove(CuTest * tc)
|
static void test_attrib_remove(CuTest * tc)
|
||||||
|
@ -83,7 +83,7 @@ static void test_attrib_remove(CuTest * tc)
|
||||||
CuAssertIntEquals(tc, 1, a_remove(&alist, a));
|
CuAssertIntEquals(tc, 1, a_remove(&alist, a));
|
||||||
CuAssertPtrNotNull(tc, alist);
|
CuAssertPtrNotNull(tc, alist);
|
||||||
CuAssertIntEquals(tc, 1, a_remove(&alist, alist));
|
CuAssertIntEquals(tc, 1, a_remove(&alist, alist));
|
||||||
CuAssertPtrEquals(tc, 0, alist);
|
CuAssertPtrEquals(tc, NULL, alist);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_attrib_nexttype(CuTest * tc)
|
static void test_attrib_nexttype(CuTest * tc)
|
||||||
|
@ -92,16 +92,16 @@ static void test_attrib_nexttype(CuTest * tc)
|
||||||
attrib_type at_bar = { "bar" };
|
attrib_type at_bar = { "bar" };
|
||||||
attrib *a, *alist = 0;
|
attrib *a, *alist = 0;
|
||||||
CuAssertPtrNotNull(tc, (a = a_new(&at_foo)));
|
CuAssertPtrNotNull(tc, (a = a_new(&at_foo)));
|
||||||
CuAssertPtrEquals(tc, 0, a->nexttype);
|
CuAssertPtrEquals(tc, NULL, a->nexttype);
|
||||||
CuAssertPtrEquals(tc, a, a_add(&alist, a));
|
CuAssertPtrEquals(tc, a, a_add(&alist, a));
|
||||||
CuAssertPtrEquals(tc, 0, alist->nexttype);
|
CuAssertPtrEquals(tc, NULL, alist->nexttype);
|
||||||
|
|
||||||
CuAssertPtrNotNull(tc, a_add(&alist, a_new(&at_foo)));
|
CuAssertPtrNotNull(tc, a_add(&alist, a_new(&at_foo)));
|
||||||
CuAssertPtrEquals(tc, 0, alist->nexttype);
|
CuAssertPtrEquals(tc, NULL, alist->nexttype);
|
||||||
|
|
||||||
CuAssertPtrNotNull(tc, (a = a_add(&alist, a_new(&at_bar))));
|
CuAssertPtrNotNull(tc, (a = a_add(&alist, a_new(&at_bar))));
|
||||||
CuAssertPtrEquals(tc, a, alist->nexttype);
|
CuAssertPtrEquals(tc, a, alist->nexttype);
|
||||||
CuAssertPtrEquals(tc, 0, a->nexttype);
|
CuAssertPtrEquals(tc, NULL, a->nexttype);
|
||||||
|
|
||||||
a_remove(&alist, alist);
|
a_remove(&alist, alist);
|
||||||
CuAssertPtrEquals(tc, a, alist->nexttype);
|
CuAssertPtrEquals(tc, a, alist->nexttype);
|
||||||
|
|
|
@ -202,8 +202,8 @@ static void test_build_building_no_materials(CuTest *tc) {
|
||||||
set_level(u, SK_BUILDING, 1);
|
set_level(u, SK_BUILDING, 1);
|
||||||
u->orders = create_order(K_MAKE, u->faction->locale, 0);
|
u->orders = create_order(K_MAKE, u->faction->locale, 0);
|
||||||
CuAssertIntEquals(tc, ENOMATERIALS, build_building(u, btype, 0, 4, u->orders));
|
CuAssertIntEquals(tc, ENOMATERIALS, build_building(u, btype, 0, 4, u->orders));
|
||||||
CuAssertPtrEquals(tc, 0, u->region->buildings);
|
CuAssertPtrEquals(tc, NULL, u->region->buildings);
|
||||||
CuAssertPtrEquals(tc, 0, u->building);
|
CuAssertPtrEquals(tc, NULL, u->building);
|
||||||
teardown_build(&bf);
|
teardown_build(&bf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ static void test_build_destroy_road(CuTest *tc)
|
||||||
|
|
||||||
CuAssertIntEquals(tc, 0, destroy_cmd(u, ord));
|
CuAssertIntEquals(tc, 0, destroy_cmd(u, ord));
|
||||||
CuAssertIntEquals(tc, 100, rroad(r, D_EAST));
|
CuAssertIntEquals(tc, 100, rroad(r, D_EAST));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "destroy_road"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "destroy_road"));
|
||||||
|
|
||||||
set_level(u, SK_ROAD_BUILDING, 1);
|
set_level(u, SK_ROAD_BUILDING, 1);
|
||||||
CuAssertIntEquals(tc, 0, destroy_cmd(u, ord));
|
CuAssertIntEquals(tc, 0, destroy_cmd(u, ord));
|
||||||
|
@ -324,7 +324,7 @@ static void test_build_destroy_road_guard(CuTest *tc)
|
||||||
CuAssertIntEquals(tc, 0, destroy_cmd(u, ord));
|
CuAssertIntEquals(tc, 0, destroy_cmd(u, ord));
|
||||||
CuAssertIntEquals(tc, 100, rroad(r, D_EAST));
|
CuAssertIntEquals(tc, 100, rroad(r, D_EAST));
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error70"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error70"));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "destroy_road"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "destroy_road"));
|
||||||
|
|
||||||
test_clear_messages(f);
|
test_clear_messages(f);
|
||||||
setguard(ug, false);
|
setguard(ug, false);
|
||||||
|
|
|
@ -37,8 +37,8 @@ static void test_command(CuTest * tc) {
|
||||||
st = stree_create();
|
st = stree_create();
|
||||||
CuAssertPtrNotNull(tc, st);
|
CuAssertPtrNotNull(tc, st);
|
||||||
CuAssertPtrEquals(tc, loc, (struct locale *)st->lang);
|
CuAssertPtrEquals(tc, loc, (struct locale *)st->lang);
|
||||||
CuAssertPtrEquals(tc, 0, st->root);
|
CuAssertPtrEquals(tc, NULL, st->root);
|
||||||
CuAssertPtrEquals(tc, 0, st->next);
|
CuAssertPtrEquals(tc, NULL, st->next);
|
||||||
stree_add(st, "two", parser_two);
|
stree_add(st, "two", parser_two);
|
||||||
stree_add(st, "six", parser_six);
|
stree_add(st, "six", parser_six);
|
||||||
CuAssertPtrNotNull(tc, st->root);
|
CuAssertPtrNotNull(tc, st->root);
|
||||||
|
|
|
@ -57,7 +57,7 @@ static void test_remove_empty_factions_alliance(CuTest *tc) {
|
||||||
CuAssertPtrEquals(tc, f, alliance_get_leader(al));
|
CuAssertPtrEquals(tc, f, alliance_get_leader(al));
|
||||||
CuAssertIntEquals(tc, 1, selist_length(al->members));
|
CuAssertIntEquals(tc, 1, selist_length(al->members));
|
||||||
remove_empty_factions();
|
remove_empty_factions();
|
||||||
CuAssertPtrEquals(tc, 0, al->_leader);
|
CuAssertPtrEquals(tc, NULL, al->_leader);
|
||||||
CuAssertIntEquals(tc, 0, selist_length(al->members));
|
CuAssertIntEquals(tc, 0, selist_length(al->members));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ static void test_remove_empty_factions(CuTest *tc) {
|
||||||
CuAssertIntEquals(tc, false, f->_alive);
|
CuAssertIntEquals(tc, false, f->_alive);
|
||||||
CuAssertPtrEquals(tc, fm, factions);
|
CuAssertPtrEquals(tc, fm, factions);
|
||||||
CuAssertPtrEquals(tc, NULL, fm->next);
|
CuAssertPtrEquals(tc, NULL, fm->next);
|
||||||
CuAssertPtrEquals(tc, 0, findfaction(fno));
|
CuAssertPtrEquals(tc, NULL, findfaction(fno));
|
||||||
CuAssertPtrEquals(tc, fm, get_monsters());
|
CuAssertPtrEquals(tc, fm, get_monsters());
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ static void test_remove_dead_factions(CuTest *tc) {
|
||||||
f->_alive = false;
|
f->_alive = false;
|
||||||
fno = f->no;
|
fno = f->no;
|
||||||
remove_empty_factions();
|
remove_empty_factions();
|
||||||
CuAssertPtrEquals(tc, 0, findfaction(fno));
|
CuAssertPtrEquals(tc, NULL, findfaction(fno));
|
||||||
CuAssertPtrEquals(tc, fm, get_monsters());
|
CuAssertPtrEquals(tc, fm, get_monsters());
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ static void test_set_origin(CuTest *tc) {
|
||||||
test_setup();
|
test_setup();
|
||||||
pl = create_new_plane(0, "", 0, 19, 0, 19, 0);
|
pl = create_new_plane(0, "", 0, 19, 0, 19, 0);
|
||||||
f = test_create_faction(NULL);
|
f = test_create_faction(NULL);
|
||||||
CuAssertPtrEquals(tc, 0, f->ursprung);
|
CuAssertPtrEquals(tc, NULL, f->ursprung);
|
||||||
faction_setorigin(f, 0, 1, 1);
|
faction_setorigin(f, 0, 1, 1);
|
||||||
CuAssertIntEquals(tc, 0, f->ursprung->id);
|
CuAssertIntEquals(tc, 0, f->ursprung->id);
|
||||||
CuAssertIntEquals(tc, 1, f->ursprung->x);
|
CuAssertIntEquals(tc, 1, f->ursprung->x);
|
||||||
|
@ -250,7 +250,7 @@ static void test_set_email(CuTest *tc) {
|
||||||
faction_setemail(f, "bugs@eressea.de");
|
faction_setemail(f, "bugs@eressea.de");
|
||||||
CuAssertStrEquals(tc, "bugs@eressea.de", f->email);
|
CuAssertStrEquals(tc, "bugs@eressea.de", f->email);
|
||||||
faction_setemail(f, NULL);
|
faction_setemail(f, NULL);
|
||||||
CuAssertPtrEquals(tc, 0, f->email);
|
CuAssertPtrEquals(tc, NULL, f->email);
|
||||||
CuAssertStrEquals(tc, "", faction_getemail(f));
|
CuAssertStrEquals(tc, "", faction_getemail(f));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,7 @@ static void test_group_readwrite_dead_faction(CuTest *tc) {
|
||||||
f = test_create_faction(NULL);
|
f = test_create_faction(NULL);
|
||||||
fno = f->no;
|
fno = f->no;
|
||||||
CuAssertPtrEquals(tc, f, factions);
|
CuAssertPtrEquals(tc, f, factions);
|
||||||
CuAssertPtrEquals(tc, 0, f->next);
|
CuAssertPtrEquals(tc, NULL, f->next);
|
||||||
f2 = test_create_faction(NULL);
|
f2 = test_create_faction(NULL);
|
||||||
CuAssertPtrEquals(tc, f2, factions->next);
|
CuAssertPtrEquals(tc, f2, factions->next);
|
||||||
u = test_create_unit(f2, test_create_region(0, 0, NULL));
|
u = test_create_unit(f2, test_create_region(0, 0, NULL));
|
||||||
|
@ -58,14 +58,14 @@ static void test_group_readwrite_dead_faction(CuTest *tc) {
|
||||||
read_game(&data);
|
read_game(&data);
|
||||||
mstream_done(&data.strm);
|
mstream_done(&data.strm);
|
||||||
gamedata_done(&data);
|
gamedata_done(&data);
|
||||||
CuAssertPtrEquals(tc, 0, findfaction(fno));
|
CuAssertPtrEquals(tc, NULL, findfaction(fno));
|
||||||
f2 = factions;
|
f2 = factions;
|
||||||
CuAssertPtrNotNull(tc, f2);
|
CuAssertPtrNotNull(tc, f2);
|
||||||
u = f2->units;
|
u = f2->units;
|
||||||
CuAssertPtrNotNull(tc, u);
|
CuAssertPtrNotNull(tc, u);
|
||||||
g = get_group(u);
|
g = get_group(u);
|
||||||
CuAssertPtrNotNull(tc, g);
|
CuAssertPtrNotNull(tc, g);
|
||||||
CuAssertPtrEquals(tc, 0, g->allies);
|
CuAssertPtrEquals(tc, NULL, g->allies);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,11 +106,11 @@ static void test_group_readwrite(CuTest * tc)
|
||||||
CuAssertPtrNotNull(tc, f->groups->next);
|
CuAssertPtrNotNull(tc, f->groups->next);
|
||||||
CuAssertIntEquals(tc, 43, f->groups->next->gid);
|
CuAssertIntEquals(tc, 43, f->groups->next->gid);
|
||||||
CuAssertStrEquals(tc, "Egoisten", f->groups->next->name);
|
CuAssertStrEquals(tc, "Egoisten", f->groups->next->name);
|
||||||
CuAssertPtrEquals(tc, 0, f->groups->allies);
|
CuAssertPtrEquals(tc, NULL, f->groups->allies);
|
||||||
g = f->groups->next;
|
g = f->groups->next;
|
||||||
CuAssertIntEquals(tc, 44, key_get(g->attribs, 44));
|
CuAssertIntEquals(tc, 44, key_get(g->attribs, 44));
|
||||||
CuAssertPtrNotNull(tc, g->allies);
|
CuAssertPtrNotNull(tc, g->allies);
|
||||||
CuAssertPtrEquals(tc, 0, g->allies->next);
|
CuAssertPtrEquals(tc, NULL, g->allies->next);
|
||||||
CuAssertPtrEquals(tc, f, g->allies->faction);
|
CuAssertPtrEquals(tc, f, g->allies->faction);
|
||||||
CuAssertIntEquals(tc, HELP_GIVE, g->allies->status);
|
CuAssertIntEquals(tc, HELP_GIVE, g->allies->status);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -135,7 +135,7 @@ static void test_group(CuTest * tc)
|
||||||
CuAssertIntEquals(tc, 1, g->members);
|
CuAssertIntEquals(tc, 1, g->members);
|
||||||
set_group(u, 0);
|
set_group(u, 0);
|
||||||
CuAssertIntEquals(tc, 0, g->members);
|
CuAssertIntEquals(tc, 0, g->members);
|
||||||
CuAssertPtrEquals(tc, 0, get_group(u));
|
CuAssertPtrEquals(tc, NULL, get_group(u));
|
||||||
set_group(u, g);
|
set_group(u, g);
|
||||||
CuAssertIntEquals(tc, 1, g->members);
|
CuAssertIntEquals(tc, 1, g->members);
|
||||||
CuAssertPtrEquals(tc, g, get_group(u));
|
CuAssertPtrEquals(tc, g, get_group(u));
|
||||||
|
|
|
@ -61,7 +61,7 @@ static void test_uchange(CuTest * tc, unit * u, const resource_type * rtype) {
|
||||||
CuAssertIntEquals(tc, 0, rtype->uchange(u, rtype, -n));
|
CuAssertIntEquals(tc, 0, rtype->uchange(u, rtype, -n));
|
||||||
CuAssertPtrNotNull(tc, sl);
|
CuAssertPtrNotNull(tc, sl);
|
||||||
CuAssertStrEquals(tc, "serious accounting error. number of items is %d.", sl->s);
|
CuAssertStrEquals(tc, "serious accounting error. number of items is %d.", sl->s);
|
||||||
CuAssertPtrEquals(tc, 0, sl->next);
|
CuAssertPtrEquals(tc, NULL, sl->next);
|
||||||
test_log_stop(log, sl);
|
test_log_stop(log, sl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,7 @@ void test_resource_type(CuTest * tc)
|
||||||
|
|
||||||
test_setup();
|
test_setup();
|
||||||
|
|
||||||
CuAssertPtrEquals(tc, 0, rt_find("herpderp"));
|
CuAssertPtrEquals(tc, NULL, rt_find("herpderp"));
|
||||||
|
|
||||||
test_create_itemtype("herpderp");
|
test_create_itemtype("herpderp");
|
||||||
test_create_itemtype("herpes");
|
test_create_itemtype("herpes");
|
||||||
|
@ -122,7 +122,7 @@ void test_findresourcetype(CuTest * tc)
|
||||||
locale_setstring(lang, "peasant", "Bauer");
|
locale_setstring(lang, "peasant", "Bauer");
|
||||||
init_resources();
|
init_resources();
|
||||||
CuAssertPtrNotNull(tc, rt_find("peasant"));
|
CuAssertPtrNotNull(tc, rt_find("peasant"));
|
||||||
CuAssertPtrEquals(tc, 0, rt_find("log"));
|
CuAssertPtrEquals(tc, NULL, rt_find("log"));
|
||||||
itype = test_create_itemtype("log");
|
itype = test_create_itemtype("log");
|
||||||
|
|
||||||
CuAssertPtrEquals(tc, (void*)itype->rtype, (void*)findresourcetype("Holz", lang));
|
CuAssertPtrEquals(tc, (void*)itype->rtype, (void*)findresourcetype("Holz", lang));
|
||||||
|
@ -164,13 +164,13 @@ static void test_core_resources(CuTest *tc) {
|
||||||
CuAssertPtrNotNull(tc, rtype->itype);
|
CuAssertPtrNotNull(tc, rtype->itype);
|
||||||
CuAssertPtrNotNull(tc, rtype->uchange);
|
CuAssertPtrNotNull(tc, rtype->uchange);
|
||||||
CuAssertPtrNotNull(tc, rtype = rt_find("peasant"));
|
CuAssertPtrNotNull(tc, rtype = rt_find("peasant"));
|
||||||
CuAssertPtrEquals(tc, 0, rtype->itype);
|
CuAssertPtrEquals(tc, NULL, rtype->itype);
|
||||||
CuAssertPtrNotNull(tc, rtype = rt_find("permaura"));
|
CuAssertPtrNotNull(tc, rtype = rt_find("permaura"));
|
||||||
CuAssertPtrEquals(tc, 0, rtype->itype);
|
CuAssertPtrEquals(tc, NULL, rtype->itype);
|
||||||
CuAssertPtrNotNull(tc, rtype = rt_find("hp"));
|
CuAssertPtrNotNull(tc, rtype = rt_find("hp"));
|
||||||
CuAssertPtrEquals(tc, 0, rtype->itype);
|
CuAssertPtrEquals(tc, NULL, rtype->itype);
|
||||||
CuAssertPtrNotNull(tc, rtype = rt_find("aura"));
|
CuAssertPtrNotNull(tc, rtype = rt_find("aura"));
|
||||||
CuAssertPtrEquals(tc, 0, rtype->itype);
|
CuAssertPtrEquals(tc, NULL, rtype->itype);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ static void test_merge_split(CuTest *tc) {
|
||||||
add_message(&append, msg = msg_message(mtype->name, ""));
|
add_message(&append, msg = msg_message(mtype->name, ""));
|
||||||
msg_release(msg);
|
msg_release(msg);
|
||||||
|
|
||||||
CuAssertPtrEquals(tc, 0, mlist->begin->next);
|
CuAssertPtrEquals(tc, NULL, mlist->begin->next);
|
||||||
CuAssertPtrEquals(tc, &mlist->begin->next, mlist->end);
|
CuAssertPtrEquals(tc, &mlist->begin->next, mlist->end);
|
||||||
split = merge_messages(mlist, append);
|
split = merge_messages(mlist, append);
|
||||||
CuAssertPtrNotNull(tc, split);
|
CuAssertPtrNotNull(tc, split);
|
||||||
|
@ -68,7 +68,7 @@ static void test_merge_split(CuTest *tc) {
|
||||||
CuAssertPtrNotNull(tc, mlist->begin->next);
|
CuAssertPtrNotNull(tc, mlist->begin->next);
|
||||||
CuAssertPtrEquals(tc, append->begin, mlist->begin->next);
|
CuAssertPtrEquals(tc, append->begin, mlist->begin->next);
|
||||||
split_messages(mlist, split);
|
split_messages(mlist, split);
|
||||||
CuAssertPtrEquals(tc, 0, mlist->begin->next);
|
CuAssertPtrEquals(tc, NULL, mlist->begin->next);
|
||||||
free_messagelist(*split);
|
free_messagelist(*split);
|
||||||
free_messagelist(mlist->begin);
|
free_messagelist(mlist->begin);
|
||||||
free(mlist);
|
free(mlist);
|
||||||
|
|
|
@ -239,11 +239,11 @@ static void test_replace_order(CuTest *tc) {
|
||||||
orig = create_order(K_MAKE, lang, NULL);
|
orig = create_order(K_MAKE, lang, NULL);
|
||||||
repl = create_order(K_ALLY, lang, NULL);
|
repl = create_order(K_ALLY, lang, NULL);
|
||||||
replace_order(&orders, orig, repl);
|
replace_order(&orders, orig, repl);
|
||||||
CuAssertPtrEquals(tc, 0, orders);
|
CuAssertPtrEquals(tc, NULL, orders);
|
||||||
orders = orig;
|
orders = orig;
|
||||||
replace_order(&orders, orig, repl);
|
replace_order(&orders, orig, repl);
|
||||||
CuAssertPtrNotNull(tc, orders);
|
CuAssertPtrNotNull(tc, orders);
|
||||||
CuAssertPtrEquals(tc, 0, orders->next);
|
CuAssertPtrEquals(tc, NULL, orders->next);
|
||||||
CuAssertIntEquals(tc, getkeyword(repl), getkeyword(orders));
|
CuAssertIntEquals(tc, getkeyword(repl), getkeyword(orders));
|
||||||
free_order(orders);
|
free_order(orders);
|
||||||
free_order(repl);
|
free_order(repl);
|
||||||
|
|
|
@ -11,15 +11,15 @@ static void test_plane(CuTest *tc) {
|
||||||
|
|
||||||
test_setup();
|
test_setup();
|
||||||
r = test_create_region(0, 0, NULL);
|
r = test_create_region(0, 0, NULL);
|
||||||
CuAssertPtrEquals(tc, 0, findplane(0, 0));
|
CuAssertPtrEquals(tc, NULL, findplane(0, 0));
|
||||||
CuAssertPtrEquals(tc, 0, getplane(r));
|
CuAssertPtrEquals(tc, NULL, getplane(r));
|
||||||
CuAssertIntEquals(tc, 0, getplaneid(r));
|
CuAssertIntEquals(tc, 0, getplaneid(r));
|
||||||
CuAssertPtrEquals(tc, 0, getplanebyid(0));
|
CuAssertPtrEquals(tc, NULL, getplanebyid(0));
|
||||||
CuAssertIntEquals(tc, 0, plane_center_x(0));
|
CuAssertIntEquals(tc, 0, plane_center_x(0));
|
||||||
CuAssertIntEquals(tc, 0, plane_center_y(0));
|
CuAssertIntEquals(tc, 0, plane_center_y(0));
|
||||||
CuAssertIntEquals(tc, 0, plane_width(0));
|
CuAssertIntEquals(tc, 0, plane_width(0));
|
||||||
CuAssertIntEquals(tc, 0, plane_height(0));
|
CuAssertIntEquals(tc, 0, plane_height(0));
|
||||||
CuAssertPtrEquals(tc, 0, get_homeplane());
|
CuAssertPtrEquals(tc, NULL, get_homeplane());
|
||||||
|
|
||||||
pl = create_new_plane(1, "Hell", 4, 8, 40, 80, 15);
|
pl = create_new_plane(1, "Hell", 4, 8, 40, 80, 15);
|
||||||
r = test_create_region(4, 40, 0);
|
r = test_create_region(4, 40, 0);
|
||||||
|
@ -28,7 +28,7 @@ static void test_plane(CuTest *tc) {
|
||||||
CuAssertIntEquals(tc, 8, pl->maxx);
|
CuAssertIntEquals(tc, 8, pl->maxx);
|
||||||
CuAssertIntEquals(tc, 40, pl->miny);
|
CuAssertIntEquals(tc, 40, pl->miny);
|
||||||
CuAssertIntEquals(tc, 80, pl->maxy);
|
CuAssertIntEquals(tc, 80, pl->maxy);
|
||||||
CuAssertPtrEquals(tc, 0, pl->attribs);
|
CuAssertPtrEquals(tc, NULL, pl->attribs);
|
||||||
CuAssertStrEquals(tc, "Hell", pl->name);
|
CuAssertStrEquals(tc, "Hell", pl->name);
|
||||||
CuAssertPtrEquals(tc, pl, findplane(4, 40));
|
CuAssertPtrEquals(tc, pl, findplane(4, 40));
|
||||||
CuAssertPtrEquals(tc, pl, getplane(r));
|
CuAssertPtrEquals(tc, pl, getplane(r));
|
||||||
|
|
|
@ -23,14 +23,14 @@ void test_terraform(CuTest *tc) {
|
||||||
t_plain = test_create_terrain("plain", LAND_REGION);
|
t_plain = test_create_terrain("plain", LAND_REGION);
|
||||||
t_ocean = test_create_terrain("ocean", SEA_REGION);
|
t_ocean = test_create_terrain("ocean", SEA_REGION);
|
||||||
r = test_create_region(0, 0, t_ocean);
|
r = test_create_region(0, 0, t_ocean);
|
||||||
CuAssertPtrEquals(tc, 0, r->land);
|
CuAssertPtrEquals(tc, NULL, r->land);
|
||||||
terraform_region(r, t_plain);
|
terraform_region(r, t_plain);
|
||||||
CuAssertPtrNotNull(tc, r->land);
|
CuAssertPtrNotNull(tc, r->land);
|
||||||
CuAssertPtrNotNull(tc, r->land->demands);
|
CuAssertPtrNotNull(tc, r->land->demands);
|
||||||
CuAssertPtrEquals(tc, itype, (void *)r->land->demands->type->itype);
|
CuAssertPtrEquals(tc, itype, (void *)r->land->demands->type->itype);
|
||||||
CuAssertIntEquals(tc, 0, r->land->demands->type->price);
|
CuAssertIntEquals(tc, 0, r->land->demands->type->price);
|
||||||
terraform_region(r, t_ocean);
|
terraform_region(r, t_ocean);
|
||||||
CuAssertPtrEquals(tc, 0, r->land);
|
CuAssertPtrEquals(tc, NULL, r->land);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@ static void test_readwrite_unit(CuTest * tc)
|
||||||
CuAssertPtrEquals(tc, f, u->faction);
|
CuAssertPtrEquals(tc, f, u->faction);
|
||||||
CuAssertStrEquals(tc, "Hodor", u->_name);
|
CuAssertStrEquals(tc, "Hodor", u->_name);
|
||||||
CuAssertTrue(tc, irace == u_irace(u));
|
CuAssertTrue(tc, irace == u_irace(u));
|
||||||
CuAssertPtrEquals(tc, 0, u->region);
|
CuAssertPtrEquals(tc, NULL, u->region);
|
||||||
|
|
||||||
mstream_done(&data.strm);
|
mstream_done(&data.strm);
|
||||||
gamedata_done(&data);
|
gamedata_done(&data);
|
||||||
|
@ -115,7 +115,7 @@ static void test_readwrite_faction(CuTest * tc)
|
||||||
f = read_faction(&data);
|
f = read_faction(&data);
|
||||||
CuAssertPtrNotNull(tc, f);
|
CuAssertPtrNotNull(tc, f);
|
||||||
CuAssertStrEquals(tc, "Hodor", f->name);
|
CuAssertStrEquals(tc, "Hodor", f->name);
|
||||||
CuAssertPtrEquals(tc, 0, f->units);
|
CuAssertPtrEquals(tc, NULL, f->units);
|
||||||
factions = f;
|
factions = f;
|
||||||
|
|
||||||
mstream_done(&data.strm);
|
mstream_done(&data.strm);
|
||||||
|
@ -179,7 +179,7 @@ static void test_readwrite_building(CuTest * tc)
|
||||||
b = read_building(&data);
|
b = read_building(&data);
|
||||||
CuAssertPtrNotNull(tc, b);
|
CuAssertPtrNotNull(tc, b);
|
||||||
CuAssertStrEquals(tc, "Hodor", b->name);
|
CuAssertStrEquals(tc, "Hodor", b->name);
|
||||||
CuAssertPtrEquals(tc, 0, b->region);
|
CuAssertPtrEquals(tc, NULL, b->region);
|
||||||
b->region = r;
|
b->region = r;
|
||||||
r->buildings = b;
|
r->buildings = b;
|
||||||
|
|
||||||
|
@ -212,7 +212,7 @@ static void test_readwrite_ship(CuTest * tc)
|
||||||
sh = read_ship(&data);
|
sh = read_ship(&data);
|
||||||
CuAssertPtrNotNull(tc, sh);
|
CuAssertPtrNotNull(tc, sh);
|
||||||
CuAssertStrEquals(tc, "Hodor", sh->name);
|
CuAssertStrEquals(tc, "Hodor", sh->name);
|
||||||
CuAssertPtrEquals(tc, 0, sh->region);
|
CuAssertPtrEquals(tc, NULL, sh->region);
|
||||||
sh->region = r;
|
sh->region = r;
|
||||||
r->ships = sh;
|
r->ships = sh;
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ static void test_readwrite_attrib(CuTest *tc) {
|
||||||
gamedata_init(&data, &store, RELEASE_VERSION);
|
gamedata_init(&data, &store, RELEASE_VERSION);
|
||||||
write_attribs(data.store, a, NULL);
|
write_attribs(data.store, a, NULL);
|
||||||
a_removeall(&a, NULL);
|
a_removeall(&a, NULL);
|
||||||
CuAssertPtrEquals(tc, 0, a);
|
CuAssertPtrEquals(tc, NULL, a);
|
||||||
|
|
||||||
data.strm.api->rewind(data.strm.handle);
|
data.strm.api->rewind(data.strm.handle);
|
||||||
read_attribs(&data, &a, NULL);
|
read_attribs(&data, &a, NULL);
|
||||||
|
@ -262,7 +262,7 @@ static void test_readwrite_dead_faction_group(CuTest *tc) {
|
||||||
f = test_create_faction(NULL);
|
f = test_create_faction(NULL);
|
||||||
fno = f->no;
|
fno = f->no;
|
||||||
CuAssertPtrEquals(tc, f, factions);
|
CuAssertPtrEquals(tc, f, factions);
|
||||||
CuAssertPtrEquals(tc, 0, f->next);
|
CuAssertPtrEquals(tc, NULL, f->next);
|
||||||
f2 = test_create_faction(NULL);
|
f2 = test_create_faction(NULL);
|
||||||
CuAssertPtrEquals(tc, f2, factions->next);
|
CuAssertPtrEquals(tc, f2, factions->next);
|
||||||
u = test_create_unit(f2, test_create_region(0, 0, NULL));
|
u = test_create_unit(f2, test_create_region(0, 0, NULL));
|
||||||
|
@ -281,14 +281,14 @@ static void test_readwrite_dead_faction_group(CuTest *tc) {
|
||||||
f = f2 = NULL;
|
f = f2 = NULL;
|
||||||
data.strm.api->rewind(data.strm.handle);
|
data.strm.api->rewind(data.strm.handle);
|
||||||
read_game(&data);
|
read_game(&data);
|
||||||
CuAssertPtrEquals(tc, 0, findfaction(fno));
|
CuAssertPtrEquals(tc, NULL, findfaction(fno));
|
||||||
f2 = factions;
|
f2 = factions;
|
||||||
CuAssertPtrNotNull(tc, f2);
|
CuAssertPtrNotNull(tc, f2);
|
||||||
u = f2->units;
|
u = f2->units;
|
||||||
CuAssertPtrNotNull(tc, u);
|
CuAssertPtrNotNull(tc, u);
|
||||||
g = get_group(u);
|
g = get_group(u);
|
||||||
CuAssertPtrNotNull(tc, g);
|
CuAssertPtrNotNull(tc, g);
|
||||||
CuAssertPtrEquals(tc, 0, g->allies);
|
CuAssertPtrEquals(tc, NULL, g->allies);
|
||||||
mstream_done(&data.strm);
|
mstream_done(&data.strm);
|
||||||
gamedata_done(&data);
|
gamedata_done(&data);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -319,10 +319,10 @@ static void test_readwrite_dead_faction_regionowner(CuTest *tc) {
|
||||||
mstream_done(&data.strm);
|
mstream_done(&data.strm);
|
||||||
gamedata_done(&data);
|
gamedata_done(&data);
|
||||||
f = factions;
|
f = factions;
|
||||||
CuAssertPtrEquals(tc, 0, f);
|
CuAssertPtrEquals(tc, NULL, f);
|
||||||
r = regions;
|
r = regions;
|
||||||
CuAssertPtrNotNull(tc, r);
|
CuAssertPtrNotNull(tc, r);
|
||||||
CuAssertPtrEquals(tc, 0, region_get_owner(r));
|
CuAssertPtrEquals(tc, NULL, region_get_owner(r));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,7 +359,7 @@ static void test_readwrite_dead_faction_changefaction(CuTest *tc) {
|
||||||
CuAssertPtrNotNull(tc, r);
|
CuAssertPtrNotNull(tc, r);
|
||||||
u = r->units;
|
u = r->units;
|
||||||
CuAssertPtrNotNull(tc, u);
|
CuAssertPtrNotNull(tc, u);
|
||||||
CuAssertPtrEquals(tc, 0, a_find(u->attribs, &at_eventhandler));
|
CuAssertPtrEquals(tc, NULL, a_find(u->attribs, &at_eventhandler));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,7 +396,7 @@ static void test_readwrite_dead_faction_createunit(CuTest *tc) {
|
||||||
CuAssertPtrNotNull(tc, r);
|
CuAssertPtrNotNull(tc, r);
|
||||||
u = r->units;
|
u = r->units;
|
||||||
CuAssertPtrNotNull(tc, u);
|
CuAssertPtrNotNull(tc, u);
|
||||||
CuAssertPtrEquals(tc, 0, a_find(u->attribs, &at_eventhandler));
|
CuAssertPtrEquals(tc, NULL, a_find(u->attribs, &at_eventhandler));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -278,7 +278,7 @@ static void test_shipowner_goes_to_same_faction_after_leave(CuTest * tc)
|
||||||
leave_ship(u3);
|
leave_ship(u3);
|
||||||
CuAssertPtrEquals(tc, u2, ship_owner(sh));
|
CuAssertPtrEquals(tc, u2, ship_owner(sh));
|
||||||
leave_ship(u2);
|
leave_ship(u2);
|
||||||
CuAssertPtrEquals(tc, 0, ship_owner(sh));
|
CuAssertPtrEquals(tc, NULL, ship_owner(sh));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -311,7 +311,7 @@ static void test_shipowner_resets_when_empty(CuTest * tc)
|
||||||
u_set_ship(u, sh);
|
u_set_ship(u, sh);
|
||||||
CuAssertPtrEquals(tc, u, ship_owner(sh));
|
CuAssertPtrEquals(tc, u, ship_owner(sh));
|
||||||
u->number = 0;
|
u->number = 0;
|
||||||
CuAssertPtrEquals(tc, 0, ship_owner(sh));
|
CuAssertPtrEquals(tc, NULL, ship_owner(sh));
|
||||||
u->number = 1;
|
u->number = 1;
|
||||||
CuAssertPtrEquals(tc, u, ship_owner(sh));
|
CuAssertPtrEquals(tc, u, ship_owner(sh));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -353,7 +353,7 @@ void test_shipowner_goes_to_empty_unit_after_leave(CuTest * tc)
|
||||||
leave_ship(u1);
|
leave_ship(u1);
|
||||||
CuAssertPtrEquals(tc, u3, ship_owner(sh));
|
CuAssertPtrEquals(tc, u3, ship_owner(sh));
|
||||||
leave_ship(u3);
|
leave_ship(u3);
|
||||||
CuAssertPtrEquals(tc, 0, ship_owner(sh));
|
CuAssertPtrEquals(tc, NULL, ship_owner(sh));
|
||||||
u2->number = 1;
|
u2->number = 1;
|
||||||
CuAssertPtrEquals(tc, u2, ship_owner(sh));
|
CuAssertPtrEquals(tc, u2, ship_owner(sh));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -365,8 +365,8 @@ static void test_stype_defaults(CuTest *tc) {
|
||||||
stype = st_get_or_create("hodor");
|
stype = st_get_or_create("hodor");
|
||||||
CuAssertPtrNotNull(tc, stype);
|
CuAssertPtrNotNull(tc, stype);
|
||||||
CuAssertStrEquals(tc, "hodor", stype->_name);
|
CuAssertStrEquals(tc, "hodor", stype->_name);
|
||||||
CuAssertPtrEquals(tc, 0, stype->construction);
|
CuAssertPtrEquals(tc, NULL, stype->construction);
|
||||||
CuAssertPtrEquals(tc, 0, stype->coasts);
|
CuAssertPtrEquals(tc, NULL, stype->coasts);
|
||||||
CuAssertDblEquals(tc, 0.0, stype->damage, 0.0);
|
CuAssertDblEquals(tc, 0.0, stype->damage, 0.0);
|
||||||
CuAssertDblEquals(tc, 1.0, stype->storm, 0.0);
|
CuAssertDblEquals(tc, 1.0, stype->storm, 0.0);
|
||||||
CuAssertDblEquals(tc, 1.0, stype->tac_bonus, 0.01);
|
CuAssertDblEquals(tc, 1.0, stype->tac_bonus, 0.01);
|
||||||
|
|
|
@ -17,8 +17,8 @@ static void test_create_a_spell(CuTest * tc)
|
||||||
spell * sp;
|
spell * sp;
|
||||||
|
|
||||||
test_setup();
|
test_setup();
|
||||||
CuAssertPtrEquals(tc, 0, spells);
|
CuAssertPtrEquals(tc, NULL, spells);
|
||||||
CuAssertPtrEquals(tc, 0, find_spell("testspell"));
|
CuAssertPtrEquals(tc, NULL, find_spell("testspell"));
|
||||||
|
|
||||||
sp = create_spell("testspell");
|
sp = create_spell("testspell");
|
||||||
CuAssertPtrEquals(tc, sp, find_spell("testspell"));
|
CuAssertPtrEquals(tc, sp, find_spell("testspell"));
|
||||||
|
@ -37,13 +37,13 @@ static void test_create_duplicate_spell(CuTest * tc)
|
||||||
test_log_stderr(0); /* suppress the "duplicate spell" error message */
|
test_log_stderr(0); /* suppress the "duplicate spell" error message */
|
||||||
log = test_log_start(LOG_CPERROR, &sl);
|
log = test_log_start(LOG_CPERROR, &sl);
|
||||||
|
|
||||||
CuAssertPtrEquals(tc, 0, find_spell("testspell"));
|
CuAssertPtrEquals(tc, NULL, find_spell("testspell"));
|
||||||
|
|
||||||
sp = create_spell("testspell");
|
sp = create_spell("testspell");
|
||||||
CuAssertPtrEquals(tc, 0, create_spell("testspell"));
|
CuAssertPtrEquals(tc, NULL, create_spell("testspell"));
|
||||||
CuAssertPtrNotNull(tc, sl);
|
CuAssertPtrNotNull(tc, sl);
|
||||||
CuAssertStrEquals(tc, "create_spell: duplicate name '%s'", sl->s);
|
CuAssertStrEquals(tc, "create_spell: duplicate name '%s'", sl->s);
|
||||||
CuAssertPtrEquals(tc, 0, sl->next);
|
CuAssertPtrEquals(tc, NULL, sl->next);
|
||||||
CuAssertPtrEquals(tc, sp, find_spell("testspell"));
|
CuAssertPtrEquals(tc, sp, find_spell("testspell"));
|
||||||
test_log_stop(log, sl);
|
test_log_stop(log, sl);
|
||||||
test_log_stderr(1); /* or teardown complains that stderr logging is off */
|
test_log_stderr(1); /* or teardown complains that stderr logging is off */
|
||||||
|
|
|
@ -25,7 +25,7 @@ void test_named_spellbooks(CuTest * tc)
|
||||||
|
|
||||||
sb = create_spellbook(0);
|
sb = create_spellbook(0);
|
||||||
CuAssertPtrNotNull(tc, sb);
|
CuAssertPtrNotNull(tc, sb);
|
||||||
CuAssertPtrEquals(tc, 0, sb->name);
|
CuAssertPtrEquals(tc, NULL, sb->name);
|
||||||
spellbook_clear(sb);
|
spellbook_clear(sb);
|
||||||
free(sb);
|
free(sb);
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ static void test_remove_empty_units(CuTest *tc) {
|
||||||
CuAssertPtrNotNull(tc, findunit(uid));
|
CuAssertPtrNotNull(tc, findunit(uid));
|
||||||
u->number = 0;
|
u->number = 0;
|
||||||
remove_empty_units();
|
remove_empty_units();
|
||||||
CuAssertPtrEquals(tc, 0, findunit(uid));
|
CuAssertPtrEquals(tc, NULL, findunit(uid));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,9 +61,9 @@ static void test_remove_empty_units_in_region(CuTest *tc) {
|
||||||
CuAssertPtrNotNull(tc, findunit(uid));
|
CuAssertPtrNotNull(tc, findunit(uid));
|
||||||
u->number = 0;
|
u->number = 0;
|
||||||
remove_empty_units_in_region(u->region);
|
remove_empty_units_in_region(u->region);
|
||||||
CuAssertPtrEquals(tc, 0, findunit(uid));
|
CuAssertPtrEquals(tc, NULL, findunit(uid));
|
||||||
CuAssertPtrEquals(tc, 0, u->nextF);
|
CuAssertPtrEquals(tc, NULL, u->nextF);
|
||||||
CuAssertPtrEquals(tc, 0, u->region);
|
CuAssertPtrEquals(tc, NULL, u->region);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ static void test_remove_units_without_faction(CuTest *tc) {
|
||||||
uid = u->no;
|
uid = u->no;
|
||||||
u_setfaction(u, 0);
|
u_setfaction(u, 0);
|
||||||
remove_empty_units_in_region(u->region);
|
remove_empty_units_in_region(u->region);
|
||||||
CuAssertPtrEquals(tc, 0, findunit(uid));
|
CuAssertPtrEquals(tc, NULL, findunit(uid));
|
||||||
CuAssertIntEquals(tc, 0, u->number);
|
CuAssertIntEquals(tc, 0, u->number);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ static void test_remove_units_with_dead_faction(CuTest *tc) {
|
||||||
uid = u->no;
|
uid = u->no;
|
||||||
u->faction->_alive = false;
|
u->faction->_alive = false;
|
||||||
remove_empty_units_in_region(u->region);
|
remove_empty_units_in_region(u->region);
|
||||||
CuAssertPtrEquals(tc, 0, findunit(uid));
|
CuAssertPtrEquals(tc, NULL, findunit(uid));
|
||||||
CuAssertIntEquals(tc, 0, u->number);
|
CuAssertIntEquals(tc, 0, u->number);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
@ -308,16 +308,16 @@ static void test_inside_building(CuTest *tc) {
|
||||||
|
|
||||||
b->size = 1;
|
b->size = 1;
|
||||||
scale_number(u, 1);
|
scale_number(u, 1);
|
||||||
CuAssertPtrEquals(tc, 0, inside_building(u));
|
CuAssertPtrEquals(tc, NULL, inside_building(u));
|
||||||
u->building = b;
|
u->building = b;
|
||||||
CuAssertPtrEquals(tc, b, inside_building(u));
|
CuAssertPtrEquals(tc, b, inside_building(u));
|
||||||
scale_number(u, 2);
|
scale_number(u, 2);
|
||||||
CuAssertPtrEquals(tc, 0, inside_building(u));
|
CuAssertPtrEquals(tc, NULL, inside_building(u));
|
||||||
b->size = 2;
|
b->size = 2;
|
||||||
CuAssertPtrEquals(tc, b, inside_building(u));
|
CuAssertPtrEquals(tc, b, inside_building(u));
|
||||||
u = test_create_unit(u->faction, u->region);
|
u = test_create_unit(u->faction, u->region);
|
||||||
u->building = b;
|
u->building = b;
|
||||||
CuAssertPtrEquals(tc, 0, inside_building(u));
|
CuAssertPtrEquals(tc, NULL, inside_building(u));
|
||||||
b->size = 3;
|
b->size = 3;
|
||||||
CuAssertPtrEquals(tc, b, inside_building(u));
|
CuAssertPtrEquals(tc, b, inside_building(u));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -397,7 +397,7 @@ static void test_unit_description(CuTest *tc) {
|
||||||
rc = test_create_race("hodor");
|
rc = test_create_race("hodor");
|
||||||
u = test_create_unit(test_create_faction(rc), test_create_region(0, 0, NULL));
|
u = test_create_unit(test_create_faction(rc), test_create_region(0, 0, NULL));
|
||||||
|
|
||||||
CuAssertPtrEquals(tc, 0, u->display);
|
CuAssertPtrEquals(tc, NULL, u->display);
|
||||||
CuAssertStrEquals(tc, 0, u_description(u, lang));
|
CuAssertStrEquals(tc, 0, u_description(u, lang));
|
||||||
u->display = str_strdup("Hodor");
|
u->display = str_strdup("Hodor");
|
||||||
CuAssertStrEquals(tc, "Hodor", u_description(u, NULL));
|
CuAssertStrEquals(tc, "Hodor", u_description(u, NULL));
|
||||||
|
@ -428,37 +428,37 @@ static void test_remove_unit(CuTest *tc) {
|
||||||
CuAssertPtrEquals(tc, u1, f->units);
|
CuAssertPtrEquals(tc, u1, f->units);
|
||||||
CuAssertPtrEquals(tc, u2, u1->nextF);
|
CuAssertPtrEquals(tc, u2, u1->nextF);
|
||||||
CuAssertPtrEquals(tc, u1, u2->prevF);
|
CuAssertPtrEquals(tc, u1, u2->prevF);
|
||||||
CuAssertPtrEquals(tc, 0, u2->nextF);
|
CuAssertPtrEquals(tc, NULL, u2->nextF);
|
||||||
uno = u1->no;
|
uno = u1->no;
|
||||||
region_setresource(r, rtype, 0);
|
region_setresource(r, rtype, 0);
|
||||||
i_change(&u1->items, rtype->itype, 100);
|
i_change(&u1->items, rtype->itype, 100);
|
||||||
remove_unit(&r->units, u1);
|
remove_unit(&r->units, u1);
|
||||||
CuAssertIntEquals(tc, 0, u1->number);
|
CuAssertIntEquals(tc, 0, u1->number);
|
||||||
CuAssertPtrEquals(tc, 0, u1->region);
|
CuAssertPtrEquals(tc, NULL, u1->region);
|
||||||
/* money is given to a survivor: */
|
/* money is given to a survivor: */
|
||||||
CuAssertPtrEquals(tc, 0, u1->items);
|
CuAssertPtrEquals(tc, NULL, u1->items);
|
||||||
CuAssertIntEquals(tc, 0, region_getresource(r, rtype));
|
CuAssertIntEquals(tc, 0, region_getresource(r, rtype));
|
||||||
CuAssertIntEquals(tc, 100, i_get(u2->items, rtype->itype));
|
CuAssertIntEquals(tc, 100, i_get(u2->items, rtype->itype));
|
||||||
|
|
||||||
/* unit is removed from f->units: */
|
/* unit is removed from f->units: */
|
||||||
CuAssertPtrEquals(tc, 0, u1->nextF);
|
CuAssertPtrEquals(tc, NULL, u1->nextF);
|
||||||
CuAssertPtrEquals(tc, u2, f->units);
|
CuAssertPtrEquals(tc, u2, f->units);
|
||||||
CuAssertPtrEquals(tc, 0, u2->nextF);
|
CuAssertPtrEquals(tc, NULL, u2->nextF);
|
||||||
CuAssertPtrEquals(tc, 0, u2->prevF);
|
CuAssertPtrEquals(tc, NULL, u2->prevF);
|
||||||
/* unit is no longer in r->units: */
|
/* unit is no longer in r->units: */
|
||||||
CuAssertPtrEquals(tc, u2, r->units);
|
CuAssertPtrEquals(tc, u2, r->units);
|
||||||
CuAssertPtrEquals(tc, 0, u2->next);
|
CuAssertPtrEquals(tc, NULL, u2->next);
|
||||||
|
|
||||||
/* unit is in deleted_units: */
|
/* unit is in deleted_units: */
|
||||||
CuAssertPtrEquals(tc, 0, findunit(uno));
|
CuAssertPtrEquals(tc, NULL, findunit(uno));
|
||||||
CuAssertPtrEquals(tc, f, dfindhash(uno));
|
CuAssertPtrEquals(tc, f, dfindhash(uno));
|
||||||
|
|
||||||
remove_unit(&r->units, u2);
|
remove_unit(&r->units, u2);
|
||||||
/* no survivor, give money to peasants: */
|
/* no survivor, give money to peasants: */
|
||||||
CuAssertIntEquals(tc, 100, region_getresource(r, rtype));
|
CuAssertIntEquals(tc, 100, region_getresource(r, rtype));
|
||||||
/* there are now no more units: */
|
/* there are now no more units: */
|
||||||
CuAssertPtrEquals(tc, 0, r->units);
|
CuAssertPtrEquals(tc, NULL, r->units);
|
||||||
CuAssertPtrEquals(tc, 0, f->units);
|
CuAssertPtrEquals(tc, NULL, f->units);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -123,8 +123,8 @@ static void test_enter_building(CuTest * tc)
|
||||||
rc->flags = RCF_SWIM;
|
rc->flags = RCF_SWIM;
|
||||||
u->building = 0;
|
u->building = 0;
|
||||||
CuAssertIntEquals(tc, 0, enter_building(u, NULL, b->no, false));
|
CuAssertIntEquals(tc, 0, enter_building(u, NULL, b->no, false));
|
||||||
CuAssertPtrEquals(tc, 0, u->building);
|
CuAssertPtrEquals(tc, NULL, u->building);
|
||||||
CuAssertPtrEquals(tc, 0, u->faction->msgs);
|
CuAssertPtrEquals(tc, NULL, u->faction->msgs);
|
||||||
|
|
||||||
CuAssertIntEquals(tc, 0, enter_building(u, NULL, b->no, true));
|
CuAssertIntEquals(tc, 0, enter_building(u, NULL, b->no, true));
|
||||||
CuAssertPtrNotNull(tc, u->faction->msgs);
|
CuAssertPtrNotNull(tc, u->faction->msgs);
|
||||||
|
@ -164,8 +164,8 @@ static void test_enter_ship(CuTest * tc)
|
||||||
rc->flags = RCF_SWIM;
|
rc->flags = RCF_SWIM;
|
||||||
u->ship = 0;
|
u->ship = 0;
|
||||||
CuAssertIntEquals(tc, 0, enter_ship(u, NULL, sh->no, false));
|
CuAssertIntEquals(tc, 0, enter_ship(u, NULL, sh->no, false));
|
||||||
CuAssertPtrEquals(tc, 0, u->ship);
|
CuAssertPtrEquals(tc, NULL, u->ship);
|
||||||
CuAssertPtrEquals(tc, 0, u->faction->msgs);
|
CuAssertPtrEquals(tc, NULL, u->faction->msgs);
|
||||||
|
|
||||||
CuAssertIntEquals(tc, 0, enter_ship(u, NULL, sh->no, true));
|
CuAssertIntEquals(tc, 0, enter_ship(u, NULL, sh->no, true));
|
||||||
CuAssertPtrNotNull(tc, u->faction->msgs);
|
CuAssertPtrNotNull(tc, u->faction->msgs);
|
||||||
|
@ -1040,8 +1040,8 @@ static void test_long_order_normal(CuTest *tc) {
|
||||||
CuAssertIntEquals(tc, 0, fval(u, UFL_MOVED));
|
CuAssertIntEquals(tc, 0, fval(u, UFL_MOVED));
|
||||||
CuAssertIntEquals(tc, 0, fval(u, UFL_LONGACTION));
|
CuAssertIntEquals(tc, 0, fval(u, UFL_LONGACTION));
|
||||||
CuAssertPtrNotNull(tc, u->orders);
|
CuAssertPtrNotNull(tc, u->orders);
|
||||||
CuAssertPtrEquals(tc, 0, u->faction->msgs);
|
CuAssertPtrEquals(tc, NULL, u->faction->msgs);
|
||||||
CuAssertPtrEquals(tc, 0, u->old_orders);
|
CuAssertPtrEquals(tc, NULL, u->old_orders);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1051,9 +1051,9 @@ static void test_long_order_none(CuTest *tc) {
|
||||||
test_setup();
|
test_setup();
|
||||||
u = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
|
u = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
|
||||||
update_long_order(u);
|
update_long_order(u);
|
||||||
CuAssertPtrEquals(tc, 0, u->thisorder);
|
CuAssertPtrEquals(tc, NULL, u->thisorder);
|
||||||
CuAssertPtrEquals(tc, 0, u->orders);
|
CuAssertPtrEquals(tc, NULL, u->orders);
|
||||||
CuAssertPtrEquals(tc, 0, u->faction->msgs);
|
CuAssertPtrEquals(tc, NULL, u->faction->msgs);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1065,9 +1065,9 @@ static void test_long_order_cast(CuTest *tc) {
|
||||||
unit_addorder(u, create_order(K_CAST, u->faction->locale, NULL));
|
unit_addorder(u, create_order(K_CAST, u->faction->locale, NULL));
|
||||||
unit_addorder(u, create_order(K_CAST, u->faction->locale, NULL));
|
unit_addorder(u, create_order(K_CAST, u->faction->locale, NULL));
|
||||||
update_long_order(u);
|
update_long_order(u);
|
||||||
CuAssertPtrEquals(tc, 0, u->thisorder);
|
CuAssertPtrEquals(tc, NULL, u->thisorder);
|
||||||
CuAssertPtrNotNull(tc, u->orders);
|
CuAssertPtrNotNull(tc, u->orders);
|
||||||
CuAssertPtrEquals(tc, 0, u->faction->msgs);
|
CuAssertPtrEquals(tc, NULL, u->faction->msgs);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1080,9 +1080,9 @@ static void test_long_order_buy_sell(CuTest *tc) {
|
||||||
unit_addorder(u, create_order(K_SELL, u->faction->locale, NULL));
|
unit_addorder(u, create_order(K_SELL, u->faction->locale, NULL));
|
||||||
unit_addorder(u, create_order(K_SELL, u->faction->locale, NULL));
|
unit_addorder(u, create_order(K_SELL, u->faction->locale, NULL));
|
||||||
update_long_order(u);
|
update_long_order(u);
|
||||||
CuAssertPtrEquals(tc, 0, u->thisorder);
|
CuAssertPtrEquals(tc, NULL, u->thisorder);
|
||||||
CuAssertPtrNotNull(tc, u->orders);
|
CuAssertPtrNotNull(tc, u->orders);
|
||||||
CuAssertPtrEquals(tc, 0, u->faction->msgs);
|
CuAssertPtrEquals(tc, NULL, u->faction->msgs);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1108,7 +1108,7 @@ static void test_long_order_multi_buy(CuTest *tc) {
|
||||||
unit_addorder(u, create_order(K_BUY, u->faction->locale, 0));
|
unit_addorder(u, create_order(K_BUY, u->faction->locale, 0));
|
||||||
unit_addorder(u, create_order(K_BUY, u->faction->locale, 0));
|
unit_addorder(u, create_order(K_BUY, u->faction->locale, 0));
|
||||||
update_long_order(u);
|
update_long_order(u);
|
||||||
CuAssertPtrEquals(tc, 0, u->thisorder);
|
CuAssertPtrEquals(tc, NULL, u->thisorder);
|
||||||
CuAssertPtrNotNull(tc, u->orders);
|
CuAssertPtrNotNull(tc, u->orders);
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(u->faction->msgs, "error52"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(u->faction->msgs, "error52"));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -1123,9 +1123,9 @@ static void test_long_order_multi_sell(CuTest *tc) {
|
||||||
unit_addorder(u, create_order(K_BUY, u->faction->locale, 0));
|
unit_addorder(u, create_order(K_BUY, u->faction->locale, 0));
|
||||||
unit_addorder(u, create_order(K_SELL, u->faction->locale, 0));
|
unit_addorder(u, create_order(K_SELL, u->faction->locale, 0));
|
||||||
update_long_order(u);
|
update_long_order(u);
|
||||||
CuAssertPtrEquals(tc, 0, u->thisorder);
|
CuAssertPtrEquals(tc, NULL, u->thisorder);
|
||||||
CuAssertPtrNotNull(tc, u->orders);
|
CuAssertPtrNotNull(tc, u->orders);
|
||||||
CuAssertPtrEquals(tc, 0, u->faction->msgs);
|
CuAssertPtrEquals(tc, NULL, u->faction->msgs);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1137,7 +1137,7 @@ static void test_long_order_buy_cast(CuTest *tc) {
|
||||||
unit_addorder(u, create_order(K_BUY, u->faction->locale, 0));
|
unit_addorder(u, create_order(K_BUY, u->faction->locale, 0));
|
||||||
unit_addorder(u, create_order(K_CAST, u->faction->locale, 0));
|
unit_addorder(u, create_order(K_CAST, u->faction->locale, 0));
|
||||||
update_long_order(u);
|
update_long_order(u);
|
||||||
CuAssertPtrEquals(tc, 0, u->thisorder);
|
CuAssertPtrEquals(tc, NULL, u->thisorder);
|
||||||
CuAssertPtrNotNull(tc, u->orders);
|
CuAssertPtrNotNull(tc, u->orders);
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(u->faction->msgs, "error52"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(u->faction->msgs, "error52"));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -1155,7 +1155,7 @@ static void test_long_order_hungry(CuTest *tc) {
|
||||||
update_long_order(u);
|
update_long_order(u);
|
||||||
CuAssertIntEquals(tc, K_WORK, getkeyword(u->thisorder));
|
CuAssertIntEquals(tc, K_WORK, getkeyword(u->thisorder));
|
||||||
CuAssertPtrNotNull(tc, u->orders);
|
CuAssertPtrNotNull(tc, u->orders);
|
||||||
CuAssertPtrEquals(tc, 0, u->faction->msgs);
|
CuAssertPtrEquals(tc, NULL, u->faction->msgs);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1167,7 +1167,7 @@ static void test_ally_cmd_errors(CuTest *tc) {
|
||||||
test_setup();
|
test_setup();
|
||||||
u = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
|
u = test_create_unit(test_create_faction(NULL), test_create_region(0, 0, NULL));
|
||||||
fid = u->faction->no + 1;
|
fid = u->faction->no + 1;
|
||||||
CuAssertPtrEquals(tc, 0, findfaction(fid));
|
CuAssertPtrEquals(tc, NULL, findfaction(fid));
|
||||||
|
|
||||||
ord = create_order(K_ALLY, u->faction->locale, itoa36(fid));
|
ord = create_order(K_ALLY, u->faction->locale, itoa36(fid));
|
||||||
ally_cmd(u, ord);
|
ally_cmd(u, ord);
|
||||||
|
@ -1264,25 +1264,25 @@ static void test_ally_cmd(CuTest *tc) {
|
||||||
|
|
||||||
ord = create_order(K_ALLY, f->locale, "%s", itoa36(f->no));
|
ord = create_order(K_ALLY, f->locale, "%s", itoa36(f->no));
|
||||||
ally_cmd(u, ord);
|
ally_cmd(u, ord);
|
||||||
CuAssertPtrEquals(tc, 0, u->faction->msgs);
|
CuAssertPtrEquals(tc, NULL, u->faction->msgs);
|
||||||
CuAssertIntEquals(tc, HELP_ALL, alliedfaction(0, u->faction, f, HELP_ALL));
|
CuAssertIntEquals(tc, HELP_ALL, alliedfaction(0, u->faction, f, HELP_ALL));
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
|
|
||||||
ord = create_order(K_ALLY, f->locale, "%s %s", itoa36(f->no), LOC(f->locale, parameters[P_NOT]));
|
ord = create_order(K_ALLY, f->locale, "%s %s", itoa36(f->no), LOC(f->locale, parameters[P_NOT]));
|
||||||
ally_cmd(u, ord);
|
ally_cmd(u, ord);
|
||||||
CuAssertPtrEquals(tc, 0, u->faction->msgs);
|
CuAssertPtrEquals(tc, NULL, u->faction->msgs);
|
||||||
CuAssertIntEquals(tc, 0, alliedfaction(0, u->faction, f, HELP_ALL));
|
CuAssertIntEquals(tc, 0, alliedfaction(0, u->faction, f, HELP_ALL));
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
|
|
||||||
ord = create_order(K_ALLY, f->locale, "%s %s", itoa36(f->no), LOC(f->locale, parameters[P_GUARD]));
|
ord = create_order(K_ALLY, f->locale, "%s %s", itoa36(f->no), LOC(f->locale, parameters[P_GUARD]));
|
||||||
ally_cmd(u, ord);
|
ally_cmd(u, ord);
|
||||||
CuAssertPtrEquals(tc, 0, u->faction->msgs);
|
CuAssertPtrEquals(tc, NULL, u->faction->msgs);
|
||||||
CuAssertIntEquals(tc, HELP_GUARD, alliedfaction(0, u->faction, f, HELP_ALL));
|
CuAssertIntEquals(tc, HELP_GUARD, alliedfaction(0, u->faction, f, HELP_ALL));
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
|
|
||||||
ord = create_order(K_ALLY, f->locale, "%s %s %s", itoa36(f->no), LOC(f->locale, parameters[P_GUARD]), LOC(f->locale, parameters[P_NOT]));
|
ord = create_order(K_ALLY, f->locale, "%s %s %s", itoa36(f->no), LOC(f->locale, parameters[P_GUARD]), LOC(f->locale, parameters[P_NOT]));
|
||||||
ally_cmd(u, ord);
|
ally_cmd(u, ord);
|
||||||
CuAssertPtrEquals(tc, 0, u->faction->msgs);
|
CuAssertPtrEquals(tc, NULL, u->faction->msgs);
|
||||||
CuAssertIntEquals(tc, 0, alliedfaction(0, u->faction, f, HELP_ALL));
|
CuAssertIntEquals(tc, 0, alliedfaction(0, u->faction, f, HELP_ALL));
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
|
|
||||||
|
@ -1374,7 +1374,7 @@ static void test_mail_unit_no_msg(CuTest *tc) {
|
||||||
f = u->faction;
|
f = u->faction;
|
||||||
ord = create_order(K_MAIL, f->locale, "%s %s", LOC(f->locale, parameters[P_UNIT]), itoa36(u->no));
|
ord = create_order(K_MAIL, f->locale, "%s %s", LOC(f->locale, parameters[P_UNIT]), itoa36(u->no));
|
||||||
mail_cmd(u, ord);
|
mail_cmd(u, ord);
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "unitmessage"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "unitmessage"));
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error30"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error30"));
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -1389,7 +1389,7 @@ static void test_mail_faction_no_msg(CuTest *tc) {
|
||||||
f = u->faction;
|
f = u->faction;
|
||||||
ord = create_order(K_MAIL, f->locale, "%s %s", LOC(f->locale, parameters[P_FACTION]), itoa36(f->no));
|
ord = create_order(K_MAIL, f->locale, "%s %s", LOC(f->locale, parameters[P_FACTION]), itoa36(f->no));
|
||||||
mail_cmd(u, ord);
|
mail_cmd(u, ord);
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "regionmessage"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "regionmessage"));
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error30"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error30"));
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -1404,7 +1404,7 @@ static void test_mail_faction_no_target(CuTest *tc) {
|
||||||
f = u->faction;
|
f = u->faction;
|
||||||
ord = create_order(K_MAIL, f->locale, "%s %s", LOC(f->locale, parameters[P_FACTION]), itoa36(f->no+1));
|
ord = create_order(K_MAIL, f->locale, "%s %s", LOC(f->locale, parameters[P_FACTION]), itoa36(f->no+1));
|
||||||
mail_cmd(u, ord);
|
mail_cmd(u, ord);
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "regionmessage"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "regionmessage"));
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error66"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error66"));
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -1419,7 +1419,7 @@ static void test_mail_region_no_msg(CuTest *tc) {
|
||||||
f = u->faction;
|
f = u->faction;
|
||||||
ord = create_order(K_MAIL, f->locale, LOC(f->locale, parameters[P_REGION]));
|
ord = create_order(K_MAIL, f->locale, LOC(f->locale, parameters[P_REGION]));
|
||||||
mail_cmd(u, ord);
|
mail_cmd(u, ord);
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(u->region->msgs, "mail_result"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(u->region->msgs, "mail_result"));
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error30"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error30"));
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -1457,14 +1457,14 @@ static void test_show_without_item(CuTest *tc)
|
||||||
locale_setstring(loc, "iteminfo::testitem", "testdescription");
|
locale_setstring(loc, "iteminfo::testitem", "testdescription");
|
||||||
|
|
||||||
reshow_cmd(u, ord);
|
reshow_cmd(u, ord);
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error21"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error21"));
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error36"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(f->msgs, "error36"));
|
||||||
test_clear_messages(f);
|
test_clear_messages(f);
|
||||||
|
|
||||||
i_add(&(u->items), i_new(itype, 1));
|
i_add(&(u->items), i_new(itype, 1));
|
||||||
reshow_cmd(u, ord);
|
reshow_cmd(u, ord);
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error21"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error21"));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "error36"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "error36"));
|
||||||
test_clear_messages(f);
|
test_clear_messages(f);
|
||||||
|
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
|
@ -1609,7 +1609,7 @@ static void test_demon_hunger(CuTest * tc)
|
||||||
get_food(r);
|
get_food(r);
|
||||||
|
|
||||||
CuAssertIntEquals(tc, 20, i_get(u->items, rtype->itype));
|
CuAssertIntEquals(tc, 20, i_get(u->items, rtype->itype));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "malnourish"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "malnourish"));
|
||||||
|
|
||||||
config_set("hunger.demon.peasant_tolerance", "0");
|
config_set("hunger.demon.peasant_tolerance", "0");
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ void test_updatespells(CuTest * tc)
|
||||||
CuAssertPtrNotNull(tc, book);
|
CuAssertPtrNotNull(tc, book);
|
||||||
spellbook_add(book, sp, 1);
|
spellbook_add(book, sp, 1);
|
||||||
|
|
||||||
CuAssertPtrEquals(tc, 0, f->spellbook);
|
CuAssertPtrEquals(tc, NULL, f->spellbook);
|
||||||
pick_random_spells(f, 1, book, 1);
|
pick_random_spells(f, 1, book, 1);
|
||||||
CuAssertPtrNotNull(tc, f->spellbook);
|
CuAssertPtrNotNull(tc, f->spellbook);
|
||||||
CuAssertIntEquals(tc, 1, selist_length(f->spellbook->spells));
|
CuAssertIntEquals(tc, 1, selist_length(f->spellbook->spells));
|
||||||
|
@ -191,7 +191,7 @@ void test_getspell_unit(CuTest * tc)
|
||||||
sp = create_spell("testspell");
|
sp = create_spell("testspell");
|
||||||
locale_setstring(lang, mkname("spell", sp->sname), "Herp-a-derp");
|
locale_setstring(lang, mkname("spell", sp->sname), "Herp-a-derp");
|
||||||
|
|
||||||
CuAssertPtrEquals(tc, 0, unit_getspell(u, "Herp-a-derp", lang));
|
CuAssertPtrEquals(tc, NULL, unit_getspell(u, "Herp-a-derp", lang));
|
||||||
|
|
||||||
unit_add_spell(u, 0, sp, 1);
|
unit_add_spell(u, 0, sp, 1);
|
||||||
CuAssertPtrNotNull(tc, unit_getspell(u, "Herp-a-derp", lang));
|
CuAssertPtrNotNull(tc, unit_getspell(u, "Herp-a-derp", lang));
|
||||||
|
@ -220,7 +220,7 @@ void test_getspell_faction(CuTest * tc)
|
||||||
sp = create_spell("testspell");
|
sp = create_spell("testspell");
|
||||||
locale_setstring(lang, mkname("spell", sp->sname), "Herp-a-derp");
|
locale_setstring(lang, mkname("spell", sp->sname), "Herp-a-derp");
|
||||||
|
|
||||||
CuAssertPtrEquals(tc, 0, unit_getspell(u, "Herp-a-derp", lang));
|
CuAssertPtrEquals(tc, NULL, unit_getspell(u, "Herp-a-derp", lang));
|
||||||
|
|
||||||
f->spellbook = create_spellbook(0);
|
f->spellbook = create_spellbook(0);
|
||||||
spellbook_add(f->spellbook, sp, 1);
|
spellbook_add(f->spellbook, sp, 1);
|
||||||
|
@ -250,7 +250,7 @@ void test_getspell_school(CuTest * tc)
|
||||||
sp = create_spell("testspell");
|
sp = create_spell("testspell");
|
||||||
locale_setstring(lang, mkname("spell", sp->sname), "Herp-a-derp");
|
locale_setstring(lang, mkname("spell", sp->sname), "Herp-a-derp");
|
||||||
|
|
||||||
CuAssertPtrEquals(tc, 0, unit_getspell(u, "Herp-a-derp", lang));
|
CuAssertPtrEquals(tc, NULL, unit_getspell(u, "Herp-a-derp", lang));
|
||||||
|
|
||||||
book = faction_get_spellbook(f);
|
book = faction_get_spellbook(f);
|
||||||
CuAssertPtrNotNull(tc, book);
|
CuAssertPtrNotNull(tc, book);
|
||||||
|
@ -287,7 +287,7 @@ void test_set_pre_combatspell(CuTest * tc)
|
||||||
CuAssertIntEquals(tc, 1, get_combatspelllevel(u, index));
|
CuAssertIntEquals(tc, 1, get_combatspelllevel(u, index));
|
||||||
unset_combatspell(u, sp);
|
unset_combatspell(u, sp);
|
||||||
CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index));
|
CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index));
|
||||||
CuAssertPtrEquals(tc, 0, (spell *)get_combatspell(u, index));
|
CuAssertPtrEquals(tc, NULL, (spell *)get_combatspell(u, index));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -319,7 +319,7 @@ void test_set_main_combatspell(CuTest * tc)
|
||||||
CuAssertIntEquals(tc, 1, get_combatspelllevel(u, index));
|
CuAssertIntEquals(tc, 1, get_combatspelllevel(u, index));
|
||||||
unset_combatspell(u, sp);
|
unset_combatspell(u, sp);
|
||||||
CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index));
|
CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index));
|
||||||
CuAssertPtrEquals(tc, 0, (spell *)get_combatspell(u, index));
|
CuAssertPtrEquals(tc, NULL, (spell *)get_combatspell(u, index));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ void test_set_post_combatspell(CuTest * tc)
|
||||||
CuAssertIntEquals(tc, 1, get_combatspelllevel(u, index));
|
CuAssertIntEquals(tc, 1, get_combatspelllevel(u, index));
|
||||||
unset_combatspell(u, sp);
|
unset_combatspell(u, sp);
|
||||||
CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index));
|
CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index));
|
||||||
CuAssertPtrEquals(tc, 0, (spell *)get_combatspell(u, index));
|
CuAssertPtrEquals(tc, NULL, (spell *)get_combatspell(u, index));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -225,16 +225,16 @@ static void test_ship_trails(CuTest *tc) {
|
||||||
move_ship(sh, r1, r3, NULL);
|
move_ship(sh, r1, r3, NULL);
|
||||||
CuAssertPtrEquals(tc, r3, sh->region);
|
CuAssertPtrEquals(tc, r3, sh->region);
|
||||||
CuAssertPtrEquals(tc, sh, r3->ships);
|
CuAssertPtrEquals(tc, sh, r3->ships);
|
||||||
CuAssertPtrEquals(tc, 0, r1->ships);
|
CuAssertPtrEquals(tc, NULL, r1->ships);
|
||||||
CuAssertPtrEquals(tc, 0, a_find(r1->attribs, &at_shiptrail));
|
CuAssertPtrEquals(tc, NULL, a_find(r1->attribs, &at_shiptrail));
|
||||||
CuAssertPtrEquals(tc, 0, a_find(r3->attribs, &at_shiptrail));
|
CuAssertPtrEquals(tc, NULL, a_find(r3->attribs, &at_shiptrail));
|
||||||
add_regionlist(&route, r3);
|
add_regionlist(&route, r3);
|
||||||
add_regionlist(&route, r2);
|
add_regionlist(&route, r2);
|
||||||
move_ship(sh, r3, r1, route);
|
move_ship(sh, r3, r1, route);
|
||||||
CuAssertPtrEquals(tc, r1, sh->region);
|
CuAssertPtrEquals(tc, r1, sh->region);
|
||||||
CuAssertPtrEquals(tc, sh, r1->ships);
|
CuAssertPtrEquals(tc, sh, r1->ships);
|
||||||
CuAssertPtrEquals(tc, 0, r3->ships);
|
CuAssertPtrEquals(tc, NULL, r3->ships);
|
||||||
CuAssertPtrEquals(tc, 0, a_find(r1->attribs, &at_shiptrail));
|
CuAssertPtrEquals(tc, NULL, a_find(r1->attribs, &at_shiptrail));
|
||||||
CuAssertPtrNotNull(tc, a_find(r2->attribs, &at_shiptrail));
|
CuAssertPtrNotNull(tc, a_find(r2->attribs, &at_shiptrail));
|
||||||
CuAssertPtrNotNull(tc, a_find(r3->attribs, &at_shiptrail));
|
CuAssertPtrNotNull(tc, a_find(r3->attribs, &at_shiptrail));
|
||||||
free_regionlist(route);
|
free_regionlist(route);
|
||||||
|
@ -258,7 +258,7 @@ static void test_age_trails(CuTest *tc) {
|
||||||
a_age(&r1->attribs, r1);
|
a_age(&r1->attribs, r1);
|
||||||
CuAssertPtrNotNull(tc, r1->attribs);
|
CuAssertPtrNotNull(tc, r1->attribs);
|
||||||
a_age(&r1->attribs, r1);
|
a_age(&r1->attribs, r1);
|
||||||
CuAssertPtrEquals(tc, 0, r1->attribs);
|
CuAssertPtrEquals(tc, NULL, r1->attribs);
|
||||||
free_regionlist(route);
|
free_regionlist(route);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
@ -323,7 +323,7 @@ static void test_ship_empty(CuTest *tc) {
|
||||||
movement();
|
movement();
|
||||||
CuAssertPtrEquals(tc, fix.sh->region, findregion(0, 0));
|
CuAssertPtrEquals(tc, fix.sh->region, findregion(0, 0));
|
||||||
CuAssertIntEquals(tc, 2, ship_damage_percent(fix.sh));
|
CuAssertIntEquals(tc, 2, ship_damage_percent(fix.sh));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(fix.f->msgs, "ship_drift"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(fix.f->msgs, "ship_drift"));
|
||||||
|
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
@ -340,7 +340,7 @@ static void test_no_drift_damage(CuTest *tc) {
|
||||||
movement();
|
movement();
|
||||||
CuAssertPtrEquals(tc, fix.sh->region, findregion(0, 0));
|
CuAssertPtrEquals(tc, fix.sh->region, findregion(0, 0));
|
||||||
CuAssertIntEquals(tc, 0, ship_damage_percent(fix.sh));
|
CuAssertIntEquals(tc, 0, ship_damage_percent(fix.sh));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(fix.f->msgs, "ship_drift"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(fix.f->msgs, "ship_drift"));
|
||||||
|
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
@ -386,7 +386,7 @@ static void test_ship_no_real_overload(CuTest *tc) {
|
||||||
movement();
|
movement();
|
||||||
CuAssertPtrEquals(tc, fix.u->region, findregion(0, 0));
|
CuAssertPtrEquals(tc, fix.u->region, findregion(0, 0));
|
||||||
CuAssertIntEquals(tc, 82, ship_damage_percent(fix.sh));
|
CuAssertIntEquals(tc, 82, ship_damage_percent(fix.sh));
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(fix.f->msgs, "massive_overload"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(fix.f->msgs, "massive_overload"));
|
||||||
|
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
@ -431,7 +431,7 @@ static void test_ship_ridiculous_overload_bad(CuTest *tc) {
|
||||||
movement();
|
movement();
|
||||||
CuAssertTrue(tc, ship_damage_percent(fix.sh) > 99);
|
CuAssertTrue(tc, ship_damage_percent(fix.sh) > 99);
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(fix.f->msgs, "massive_overload"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(fix.f->msgs, "massive_overload"));
|
||||||
CuAssertPtrEquals(tc, 0, fix.sh->region);
|
CuAssertPtrEquals(tc, NULL, fix.sh->region);
|
||||||
CuAssertPtrNotNull(tc, test_find_messagetype(fix.f->msgs, "shipsink"));
|
CuAssertPtrNotNull(tc, test_find_messagetype(fix.f->msgs, "shipsink"));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ static void test_piracy_cmd(CuTest * tc) {
|
||||||
u->thisorder = create_order(K_PIRACY, f->locale, "%s", itoa36(u2->faction->no));
|
u->thisorder = create_order(K_PIRACY, f->locale, "%s", itoa36(u2->faction->no));
|
||||||
|
|
||||||
piracy_cmd(u);
|
piracy_cmd(u);
|
||||||
CuAssertPtrEquals(tc, 0, u->thisorder);
|
CuAssertPtrEquals(tc, NULL, u->thisorder);
|
||||||
CuAssertTrue(tc, u->region != r);
|
CuAssertTrue(tc, u->region != r);
|
||||||
CuAssertPtrEquals(tc, u2->region, u->region);
|
CuAssertPtrEquals(tc, u2->region, u->region);
|
||||||
CuAssertPtrEquals(tc, u2->region, u->ship->region);
|
CuAssertPtrEquals(tc, u2->region, u->ship->region);
|
||||||
|
@ -211,7 +211,7 @@ static void test_piracy_cmd_land_to_land(CuTest * tc) {
|
||||||
u->thisorder = create_order(K_PIRACY, f->locale, "%s", itoa36(target));
|
u->thisorder = create_order(K_PIRACY, f->locale, "%s", itoa36(target));
|
||||||
|
|
||||||
piracy_cmd(u);
|
piracy_cmd(u);
|
||||||
CuAssertPtrEquals(tc, 0, u->thisorder);
|
CuAssertPtrEquals(tc, NULL, u->thisorder);
|
||||||
CuAssertPtrEquals(tc, r, u->region);
|
CuAssertPtrEquals(tc, r, u->region);
|
||||||
|
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
@ -226,7 +226,7 @@ static void test_piracy_cmd_swimmer(CuTest * tc) {
|
||||||
r = pirate->region;
|
r = pirate->region;
|
||||||
|
|
||||||
piracy_cmd(pirate);
|
piracy_cmd(pirate);
|
||||||
CuAssertPtrEquals(tc, 0, pirate->thisorder);
|
CuAssertPtrEquals(tc, NULL, pirate->thisorder);
|
||||||
CuAssertTrue(tc, pirate->region != r);
|
CuAssertTrue(tc, pirate->region != r);
|
||||||
CuAssertPtrEquals(tc, victim->region, pirate->region);
|
CuAssertPtrEquals(tc, victim->region, pirate->region);
|
||||||
CuAssertPtrNotNullMsg(tc, "successful PIRACY message", test_find_messagetype(pirate->faction->msgs, "piratesawvictim"));
|
CuAssertPtrNotNullMsg(tc, "successful PIRACY message", test_find_messagetype(pirate->faction->msgs, "piratesawvictim"));
|
||||||
|
|
|
@ -11,17 +11,17 @@
|
||||||
|
|
||||||
static void test_add_prefix(CuTest *tc) {
|
static void test_add_prefix(CuTest *tc) {
|
||||||
test_setup();
|
test_setup();
|
||||||
CuAssertPtrEquals(tc, 0, race_prefixes);
|
CuAssertPtrEquals(tc, NULL, race_prefixes);
|
||||||
CuAssertIntEquals(tc, 0, add_raceprefix("sea"));
|
CuAssertIntEquals(tc, 0, add_raceprefix("sea"));
|
||||||
CuAssertPtrNotNull(tc, race_prefixes);
|
CuAssertPtrNotNull(tc, race_prefixes);
|
||||||
CuAssertStrEquals(tc, "sea", race_prefixes[0]);
|
CuAssertStrEquals(tc, "sea", race_prefixes[0]);
|
||||||
CuAssertPtrEquals(tc, 0, race_prefixes[1]);
|
CuAssertPtrEquals(tc, NULL, race_prefixes[1]);
|
||||||
CuAssertIntEquals(tc, 0, add_raceprefix("moon"));
|
CuAssertIntEquals(tc, 0, add_raceprefix("moon"));
|
||||||
CuAssertStrEquals(tc, "sea", race_prefixes[0]);
|
CuAssertStrEquals(tc, "sea", race_prefixes[0]);
|
||||||
CuAssertStrEquals(tc, "moon", race_prefixes[1]);
|
CuAssertStrEquals(tc, "moon", race_prefixes[1]);
|
||||||
CuAssertPtrEquals(tc, 0, race_prefixes[2]);
|
CuAssertPtrEquals(tc, NULL, race_prefixes[2]);
|
||||||
free_prefixes();
|
free_prefixes();
|
||||||
CuAssertPtrEquals(tc, 0, race_prefixes);
|
CuAssertPtrEquals(tc, NULL, race_prefixes);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ static void test_reorder_units(CuTest * tc)
|
||||||
CuAssertPtrEquals(tc, u2, u3->next);
|
CuAssertPtrEquals(tc, u2, u3->next);
|
||||||
CuAssertPtrEquals(tc, u1, u2->next);
|
CuAssertPtrEquals(tc, u1, u2->next);
|
||||||
CuAssertPtrEquals(tc, u0, u1->next);
|
CuAssertPtrEquals(tc, u0, u1->next);
|
||||||
CuAssertPtrEquals(tc, 0, u0->next);
|
CuAssertPtrEquals(tc, NULL, u0->next);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,19 +130,19 @@ static void test_sparagraph(CuTest *tc) {
|
||||||
split_paragraph(&sp, "Hello World", 0, 16, 0);
|
split_paragraph(&sp, "Hello World", 0, 16, 0);
|
||||||
CuAssertPtrNotNull(tc, sp);
|
CuAssertPtrNotNull(tc, sp);
|
||||||
CuAssertStrEquals(tc, "Hello World", sp->s);
|
CuAssertStrEquals(tc, "Hello World", sp->s);
|
||||||
CuAssertPtrEquals(tc, 0, sp->next);
|
CuAssertPtrEquals(tc, NULL, sp->next);
|
||||||
freestrlist(sp);
|
freestrlist(sp);
|
||||||
|
|
||||||
split_paragraph(&sp, "Hello World", 4, 16, 0);
|
split_paragraph(&sp, "Hello World", 4, 16, 0);
|
||||||
CuAssertPtrNotNull(tc, sp);
|
CuAssertPtrNotNull(tc, sp);
|
||||||
CuAssertStrEquals(tc, " Hello World", sp->s);
|
CuAssertStrEquals(tc, " Hello World", sp->s);
|
||||||
CuAssertPtrEquals(tc, 0, sp->next);
|
CuAssertPtrEquals(tc, NULL, sp->next);
|
||||||
freestrlist(sp);
|
freestrlist(sp);
|
||||||
|
|
||||||
split_paragraph(&sp, "Hello World", 4, 16, '*');
|
split_paragraph(&sp, "Hello World", 4, 16, '*');
|
||||||
CuAssertPtrNotNull(tc, sp);
|
CuAssertPtrNotNull(tc, sp);
|
||||||
CuAssertStrEquals(tc, " * Hello World", sp->s);
|
CuAssertStrEquals(tc, " * Hello World", sp->s);
|
||||||
CuAssertPtrEquals(tc, 0, sp->next);
|
CuAssertPtrEquals(tc, NULL, sp->next);
|
||||||
freestrlist(sp);
|
freestrlist(sp);
|
||||||
|
|
||||||
split_paragraph(&sp, "12345678 90 12345678", 0, 8, '*');
|
split_paragraph(&sp, "12345678 90 12345678", 0, 8, '*');
|
||||||
|
@ -152,7 +152,7 @@ static void test_sparagraph(CuTest *tc) {
|
||||||
CuAssertStrEquals(tc, "90", sp->next->s);
|
CuAssertStrEquals(tc, "90", sp->next->s);
|
||||||
CuAssertPtrNotNull(tc, sp->next->next);
|
CuAssertPtrNotNull(tc, sp->next->next);
|
||||||
CuAssertStrEquals(tc, "12345678", sp->next->next->s);
|
CuAssertStrEquals(tc, "12345678", sp->next->next->s);
|
||||||
CuAssertPtrEquals(tc, 0, sp->next->next->next);
|
CuAssertPtrEquals(tc, NULL, sp->next->next->next);
|
||||||
freestrlist(sp);
|
freestrlist(sp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -326,7 +326,7 @@ static void test_arg_resources(CuTest *tc) {
|
||||||
CuAssertPtrNotNull(tc, res = res->next);
|
CuAssertPtrNotNull(tc, res = res->next);
|
||||||
CuAssertPtrEquals(tc, itype->rtype, (void *)res->type);
|
CuAssertPtrEquals(tc, itype->rtype, (void *)res->type);
|
||||||
CuAssertIntEquals(tc, 5, res->number);
|
CuAssertIntEquals(tc, 5, res->number);
|
||||||
CuAssertPtrEquals(tc, 0, res->next);
|
CuAssertPtrEquals(tc, NULL, res->next);
|
||||||
atype->release(v2);
|
atype->release(v2);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
@ -340,7 +340,7 @@ static void test_newbie_password_message(CuTest *tc) {
|
||||||
f->flags = 0;
|
f->flags = 0;
|
||||||
prepare_report(&ctx, f);
|
prepare_report(&ctx, f);
|
||||||
CuAssertIntEquals(tc, 0, f->flags&FFL_PWMSG);
|
CuAssertIntEquals(tc, 0, f->flags&FFL_PWMSG);
|
||||||
CuAssertPtrEquals(tc, 0, test_find_messagetype(f->msgs, "changepasswd"));
|
CuAssertPtrEquals(tc, NULL, test_find_messagetype(f->msgs, "changepasswd"));
|
||||||
f->age=2;
|
f->age=2;
|
||||||
prepare_report(&ctx, f);
|
prepare_report(&ctx, f);
|
||||||
CuAssertIntEquals(tc, FFL_PWMSG, f->flags&FFL_PWMSG);
|
CuAssertIntEquals(tc, FFL_PWMSG, f->flags&FFL_PWMSG);
|
||||||
|
@ -511,7 +511,7 @@ void test_prepare_lighthouse_capacity(CuTest *tc) {
|
||||||
|
|
||||||
prepare_report(&ctx, u2->faction);
|
prepare_report(&ctx, u2->faction);
|
||||||
CuAssertPtrEquals(tc, r1, ctx.first);
|
CuAssertPtrEquals(tc, r1, ctx.first);
|
||||||
CuAssertPtrEquals(tc, 0, ctx.last);
|
CuAssertPtrEquals(tc, NULL, ctx.last);
|
||||||
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
|
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
|
||||||
CuAssertIntEquals(tc, seen_neighbour, r2->seen.mode);
|
CuAssertIntEquals(tc, seen_neighbour, r2->seen.mode);
|
||||||
finish_reports(&ctx);
|
finish_reports(&ctx);
|
||||||
|
@ -520,7 +520,7 @@ void test_prepare_lighthouse_capacity(CuTest *tc) {
|
||||||
config_set_int("rules.lighthouse.unit_capacity", 1);
|
config_set_int("rules.lighthouse.unit_capacity", 1);
|
||||||
prepare_report(&ctx, u2->faction);
|
prepare_report(&ctx, u2->faction);
|
||||||
CuAssertPtrEquals(tc, r1, ctx.first);
|
CuAssertPtrEquals(tc, r1, ctx.first);
|
||||||
CuAssertPtrEquals(tc, 0, ctx.last);
|
CuAssertPtrEquals(tc, NULL, ctx.last);
|
||||||
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
|
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
|
||||||
CuAssertIntEquals(tc, seen_lighthouse, r2->seen.mode);
|
CuAssertIntEquals(tc, seen_lighthouse, r2->seen.mode);
|
||||||
finish_reports(&ctx);
|
finish_reports(&ctx);
|
||||||
|
@ -619,15 +619,15 @@ static void test_prepare_report(CuTest *tc) {
|
||||||
r = test_create_region(0, 0, NULL);
|
r = test_create_region(0, 0, NULL);
|
||||||
|
|
||||||
prepare_report(&ctx, f);
|
prepare_report(&ctx, f);
|
||||||
CuAssertPtrEquals(tc, 0, ctx.first);
|
CuAssertPtrEquals(tc, NULL, ctx.first);
|
||||||
CuAssertPtrEquals(tc, 0, ctx.last);
|
CuAssertPtrEquals(tc, NULL, ctx.last);
|
||||||
CuAssertIntEquals(tc, seen_none, r->seen.mode);
|
CuAssertIntEquals(tc, seen_none, r->seen.mode);
|
||||||
finish_reports(&ctx);
|
finish_reports(&ctx);
|
||||||
|
|
||||||
test_create_unit(f, r);
|
test_create_unit(f, r);
|
||||||
prepare_report(&ctx, f);
|
prepare_report(&ctx, f);
|
||||||
CuAssertPtrEquals(tc, r, ctx.first);
|
CuAssertPtrEquals(tc, r, ctx.first);
|
||||||
CuAssertPtrEquals(tc, 0, ctx.last);
|
CuAssertPtrEquals(tc, NULL, ctx.last);
|
||||||
CuAssertIntEquals(tc, seen_unit, r->seen.mode);
|
CuAssertIntEquals(tc, seen_unit, r->seen.mode);
|
||||||
finish_reports(&ctx);
|
finish_reports(&ctx);
|
||||||
CuAssertIntEquals(tc, seen_none, r->seen.mode);
|
CuAssertIntEquals(tc, seen_none, r->seen.mode);
|
||||||
|
@ -655,7 +655,7 @@ static void test_seen_neighbours(CuTest *tc) {
|
||||||
test_create_unit(f, r1);
|
test_create_unit(f, r1);
|
||||||
prepare_report(&ctx, f);
|
prepare_report(&ctx, f);
|
||||||
CuAssertPtrEquals(tc, r1, ctx.first);
|
CuAssertPtrEquals(tc, r1, ctx.first);
|
||||||
CuAssertPtrEquals(tc, 0, ctx.last);
|
CuAssertPtrEquals(tc, NULL, ctx.last);
|
||||||
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
|
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
|
||||||
CuAssertIntEquals(tc, seen_neighbour, r2->seen.mode);
|
CuAssertIntEquals(tc, seen_neighbour, r2->seen.mode);
|
||||||
finish_reports(&ctx);
|
finish_reports(&ctx);
|
||||||
|
@ -682,7 +682,7 @@ static void test_seen_travelthru(CuTest *tc) {
|
||||||
CuAssertPtrEquals(tc, r3, f->last);
|
CuAssertPtrEquals(tc, r3, f->last);
|
||||||
prepare_report(&ctx, f);
|
prepare_report(&ctx, f);
|
||||||
CuAssertPtrEquals(tc, r1, ctx.first);
|
CuAssertPtrEquals(tc, r1, ctx.first);
|
||||||
CuAssertPtrEquals(tc, 0, ctx.last);
|
CuAssertPtrEquals(tc, NULL, ctx.last);
|
||||||
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
|
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
|
||||||
CuAssertIntEquals(tc, seen_travel, r2->seen.mode);
|
CuAssertIntEquals(tc, seen_travel, r2->seen.mode);
|
||||||
CuAssertIntEquals(tc, seen_neighbour, r3->seen.mode);
|
CuAssertIntEquals(tc, seen_neighbour, r3->seen.mode);
|
||||||
|
@ -760,7 +760,7 @@ static void test_report_far_vision(CuTest *tc) {
|
||||||
report_context ctx;
|
report_context ctx;
|
||||||
prepare_report(&ctx, f);
|
prepare_report(&ctx, f);
|
||||||
CuAssertPtrEquals(tc, r1, ctx.first);
|
CuAssertPtrEquals(tc, r1, ctx.first);
|
||||||
CuAssertPtrEquals(tc, 0, ctx.last);
|
CuAssertPtrEquals(tc, NULL, ctx.last);
|
||||||
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
|
CuAssertIntEquals(tc, seen_unit, r1->seen.mode);
|
||||||
CuAssertIntEquals(tc, seen_spell, r2->seen.mode);
|
CuAssertIntEquals(tc, seen_spell, r2->seen.mode);
|
||||||
finish_reports(&ctx);
|
finish_reports(&ctx);
|
||||||
|
|
|
@ -272,7 +272,7 @@ static void test_sabotage_other_success(CuTest *tc) {
|
||||||
assert(ord);
|
assert(ord);
|
||||||
set_level(u2, SK_SPY, 1);
|
set_level(u2, SK_SPY, 1);
|
||||||
CuAssertIntEquals(tc, 0, sabotage_cmd(u2, ord));
|
CuAssertIntEquals(tc, 0, sabotage_cmd(u2, ord));
|
||||||
CuAssertPtrEquals(tc, 0, r->ships);
|
CuAssertPtrEquals(tc, NULL, r->ships);
|
||||||
free_order(ord);
|
free_order(ord);
|
||||||
test_teardown();
|
test_teardown();
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,13 +23,13 @@ static void test_resources(CuTest *tc) {
|
||||||
CuAssertPtrNotNull(tc, rt_find("permaura"));
|
CuAssertPtrNotNull(tc, rt_find("permaura"));
|
||||||
CuAssertPtrEquals(tc, rt_find("permaura"), (void *)get_resourcetype(R_PERMAURA));
|
CuAssertPtrEquals(tc, rt_find("permaura"), (void *)get_resourcetype(R_PERMAURA));
|
||||||
|
|
||||||
CuAssertPtrEquals(tc, 0, rt_find("stone"));
|
CuAssertPtrEquals(tc, NULL, rt_find("stone"));
|
||||||
rtype = rt_get_or_create("stone");
|
rtype = rt_get_or_create("stone");
|
||||||
CuAssertPtrEquals(tc, (void *)rtype, (void *)rt_find("stone"));
|
CuAssertPtrEquals(tc, (void *)rtype, (void *)rt_find("stone"));
|
||||||
CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE));
|
CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE));
|
||||||
free_resources();
|
free_resources();
|
||||||
CuAssertPtrEquals(tc, 0, rt_find("stone"));
|
CuAssertPtrEquals(tc, NULL, rt_find("stone"));
|
||||||
CuAssertPtrEquals(tc, 0, rt_find("peasant"));
|
CuAssertPtrEquals(tc, NULL, rt_find("peasant"));
|
||||||
rtype = rt_get_or_create("stone");
|
rtype = rt_get_or_create("stone");
|
||||||
CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE));
|
CuAssertPtrEquals(tc, (void *)rtype, (void *)get_resourcetype(R_STONE));
|
||||||
test_teardown();
|
test_teardown();
|
||||||
|
|
Loading…
Reference in a new issue