예제 #1
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");
        }
예제 #2
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");
        }