using Theriapolis.Core.Rules.Stats;
using Xunit;

namespace Theriapolis.Tests.Rules;

public sealed class SizeTests
{
    [Theory]
    [InlineData(SizeCategory.Small,       1)]
    [InlineData(SizeCategory.Medium,      1)]
    [InlineData(SizeCategory.MediumLarge, 1)]
    [InlineData(SizeCategory.Large,       2)]
    public void FootprintTiles_MatchesPlanTable(SizeCategory s, int expected)
    {
        Assert.Equal(expected, s.FootprintTiles());
    }

    [Theory]
    [InlineData(SizeCategory.Small,       1)]
    [InlineData(SizeCategory.Medium,      1)]
    [InlineData(SizeCategory.MediumLarge, 1)]
    [InlineData(SizeCategory.Large,       2)]
    public void DefaultReachTiles_MatchesPlanTable(SizeCategory s, int expected)
    {
        Assert.Equal(expected, s.DefaultReachTiles());
    }

    [Theory]
    [InlineData("small",        SizeCategory.Small)]
    [InlineData("medium",       SizeCategory.Medium)]
    [InlineData("medium_large", SizeCategory.MediumLarge)]
    [InlineData("large",        SizeCategory.Large)]
    public void FromJson_ParsesSnakeCase(string raw, SizeCategory expected)
    {
        Assert.Equal(expected, SizeExtensions.FromJson(raw));
    }

    [Fact]
    public void FromJson_UnknownThrows()
    {
        Assert.Throws<ArgumentException>(() => SizeExtensions.FromJson("gargantuan"));
    }

    [Fact]
    public void CarryCapacityMult_LargeIsDoubled()
    {
        Assert.Equal(2.0f, SizeCategory.Large.CarryCapacityMult());
        Assert.Equal(0.5f, SizeCategory.Small.CarryCapacityMult());
    }
}
