Skip to content

Commit

Permalink
[#16] save_game: add tests for fast save-games
Browse files Browse the repository at this point in the history
With commit 038625e fast save games were also fixed. It now no longer necessary to switch off fast save-games in `Gothic.ini`
  • Loading branch information
lmichaelis committed Dec 29, 2022
1 parent 15396f0 commit 63692ad
Showing 1 changed file with 47 additions and 2 deletions.
49 changes: 47 additions & 2 deletions tests/test_save_game.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using namespace phoenix::unstable;

TEST_SUITE("save_game") {
TEST_CASE("save-games of Gothic 1 are read correctly") {
TEST_CASE("slow save-games of Gothic 1 are read correctly") {
auto save = save_game::parse("./samples/SaveG1");
CHECK(save.metadata.title == "sds");
CHECK(save.metadata.world == "WORLD");
Expand All @@ -29,7 +29,29 @@ TEST_SUITE("save_game") {
// TODO: Add more checks
}

TEST_CASE("save-games of Gothic 2 are read correctly") {
TEST_CASE("fast save-games of Gothic 1 are read correctly") {
auto save = save_game::parse("./samples/FastSaveG1");
CHECK(save.metadata.title == "sds_fast");
CHECK(save.metadata.world == "WORLD");
CHECK(save.metadata.time_day == 0);
CHECK(save.metadata.time_hour == 8);
CHECK(save.metadata.time_minute == 6);
CHECK(save.metadata.save_date == "28.12.2022 - 19:32");
CHECK(save.metadata.version_major == 1);
CHECK(save.metadata.version_minor == 87);
CHECK(save.metadata.play_time_seconds == 60);

CHECK(save.script.day == 0);
CHECK(save.script.hour == 8);
CHECK(save.script.minute == 6);

// Try to parse the world data.
(void) phoenix::world::parse(*save.open_world_save(save.current_world), phoenix::game_version::gothic_1);

// TODO: Add more checks
}

TEST_CASE("slow save-games of Gothic 2 are read correctly") {
auto save = save_game::parse("./samples/SaveG2");
CHECK(save.metadata.title == "uwuowo");
CHECK(save.metadata.world == "NEWWORLD");
Expand All @@ -51,4 +73,27 @@ TEST_SUITE("save_game") {
(void) phoenix::world::parse(*save.open_world_save(save.current_world), phoenix::game_version::gothic_2);
// TODO: Add more checks
}

TEST_CASE("fast save-games of Gothic 2 are read correctly") {
auto save = save_game::parse("./samples/FastSaveG2");
CHECK(save.metadata.title == "inminevalley");
CHECK(save.metadata.world == "OLDWORLD");
CHECK(save.metadata.time_day == 0);
CHECK(save.metadata.time_hour == 0);
CHECK(save.metadata.time_minute == 0);
CHECK(save.metadata.save_date == "3.10.2022 - 11:15");
CHECK(save.metadata.version_major == 2);
CHECK(save.metadata.version_minor == 6);
CHECK(save.metadata.play_time_seconds == 433);
CHECK(save.metadata.version_point == 0);
CHECK(save.metadata.version_int == 0);
CHECK(save.metadata.version_app_name == "Gothic II - 2.6 (fix)");

CHECK(save.script.day == 0);
CHECK(save.script.hour == 0);
CHECK(save.script.minute == 0);

(void) phoenix::world::parse(*save.open_world_save(save.current_world), phoenix::game_version::gothic_2);
// TODO: Add more checks
}
}

0 comments on commit 63692ad

Please sign in to comment.