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.

test: the citing tests of R-CITY-008, R-MONEY-001 and R-NAT-001 now catch their mutations (#904)

Eyal Golanbb0482121763
diff --git a/sim/Statecraft.Sim.Tests/ArrivalsTests.cs b/sim/Statecraft.Sim.Tests/ArrivalsTests.cs
index 2ef659dcf..c41f701d4 100644
--- a/sim/Statecraft.Sim.Tests/ArrivalsTests.cs
+++ b/sim/Statecraft.Sim.Tests/ArrivalsTests.cs
@@ -111,4 +111,19 @@ public class ArrivalsTests
}
Assert.Equal(Mvp.End, s.Date);
}
+
+ // R-CITY-008: with natural increase disabled, every change in the national population is an arrival.
+ [Fact]
+ public void TheNationalPopulationReceivesEveryArrival()
+ {
+ var files = Fixture.Gdd();
+ files["rules.yaml"] = files["rules.yaml"].Replace("natural_increase_per_year: 0.017", "natural_increase_per_year: 0");
+ var c = ContentLoader.Load(Fixture.Write(files));
+ var before = Simulation.NewGame(c, GoldenRun.Seed, Mode.Historical);
+ var after = Step(c, before).State;
+ var arrived = PopulationSystem.Arrivals(c, before.Date, after.Date).Values.Sum();
+
+ Assert.True(arrived > 0, "the fixture's first turn has arrivals");
+ Assert.Equal(arrived, after.TotalPopulation - before.TotalPopulation, 9);
+ }
}
diff --git a/sim/Statecraft.Sim.Tests/MoneyTests.cs b/sim/Statecraft.Sim.Tests/MoneyTests.cs
index b8da6d963..806482487 100644
--- a/sim/Statecraft.Sim.Tests/MoneyTests.cs
+++ b/sim/Statecraft.Sim.Tests/MoneyTests.cs
@@ -20,6 +20,20 @@ public class MoneyTests
Assert.Equal("Foreign currency", PlayerText.Target(C, "fx_reserves"));
}
+ // R-MONEY-001: before Phase 3 upkeep, the normal economy flow contains only tax, spending and mobilization.
+ [Fact]
+ public void TheTreasuryPaysNoUpkeep()
+ {
+ var s = Simulation.NewGame(C, GoldenRun.Seed, Mode.Historical);
+ s.Treasury = 10_000;
+ var before = s.Treasury;
+ var flows = EconomySystem.Flows(C, s, 0.25);
+
+ EconomySystem.Apply(C, s, 0.25, new List<Cause>());
+
+ Assert.Equal(before + flows.Tax - flows.Spending - flows.Mobilization, s.Treasury, 9);
+ }
+
// R-MONEY-001 (D-C3): a guard, not a change. The real game runs the GDD loop, its debt and foreign currency are in the
// state hash, and the sourced 1951 crisis still happens: debt is taken on, and reserves run out after 19 October 1951
// (FRUS 1951 v.V doc 513) and before the turn that covers the end of 1951, as EconomyCalibrationTests anchors.
diff --git a/sim/Statecraft.Sim.Tests/NationalParametersTests.cs b/sim/Statecraft.Sim.Tests/NationalParametersTests.cs
index 09f561f11..2feb05700 100644
--- a/sim/Statecraft.Sim.Tests/NationalParametersTests.cs
+++ b/sim/Statecraft.Sim.Tests/NationalParametersTests.cs
@@ -68,6 +68,11 @@ public class NationalParametersTests
// Housing: the existing link (homes_lift_morale) stays.
var cramped = s.Clone(); EffectsSystem.Shift(Mvp, cramped, "housing", -0.2);
Assert.True(After(s) > After(cramped), "worse housing lowers Social cohesion");
+
+ // Security: the existing security link stays.
+ var lowSecurity = s.Clone(); EffectsSystem.Shift(Mvp, lowSecurity, "security", 0.2 - lowSecurity.Indicators["security"]);
+ var highSecurity = s.Clone(); EffectsSystem.Shift(Mvp, highSecurity, "security", 0.8 - highSecurity.Indicators["security"]);
+ Assert.True(After(highSecurity) > After(lowSecurity), "better security raises Social cohesion");
}
/// <summary>The cities' employed share, the effect web's source: employed over civilians summed over all cities, 1 with