1
0
mirror of https://github.com/oliverbooth/X10D synced 2024-11-22 20:18:47 +00:00

Allow for minor differentiation in equality test

This commit is contained in:
Oliver Booth 2022-11-29 17:45:27 +00:00
parent b09b2287d2
commit af622a8ef7
No known key found for this signature in database
GPG Key ID: 32A00B35503AF634

View File

@ -14,39 +14,39 @@ namespace X10D.Unity.Tests
{
int frameCount = UTime.frameCount;
yield return new WaitForFrames(10);
Assert.AreEqual(frameCount + 10, UTime.frameCount);
Assert.AreEqual(frameCount + 10, UTime.frameCount, $"{frameCount + 10} == {UTime.frameCount}");
}
[UnityTest]
public IEnumerator WaitForSecondsNoAlloc_ShouldYieldForCorrectTime()
{
var time = (int)UTime.time;
float time = UTime.time;
yield return new WaitForSecondsNoAlloc(2);
Assert.AreEqual(time + 2, (int)UTime.time);
Assert.AreEqual(time + 2, UTime.time, 1e-2, $"{time + 2} == {UTime.time}");
}
[UnityTest]
public IEnumerator WaitForSecondsRealtimeNoAlloc_ShouldYieldForCorrectTime()
{
var time = (int)UTime.time;
float time = UTime.time;
yield return new WaitForSecondsRealtimeNoAlloc(2);
Assert.AreEqual(time + 2, (int)UTime.time);
Assert.AreEqual(time + 2, UTime.time, 1e-2, $"{time + 2} == {UTime.time}");
}
[UnityTest]
public IEnumerator WaitForTimeSpan_ShouldYieldForCorrectTime()
{
var time = (int)UTime.time;
float time = UTime.time;
yield return new WaitForTimeSpan(TimeSpan.FromSeconds(2));
Assert.AreEqual(time + 2, (int)UTime.time);
Assert.AreEqual(time + 2, UTime.time, 1e-2, $"{time + 2} == {UTime.time}");
}
[UnityTest]
public IEnumerator WaitForTimeSpanRealtime_ShouldYieldForCorrectTime()
{
var time = (int)UTime.time;
float time = UTime.time;
yield return new WaitForTimeSpanRealtime(TimeSpan.FromSeconds(2));
Assert.AreEqual(time + 2, (int)UTime.time);
Assert.AreEqual(time + 2, UTime.time, 1e-2, $"{time + 2} == {UTime.time}");
}
}
}