scale_number test revised

This commit is contained in:
Enno Rehling 2017-11-26 15:06:52 +01:00
parent 38922d9205
commit 9188f6fbb6
1 changed files with 12 additions and 3 deletions

View File

@ -106,13 +106,22 @@ static void test_scale_number(CuTest *tc) {
ptype = new_potiontype(it_get_or_create(rt_get_or_create("hodor")), 1); ptype = new_potiontype(it_get_or_create(rt_get_or_create("hodor")), 1);
u = test_create_unit(test_create_faction(test_create_race("human")), findregion(0, 0)); u = test_create_unit(test_create_faction(test_create_race("human")), findregion(0, 0));
change_effect(u, ptype, 1); change_effect(u, ptype, 1);
u->hp = 35;
CuAssertIntEquals(tc, 1, u->number); CuAssertIntEquals(tc, 1, u->number);
CuAssertIntEquals(tc, 20, u->hp); CuAssertIntEquals(tc, 35, u->hp);
CuAssertIntEquals(tc, 1, get_effect(u, ptype)); CuAssertIntEquals(tc, 1, get_effect(u, ptype));
scale_number(u, 2); scale_number(u, 2);
CuAssertIntEquals(tc, 2, u->number); CuAssertIntEquals(tc, 2, u->number);
CuAssertIntEquals(tc, 40, u->hp); CuAssertIntEquals(tc, 35 * u->number, u->hp);
CuAssertIntEquals(tc, 2, get_effect(u, ptype)); CuAssertIntEquals(tc, u->number, get_effect(u, ptype));
scale_number(u, 8237);
CuAssertIntEquals(tc, 8237, u->number);
CuAssertIntEquals(tc, 35 * u->number, u->hp);
CuAssertIntEquals(tc, u->number, get_effect(u, ptype));
scale_number(u, 8100);
CuAssertIntEquals(tc, 8100, u->number);
CuAssertIntEquals(tc, 35 * u->number, u->hp);
CuAssertIntEquals(tc, u->number, get_effect(u, ptype));
set_level(u, SK_ALCHEMY, 1); set_level(u, SK_ALCHEMY, 1);
scale_number(u, 0); scale_number(u, 0);
CuAssertIntEquals(tc, 0, get_level(u, SK_ALCHEMY)); CuAssertIntEquals(tc, 0, get_level(u, SK_ALCHEMY));