Example #1
0
        public void NoCommonPrefixReturnsEmptyString()
        {
            var input = new[] { "cat", "bat", "hat" };
            var lcp   = new LongestCommonPrefix();

            Assert.Equal("", lcp.longestCommonPrefix(input));
        }
Example #2
0
        public void StringsCanShareCommonPrefix()
        {
            var input = new[] { "aab", "aabcd" };
            var lcp   = new LongestCommonPrefix();

            Assert.Equal("aab", lcp.longestCommonPrefix(input));
        }
Example #3
0
        public void ReturnsEmptyStringForNoInput()
        {
            var lcp = new LongestCommonPrefix();

            Assert.Equal("", lcp.longestCommonPrefix(null));
        }