Skip to content

Commit 5ed0118

Browse files
test: Walk the stationary ticks with a while loop
The bound is unchanged: ticks 102 through 105 inclusive.
1 parent 8773a34 commit 5ed0118

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

com.unity.netcode.gameobjects/Tests/Editor/NetworkDeltaPositionTests.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,19 @@ public void StandingStillDoesNotChangeWhatIsSent()
131131
var lossOnArrival = deltaPosition.PrecisionLossDelta;
132132
Assert.AreNotEqual(0.0f, lossOnArrival.x, "The arrival conversion has to leave rounding loss behind.");
133133

134+
var currentTick = k_Tick + 2;
135+
var maxTick = k_Tick + 5;
136+
134137
// Folding the loss back in while stationary is what made resting objects jitter.
135-
for (var tick = k_Tick + 2; tick <= k_Tick + 5; tick++)
138+
while (currentTick <= maxTick)
136139
{
137-
deltaPosition.UpdateFrom(ref arrived, tick);
140+
deltaPosition.UpdateFrom(ref arrived, currentTick);
138141

139142
Assert.AreEqual(encodedOnArrival, Encoded(deltaPosition),
140-
$"The transmitted delta changed on tick {tick} while the position did not move.");
143+
$"The transmitted delta changed on tick {currentTick} while the position did not move.");
141144
Assert.AreEqual(lossOnArrival, deltaPosition.PrecisionLossDelta,
142-
$"The carried loss should be untouched on tick {tick} so it still applies once movement resumes.");
145+
$"The carried loss should be untouched on tick {currentTick} so it still applies once movement resumes.");
146+
currentTick++;
143147
}
144148
}
145149

0 commit comments

Comments
 (0)