Esempio n. 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);
        }
Esempio n. 2
0
        public void GetLongestCommonPrefix_dog_racecar_car()
        {
            var    srv = new LongestCommonPrefix();
            string s   = srv.GetLongestCommonPrefix(new string[] { "dog", "racecar", "car" });

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

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

            Assert.AreEqual("", prefix);
        }