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,51 @@
|
||||
using Theriapolis.Core.Rules.Stats;
|
||||
using Xunit;
|
||||
|
||||
namespace Theriapolis.Tests.Rules;
|
||||
|
||||
public sealed class XpTableTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(0, 1)]
|
||||
[InlineData(1, 1)]
|
||||
[InlineData(299, 1)]
|
||||
[InlineData(300, 2)]
|
||||
[InlineData(899, 2)]
|
||||
[InlineData(900, 3)]
|
||||
[InlineData(2_700, 4)]
|
||||
[InlineData(355_000, 20)]
|
||||
[InlineData(1_000_000,20)]
|
||||
public void LevelForXp_MatchesD20Table(int xp, int expectedLevel)
|
||||
{
|
||||
Assert.Equal(expectedLevel, XpTable.LevelForXp(xp));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LevelForXp_NegativeThrows()
|
||||
{
|
||||
Assert.Throws<ArgumentOutOfRangeException>(() => XpTable.LevelForXp(-1));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(1, 300)]
|
||||
[InlineData(2, 900)]
|
||||
[InlineData(19, 355_000)]
|
||||
public void XpRequiredForNextLevel_MatchesTable(int currentLevel, int expectedNext)
|
||||
{
|
||||
Assert.Equal(expectedNext, XpTable.XpRequiredForNextLevel(currentLevel));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void XpRequiredForNextLevel_AtCap_ReturnsMaxValue()
|
||||
{
|
||||
Assert.Equal(int.MaxValue, XpTable.XpRequiredForNextLevel(20));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Threshold_IsMonotonicallyIncreasing()
|
||||
{
|
||||
for (int lv = 2; lv <= 20; lv++)
|
||||
Assert.True(XpTable.Threshold[lv] > XpTable.Threshold[lv - 1],
|
||||
$"Threshold[{lv}]={XpTable.Threshold[lv]} should be > Threshold[{lv-1}]={XpTable.Threshold[lv-1]}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user