Update README.md to include project description, developer documentation links, and license information.
CI / build-test (push) Successful in 1m6s
CI / build-test (push) Successful in 1m6s
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
using MrGameEng.Core;
|
||||
using Xunit;
|
||||
|
||||
namespace MrGameEng.Core.Tests;
|
||||
|
||||
public class GameClockTests
|
||||
{
|
||||
[Fact]
|
||||
public void Advance_SingleFrame_UpdatesDeltaTotalAndFrameCount()
|
||||
{
|
||||
var clock = new GameClock();
|
||||
|
||||
clock.Advance(0.016f);
|
||||
|
||||
Assert.Equal(0.016f, clock.DeltaTime);
|
||||
Assert.Equal(0.016f, clock.UnscaledDeltaTime);
|
||||
Assert.Equal(0.016, clock.TotalTime, 3);
|
||||
Assert.Equal(1, clock.FrameCount);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Advance_WithTimeScale_ScalesDeltaButNotUnscaled()
|
||||
{
|
||||
var clock = new GameClock { TimeScale = 0.5f };
|
||||
|
||||
clock.Advance(0.02f);
|
||||
|
||||
Assert.Equal(0.01f, clock.DeltaTime, 3);
|
||||
Assert.Equal(0.02f, clock.UnscaledDeltaTime, 3);
|
||||
Assert.Equal(0.01, clock.TotalTime, 3);
|
||||
Assert.Equal(0.02, clock.UnscaledTotalTime, 3);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TimeScale_Zero_PausesScaledTime()
|
||||
{
|
||||
var clock = new GameClock { TimeScale = 0f };
|
||||
|
||||
clock.Advance(0.016f);
|
||||
|
||||
Assert.Equal(0f, clock.DeltaTime);
|
||||
Assert.Equal(0.0, clock.TotalTime);
|
||||
Assert.Equal(0.016, clock.UnscaledTotalTime, 3);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TimeScale_Negative_ClampsToZero()
|
||||
{
|
||||
var clock = new GameClock { TimeScale = -1f };
|
||||
|
||||
Assert.Equal(0f, clock.TimeScale);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user