namespace ClaudeDo.Releases.Tests;

public class VersionComparerTests
{
    [Theory]
    [InlineData("0.2.0", "0.1.0", true, false)]
    [InlineData("0.2.0", "0.2.0", false, false)]
    [InlineData("0.1.0", "0.2.0", false, false)]
    [InlineData("v0.2.0", "0.1.0", true, false)]
    [InlineData("0.2.0", "v0.1.0", true, false)]
    [InlineData("1.0.0.0", "0.99.99.99", true, false)]
    public void Compare_ParseableVersions(string latest, string current, bool expectedNewer, bool expectedUnparseable)
    {
        var result = VersionComparer.Compare(latest, current);
        Assert.Equal(expectedNewer, result.IsNewer);
        Assert.Equal(expectedUnparseable, result.Unparseable);
    }

    [Theory]
    [InlineData("0.2.0-beta", "0.1.0")]
    [InlineData("0.2.0", "0.1.0-alpha")]
    [InlineData("garbage", "0.1.0")]
    [InlineData("", "0.1.0")]
    public void Compare_UnparseableReturnsNotNewer(string latest, string current)
    {
        var result = VersionComparer.Compare(latest, current);
        Assert.False(result.IsNewer);
        Assert.True(result.Unparseable);
    }
}
