Skip to content

Commit

Permalink
Organized tests into subfolders (#2822)
Browse files Browse the repository at this point in the history
  • Loading branch information
AsparagusEduardo authored Aug 12, 2023
1 parent ada2931 commit d62c0d6
Show file tree
Hide file tree
Showing 166 changed files with 527 additions and 489 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ $(OBJ_DIR)/sym_ewram.ld: sym_ewram.txt

# NOTE: Based on C_DEP above, but without NODEP and KEEP_TEMPS handling.
define TEST_DEP
$1: $2 $$(shell $(SCANINC) -I include -I tools/agbcc/include -I gflib -I test $2)
$1: $2 $$(shell $(SCANINC) -I include -I tools/agbcc/include -I gflib $2)
@echo "$$(CC1) <flags> -o $$@ $$<"
@$$(CPP) $$(CPPFLAGS) $$< | $$(PREPROC) $$< charmap.txt -i | $$(CC1) $$(CFLAGS) -o - - | cat - <(echo -e ".text\n\t.align\t2, 0") | $$(AS) $$(ASFLAGS) -o $$@ -
endef
Expand Down
3 changes: 2 additions & 1 deletion test/test_battle.h → include/test/battle.h
Original file line number Diff line number Diff line change
Expand Up @@ -447,13 +447,13 @@
#ifndef GUARD_TEST_BATTLE_H
#define GUARD_TEST_BATTLE_H

#include "global.h"
#include "battle.h"
#include "battle_anim.h"
#include "data.h"
#include "item.h"
#include "random.h"
#include "recorded_battle.h"
#include "test.h"
#include "util.h"
#include "constants/abilities.h"
#include "constants/battle_anim.h"
Expand All @@ -462,6 +462,7 @@
#include "constants/items.h"
#include "constants/moves.h"
#include "constants/species.h"
#include "test/test.h"

// NOTE: If the stack is too small the test runner will probably crash
// or loop.
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

ASSUMPTIONS
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

ASSUMPTIONS
{
Expand Down
2 changes: 1 addition & 1 deletion test/ability_blaze.c → test/battle/ability/blaze.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Blaze boosts Fire-type moves in a pinch", s16 damage)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Clear Body prevents intimidate")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Cloud Nine prevents weather effects")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Compound Eyes raises accuracy")
{
Expand Down
2 changes: 1 addition & 1 deletion test/ability_contrary.c → test/battle/ability/contrary.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

ASSUMPTIONS
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Cute Charm inflicts infatuation on contact")
{
Expand Down
2 changes: 1 addition & 1 deletion test/ability_damp.c → test/battle/ability/damp.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Damp prevents explosion-like moves from enemies")
{
Expand Down
62 changes: 1 addition & 61 deletions test/primal_weather.c → test/battle/ability/desolate_land.c
Original file line number Diff line number Diff line change
@@ -1,72 +1,12 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

ASSUMPTIONS
{
ASSUME(gBattleMoves[MOVE_EMBER].power != 0);
ASSUME(gBattleMoves[MOVE_EMBER].type == TYPE_FIRE);
ASSUME(gBattleMoves[MOVE_WATER_GUN].power != 0);
ASSUME(gBattleMoves[MOVE_WATER_GUN].type == TYPE_WATER);
}

SINGLE_BATTLE_TEST("Primordial Sea blocks damaging Fire-type moves")
{
GIVEN {
PLAYER(SPECIES_KYOGRE) {Item(ITEM_BLUE_ORB);}
OPPONENT(SPECIES_WOBBUFFET);
} WHEN {
TURN { MOVE(opponent, MOVE_EMBER); }
TURN { MOVE(opponent, MOVE_EMBER); }
} SCENE {
MESSAGE("Foe Wobbuffet used Ember!");
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_EMBER, opponent);
MESSAGE("The Fire-type attack fizzled out\nin the heavy rain!");
NOT HP_BAR(player);
MESSAGE("Foe Wobbuffet used Ember!");
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_EMBER, opponent);
MESSAGE("The Fire-type attack fizzled out\nin the heavy rain!");
NOT HP_BAR(player);
} THEN {
EXPECT_EQ(player->hp, player->maxHP);
}
}

DOUBLE_BATTLE_TEST("Primordial Sea blocks damaging Fire-type moves and prints the message only once with moves hitting multiple targets")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_ERUPTION].power != 0);
ASSUME(gBattleMoves[MOVE_ERUPTION].type == TYPE_FIRE);
ASSUME(gBattleMoves[MOVE_ERUPTION].target == MOVE_TARGET_BOTH);
PLAYER(SPECIES_KYOGRE) {Item(ITEM_BLUE_ORB); {Speed(5);}}
PLAYER(SPECIES_WOBBUFFET) {Speed(5);}
OPPONENT(SPECIES_WOBBUFFET) {Speed(10);}
OPPONENT(SPECIES_WOBBUFFET) {Speed(8);}
} WHEN {
TURN { MOVE(opponentLeft, MOVE_ERUPTION); }
} SCENE {
MESSAGE("Foe Wobbuffet used Eruption!");
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_ERUPTION, opponentLeft);
MESSAGE("The Fire-type attack fizzled out\nin the heavy rain!");
NOT MESSAGE("The Fire-type attack fizzled out\nin the heavy rain!");
} THEN {
EXPECT_EQ(playerLeft->hp, playerLeft->maxHP);
EXPECT_EQ(playerRight->hp, playerRight->maxHP);
}
}

SINGLE_BATTLE_TEST("Primordial Sea does not block a move if pokemon is asleep and uses a Fire-type move") // Sleep/confusion/paralysis all happen before the check for primal weather
{
GIVEN {
PLAYER(SPECIES_KYOGRE) {Item(ITEM_BLUE_ORB);}
OPPONENT(SPECIES_WOBBUFFET) {Status1(STATUS1_SLEEP);}
} WHEN {
TURN { MOVE(opponent, MOVE_EMBER); }
} SCENE {
NOT MESSAGE("The Fire-type attack fizzled out\nin the heavy rain!");
MESSAGE("Foe Wobbuffet is fast asleep.");
}
}

SINGLE_BATTLE_TEST("Desolate Land blocks damaging Water-type moves")
{
GIVEN {
Expand Down
2 changes: 1 addition & 1 deletion test/ability_download.c → test/battle/ability/download.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

ASSUMPTIONS
{
Expand Down
2 changes: 1 addition & 1 deletion test/ability_drizzle.c → test/battle/ability/drizzle.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Drizzle summons rain", s16 damage)
{
Expand Down
2 changes: 1 addition & 1 deletion test/ability_dry_skin.c → test/battle/ability/dry_skin.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Dry Skin causes 1/8th Max HP damage in Sun")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Electromorphosis sets up Charge when hit by any move")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Flame Body inflicts burn on contact")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Flower Gift transforms Cherrim in harsh sunlight")
{
Expand Down
2 changes: 1 addition & 1 deletion test/ability_forecast.c → test/battle/ability/forecast.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Forecast transforms Castform in weather from an opponent's move")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Full Metal Body prevents intimidate")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Hunger Switch switches Morpeko's forms at the end of the turn")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Hydration cures non-volatile Status conditions if it is raining")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Hyper Cutter prevents intimidate")
{
Expand Down
2 changes: 1 addition & 1 deletion test/ability_ice_body.c → test/battle/ability/ice_body.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Ice Body prevents damage from hail")
{
Expand Down
2 changes: 1 addition & 1 deletion test/ability_immunity.c → test/battle/ability/immunity.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Immunity prevents Poison Sting poison")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Inner Focus prevents intimidate")
{
Expand Down
2 changes: 1 addition & 1 deletion test/ability_insomnia.c → test/battle/ability/insomnia.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Insomnia prevents sleep")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

ASSUMPTIONS
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Leaf Guard prevents non-volatile status conditions in sun")
{
Expand Down
2 changes: 1 addition & 1 deletion test/ability_limber.c → test/battle/ability/limber.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Limber prevents paralysis")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"


SINGLE_BATTLE_TEST("Magic Bounce bounces back status moves")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

ASSUMPTIONS
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Oblivious prevents Infatuation")
{
Expand Down
21 changes: 21 additions & 0 deletions test/battle/ability/overcoat.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#include "global.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Overcoat blocks powder and spore moves")
{
GIVEN {
ASSUME(gBattleMoves[MOVE_STUN_SPORE].flags & FLAG_POWDER);
PLAYER(SPECIES_WYNAUT);
OPPONENT(SPECIES_PINECO) { Ability(ABILITY_OVERCOAT); }
} WHEN {
TURN { MOVE(player, MOVE_STUN_SPORE); }
} SCENE {
ABILITY_POPUP(opponent, ABILITY_OVERCOAT);
NOT ANIMATION(ANIM_TYPE_MOVE, MOVE_STUN_SPORE, player);
MESSAGE("It doesn't affect Foe Pineco…");
}
}

TO_DO_BATTLE_TEST("Overcoat blocks damage from hail");
TO_DO_BATTLE_TEST("Overcoat blocks damage from sandstorm");
TO_DO_BATTLE_TEST("Overcoat blocks Effect Spore's effect");
2 changes: 1 addition & 1 deletion test/ability_overgrow.c → test/battle/ability/overgrow.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Overgrow boosts Grass-type moves in a pinch", s16 damage)
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Own Tempo prevents intimidate")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Pastel Veil prevents Poison Sting poison")
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "global.h"
#include "test_battle.h"
#include "test/battle.h"

SINGLE_BATTLE_TEST("Poison Point inflicts poison on contact")
{
Expand Down
Loading

0 comments on commit d62c0d6

Please sign in to comment.