Exemple #1
0
        public void BothAreEmpty()
        {
            var ImpStr   = new ImplementStr();
            var haystack = "";
            var needle   = "";

            Assert.AreEqual(0, ImpStr.StrStr(haystack, needle));
        }
Exemple #2
0
        public void NeedleLongerThanHaystack()
        {
            var ImpStr   = new ImplementStr();
            var haystack = "Test";
            var needle   = "Tests";

            Assert.AreEqual(-1, ImpStr.StrStr(haystack, needle));
        }
Exemple #3
0
        public void FindNeedle()
        {
            var ImpStr   = new ImplementStr();
            var haystack = "TestTest";
            var needle   = "st";

            Assert.AreEqual(2, ImpStr.StrStr(haystack, needle));
        }
Exemple #4
0
        public void FindNeedle1()
        {
            var ImpStr   = new ImplementStr();
            var haystack = "mississippi";
            var needle   = "issip";

            Assert.AreEqual(4, ImpStr.StrStr(haystack, needle));
        }
Exemple #5
0
        public void NeedleEmpty()
        {
            var ImpStr   = new ImplementStr();
            var haystack = "aa";
            var needle   = string.Empty;

            Assert.AreEqual(0, ImpStr.StrStr(haystack, needle));
        }