From 5b26d28b082756fdc2309a16eba804e22085e685 Mon Sep 17 00:00:00 2001 From: Erik Date: Sat, 2 May 2026 19:20:39 +0200 Subject: [PATCH] test(physics): MyRunRate fallback test for GetMaxSpeed (L.3.1 Task 2 polish) Code-quality review on commit 9c5634a flagged that the existing 4 GetMaxSpeed tests didn't cover the case where WeenieObj is null and RunForward must fall back to MyRunRate. Without this test, a regression that hardcoded the fallback to 1.0f would silently pass. Co-Authored-By: Claude Opus 4.7 --- .../Physics/MotionInterpreterTests.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/AcDream.Core.Tests/Physics/MotionInterpreterTests.cs b/tests/AcDream.Core.Tests/Physics/MotionInterpreterTests.cs index addc9fa..1b7d05e 100644 --- a/tests/AcDream.Core.Tests/Physics/MotionInterpreterTests.cs +++ b/tests/AcDream.Core.Tests/Physics/MotionInterpreterTests.cs @@ -873,4 +873,19 @@ public sealed class MotionInterpreterTests Assert.Equal(0f, speed, precision: 4); } + + [Fact] + public void GetMaxSpeed_RunForward_NoWeenie_FallsBackToMyRunRate() + { + // WeenieObj is null (MakeInterp with no weenie argument); MyRunRate + // is set explicitly. GetMaxSpeed must use MyRunRate as the run-rate + // source when InqRunRate is unavailable. + var interp = MakeInterp(); + interp.MyRunRate = 1.75f; + interp.InterpretedState.ForwardCommand = MotionCommand.RunForward; + + float speed = interp.GetMaxSpeed(); + + Assert.Equal(MotionInterpreter.RunAnimSpeed * 1.75f, speed, precision: 4); + } }