public void CheckBalanceBrackets_correct_true_returned() { string str = "((1+3)()(4+(3-5)))"; bool expected = true; BalanceBrackets balanceBrackets = BalanceBrackets.GetBalanceBrackets(); bool actual = balanceBrackets.CheckBalanceRoundBrackets(str); Assert.AreEqual(expected, actual); }
public void IsBalanced_OpeningOnly_False() { var indexGenerator = new Random(DateTime.UtcNow.Millisecond); var openingBrackets = new[] { '(', '[', '{' }; var characters = Enumerable.Range(1, 1_000_000) .Select(n => openingBrackets[indexGenerator.Next(0, 3)]) .ToArray(); var s = new string(characters); BalanceBrackets.IsBalanced(s).Should().BeFalse(); }
public void IsBalanced_Example_MatchExpectations(string input, bool expectations) { BalanceBrackets.IsBalanced(input).Should().Be(expectations); }