コード例 #1
0
        public void GetMatchesFindsNoMatchesForEmpty()
        {
            LookAheadExpression<char> expression = new LookAheadExpression<char> (m_any);

             var matches = expression.GetMatches (EmptyList, 0);

             Assert.AreEqual (0, matches.Count (), "Count");
        }
コード例 #2
0
        public void GetMatchesFindsOneMatchForA()
        {
            LookAheadExpression<char> expression = new LookAheadExpression<char> (m_a);

             string [] expectedValues = new [] {""};
             int index = 0;
             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");
             }
        }