예제 #1
0
        public void TestStringIsPalendrome()
        {
            String p    = "hannah";
            String notP = "palendrome";

            bool isP = PalendromeHelper.IsPalendrome(p);

            Assert.IsTrue(isP, $"IsPalendrome did not detect a palendrome");

            bool isNotP = PalendromeHelper.IsPalendrome(notP);

            Assert.IsFalse(isNotP, $"IsPalendrome claimed a non-palendrome was a palendrome");
        }
예제 #2
0
        public void TestIsBase2Palendrome()
        {
            int p    = 9; // is 1001 in base-2
            int notP = 11;

            bool isP = PalendromeHelper.IsBase2Palendrome(p);

            Assert.IsTrue(isP, "IsBase2Palendrome did not detect a base-2 palendrome");

            bool isNotP = PalendromeHelper.IsBase2Palendrome(notP);

            Assert.IsFalse(isNotP, "IsBase2Palendrome claimed a non-palendrome was a base-2 palendrome");
        }
예제 #3
0
        public void TestIsBase10Palendrome()
        {
            int p    = 98789;
            int notP = 98799;

            bool isP = PalendromeHelper.IsBase10Palendrome(p);

            Assert.IsTrue(isP, "IsBase10Palendrome did not detect a base-10 palendrome");

            bool isNotP = PalendromeHelper.IsBase10Palendrome(notP);

            Assert.IsFalse(isNotP, "IsBase10Palendrome claimed a non-palendrome was a base-10 palendrome");
        }
예제 #4
0
        public void TestIsBaseNPalendrome2()
        {
            int p     = 98789;
            int notP  = 98799;
            int baseN = 10;

            bool isP = PalendromeHelper.IsBaseNPalendrome(p, baseN);

            Assert.IsTrue(isP, $"IsBaseNPalendrome did not detect a base-{baseN} palendrome");

            bool isNotP = PalendromeHelper.IsBaseNPalendrome(notP, baseN);

            Assert.IsFalse(isNotP, $"IsBaseNPalendrome claimed a non-palendrome was a base-{baseN} palendrome");
        }
예제 #5
0
        public void TestIsBaseNPalendrome1()
        {
            int p     = 9; // is 1001 in base-2
            int notP  = 11;
            int baseN = 2;

            bool isP = PalendromeHelper.IsBaseNPalendrome(p, baseN);

            Assert.IsTrue(isP, $"IsBaseNPalendrome did not detect a base-{baseN} palendrome");

            bool isNotP = PalendromeHelper.IsBaseNPalendrome(notP, baseN);

            Assert.IsFalse(isNotP, "IsBaseNPalendrome claimed a non-palendrome was a base-2 palendrome");
        }