fix(test): 到达边界用例改用二进制可精确表示的值(1.25/0.25),避免浮点噪声误判
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user