test(render) Campaign FW0: walk-oracle replay helper + fixture goldens
WalkOracleTrace parses the FW0 retail traces (frames of LS/BLD/DI/DC events, truncated detach frame dropped) and loads fixtures from the research directory. Nineteen tests pin the load-bearing shapes: the far building drawn every terrace-edge frame, the cathedral roster cull, the stable doorway root, the one-frame walkout handover, camera-cell rooting (porch-cam), the foundry landscape drop, and bit-identical stationary frames. FW1 conformance builds on these. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
71b11817ad
commit
9f4c0f95e3
2 changed files with 321 additions and 0 deletions
171
tests/AcDream.App.Tests/Rendering/Walk/WalkOracleTraceTests.cs
Normal file
171
tests/AcDream.App.Tests/Rendering/Walk/WalkOracleTraceTests.cs
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
namespace AcDream.App.Tests.Rendering.Walk;
|
||||
|
||||
/// <summary>
|
||||
/// Integrity tests for the FW0 walk-oracle fixtures: every checked-in
|
||||
/// trace parses, and the load-bearing shapes recorded in the fixture
|
||||
/// README hold. FW1's conformance suite builds on these parsed frames;
|
||||
/// if a fixture is edited or recaptured, these goldens catch drift.
|
||||
/// </summary>
|
||||
public sealed class WalkOracleTraceTests
|
||||
{
|
||||
private const uint FarBuilding = 0xF518002Eu;
|
||||
|
||||
public static readonly TheoryData<string> AllFixtures = new()
|
||||
{
|
||||
"terrace-center",
|
||||
"terrace-edge",
|
||||
"cathedral-arrival",
|
||||
"holtburg-doorway-still",
|
||||
"holtburg-walkout",
|
||||
"holtburg-street-porchcam",
|
||||
"holtburg-street-outdoor",
|
||||
"holtburg-walkabout",
|
||||
"foundry-entry",
|
||||
"foundry-deep",
|
||||
};
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(AllFixtures))]
|
||||
public void Fixture_parses_with_complete_frames(string name)
|
||||
{
|
||||
IReadOnlyList<WalkOracleFrame> frames = WalkOracleTrace.Load(name);
|
||||
|
||||
Assert.NotEmpty(frames);
|
||||
// Frame numbers are contiguous from 1; the truncated final frame is dropped.
|
||||
Assert.Equal(1, frames[0].Number);
|
||||
Assert.Equal(frames.Count, frames[^1].Number);
|
||||
Assert.All(frames, f => Assert.NotEmpty(f.Events));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Terrace_edge_draws_the_far_building_every_outdoor_frame()
|
||||
{
|
||||
// The #456 acceptance oracle: retail HIDES the vista by depth cover,
|
||||
// not by omission — 0xF518002E is submitted every single frame.
|
||||
IReadOnlyList<WalkOracleFrame> frames = WalkOracleTrace.Load("terrace-edge");
|
||||
|
||||
Assert.All(frames, f =>
|
||||
{
|
||||
Assert.Null(f.InteriorRootCell);
|
||||
Assert.True(f.HasLandscape);
|
||||
Assert.Contains(FarBuilding, f.Buildings);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Cathedral_arrival_roots_interior_and_culls_the_far_building()
|
||||
{
|
||||
IReadOnlyList<WalkOracleFrame> frames = WalkOracleTrace.Load("cathedral-arrival");
|
||||
|
||||
Assert.All(frames, f =>
|
||||
{
|
||||
Assert.Equal(0xF4180106u, f.InteriorRootCell);
|
||||
Assert.True(f.HasLandscape); // drawn THROUGH the exit view
|
||||
Assert.DoesNotContain(FarBuilding, f.Buildings);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Doorway_root_is_stable_across_every_frame()
|
||||
{
|
||||
IReadOnlyList<WalkOracleFrame> frames = WalkOracleTrace.Load("holtburg-doorway-still");
|
||||
|
||||
Assert.All(frames, f => Assert.Equal(0xA9B4013Fu, f.InteriorRootCell));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Walkout_hands_over_between_interior_cells_in_one_frame()
|
||||
{
|
||||
IReadOnlyList<WalkOracleFrame> frames = WalkOracleTrace.Load("holtburg-walkout");
|
||||
|
||||
uint?[] roots = frames.Select(f => f.InteriorRootCell).Distinct().ToArray();
|
||||
Assert.Equal(new uint?[] { 0xA9B4013Fu, 0xA9B40150u }, roots);
|
||||
// Exactly one handover: the root sequence is two contiguous runs.
|
||||
int transitions = frames.Zip(frames.Skip(1))
|
||||
.Count(pair => pair.First.InteriorRootCell != pair.Second.InteriorRootCell);
|
||||
Assert.Equal(1, transitions);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Street_porchcam_roots_at_the_camera_cell_not_the_player()
|
||||
{
|
||||
// The player stood in the street; the chase camera sat inside the
|
||||
// cottage porch — and retail rooted the frame at the CAMERA's cell.
|
||||
IReadOnlyList<WalkOracleFrame> frames = WalkOracleTrace.Load("holtburg-street-porchcam");
|
||||
|
||||
Assert.All(frames, f => Assert.Equal(0xA9B40150u, f.InteriorRootCell));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Street_outdoor_never_enters_an_interior_root()
|
||||
{
|
||||
IReadOnlyList<WalkOracleFrame> frames = WalkOracleTrace.Load("holtburg-street-outdoor");
|
||||
|
||||
Assert.All(frames, f =>
|
||||
{
|
||||
Assert.Null(f.InteriorRootCell);
|
||||
Assert.True(f.HasLandscape);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Foundry_entry_flips_outdoor_to_interior_and_drops_the_landscape()
|
||||
{
|
||||
IReadOnlyList<WalkOracleFrame> frames = WalkOracleTrace.Load("foundry-entry");
|
||||
|
||||
WalkOracleFrame flip = frames.First(f => f.InteriorRootCell is not null);
|
||||
Assert.Equal(0xA9B40178u, flip.InteriorRootCell);
|
||||
// The frame before the flip is fully outdoor; the flip frame itself
|
||||
// draws NO landscape and NO buildings — the pure-interior shape.
|
||||
WalkOracleFrame before = frames[flip.Number - 2];
|
||||
Assert.Null(before.InteriorRootCell);
|
||||
Assert.True(before.HasLandscape);
|
||||
Assert.False(flip.HasLandscape);
|
||||
Assert.Empty(flip.Buildings);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Foundry_deep_draws_the_town_through_the_surviving_chain()
|
||||
{
|
||||
IReadOnlyList<WalkOracleFrame> frames = WalkOracleTrace.Load("foundry-deep");
|
||||
|
||||
Assert.All(frames, f =>
|
||||
{
|
||||
Assert.Equal(0xA9B40176u, f.InteriorRootCell);
|
||||
Assert.True(f.HasLandscape);
|
||||
Assert.NotEmpty(f.Buildings);
|
||||
});
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Stationary_frames_repeat_their_event_sequence_exactly()
|
||||
{
|
||||
// README finding 6: while the camera is still, the whole-frame
|
||||
// sequence repeats bit-for-bit. Assert it on the terrace fixture.
|
||||
IReadOnlyList<WalkOracleFrame> frames = WalkOracleTrace.Load("terrace-center");
|
||||
|
||||
WalkOracleFrame first = frames[0];
|
||||
Assert.All(frames.Skip(1), f =>
|
||||
{
|
||||
Assert.Equal(first.Events.Count, f.Events.Count);
|
||||
for (int i = 0; i < first.Events.Count; i++)
|
||||
Assert.Equal(first.Events[i], f.Events[i], WalkOracleEventComparer.Instance);
|
||||
});
|
||||
}
|
||||
|
||||
private sealed class WalkOracleEventComparer : IEqualityComparer<WalkOracleEvent>
|
||||
{
|
||||
public static readonly WalkOracleEventComparer Instance = new();
|
||||
|
||||
public bool Equals(WalkOracleEvent? x, WalkOracleEvent? y)
|
||||
=> x is not null && y is not null
|
||||
&& x.Kind == y.Kind
|
||||
&& x.CellId == y.CellId
|
||||
&& x.OutsideViewCount == y.OutsideViewCount
|
||||
&& x.DeclaredCellCount == y.DeclaredCellCount
|
||||
&& x.Cells.SequenceEqual(y.Cells);
|
||||
|
||||
public int GetHashCode(WalkOracleEvent obj)
|
||||
=> HashCode.Combine(obj.Kind, obj.CellId, obj.Cells.Count);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue