Skip to content

Commit 0de0857

Browse files
test: Drop two NetworkDeltaPosition tests that cover an already covered path
ADeltaUnderTheThresholdIsLeftAsADelta asserted nothing the other tests do not: MovingFoldsThePreviousRoundingLossBackIn already requires the delta to stay under the threshold, and UnsynchronizedAxesAreLeftUntouched already requires the synchronized axis to hold the movement. QuantumDropsTheSignBecauseTheLatticeIsSymmetric ran its own value list to assert one thing, so it moves into the loop in QuantumIsTheSmallestChangeTheEncodingCanSee, which already walks the same kind of values. 300f joins that list so no input is lost. The masking it covers is a common path executed by every call, so the coverage score is unchanged either way.
1 parent 038311b commit 0de0857

1 file changed

Lines changed: 3 additions & 24 deletions

File tree

com.unity.netcode.gameobjects/Tests/Runtime/NetworkTransform/NetworkDeltaPositionTests.cs

Lines changed: 3 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -160,20 +160,6 @@ public void DeltaCollapsesIntoTheBaseAtTheThreshold()
160160
"Folding the delta into the base must not move the object it describes.");
161161
}
162162

163-
[Test]
164-
public void ADeltaUnderTheThresholdIsLeftAsADelta()
165-
{
166-
var deltaPosition = new NetworkDeltaPosition(k_Base, k_Tick);
167-
var originalBase = deltaPosition.GetCurrentBasePosition();
168-
169-
var moved = Offset(k_LossyStep);
170-
deltaPosition.UpdateFrom(ref moved, k_Tick + 1);
171-
172-
Assert.IsFalse(deltaPosition.CollapsedDeltaIntoBase, "A delta under the threshold should stay a delta.");
173-
Assert.AreEqual(originalBase, deltaPosition.GetCurrentBasePosition(), "The base should not move while the delta is small.");
174-
Assert.AreNotEqual(0.0f, deltaPosition.GetDeltaPosition().x, "The delta should hold the movement.");
175-
}
176-
177163
[Test]
178164
public void UnsynchronizedAxesAreLeftUntouched()
179165
{
@@ -305,7 +291,7 @@ public void FullPrecisionRoundTripsWhenTheBaseIsSynchronized()
305291
public void QuantumIsTheSmallestChangeTheEncodingCanSee()
306292
{
307293
// Exactly representable, so "one step away" is unambiguous.
308-
foreach (var value in new[] { 0.5f, 1.0f, -1.0f, 2.0f, 1024.0f })
294+
foreach (var value in new[] { 0.5f, 1.0f, -1.0f, 2.0f, 300.0f, 1024.0f })
309295
{
310296
var quantum = NetworkDeltaPosition.HalfPrecisionQuantum(value);
311297
Assert.Greater(quantum, 0.0f, $"The step size at {value} should be positive.");
@@ -314,16 +300,9 @@ public void QuantumIsTheSmallestChangeTheEncodingCanSee()
314300
$"A full step from {value} should encode differently, or it is not the step size.");
315301
Assert.AreEqual(math.half(value).value, math.half(value + (quantum * 0.25f)).value,
316302
$"A quarter step from {value} should encode identically, or the step size is too large.");
317-
}
318-
}
319303

320-
[Test]
321-
public void QuantumDropsTheSignBecauseTheLatticeIsSymmetric()
322-
{
323-
foreach (var value in new[] { 0.5f, 1.0f, 300.0f, 1024.0f })
324-
{
325-
Assert.AreEqual(NetworkDeltaPosition.HalfPrecisionQuantum(value),
326-
NetworkDeltaPosition.HalfPrecisionQuantum(-value),
304+
// The lattice is symmetric about zero, which is why the sign is dropped.
305+
Assert.AreEqual(quantum, NetworkDeltaPosition.HalfPrecisionQuantum(-value),
327306
$"The step size at {value} and {-value} should be the same.");
328307
}
329308
}

0 commit comments

Comments
 (0)