Ejemplo n.º 1
0
        public void Should_ReturnFalse_When_StringHasNoLetters()
        {
            // [arrange]
            var input     = " ";
            var underTest = new PalindromePermutation();

            // [act]
            var result = underTest.HasPermutationsThatArePalindrome(input);

            // [assert]
            Assert.False(result);
        }
Ejemplo n.º 2
0
        public void Should_ReturnFalse_When_NoPermutationIsAPalindrome()
        {
            // [arrange]
            var input     = "no permutations of this are a palindrome";
            var underTest = new PalindromePermutation();

            // [act]
            var result = underTest.HasPermutationsThatArePalindrome(input);

            // [assert]
            Assert.False(result);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            var condition = true;

            //just keeping the current solving problem in if condition; nothing else
            if (condition)
            {
                KStacks.MainMethod();
            }
            else
            {
                #region LinkedLists
                LinkIntersection.MainMethod();
                SumList.MainMethod();
                RemoveDups <int> .MainMethod();

                ReturnKthToLast.MainMethod(1);
                DeleteMiddleNode.MainMethod();
                LoopDetection.MainMethod();
                #endregion

                #region Array and Strings
                StringRotation.IsStringRotation("waterbottle", "erbottlewat");
                ZeroMatrixImplementation();
                RotateMatrixImplementation(4);
                StringCompression.CompressedString("aabcccccaaa");
                OneAway.IsStringOneAway("pale", "paled");
                PalindromePermutation.IsPalindromePermutation("Mr. owl ate my Metal worm");
                URLify.URLifyString("Spaces in this string will be replaced by percent20");
                IsStringPermutation.VerifyStringPermutation("abdcdefgh", "aefgb2cdh");
                UniqueString.VerifyUniqueStringAsciiSet("!@#$%$^&*()EFgh");
                HashTableImplentation();
                SwapWithoutTemp.SwapWithoutTempVar(12, 24);
                #endregion
            }
        }
Ejemplo n.º 4
0
        public void Test_NotPalindromePermutation_Success(string input)
        {
            var actual = PalindromePermutation.IsPalindromePermutation(input);

            Assert.IsFalse(actual);
        }
Ejemplo n.º 5
0
 public void TestPalindromePermutations(string source, bool isPalindrome)
 {
     Assert.Equal(isPalindrome, PalindromePermutation.Execute(source));
 }
        [TestCase("superdupers 12 345  6 ' $%", true)] // still a palindrome permutation as non letters are ignored
        public void Test_IsPermutation(string input, bool expected)
        {
            var actual = PalindromePermutation.IsPermutation(input);

            Assert.That(actual, Is.EqualTo(expected));
        }
Ejemplo n.º 7
0
 public void PalindromePermutation_Test()
 {
     PalindromePermutation.PalindromePermutationAlgo("TactCoa").Should().BeTrue();
     PalindromePermutation.PalindromePermutationAlgo("TactCoaa").Should().BeFalse();
     PalindromePermutation.PalindromePermutationAlgo("xReowtaoraewX").Should().BeTrue();
 }
Ejemplo n.º 8
0
        public void PalindromePermutationTest(string input, bool expectedResult)
        {
            var result = PalindromePermutation.Run(input);

            Assert.Equal(expectedResult, result);
        }
        public void shouldReturnTrueWhenLengthRemovingSpacesIsOddAndOnlyOneCharacterCountIsOdd()
        {
            string permutation = "a  bc dcb  a";

            Assert.True(PalindromePermutation.IsPalindromePermutation(permutation));
        }
        public void shouldReturnFalseWhenLengthRemovingSpacesIsOddAndThereIsNotOneOddCharacterCounts()
        {
            string permutation = "a  b ccbacb";

            Assert.False(PalindromePermutation.IsPalindromePermutation(permutation));
        }
Ejemplo n.º 11
0
 public void Setup()
 {
     palindromePermutation = new PalindromePermutation();
 }
Ejemplo n.º 12
0
        public void Given_A_Palindrome_And_Permutation_CheckPalindromePermutation_Returns_True(string s, string p)
        {
            var actual = PalindromePermutation.CheckPalindromePermutation(s, p);

            Assert.True(actual);
        }