Beispiel #1
0
 public static void GapInPrimesTests_test1()
 {
     Assert.AreEqual(new long[] { 101, 103 }, GapInPrimes.Gap(2, 100, 110));
     Assert.AreEqual(new long[] { 103, 107 }, GapInPrimes.Gap(4, 100, 110));
     Assert.AreEqual(null, GapInPrimes.Gap(6, 100, 110));
     Assert.AreEqual(new long[] { 359, 367 }, GapInPrimes.Gap(8, 300, 400));
     Assert.AreEqual(new long[] { 337, 347 }, GapInPrimes.Gap(10, 300, 400));
 }
Beispiel #2
0
        public void DoGapTestWithNull()
        {
            var gap           = 6;
            var initialNumber = 100;
            var finalNumber   = 110;

            var gapInPrimes = new GapInPrimes();
            var result      = gapInPrimes.DoGap(gap, initialNumber, finalNumber);

            Assert.AreEqual(null, result, "Incorrect");
        }
Beispiel #3
0
        public void DoGapTest()
        {
            var gap           = 2;
            var initialNumber = 100;
            var finalNumber   = 110;

            var gapInPrimes = new GapInPrimes();
            var result      = gapInPrimes.DoGap(gap, initialNumber, finalNumber);

            Assert.IsTrue(new long[] { 101, 103 }.SequenceEqual(result), "Incorrect");
        }
Beispiel #4
0
        public static void GapInPrimesTest()
        {
            //Primes primes = new Primes(500);

            //primes.PrintPrimes();

            Assert.AreEqual(new long[] { 101, 103 }, GapInPrimes.Gap(2, 100, 110));
            Assert.AreEqual(new long[] { 103, 107 }, GapInPrimes.Gap(4, 100, 110));
            Assert.AreEqual(null, GapInPrimes.Gap(6, 100, 110));
            Assert.AreEqual(new long[] { 359, 367 }, GapInPrimes.Gap(8, 300, 400));
            Assert.AreEqual(new long[] { 337, 347 }, GapInPrimes.Gap(10, 300, 400));
        }
Beispiel #5
0
        public void DoGapLongTest()
        {
            var gap           = 8;
            var initialNumber = (long)3e6;
            var finalNumber   = (long)4e6;

            var gapInPrimes = new GapInPrimes();
            var result      = gapInPrimes.DoGap(gap, initialNumber, finalNumber);


            Assert.IsTrue(new long[] { 3000953, 3000961 }.SequenceEqual(result), "Incorrect");
        }
Beispiel #6
0
 public static void Test1()
 {
     Assert.AreEqual(new long[] { 101, 103 }, GapInPrimes.Gap(2, 100, 110));
 }
Beispiel #7
0
 public static void Test6()
 {
     Assert.AreEqual(new long[] { 337, 347 }, GapInPrimes.Gap(10, 300, 400));
 }
Beispiel #8
0
 public static void Test5()
 {
     Assert.AreEqual(new long[] { 359, 367 }, GapInPrimes.Gap(8, 300, 400));
 }
Beispiel #9
0
 public static void Test4()
 {
     Assert.AreEqual(null, GapInPrimes.Gap(6, 100, 110));
 }
Beispiel #10
0
 public static void Test2()
 {
     Assert.AreEqual(new long[] { 103, 107 }, GapInPrimes.Gap(4, 100, 110));
 }