using AcDream.App.Tests.Rendering; using AcDream.App.Rendering.Walk; using DatReaderWriter; using DatReaderWriter.Options; namespace AcDream.App.Tests.Rendering.Walk; /// /// FW1's conformance gate, first slice: replay pose-stamped oracle /// fixtures through the ported walk and require the identical event /// sequence. The projection-light interior fixtures gate first /// (docs/research/2026-08-30-fw-walk-oracle/README.md, posed round); /// the outdoor/landscape fixtures join as the landscape world build /// lands. /// [Trait("Lane", "InstalledDat")] public sealed class WalkTraceConformanceTests { private sealed class Recorder : IWalkEventSink { public readonly List Events = new(); public void Emit(in WalkEvent walkEvent) => Events.Add(walkEvent); } private static DatCollection OpenDats() { string? datDir = CornerFloodReplayTests.ResolveDatDir(); if (datDir is null) { Assert.Fail("Lane=InstalledDat requires an installed retail DAT directory; see docs/release-gate.md."); } return new DatCollection(datDir!, DatAccessType.Read); } [Fact(Skip = "FW1 outdoor adjudication (2026-08-30 state): with the pinned " + "camera basis the BLD roster+order match retail EXACTLY except one " + "ring-1 boundary pair (aab50002 extra / a9b3003c missing). The " + "look-in punches fire at the wrong buildings under BOTH GfxObj " + "plane-winding conventions (retail: only 001a and 0022, cells " + "a9b4016x) — adjudicate the PortalRef.PortalIndex join and the " + "BuildingPortal side-flag decode with a per-building dump next. " + "Re-enable as the outdoor gate when adjudicated.")] public void Street_outdoor_first_frame_diff() { // The first landscape-involving conformance case: diff-first (the // assert prints both signatures on mismatch for adjudication). IReadOnlyList frames = WalkOracleTrace.Load("posed/holtburg-street-outdoor"); Assert.NotEmpty(frames); using DatCollection dats = OpenDats(); WalkOracleFrame frame = frames[1]; // frame 2: pose settled (marker timing) Assert.NotNull(frame.Pose); WalkLandscapeDatBuilder.BuiltWorld world = WalkLandscapeDatBuilder.Build(dats, frame.Pose!.CellId); var ctx = new WalkTraceReplayContext(frame.Pose, world.Cells) { Buildings = world.Buildings, }; var walk = new RetailFrameWalk(); var recorder = new Recorder(); walk.WalkFrame(frame.Pose.CellId, null, world.Landscape, ctx, recorder); string expected = WalkTraceReplayContext.Signature(frame); string actual = WalkTraceReplayContext.Signature(recorder.Events); Assert.True( expected == actual, $"walk diverged from retail\nEXPECTED: {expected}\nACTUAL: {actual}"); } [Fact] public void Foundry_deep_reproduces_every_complete_frame_exactly() { IReadOnlyList frames = WalkOracleTrace.Load("posed/foundry-deep"); Assert.NotEmpty(frames); using DatCollection dats = OpenDats(); Dictionary cells = WalkWorldDatAdapter.BuildInteriorCells(dats, 0xA9B40000u); var landscape = new WalkLandscape { MidWidth = 1, Blocks = new WalkLandBlock?[1] }; foreach (WalkOracleFrame frame in frames) { Assert.NotNull(frame.Pose); WalkCell camera = Assert.Contains(frame.Pose!.CellId, cells); var ctx = new WalkTraceReplayContext(frame.Pose, cells); var walk = new RetailFrameWalk(); var recorder = new Recorder(); walk.WalkFrame(frame.Pose.CellId, camera, landscape, ctx, recorder); Assert.Equal( WalkTraceReplayContext.Signature(frame), WalkTraceReplayContext.Signature(recorder.Events)); } } }