Add test to detect save file shifting (#8030)
This commit is contained in:
parent
6eaa09bf5d
commit
9fa6cd6a4c
35
test/save.c
Normal file
35
test/save.c
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
#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
|
||||||
Loading…
x
Reference in New Issue
Block a user