public void LongestCommonPrefix_HasCommon()
        {
            //Arrange
            Solution014 s014 = new Solution014();

            string[] strArrar = new string[] { "flower", "flow", "flight" };
            string   expected = "fl";

            //Act
            string actual = s014.LongestCommonPrefix(strArrar);

            //Assert
            Assert.Equal(expected, actual);
        }
        public void LongestCommonPrefix_Ex1()
        {
            //Arrange
            Solution014 s014 = new Solution014();

            string[] strArrar = new string[] { "aca", "cba" };
            string   expected = "";

            //Act
            string actual = s014.LongestCommonPrefix(strArrar);

            //Assert
            Assert.Equal(expected, actual);
        }
        public void LongestCommonPrefix_NoCommon()
        {
            //Arrange
            Solution014 s014 = new Solution014();

            string[] strArrar = new string[] { "dog", "racecar", "car" };
            string   expected = "";

            //Act
            string actual = s014.LongestCommonPrefix(strArrar);

            //Assert
            Assert.Equal(expected, actual);
        }
Beispiel #4
0
 public void Solves_Problem_014_Example()
 {
     Solution014.Run(13).Should().Be(9);
 }
Beispiel #5
0
 public void TestMethod(string[] arr, string output)
 {
     Assert.Equal(output, Solution014.LongestCommonPrefix(arr));
 }