using LeetCode.Logic;

namespace LeetCode.Tests;

public class BracketValidatorTests
{
    private readonly BracketValidator _sut = new();

    [Theory]
    [InlineData("()", true)]
    [InlineData("()[]{}", true)]
    [InlineData("(]", false)]
    [InlineData("([])", true)]
    [InlineData("([)]", false)]
    [InlineData("{[]}", true)]
    public void IsValid_ShouldReturnExpectedResult_ForStandardCases(string input, bool expected)
    {
        // Act
        var result = _sut.IsValid(input);

        // Assert
        Assert.Equal(expected, result);
    }

    [Theory]
    [InlineData("", true)] // An empty string is technically balanced
    [InlineData("[", false)] // Open but never closed
    [InlineData("]", false)] // Closed but never opened
    [InlineData("((((((", false)]
    [InlineData("))))))", false)]
    [InlineData("]()]", false)]
    public void IsValid_ShouldHandleEdgeCases(string input, bool expected)
    {
        // Act
        var result = _sut.IsValid(input);

        // Assert
        Assert.Equal(expected, result);
    }
}