示例#1
0
        public void GetLongestCommonPrefix_flower_flow_flight()
        {
            var    srv = new LongestCommonPrefix();
            string s   = srv.GetLongestCommonPrefix(new string[] { "flower", "flow", "flight" });

            Assert.AreEqual("fl", s);
        }
示例#2
0
        public void GetLongestCommonPrefix_dog_racecar_car()
        {
            var    srv = new LongestCommonPrefix();
            string s   = srv.GetLongestCommonPrefix(new string[] { "dog", "racecar", "car" });

            Assert.AreEqual("", s);
        }
示例#3
0
        public void TestEmptyPrefix()
        {
            LongestCommonPrefix longestCommonPrefix = new LongestCommonPrefix();

            string[] stringArray = new string[] { "abc", "efg" };
            string   prefix      = longestCommonPrefix.GetLongestCommonPrefix(stringArray);

            Assert.AreEqual("", prefix);
        }