コード例 #1
0
        public void CheckPrimality_NumberIs449()
        {
            var test   = new RabinMillerTest(447);
            var number = CreateNumber(193, 1);

            Assert.IsTrue(test.CheckPrimality(number));
        }
コード例 #2
0
        public void CheckPrimality_NumberIs257()
        {
            var test   = new RabinMillerTest(255);
            var number = CreateNumber(1, 1);

            Assert.IsTrue(test.CheckPrimality(number));
        }
コード例 #3
0
        public void CheckPrimality_NumberIs6()
        {
            var test   = new RabinMillerTest(4);
            var number = CreateNumber(6);

            Assert.IsFalse(test.CheckPrimality(number));
        }
コード例 #4
0
        public void CheckPrimality3()
        {
            var test   = new RabinMillerTest(CreateNumber(2));
            var number = CreateNumber(37);

            Assert.IsTrue(test.CheckPrimality(number));
        }
コード例 #5
0
 public void CheckPrimality1()
 {
     for (var i = 5; i < 500; ++i)
     {
         var test   = new RabinMillerTest(i - 2);
         var result = test.CheckPrimality(BigNumber.FromInt(i));
         if (result != CheckPrimality(i))
         {
             Assert.Fail("Error: " + i);
         }
     }
 }
コード例 #6
0
        public void CheckPrimality_NumberIsNull()
        {
            var test = new RabinMillerTest(2);

            Assert.Throws(typeof(ArgumentNullException), () => test.CheckPrimality(null));
        }