public void StrStrTest3() { var input1 = ""; var input2 = ""; var expected = 0; ImplementstrStr.StrStr(input1, input2).Should().Be(expected); }
public void StrStrTest() { var input1 = "hello"; var input2 = "ll"; var expected = 2; ImplementstrStr.StrStr(input1, input2).Should().Be(expected); }
public void StrStrTest2() { var input1 = "aaaaa"; var input2 = "bba"; var expected = -1; ImplementstrStr.StrStr(input1, input2).Should().Be(expected); }
public void ImplementstrStrTest() { var c = new ImplementstrStr(); // example1 var haystack = "hello"; var needle = "ll"; var result = c.StrStr(haystack, needle); Assert.AreEqual(result, 2); // example2 haystack = "aaaaa"; needle = "bba"; result = c.StrStr(haystack, needle); Assert.AreEqual(result, -1); //example3 haystack = ""; needle = ""; result = c.StrStr(haystack, needle); Assert.AreEqual(result, 0); }