Ejemplo n.º 1
0
        public void RunTest05()
        {
            OneAway test   = new OneAway("payles", "pale");
            var     result = test.Run();

            Assert.IsFalse(result);
        }
Ejemplo n.º 2
0
        public void RunTest03()
        {
            OneAway test   = new OneAway("pale", "bale");
            var     result = test.Run();

            Assert.IsTrue(result);
        }
Ejemplo n.º 3
0
 public void OneAwayAlgoTests()
 {
     OneAway.OneAwayAlgo("pale", "ple").Should().BeTrue();
     OneAway.OneAwayAlgo("pales", "pale").Should().BeTrue();
     OneAway.OneAwayAlgo("pale", "bale").Should().BeTrue();
     OneAway.OneAwayAlgo("pale", "bake").Should().BeFalse();
 }
Ejemplo n.º 4
0
        public void FirstTry_Equal_Parameters_Returns_True()
        {
            string first  = "pale";
            string second = "pale";

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

            Assert.True(result);
        }
Ejemplo n.º 5
0
        public void FirstTry_Parameters_PALE_and_BAE_Returns_False()
        {
            string first  = "pale";
            string second = "bae";

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

            Assert.False(result);
        }
Ejemplo n.º 6
0
        public void Fast_Parameters_PALE_and_BALE_Returns_True()
        {
            string first  = "pale";
            string second = "bale";

            bool result = new OneAway().Fast(first, second);

            Assert.True(result);
        }
        public void TestOneAway()
        {
            // solution #1
            Assert.True(OneAway.OneAwayEdit("pale", "ple"));
            Assert.True(OneAway.OneAwayEdit("pales", "pale"));
            Assert.True(OneAway.OneAwayEdit("pale", "bale"));
            Assert.False(OneAway.OneAwayEdit("pale", "bae"));

            // solution #2
            Assert.True(OneAway.OneAwayEditWhole("pale", "ple"));
            Assert.True(OneAway.OneAwayEditWhole("pales", "pale"));
            Assert.True(OneAway.OneAwayEditWhole("pale", "bale"));
            Assert.False(OneAway.OneAwayEditWhole("pale", "bae"));
        }
Ejemplo n.º 8
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.º 9
0
        public void OneAwayTest(string inputOne, string inputTwo, bool expectedResult)
        {
            var result = OneAway.Run(inputOne, inputTwo);

            Assert.Equal(expectedResult, result);
        }
 public void TestOneAway(string first, string second, bool expected)
 {
     Assert.Equal(expected, OneAway.Execute(first, second));
 }
Ejemplo n.º 11
0
        public void Given_Two_Strings_And_One_String_Is_Not_One_Away_From_The_Other_CheckOneAway_Returns_False(string s, string t)
        {
            var actual = OneAway.CheckOneAway(s, t);

            Assert.False(actual, string.Format(@"for values '{0}' and '{1}' CheckOneAway should return false", s, t));
        }
Ejemplo n.º 12
0
        public void Test_OneAway(string a, string b, bool expected)
        {
            var actual = OneAway.IsOneAway(a, b);

            Assert.That(actual, Is.EqualTo(expected));
        }
Ejemplo n.º 13
0
 public void Setup()
 {
     oneAway = new OneAway();
 }