From 416519220d54006eae2ca448c2315c6e84432efa Mon Sep 17 00:00:00 2001 From: Bassoonian Date: Wed, 12 Jun 2024 21:52:04 +0200 Subject: [PATCH] Add evolution tracker check tests (#4771) --- test/species.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/test/species.c b/test/species.c index 02827ba9c745..3ad7495d236b 100644 --- a/test/species.c +++ b/test/species.c @@ -85,3 +85,47 @@ TEST("Form change targets have the appropriate species flags") } } } + +TEST("No species has two evolutions that use the evolution tracker") +{ + u32 i; + u32 species = SPECIES_NONE; + u32 evolutionTrackerEvolutions; + bool32 hasGenderBasedRecoil; + const struct Evolution *evolutions; + + for (i = 0; i < NUM_SPECIES; i++) + { + if (GetSpeciesEvolutions(i) != NULL) PARAMETRIZE { species = i; } + } + + evolutionTrackerEvolutions = 0; + hasGenderBasedRecoil = FALSE; + evolutions = GetSpeciesEvolutions(species); + + for (i = 0; evolutions[i].method != EVOLUTIONS_END; i++) + { + if (evolutions[i].method == EVO_LEVEL_MOVE_TWENTY_TIMES + #ifdef EVO_DEFEAT_WITH_ITEM + || evolutions[i].method == EVO_DEFEAT_WITH_ITEM + #endif //EVO_DEFEAT_WITH_ITEM + #ifdef EVO_OVERWORLD_STEPS + || evolutions[i].method == EVO_OVERWORLD_STEPS + #endif //EVO_OVERWORLD_STEPS + ) + evolutionTrackerEvolutions++; + + if (evolutions[i].method == EVO_LEVEL_RECOIL_DAMAGE_MALE + || evolutions[i].method == EVO_LEVEL_RECOIL_DAMAGE_FEMALE) + { + // Special handling for these since they can be combined as the evolution tracker field is used for the same purpose + if (!hasGenderBasedRecoil) + { + hasGenderBasedRecoil = TRUE; + evolutionTrackerEvolutions++; + } + } + } + + EXPECT(evolutionTrackerEvolutions < 2); +}