Beispiel #1
0
        public void TestMyAnagram()
        {
            AnagramStrings First = new AnagramStrings();
            string firstWord = "hard";
            string secondWord = "dhar";

            Assert.AreEqual(true, First.Anagrammer(firstWord, secondWord));
        }
        public void Test1()
        {
            var text1 = "pablo";
            var text2 = "blpao";

            var isAnagram = new AnagramStrings().IsAnagram(text1, text2);

            Assert.True((bool)isAnagram);
        }
Beispiel #3
0
        public IActionResult Get([FromBody] AnagramStrings values)
        {
            var awc = new AnagramWordsChecker();

            if (awc.Check(values.w1, values.w2))
            {
                return(Ok());
            }
            else
            {
                return(BadRequest());
            }
        }
Beispiel #4
0
 public void TestAnagramsUsingXor()
 {
     Assert.True(AnagramStrings.AreStringsAnagramsUsingXor("silent", "listen"));
     Assert.True(AnagramStrings.AreStringsAnagramsUsingXor("word", "wrdo"));
     Assert.True(AnagramStrings.AreStringsAnagramsUsingXor("mary", "army"));
     Assert.True(AnagramStrings.AreStringsAnagramsUsingXor("stop", "tops"));
     Assert.True(AnagramStrings.AreStringsAnagramsUsingXor("boat", "btoa"));
     Assert.False(AnagramStrings.AreStringsAnagramsUsingXor("pure", "in"));
     Assert.False(AnagramStrings.AreStringsAnagramsUsingXor("fill", "fil"));
     Assert.False(AnagramStrings.AreStringsAnagramsUsingXor("b", "bbb"));
     Assert.False(AnagramStrings.AreStringsAnagramsUsingXor("ccc", "ccccccc"));
     Assert.True(AnagramStrings.AreStringsAnagramsUsingXor("a", "a"));
     Assert.False(AnagramStrings.AreStringsAnagramsUsingXor("sleep", "slep"));
 }