コード例 #1
0
        public void TestBruteForceAll()
        {
            string t = "zabcdefghijkabc";
            string p = "cde";

            CollectionAssert.AreEqual(StringMatcher.BruteForceAll(t, p), new [] { 3 });

            p = "abc";
            CollectionAssert.AreEqual(StringMatcher.BruteForceAll(t, p), new[] { 1, 12 });

            p = "aabc";
            Assert.That(StringMatcher.BruteForceAll(t, p), Is.Empty);

            p = string.Empty;
            CollectionAssert.AreEqual(StringMatcher.BruteForceAll(t, p), new[] { 0 });

            t = "one";
            p = "bigger";
            Assert.That(StringMatcher.BruteForceAll(t, p), Is.Empty);
        }