Beispiel #1
0
        public void TestMoreThanOneWord()
        {
            var list = new List <string> {
                "v", "n", "p", "u", "s", "t", "w", "o"
            };

            Assert.AreEqual(list, UniqueCharacter.UniqueCharacters("eleven plus two"));
        }
Beispiel #2
0
        public void TestUpperLowerChars()
        {
            var list = new List <string> {
                "l", "m"
            };

            Assert.AreEqual(list, UniqueCharacter.UniqueCharacters("AlMa"));
        }
Beispiel #3
0
        public void TestAllUniqueChars()
        {
            var list = new List <string> {
                "s", "a", "l", "t"
            };

            Assert.AreEqual(list, UniqueCharacter.UniqueCharacters("salt"));
            list = new List <string> {
                "a"
            };
            Assert.AreEqual(list, UniqueCharacter.UniqueCharacters("a"));
        }
Beispiel #4
0
        public void TestSomeUniqueChars()
        {
            var list = new List <string> {
                "a", "r", "e"
            };

            Assert.AreEqual(list, UniqueCharacter.UniqueCharacters("address"));
            list = new List <string> {
                "n", "g", "r", "m"
            };
            Assert.AreEqual(list, UniqueCharacter.UniqueCharacters("anagram"));
            list = new List <string> {
                "a"
            };
            Assert.AreEqual(list, UniqueCharacter.UniqueCharacters("bba"));
        }
 public UniqueCharTests()
 {
     _algo = new UniqueCharacter();
 }
Beispiel #6
0
 public void UniqueCharacter_Success()
 {
     Assert.AreEqual("compresd", UniqueCharacter.GetUniqueCharacters("compressed"));
     Assert.AreEqual("implent", UniqueCharacter.GetUniqueCharacters("implement"));
 }
Beispiel #7
0
 public void UniqueCharacter_Emptytring()
 {
     Assert.IsEmpty(UniqueCharacter.GetUniqueCharacters(String.Empty));
 }
Beispiel #8
0
 public void UniqueCharacter_NullString()
 {
     Assert.IsNull(UniqueCharacter.GetUniqueCharacters(null));
 }
Beispiel #9
0
        public void Test1()
        {
            var s = "xabb";

            Assert.Equal(0, UniqueCharacter.FindFirstUniqChar(s));
        }
Beispiel #10
0
        public void Test5()
        {
            var s = "";

            Assert.Equal(-1, UniqueCharacter.FindFirstUniqChar(s));
        }
Beispiel #11
0
        public void Test3()
        {
            var s = "leetcode";

            Assert.Equal(0, UniqueCharacter.FindFirstUniqChar(s));
        }
Beispiel #12
0
        public void TestNoUniqueChars()
        {
            var list = new List <string>();

            Assert.AreEqual(list, UniqueCharacter.UniqueCharacters("meme"));
        }