示例#1
0
        public static void Pow()
        {
            Assert.That(MathQ.Pow(2, 5) == 32);
            Assert.That(MathQ.Pow(2, 6) == 64);

            Assert.That(MathQ.PowWithoutRecursion(2, 0) == 1);
            Assert.That(MathQ.PowWithoutRecursion(2, 1) == 2);
            Assert.That(MathQ.PowWithoutRecursion(2, 2) == 4);
            Assert.That(MathQ.PowWithoutRecursion(2, 3) == 8);
            Assert.That(MathQ.PowWithoutRecursion(2, 4) == 16);
            Assert.That(MathQ.PowWithoutRecursion(2, 5) == 32);
            Assert.That(MathQ.PowWithoutRecursion(2, 6) == 64);

            Assert.That(MathQ.PowMod(2, 4, 2) == 0);
            Assert.That(MathQ.PowMod(2, 3, 3) == 2);
            Assert.That(MathQ.PowMod(2, 7, 5) == 3);
        }