INVALID if results without PARAMETRIZE

This commit is contained in:
Martin Griffin 2023-04-26 11:38:52 +01:00
parent 29fa6ba574
commit efab893c47
6 changed files with 21 additions and 15 deletions

View File

@ -33,10 +33,13 @@ SINGLE_BATTLE_TEST("Dry Skin heals 1/8th Max HP in Rain")
SINGLE_BATTLE_TEST("Dry Skin increases damage taken from Fire-type moves by 25%", s16 damage) SINGLE_BATTLE_TEST("Dry Skin increases damage taken from Fire-type moves by 25%", s16 damage)
{ {
u32 ability;
PARAMETRIZE { ability = ABILITY_EFFECT_SPORE; }
PARAMETRIZE { ability = ABILITY_DRY_SKIN; }
GIVEN { GIVEN {
ASSUME(gBattleMoves[MOVE_EMBER].type == TYPE_FIRE); ASSUME(gBattleMoves[MOVE_EMBER].type == TYPE_FIRE);
PLAYER(SPECIES_WOBBUFFET); PLAYER(SPECIES_WOBBUFFET);
OPPONENT(SPECIES_PARASECT) { Ability(ABILITY_DRY_SKIN); }; OPPONENT(SPECIES_PARASECT) { Ability(ability); };
} WHEN { } WHEN {
TURN {MOVE(player, MOVE_EMBER); } TURN {MOVE(player, MOVE_EMBER); }
} SCENE { } SCENE {

View File

@ -63,8 +63,9 @@ SINGLE_BATTLE_TEST("Volt Absorb is only triggered once on multi strike moves")
} }
} }
DOUBLE_BATTLE_TEST("Volt Absorb does not stop Electric Typed Explosion from damaging other pokemon", s16 damage1, s16 damage2) // Fixed issue #1961 DOUBLE_BATTLE_TEST("Volt Absorb does not stop Electric Typed Explosion from damaging other pokemon") // Fixed issue #1961
{ {
s16 damage1, damage2;
GIVEN { GIVEN {
ASSUME(gBattleMoves[MOVE_EXPLOSION].effect == EFFECT_EXPLOSION); ASSUME(gBattleMoves[MOVE_EXPLOSION].effect == EFFECT_EXPLOSION);
ASSUME(gBattleMoves[MOVE_EXPLOSION].type == TYPE_NORMAL); ASSUME(gBattleMoves[MOVE_EXPLOSION].type == TYPE_NORMAL);
@ -78,11 +79,11 @@ DOUBLE_BATTLE_TEST("Volt Absorb does not stop Electric Typed Explosion from dama
ABILITY_POPUP(playerLeft, ABILITY_VOLT_ABSORB); ABILITY_POPUP(playerLeft, ABILITY_VOLT_ABSORB);
HP_BAR(playerLeft, hp: TEST_MAX_HP / 4 + 1); HP_BAR(playerLeft, hp: TEST_MAX_HP / 4 + 1);
MESSAGE("Jolteon restored HP using its Volt Absorb!"); MESSAGE("Jolteon restored HP using its Volt Absorb!");
HP_BAR(playerRight, captureDamage: &results->damage1); HP_BAR(playerRight, captureDamage: &damage1);
HP_BAR(opponentRight, captureDamage: &results->damage2); HP_BAR(opponentRight, captureDamage: &damage2);
} THEN { } THEN {
EXPECT_NE(results[0].damage1, 0); EXPECT_NE(damage1, 0);
EXPECT_NE(results[0].damage2, 0); EXPECT_NE(damage2, 0);
} }
} }

View File

@ -9,8 +9,8 @@ ASSUMPTIONS
SINGLE_BATTLE_TEST("Mirror Herb copies all of foe's stat changes in a turn", s16 damage) SINGLE_BATTLE_TEST("Mirror Herb copies all of foe's stat changes in a turn", s16 damage)
{ {
u32 item; u32 item;
PARAMETRIZE{ item = ITEM_NONE; } PARAMETRIZE { item = ITEM_NONE; }
PARAMETRIZE{ item = ITEM_MIRROR_HERB; } PARAMETRIZE { item = ITEM_MIRROR_HERB; }
GIVEN { GIVEN {
PLAYER(SPECIES_WOBBUFFET) { Speed(4); } PLAYER(SPECIES_WOBBUFFET) { Speed(4); }
OPPONENT(SPECIES_WOBBUFFET) { Speed(5); Item(item); } OPPONENT(SPECIES_WOBBUFFET) { Speed(5); Item(item); }
@ -34,7 +34,7 @@ SINGLE_BATTLE_TEST("Mirror Herb copies all of foe's stat changes in a turn", s16
} }
} }
SINGLE_BATTLE_TEST("Mirror Herb copies all of of Stuff Cheeks", s16 damage) SINGLE_BATTLE_TEST("Mirror Herb copies all of of Stuff Cheeks")
{ {
GIVEN { GIVEN {
ASSUME(gItems[ITEM_LIECHI_BERRY].holdEffect == HOLD_EFFECT_ATTACK_UP); ASSUME(gItems[ITEM_LIECHI_BERRY].holdEffect == HOLD_EFFECT_ATTACK_UP);

View File

@ -126,7 +126,7 @@ SINGLE_BATTLE_TEST("X Speed sharply raises battler's Speed stat", s16 damage)
} }
} }
SINGLE_BATTLE_TEST("X Accuracy sharply raises battler's Accuracy stat", s16 damage) SINGLE_BATTLE_TEST("X Accuracy sharply raises battler's Accuracy stat")
{ {
ASSUME(gBattleMoves[MOVE_SING].accuracy == 55); ASSUME(gBattleMoves[MOVE_SING].accuracy == 55);

View File

@ -61,7 +61,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain increases power of Psychic-type moves by 30/
} }
} }
SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target the user", s16 damage) SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target the user")
{ {
GIVEN { GIVEN {
PLAYER(SPECIES_SABLEYE) { Ability(ABILITY_PRANKSTER); HP(1); } PLAYER(SPECIES_SABLEYE) { Ability(ABILITY_PRANKSTER); HP(1); }
@ -76,7 +76,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target the
} }
} }
SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all battlers", s16 damage) SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all battlers")
{ {
KNOWN_FAILING; KNOWN_FAILING;
GIVEN { GIVEN {
@ -91,7 +91,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all
} }
} }
SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all opponents", s16 damage) SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all opponents")
{ {
KNOWN_FAILING; KNOWN_FAILING;
GIVEN { GIVEN {
@ -106,7 +106,7 @@ SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all
} }
} }
DOUBLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target allies", s16 damage) DOUBLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target allies")
{ {
GIVEN { GIVEN {
PLAYER(SPECIES_SABLEYE) { Ability(ABILITY_PRANKSTER); } PLAYER(SPECIES_SABLEYE) { Ability(ABILITY_PRANKSTER); }
@ -122,7 +122,7 @@ DOUBLE_BATTLE_TEST("Psychic Terrain doesn't block priority moves that target all
} }
} }
SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority field moves", s16 damage) SINGLE_BATTLE_TEST("Psychic Terrain doesn't block priority field moves")
{ {
KNOWN_FAILING; KNOWN_FAILING;
GIVEN { GIVEN {

View File

@ -134,6 +134,8 @@ static void BattleTest_SetUp(void *data)
Test_ExitWithResult(TEST_RESULT_ERROR, "OOM: STATE = AllocZerod(%d)", sizeof(*STATE)); Test_ExitWithResult(TEST_RESULT_ERROR, "OOM: STATE = AllocZerod(%d)", sizeof(*STATE));
InvokeTestFunction(test); InvokeTestFunction(test);
STATE->parameters = STATE->parametersCount; STATE->parameters = STATE->parametersCount;
if (STATE->parametersCount == 0 && test->resultsSize > 0)
Test_ExitWithResult(TEST_RESULT_INVALID, "results without PARAMETRIZE");
STATE->results = AllocZeroed(test->resultsSize * STATE->parameters); STATE->results = AllocZeroed(test->resultsSize * STATE->parameters);
if (!STATE->results) if (!STATE->results)
Test_ExitWithResult(TEST_RESULT_ERROR, "OOM: STATE->results = AllocZerod(%d)", sizeof(test->resultsSize * STATE->parameters)); Test_ExitWithResult(TEST_RESULT_ERROR, "OOM: STATE->results = AllocZerod(%d)", sizeof(test->resultsSize * STATE->parameters));