using NeonSprawl.Server.Game.World;
using Xunit;

namespace NeonSprawl.Server.Tests.Game.Interaction;

public class HorizontalReachTests
{
    [Fact]
    public void HorizontalDistance_IgnoresY()
    {
        // Y is not a parameter; identical X/Z → zero horizontal separation regardless of implied height difference.
        var d = HorizontalReach.HorizontalDistance(1, 2, 1, 2);
        Assert.Equal(0, d);
    }

    [Fact]
    public void IsWithinHorizontalRadius_AtExactBoundary_ReturnsTrue()
    {
        Assert.True(HorizontalReach.IsWithinHorizontalRadius(0, 0, 3, 0, 3));
    }

    [Fact]
    public void IsWithinHorizontalRadius_JustInside_ReturnsTrue()
    {
        const double radius = 3.0;
        const double eps = 1e-10;
        Assert.True(HorizontalReach.IsWithinHorizontalRadius(0, 0, radius - eps, 0, radius));
    }

    [Fact]
    public void IsWithinHorizontalRadius_JustOutside_ReturnsFalse()
    {
        const double radius = 3.0;
        const double eps = 1e-7;
        Assert.False(HorizontalReach.IsWithinHorizontalRadius(0, 0, radius + eps, 0, radius));
    }

    [Fact]
    public void IsWithinHorizontalRadius_NegativeRadius_ThrowsArgumentOutOfRange()
    {
        Assert.Throws<ArgumentOutOfRangeException>(() =>
            HorizontalReach.IsWithinHorizontalRadius(0, 0, 0, 0, -1.0));
    }
}
