Initial commit: Theriapolis baseline at port/godot branch point
Captures the pre-Godot-port state of the codebase. This is the rollback anchor for the Godot port (M0 of theriapolis-rpg-implementation-plan-godot-port.md). All Phase 0 through Phase 6.5 work is included; Phase 7 is in flight. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
using Theriapolis.Core.Time;
|
||||
using Xunit;
|
||||
|
||||
namespace Theriapolis.Tests.Entities;
|
||||
|
||||
public sealed class WorldClockTests
|
||||
{
|
||||
[Fact]
|
||||
public void Advance_AccumulatesSeconds()
|
||||
{
|
||||
var c = new WorldClock();
|
||||
c.Advance(120);
|
||||
c.Advance(30);
|
||||
Assert.Equal(150, c.InGameSeconds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DayHourMinute_DerivedFromSeconds()
|
||||
{
|
||||
var c = new WorldClock();
|
||||
c.Advance(WorldClock.SecondsPerDay * 3 + WorldClock.SecondsPerHour * 14 + WorldClock.SecondsPerMinute * 27);
|
||||
Assert.Equal(3, c.Day);
|
||||
Assert.Equal(14, c.Hour);
|
||||
Assert.Equal(27, c.Minute);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Season_RotatesWithDays()
|
||||
{
|
||||
var c = new WorldClock();
|
||||
// Advance past one full season (24 days).
|
||||
c.Advance(WorldClock.SecondsPerDay * WorldClock.DaysPerSeason + 1);
|
||||
Assert.Equal(Season.Summer, c.Season);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void RoundTrip_RestoresState()
|
||||
{
|
||||
var c = new WorldClock();
|
||||
c.Advance(98765);
|
||||
var s = c.CaptureState();
|
||||
|
||||
var c2 = new WorldClock();
|
||||
c2.RestoreState(s);
|
||||
Assert.Equal(98765, c2.InGameSeconds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Advance_RejectsNegative()
|
||||
{
|
||||
var c = new WorldClock();
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => c.Advance(-5));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user