コード例 #1
0
        public void BuildTable_LargePrefix()
        {
            int[] expected = new[] { 0, 0, 0, 0, 0, 0, 0, 1, 2, 3, 4, 5 };
            var   pattern  = "abcdefabcdef";
            var   result   = KMP.BuildLookupTable(pattern);

            CollectionAssert.AreEqual(result, expected);
        }
コード例 #2
0
        public void BuildTable_TwoPrefixes()
        {
            int[] expected = new[] { 0, 0, 1, 0, 1 };
            var   pattern  = "aacaa";
            var   result   = KMP.BuildLookupTable(pattern);

            CollectionAssert.AreEqual(result, expected);
        }