示例#1
0
        public void RandomInvSmallNumbersTest()
        {
            Random r = new Random();

            for (int i = 0; i < 20; i++)
            {
                long n = r.Next(1000);
                Assert.AreEqual(MysteryInv(n), MysteryFunction.MysteryInv(n), $"mysteryInv({n})");
            }
        }
示例#2
0
        public void RandomInvBigNumbersTest()
        {
            Random r = new Random();

            for (int i = 0; i < 20; i++)
            {
                long n = (long)(r.NextDouble() * 999999999999999L);
                Assert.AreEqual(MysteryInv(n), MysteryFunction.MysteryInv(n), $"mysteryInv({n})");
            }
        }
示例#3
0
        public void MysteryInvTest()
        {
            Assert.AreEqual(6, MysteryFunction.MysteryInv(5), "mysteryInv(5)");
            Assert.AreEqual(9, MysteryFunction.MysteryInv(13), "mysteryInv(13)");
            Assert.AreEqual(19, MysteryFunction.MysteryInv(26), "mysteryInv(26)");
            int x = 10;

            Assert.AreEqual((int)Math.Pow(2, x + 1) - 1, MysteryFunction.MysteryInv((int)Math.Pow(2, x)), string.Format("mysteryInv({0}) ", (int)Math.Pow(2, x)));
            Assert.AreEqual(50320920207254, MysteryFunction.MysteryInv(65036019806301), "mysteryInv(65036019806301)");
        }