pokeemerald-expansion/test/save.c
Bassoonian 9fa6cd6a4c
Some checks are pending
CI / build (push) Waiting to run
CI / allcontributors (push) Waiting to run
Docs / deploy (push) Waiting to run
Add test to detect save file shifting (#8030)
2025-10-25 14:38:58 +02:00

36 lines
1017 B
C

#include "global.h"
#include "pokemon_storage_system.h"
#include "test/test.h"
// If you would like to ensure save compatibility, update the values below with those for your hack. You can find these through the debug menu.
// Please note that this simple check is not 100% foolproof, but should be able to catch most unintended shifts.
#define T_SAVEBLOCK1_SIZE 15568
#define T_SAVEBLOCK2_SIZE 3884
#define T_SAVEBLOCK3_SIZE 4
#define T_POKEMONSTORAGE_SIZE 34144
TEST("SaveBlock1 is backwards compatible")
{
EXPECT_EQ(sizeof(struct SaveBlock1), T_SAVEBLOCK1_SIZE);
}
TEST("SaveBlock2 is backwards compatible")
{
EXPECT_EQ(sizeof(struct SaveBlock2), T_SAVEBLOCK2_SIZE);
}
TEST("SaveBlock3 is backwards compatible")
{
EXPECT_EQ(sizeof(struct SaveBlock3), T_SAVEBLOCK3_SIZE);
}
TEST("PokemonStorage is backwards compatible")
{
EXPECT_EQ(sizeof(struct PokemonStorage), T_POKEMONSTORAGE_SIZE);
}
#undef T_SAVEBLOCK1_SIZE
#undef T_SAVEBLOCK2_SIZE
#undef T_SAVEBLOCK3_SIZE
#undef T_POKEMONSTORAGE_SIZE