diff --git a/include/constants/pokemon.h b/include/constants/pokemon.h index ab0f6b845343..8e76a9aba440 100644 --- a/include/constants/pokemon.h +++ b/include/constants/pokemon.h @@ -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 diff --git a/src/move_relearner.c b/src/move_relearner.c index 7930ba15b621..d38dcedcf2da 100644 --- a/src/move_relearner.c +++ b/src/move_relearner.c @@ -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; diff --git a/test/pokemon.c b/test/pokemon.c index 00b08ebb79c7..ac2342f155c4 100644 --- a/test/pokemon.c +++ b/test/pokemon.c @@ -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 +}