acdream/tests/AcDream.Core.Tests/Physics/WalkMissDiagnosticTests.cs
Erik 27c728484d feat(physics): ProbeWalkMissEnabled flag for ISSUES #83 H-disambiguation
Adds a new diagnostic flag for the indoor-walking walk-miss probe
spike per docs/superpowers/specs/2026-05-21-indoor-walk-miss-probe-design.md.
Env var ACDREAM_PROBE_WALK_MISS=1, runtime-toggleable via property.
No DebugPanel mirror — spike-only. Following commits wire the
[walk-miss] and [floor-polys] emissions to this flag.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-20 10:23:00 +02:00

41 lines
1.3 KiB
C#

using AcDream.Core.Physics;
using DatReaderWriter.Enums;
using System.Collections.Generic;
using System.Numerics;
using Xunit;
namespace AcDream.Core.Tests.Physics;
/// <summary>
/// Tests for the ISSUES #83 H-disambiguation probe spike (spec
/// 2026-05-21-indoor-walk-miss-probe-design.md).
///
/// Covers:
/// 1. PhysicsDiagnostics.ProbeWalkMissEnabled flag get/set roundtrip.
/// 2. WalkMissDiagnostic.AggregateNearestWalkable selects the nearest
/// walkable polygon by |dz| when the foot XY lies inside a poly's
/// local XY bounding box.
/// 3. WalkMissDiagnostic.AggregateNearestWalkable falls back to the
/// nearest poly by |dz| when no walkable poly XY-contains the foot,
/// reporting ContainsFootXY=false.
/// </summary>
public class WalkMissDiagnosticTests
{
[Fact]
public void ProbeWalkMiss_StaticApi_Roundtrip()
{
bool initial = PhysicsDiagnostics.ProbeWalkMissEnabled;
try
{
PhysicsDiagnostics.ProbeWalkMissEnabled = true;
Assert.True(PhysicsDiagnostics.ProbeWalkMissEnabled);
PhysicsDiagnostics.ProbeWalkMissEnabled = false;
Assert.False(PhysicsDiagnostics.ProbeWalkMissEnabled);
}
finally
{
PhysicsDiagnostics.ProbeWalkMissEnabled = initial;
}
}
}