From 393bed069a94744cc27deb52f0c9f221761d0754 Mon Sep 17 00:00:00 2001 From: Eduardo Quezada Date: Wed, 11 Jun 2025 03:13:37 -0400 Subject: [PATCH] Wrote some missing tests (#7094) --- test/battle/move_effect/acupressure.c | 2 +- test/battle/move_effect/blizzard.c | 4 --- test/battle/move_effect/bulk_up.c | 20 +++++++++++++- test/battle/move_effect/calm_mind.c | 20 +++++++++++++- test/battle/move_effect/expanding_force.c | 26 ++++++++++++++++++- .../move_flags/always_hits_in_hail_snow.c | 1 + 6 files changed, 65 insertions(+), 8 deletions(-) delete mode 100644 test/battle/move_effect/blizzard.c diff --git a/test/battle/move_effect/acupressure.c b/test/battle/move_effect/acupressure.c index 02be60725d..6eaade94ae 100644 --- a/test/battle/move_effect/acupressure.c +++ b/test/battle/move_effect/acupressure.c @@ -1,7 +1,7 @@ #include "global.h" #include "test/battle.h" -TO_DO_BATTLE_TEST("Acupressure increases one of two stats by 2 stages at random"); +TO_DO_BATTLE_TEST("Acupressure increases one of its stats by 2 stages at random"); TO_DO_BATTLE_TEST("Acupressure doesn't try to increase a stat that has been maximized"); TO_DO_BATTLE_TEST("Acupressure fails on the user if all of its stats are maximized"); TO_DO_BATTLE_TEST("Acupressure fails on the ally if all of its stats are maximized"); diff --git a/test/battle/move_effect/blizzard.c b/test/battle/move_effect/blizzard.c deleted file mode 100644 index 1e566f98fc..0000000000 --- a/test/battle/move_effect/blizzard.c +++ /dev/null @@ -1,4 +0,0 @@ -#include "global.h" -#include "test/battle.h" - -TO_DO_BATTLE_TEST("Blizzard ignores accuracy check durin Hail and Snow"); diff --git a/test/battle/move_effect/bulk_up.c b/test/battle/move_effect/bulk_up.c index 7f47d5d48e..be0536f4ca 100644 --- a/test/battle/move_effect/bulk_up.c +++ b/test/battle/move_effect/bulk_up.c @@ -1,4 +1,22 @@ #include "global.h" #include "test/battle.h" -TO_DO_BATTLE_TEST("Bulk Up increases the user's Attack and Defense"); +ASSUMPTIONS +{ + ASSUME(GetMoveEffect(MOVE_BULK_UP) == EFFECT_BULK_UP); +} + +SINGLE_BATTLE_TEST("Bulk Up increases the user's Attack and Defense by 1 stage each") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_BULK_UP); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_BULK_UP, player); + } THEN { + EXPECT_EQ(player->statStages[STAT_ATK], DEFAULT_STAT_STAGE + 1); + EXPECT_EQ(player->statStages[STAT_DEF], DEFAULT_STAT_STAGE + 1); + } +} diff --git a/test/battle/move_effect/calm_mind.c b/test/battle/move_effect/calm_mind.c index 66c16361f4..3b2ba76113 100644 --- a/test/battle/move_effect/calm_mind.c +++ b/test/battle/move_effect/calm_mind.c @@ -1,4 +1,22 @@ #include "global.h" #include "test/battle.h" -TO_DO_BATTLE_TEST("Calm Mind increases the user's Sp. Attack and Sp. Defense by 1 stage each"); +ASSUMPTIONS +{ + ASSUME(GetMoveEffect(MOVE_CALM_MIND) == EFFECT_CALM_MIND); +} + +SINGLE_BATTLE_TEST("Calm Mind increases the user's Sp. Attack and Sp. Defense by 1 stage each") +{ + GIVEN { + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + TURN { MOVE(player, MOVE_CALM_MIND); } + } SCENE { + ANIMATION(ANIM_TYPE_MOVE, MOVE_CALM_MIND, player); + } THEN { + EXPECT_EQ(player->statStages[STAT_SPATK], DEFAULT_STAT_STAGE + 1); + EXPECT_EQ(player->statStages[STAT_SPDEF], DEFAULT_STAT_STAGE + 1); + } +} diff --git a/test/battle/move_effect/expanding_force.c b/test/battle/move_effect/expanding_force.c index 74b78fdd86..7b0284390b 100644 --- a/test/battle/move_effect/expanding_force.c +++ b/test/battle/move_effect/expanding_force.c @@ -1,4 +1,28 @@ #include "global.h" #include "test/battle.h" -TO_DO_BATTLE_TEST("Expanding Force's power increases by 50% if the user is affected by Psychic Terrain"); +SINGLE_BATTLE_TEST("Expanding Force's power increases by 50% if the user is affected by Psychic Terrain", s16 damage) +{ + bool32 terrain; + PARAMETRIZE { terrain = FALSE; } + PARAMETRIZE { terrain = TRUE; } + GIVEN { + ASSUME(GetMoveEffect(MOVE_EXPANDING_FORCE) == EFFECT_EXPANDING_FORCE); + PLAYER(SPECIES_WOBBUFFET); + OPPONENT(SPECIES_WOBBUFFET); + } WHEN { + if (terrain) + TURN { MOVE(player, MOVE_PSYCHIC_TERRAIN); } + TURN { MOVE(player, MOVE_EXPANDING_FORCE); } + } SCENE { + MESSAGE("Wobbuffet used Expanding Force!"); + HP_BAR(opponent, captureDamage: &results[i].damage); + } FINALLY { + if (B_TERRAIN_TYPE_BOOST >= GEN_8) + // 1.3 Terrain boost x 1.5 effect boost = 1.95 boost + EXPECT_MUL_EQ(results[0].damage, Q_4_12(1.95), results[1].damage); + else + // 1.5 Terrain boost x 1.5 effect boost = 2.25 boost + EXPECT_MUL_EQ(results[0].damage, Q_4_12(2.25), results[1].damage); + } +} diff --git a/test/battle/move_flags/always_hits_in_hail_snow.c b/test/battle/move_flags/always_hits_in_hail_snow.c index 5673c0df8a..788186e7b5 100644 --- a/test/battle/move_flags/always_hits_in_hail_snow.c +++ b/test/battle/move_flags/always_hits_in_hail_snow.c @@ -6,6 +6,7 @@ SINGLE_BATTLE_TEST("Blizzard bypasses accuracy checks in Hail and Snow") u32 move; PARAMETRIZE { move = MOVE_HAIL; } PARAMETRIZE { move = MOVE_SNOWSCAPE; } + PASSES_RANDOMLY(100, 100, RNG_ACCURACY); GIVEN { ASSUME(GetMoveAccuracy(MOVE_BLIZZARD) == 70); ASSUME(MoveAlwaysHitsInHailSnow(MOVE_BLIZZARD));