Skip to content

Commit

Permalink
Add known failing learnset cap test (#6046)
Browse files Browse the repository at this point in the history
  • Loading branch information
Bassoonian authored Jan 18, 2025
1 parent 17e2243 commit 199760a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/constants/pokemon.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@
#define LEVEL_UP_MOVE_END 0xFFFF

#define MAX_LEVEL_UP_MOVES 20
#define MAX_RELEARNER_MOVES max(MAX_LEVEL_UP_MOVES, 25)

#define MON_MALE 0x00
#define MON_FEMALE 0xFE
Expand Down
2 changes: 0 additions & 2 deletions src/move_relearner.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,6 @@ enum {
#define GFXTAG_UI 5525
#define PALTAG_UI 5526

#define MAX_RELEARNER_MOVES max(MAX_LEVEL_UP_MOVES, 25)

static EWRAM_DATA struct
{
u8 state;
Expand Down
20 changes: 20 additions & 0 deletions test/pokemon.c
Original file line number Diff line number Diff line change
Expand Up @@ -399,3 +399,23 @@ TEST("createmon [simple]")
EXPECT_EQ(GetMonData(&gEnemyParty[1], MON_DATA_SPECIES), SPECIES_WYNAUT);
EXPECT_EQ(GetMonData(&gEnemyParty[1], MON_DATA_LEVEL), 10);
}

TEST("Pokémon level up learnsets fit within MAX_LEVEL_UP_MOVES and MAX_RELEARNER_MOVES")
{
KNOWN_FAILING;

u32 j, count, species = 0;
const struct LevelUpMove *learnset;

for(j = 0; j < SPECIES_EGG; j++)
{
PARAMETRIZE { species = j; }
}

learnset = GetSpeciesLevelUpLearnset(species);
count = 0;
for (j = 0; learnset[j].move != LEVEL_UP_MOVE_END; j++)
count++;
EXPECT_LT(count, MAX_LEVEL_UP_MOVES);
EXPECT_LT(count, MAX_RELEARNER_MOVES - 1); // - 1 because at least one move is already known
}

0 comments on commit 199760a

Please sign in to comment.