示例#1
0
        public void CheckPermutationShoulReturnTrueOrFalseWhenGivenOneAndOtherStrings(string one, string other, bool expected)
        {
            CheckPermutation checkPermutation = new CheckPermutation();
            bool             actual           = checkPermutation.IsPermutation(one, other);

            Assert.Equal(expected, actual);
        }
示例#2
0
        public void RunTest03()
        {
            CheckPermutation cp = new CheckPermutation(null, null);
            var result          = cp.Run();

            Assert.IsTrue(result);
        }
示例#3
0
        public void RunTest11()
        {
            CheckPermutation cp = new CheckPermutation("asdf", "afewfs");
            var result          = cp.Run();

            Assert.IsFalse(result);
        }
示例#4
0
        public void RunTest02()
        {
            CheckPermutation cp = new CheckPermutation("", "");
            var result          = cp.Run();

            Assert.IsTrue(result);
        }
示例#5
0
        public void RunTest07()
        {
            CheckPermutation cp = new CheckPermutation("cba", null);
            var result          = cp.Run();

            Assert.IsFalse(result);
        }
示例#6
0
        public void RunTest08()
        {
            CheckPermutation cp = new CheckPermutation("abc", "aab");
            var result          = cp.Run();

            Assert.IsFalse(result);
        }
示例#7
0
        public void RunTest10()
        {
            CheckPermutation cp = new CheckPermutation("abcasdffe", "cbb");
            var result          = cp.Run();

            Assert.IsFalse(result);
        }
示例#8
0
 public void CheckPermutationSolution()
 {
     foreach (var item in _expected)
     {
         Assert.Equal(item.Item3,
                      CheckPermutation.CheckPermutationSolution(item.Item1, item.Item2));
     }
 }
示例#9
0
        public void CheckPermutation2Test(string a, string b, bool expected)
        {
            // act
            var actual = CheckPermutation.IsPermutation2(a, b);

            // assert
            Assert.That(actual, Is.EqualTo(expected));
        }
        public void FirstTry_One_String_Is_Permutation_Of_The_Other()
        {
            string first  = "abcdefgh";
            string second = "fdceagbh";

            bool result = new CheckPermutation().FirstTry(first, second);

            Assert.True(result);
        }
        public void FirstTry_Second_Parameter_Is_Null()
        {
            string first  = "abcdefgh";
            string second = null;

            bool result = new CheckPermutation().FirstTry(first, second);

            Assert.False(result);
        }
        public void FirstTry_Qty_Of_Elements_Are_Different()
        {
            string first  = "abcdefgh";
            string second = "abcdefg";

            bool result = new CheckPermutation().FirstTry(first, second);

            Assert.False(result);
        }
        public void FirstTry_One_String_Is_Not_Permutation_Of_The_Other()
        {
            string first  = "abcddfgh";
            string second = "abcdcfgh";

            bool result = new CheckPermutation().FirstTry(first, second);

            Assert.False(result);
        }
        public void FirstTry_One_String_Is_Not_Permutation_Of_The_Other_Because_Contains_a_Different_Char()
        {
            string first  = "abcdefgh";
            string second = "fdcmagbh";

            bool result = new CheckPermutation().FirstTry(first, second);

            Assert.False(result);
        }
示例#15
0
        public void SbyteTry_Vafzamora_Second_Parameter_Is_Null()
        {
            string first  = "abcdefgh";
            string second = null;

            bool result = new CheckPermutation().SbyteTry_Vafzamora(first, second);

            Assert.False(result);
        }
示例#16
0
        static void Main(string[] args)
        {
            bool isLinkedListTest  = false;
            bool isStringArrayTest = true;

            if (isLinkedListTest)
            {
                SinglyLinkedList sList = new SinglyLinkedList();
                DoublyLinkList   dList = new DoublyLinkList();
                CircularLinkList cList = new CircularLinkList();
                Random           rand  = new Random();
                for (int i = 0; i < 10; i++)
                {
                    var nodeVal = rand.Next(10, 20);
                    sList.AddNewNode(nodeVal.ToString());
                    dList.AddNewNode(nodeVal.ToString());
                    cList.AddNewNode(nodeVal.ToString());
                }
                sList.PrintAllNode();
                sList.ReverseNode();
                sList.RemoveDuplicateWithBuffer();
                // sList.RemoveDuplicateWithoutBuffer();
            }
            if (isStringArrayTest)
            {
                ShiftCharacterKpositions shiftCharacter = new ShiftCharacterKpositions();

                shiftCharacter.SiftByK("abnish", 2);

                StringHasUniqueChar stringHasUniqueChar = new StringHasUniqueChar();
                stringHasUniqueChar.StringHasUniqueCharacter("aba");

                CheckPermutation checkPermutation = new CheckPermutation();
                checkPermutation.CheckStringPermutation("abnish", "shabnI");
                ReplaceSpace replaceSpace = new ReplaceSpace();
                replaceSpace.ReplaceSpaceWithPercent20("abnish kumar choudhary   ");

                OneAwayString oneAwayString = new OneAwayString();
                oneAwayString.CheckOneAwayString("abnish", "abnis");
                oneAwayString.CheckOneAwayString("abnish", "abnish");
                oneAwayString.CheckOneAwayString("abnish", "sanjeet");
            }
            Console.ReadKey();
        }
示例#17
0
        public void CheckPermutationWithoutSortTest(string inputOne, string inputTwo, bool expectedResult)
        {
            var result = CheckPermutation.RunWithoutSort(inputOne, inputTwo);

            Assert.Equal(expectedResult, result);
        }
        public void Given_Two_Strings_Where_One_String_Is_Not_A_Permutation_Of_The_First_IsPermutation_Returns_False(string s, string ss)
        {
            var actual = CheckPermutation.IsPermutation(s, ss);

            Assert.False(actual);
        }
示例#19
0
 public void IsPermutation()
 {
     Assert.AreEqual(CheckPermutation.IsPermutation(original, permutation), true);
     Assert.AreEqual(CheckPermutation.IsPermutation(original, notPermutation), false);
 }
示例#20
0
 public void TestPermutationsCheck(string source, string target, bool result)
 {
     Assert.Equal(result, CheckPermutation.Check(source, target));
 }
示例#21
0
        public void Test5()
        {
            var actual = CheckPermutation.IsPermutation("test111111", "111111tset");

            Assert.IsTrue(actual);
        }
示例#22
0
        public void Test4()
        {
            var actual = CheckPermutation.IsPermutation("test", "tset");

            Assert.IsTrue(actual);
        }
示例#23
0
        public void Test6()
        {
            var actual = CheckPermutation.IsPermutation("test111111", "111112tset");

            Assert.IsFalse(actual);
        }
示例#24
0
 public void InitCheckPermutation()
 {
     _perms = new CheckPermutation();
 }
示例#25
0
 public void Setup()
 {
     checkPermutation = new CheckPermutation();
 }
示例#26
0
 public void CheckPermutationUsingSorting_Tests()
 {
     CheckPermutation.CheckPermutationUsingSorting("adasdasdasd", "adasdasdasda").Should().BeFalse();
     CheckPermutation.CheckPermutationUsingSorting("adasdasdasd", "adasdasdasd").Should().BeTrue();
 }
示例#27
0
        public void Test3()
        {
            var actual = CheckPermutation.IsPermutation("test", "tess");

            Assert.IsFalse(actual);
        }