public void GetLongestCommonPrefix_flower_flow_flight() { var srv = new LongestCommonPrefix(); string s = srv.GetLongestCommonPrefix(new string[] { "flower", "flow", "flight" }); Assert.AreEqual("fl", s); }
public void GetLongestCommonPrefix_dog_racecar_car() { var srv = new LongestCommonPrefix(); string s = srv.GetLongestCommonPrefix(new string[] { "dog", "racecar", "car" }); Assert.AreEqual("", s); }
public void TestEmptyPrefix() { LongestCommonPrefix longestCommonPrefix = new LongestCommonPrefix(); string[] stringArray = new string[] { "abc", "efg" }; string prefix = longestCommonPrefix.GetLongestCommonPrefix(stringArray); Assert.AreEqual("", prefix); }