From c041712e9988696a660aefc02c163cfccb1778c5 Mon Sep 17 00:00:00 2001 From: Joywayer Date: Tue, 28 Jul 2026 11:15:16 +0800 Subject: [PATCH] =?UTF-8?q?fix(test):=20=E5=88=B0=E8=BE=BE=E8=BE=B9?= =?UTF-8?q?=E7=95=8C=E7=94=A8=E4=BE=8B=E6=94=B9=E7=94=A8=E4=BA=8C=E8=BF=9B?= =?UTF-8?q?=E5=88=B6=E5=8F=AF=E7=B2=BE=E7=A1=AE=E8=A1=A8=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E5=80=BC(1.25/0.25),=E9=81=BF=E5=85=8D=E6=B5=AE=E7=82=B9?= =?UTF-8?q?=E5=99=AA=E5=A3=B0=E8=AF=AF=E5=88=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Tests/EditMode/Enemies/GroundNavigatorLogicTests.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Assets/Tests/EditMode/Enemies/GroundNavigatorLogicTests.cs b/Assets/Tests/EditMode/Enemies/GroundNavigatorLogicTests.cs index 7d459053..0ef1ba9e 100644 --- a/Assets/Tests/EditMode/Enemies/GroundNavigatorLogicTests.cs +++ b/Assets/Tests/EditMode/Enemies/GroundNavigatorLogicTests.cs @@ -10,9 +10,11 @@ namespace BaseGames.Tests.EditMode.Enemies public void Arrived_WhenWithinStopDistance() => Assert.IsTrue(GroundNavigator.Arrived(1.0f, 1.1f, 0.2f)); + // 边界含等号。刻意选二进制可精确表示的值(1.25-1.0 恰为 0.25), + // 否则如 1.2f-1.0f=0.20000005 会因浮点误差略大于 0.2f,测的就不是边界语义而是浮点噪声。 [Test] public void Arrived_ExactlyAtStopDistance_True() - => Assert.IsTrue(GroundNavigator.Arrived(1.0f, 1.2f, 0.2f)); + => Assert.IsTrue(GroundNavigator.Arrived(1.0f, 1.25f, 0.25f)); [Test] public void NotArrived_WhenOutsideStopDistance()