SnapshotInterpolationTests: use actual type instead of interface now

This commit is contained in:
vis2k 2021-08-03 11:50:18 +08:00
parent 2c70e71555
commit a7c0c29025

View File

@ -33,12 +33,12 @@ public Snapshot Interpolate(Snapshot to, double t) =>
public class SnapshotInterpolationTests
{
// buffer for convenience so we don't have to create it manually each time
SortedList<double, Snapshot> buffer;
SortedList<double, SimpleSnapshot> buffer;
[SetUp]
public void SetUp()
{
buffer = new SortedList<double, Snapshot>();
buffer = new SortedList<double, SimpleSnapshot>();
}
[Test]
@ -212,7 +212,7 @@ public void GetFirstSecondAndDelta()
buffer.Add(b.remoteTimestamp, b);
buffer.Add(c.remoteTimestamp, c);
SnapshotInterpolation.GetFirstSecondAndDelta(buffer, out Snapshot first, out Snapshot second, out double delta);
SnapshotInterpolation.GetFirstSecondAndDelta(buffer, out SimpleSnapshot first, out SimpleSnapshot second, out double delta);
Assert.That(first, Is.EqualTo(a));
Assert.That(second, Is.EqualTo(b));
Assert.That(delta, Is.EqualTo(b.remoteTimestamp - a.remoteTimestamp));
@ -241,7 +241,7 @@ public void Compute_Step1_DefaultDoesNothing()
float bufferTime = 0;
int catchupThreshold = Int32.MaxValue;
float catchupMultiplier = 0;
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out Snapshot computed);
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out SimpleSnapshot computed);
// should not spit out any snapshot to apply
Assert.That(result, Is.False);
@ -274,7 +274,7 @@ public void Compute_Step3_WaitsUntilBufferTime()
float bufferTime = 2;
int catchupThreshold = Int32.MaxValue;
float catchupMultiplier = 0;
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out Snapshot computed);
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out SimpleSnapshot computed);
// should not spit out any snapshot to apply
Assert.That(result, Is.False);
@ -302,7 +302,7 @@ public void Compute_Step3_WaitsForSecondSnapshot()
float bufferTime = 1;
int catchupThreshold = Int32.MaxValue;
float catchupMultiplier = 0;
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out Snapshot computed);
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out SimpleSnapshot computed);
// should not spit out any snapshot to apply
Assert.That(result, Is.False);
@ -335,7 +335,7 @@ public void Compute_Step4_InterpolateWithTwoOldEnoughSnapshots()
float bufferTime = 2;
int catchupThreshold = Int32.MaxValue;
float catchupMultiplier = 0;
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out Snapshot computed);
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out SimpleSnapshot computed);
// should spit out the interpolated snapshot
Assert.That(result, Is.True);
@ -373,7 +373,7 @@ public void Compute_Step4_InterpolateWithThreeOldEnoughSnapshots()
float bufferTime = 2;
int catchupThreshold = Int32.MaxValue;
float catchupMultiplier = 0;
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out Snapshot computed);
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out SimpleSnapshot computed);
// should spit out the interpolated snapshot
Assert.That(result, Is.True);
@ -411,7 +411,7 @@ public void Compute_Step4_InterpolateAfterLongPause()
float bufferTime = 2;
int catchupThreshold = Int32.MaxValue;
float catchupMultiplier = 0;
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out Snapshot computed);
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out SimpleSnapshot computed);
// should spit out the interpolated snapshot
Assert.That(result, Is.True);
@ -462,7 +462,7 @@ public void Compute_Step4_InterpolateWithCatchup()
double deltaTime = 0.5;
double interpolationTime = 0;
float bufferTime = 2;
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out Snapshot computed);
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out SimpleSnapshot computed);
// should spit out the interpolated snapshot
Assert.That(result, Is.True);
@ -524,7 +524,7 @@ public void Compute_Step5_OvershootWithoutEnoughSnapshots()
float bufferTime = 2;
int catchupThreshold = Int32.MaxValue;
float catchupMultiplier = 0;
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out Snapshot computed);
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out SimpleSnapshot computed);
// should spit out the interpolated snapshot
Assert.That(result, Is.True);
@ -593,7 +593,7 @@ public void Compute_Step5_OvershootWithEnoughSnapshots_NextIsntOldEnough()
float bufferTime = 2;
int catchupThreshold = Int32.MaxValue;
float catchupMultiplier = 0;
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out Snapshot computed);
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out SimpleSnapshot computed);
// should still spit out a result between first & second.
Assert.That(result, Is.True);
@ -654,7 +654,7 @@ public void Compute_Step5_OvershootWithEnoughSnapshots_MovesToNextSnapshotIfOldE
float bufferTime = 2;
int catchupThreshold = Int32.MaxValue;
float catchupMultiplier = 0;
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out Snapshot computed);
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out SimpleSnapshot computed);
// should spit out the interpolated snapshot
Assert.That(result, Is.True);
@ -711,7 +711,7 @@ public void Compute_Step5_OvershootWithEnoughSnapshots_2x_MovesToSecondNextSnaps
float bufferTime = 2;
int catchupThreshold = Int32.MaxValue;
float catchupMultiplier = 0;
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out Snapshot computed);
bool result = SnapshotInterpolation.Compute(localTime, deltaTime, ref interpolationTime, bufferTime, buffer, catchupThreshold, catchupMultiplier, out SimpleSnapshot computed);
// should spit out the interpolated snapshot
Assert.That(result, Is.True);