public void GetMatchesFindsNoMatchesForEmpty() { NegativeLookBackExpression<char> expression = new NegativeLookBackExpression<char> (m_any); var matches = expression.GetMatches (EmptyList, 0).ToList (); Assert.AreEqual (1, matches.Count, "matches.Count"); Assert.AreEqual (0, matches[0].Index, "matches[0].Index"); Assert.AreEqual (0, matches[0].Length, "matches[0].Length"); }
public void GetMatchesFindsOneMatchForB() { NegativeLookBackExpression<char> expression = new NegativeLookBackExpression<char> (m_B); string [] expectedValues = new [] {""}; int index = 1; var list = AList; var matches = expression.GetMatches (list, index).ToList (); Assert.AreEqual (expectedValues.Length, matches.Count (), "Count"); for (int i = 0; i < expectedValues.Length; i++) { var match = matches [i]; var expected = expectedValues [i]; Assert.AreEqual (index, match.Index, "match.Index"); Assert.AreEqual (expected.Length, match.Length, "match.Length"); Assert.IsTrue (match.Success, "match.Success"); Assert.AreEqual (expected.Length, match.Items.Count, "match.Items.Count"); Assert.AreEqual (expected, new string (match.Items.ToArray ()), "match.Items"); index++; } }
public void ConstructorSucceeds() { var expression = new NegativeLookBackExpression<char> (m_A); Assert.IsTrue (expression.Negate); }
public void ConstructorThrowArgumentNullExceptionForNullArray() { var expression = new NegativeLookBackExpression<char> ((IExpression<char>) null); }
public void IsMatchAt5Of_NegativeLookBack_Greedy_Any_2_ForDigetsReturnsFalse() { int index = 5; NegativeLookBackExpression<char> expression = new NegativeLookBackExpression<char> (new GreedyRepeatExpression<char> (m_any, 2)); int length = 0; var list = DigetsList; var ml = expression.IsMatchAt (list, index); Assert.IsFalse (ml.Success, "isMatch"); Assert.AreEqual (length, ml.Length, "assertionLength"); }