Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

2.1 KB
Raw Blame
using System.IO;
using Statecraft.Sim;

/// <summary>
/// The fixture is a real gdd-0.1 save written by v0.3.4. It delegates ten_days and chooses operation_yoav, whose unit
/// orders now apply under gdd-0.1 (R-ENEMY-005), so it replays differently by design (owner, 3 Nov 2026, #2087). Any
/// other replay change still needs an owner decision, not a fixture to regenerate.
/// </summary>
public class OldSaveCompatibilityTests
{
    [Fact]
    public void V034Gdd01SaveStillLoadsAndReportsReplayDiffers()
    {
        var content = ContentLoader.Load(RealContentTests.ContentRoot());
        var repo = Directory.GetParent(RealContentTests.ContentRoot())!.FullName;
        var path = Path.Combine(repo, "sim", "Statecraft.Sim.Tests", "saves", "v0.3.4-gdd01.txt");
        var text = File.ReadAllText(path);

        var saved = SaveGame.Parse(text);
        Assert.Equal(SaveGame.GddRuleset, saved.Ruleset);

        var loaded = GameSession.Load(content, text, out var warnings);

        // Owner, 3 Nov 2026, #2087, option (a) "Accept replay differs": a v0.3.4 save that chose or delegated an
        // operation card replays differently now that the cards' unit orders apply under gdd-0.1, and loads with
        // replay_differs. No v0.3.4 save that never touches these cards was produced, so this save checks the accepted
        // outcome: it still loads, keeps its open order and warns content_changed plus replay_differs, nothing else.
        // Then changed (3 Nov 2026, maintainer agent; the lines above are Beri's, unchanged): a v0.3.4 save that never
        // touches these cards now exists and still replays identically (OldSaveNoOperationCardsTests).
        // Then changed (4 Nov 2026, #2180): that save reaches the Syrian S1 step of 15 July 1948 (#1270) and so replays
        // differently too, by the owner's ruling of 4 Nov 2026 (OldSaveNoOperationCardsTests).
        var order = Assert.IsType<UnitOrder>(Assert.Single(loaded.Committed));
        Assert.Equal((3, Orders.Fortify), (order.Unit, order.Order));

        Assert.Equal(new[] { GameSession.ContentChanged, GameSession.ReplayDiffers }, warnings);
    }
}