package aioe import "testing" // TestSimulationCharacterization is the calibration proof for the model card: across every standard // regime the sum stays exactly 1, the clamps always hold, and the directional regimes move the // intended dimension the intended way while noise leaves the weights put. func TestSimulationCharacterization(t *testing.T) { p := DefaultParams() byName := map[string]Simulation{} for _, r := range StandardRegimes() { s := Simulate(r, 40, 200, p) if !s.SumAlways1 { t.Fatalf("regime %s broke the sum-to-one invariant", r.Name) } if !s.ClampsHeld { t.Fatalf("regime %s escaped the clamps", r.Name) } byName[r.Name] = s } if !byName["rewards-skills"].End["skills"].GreaterThan(byName["rewards-skills"].Start["skills"]) { t.Fatal("rewards-skills must raise the skills weight") } if !byName["penalizes-location"].End["location"].LessThan(byName["penalizes-location"].Start["location"]) { t.Fatal("penalizes-location must lower the location weight") } // Pure noise must not meaningfully move any weight (within a grain or two of rounding). noise := byName["pure-noise"] for _, d := range Dimensions { if noise.End[d].Sub(noise.Start[d]).Abs().GreaterThan(dec("0.001")) { t.Fatalf("pure noise moved %s by more than a rounding grain: %s -> %s", d, noise.Start[d], noise.End[d]) } } // The adversarial flip must stay bounded (clamps held above) and not blow the sum. if !byName["adversarial-flip"].SumAlways1 { t.Fatal("adversarial flip broke the sum invariant") } } func TestSimulateIsDeterministic(t *testing.T) { p := DefaultParams() r := StandardRegimes()[0] a := Simulate(r, 30, 100, p) b := Simulate(r, 30, 100, p) if a.Report() != b.Report() { t.Fatal("same regime and params must produce an identical report") } }