| 20 | */ |
| 21 | |
| 22 | bool test_gamestate_serialization_roundtrip(OpenApoc::sp<OpenApoc::GameState> state, |
| 23 | OpenApoc::UString save_name) |
| 24 | { |
| 25 | if (!state->saveGame(save_name)) |
| 26 | { |
| 27 | |
| 28 | LogWarning("Failed to save packed gamestate"); |
| 29 | return false; |
| 30 | } |
| 31 | |
| 32 | auto read_gamestate = OpenApoc::mksp<OpenApoc::GameState>(); |
| 33 | if (!read_gamestate->loadGame(save_name)) |
| 34 | { |
| 35 | LogWarning("Failed to load packed gamestate"); |
| 36 | return false; |
| 37 | } |
| 38 | |
| 39 | #if 0 |
| 40 | // FIXME: This isn't reliable due to undefined order of containers |
| 41 | if (*state != *read_gamestate) |
| 42 | #endif |
| 43 | if (0) |
| 44 | { |
| 45 | LogWarning("Gamestate changed over serialization"); |
| 46 | |
| 47 | return false; |
| 48 | } |
| 49 | return true; |
| 50 | } |
| 51 | |
| 52 | bool test_gamestate_serialization(OpenApoc::sp<OpenApoc::GameState> state) |
| 53 | { |
no test coverage detected