Beispiel #1
0
 def test_medium_list_generation(self):
     prime3.prime_gen(10000)
     primes_under_1k = 1229
     last_three = [9949, 9967, 9973]
     
     self.assertEqual(len(prime3.prime_list), primes_under_1k)
     self.assertEqual(prime3.prime_list[-3:], last_three)
Beispiel #2
0
    def test_medium_list_generation(self):
        prime3.prime_gen(10000)
        primes_under_1k = 1229
        last_three = [9949, 9967, 9973]

        self.assertEqual(len(prime3.prime_list), primes_under_1k)
        self.assertEqual(prime3.prime_list[-3:], last_three)
Beispiel #3
0
 def setUp(self):
     prime3.prime_gen(10)
Beispiel #4
0
 def setUp(self):
     prime3.prime_gen(600)
Beispiel #5
0
 def test_normal_usage(self):
     prime3.prime_gen(541)
     self.assertEqual(prime3.get_ordinal(541), 100)
Beispiel #6
0
 def test_prime(self):
     prime3.prime_gen(7)
     self.assertEqual(7, prime3.latest_prime())
Beispiel #7
0
 def test_twin_prime(self):
     prime3.prime_gen(18)
     self.assertEqual(17, prime3.latest_prime())
Beispiel #8
0
 def test_composite(self):
     prime3.prime_gen(10)
     self.assertEqual(7, prime3.latest_prime())
Beispiel #9
0
 def test_twin_prime(self):
     prime3.prime_gen(18)
     self.assertEqual(17, prime3.latest_prime())
Beispiel #10
0
 def test_float(self):
     prime3.prime_gen(14.7)
     true_list = [2, 3, 5, 7, 11, 13]
     self.assertEqual(prime3.prime_list, true_list)
Beispiel #11
0
 def test_prime(self):
     prime3.prime_gen(7)
     self.assertEqual(7, prime3.latest_prime())
Beispiel #12
0
 def test_policy_2(self):
     prime3.index_policy = 2
     prime3.prime_gen(10)
     self.assertEqual({2: 1, 3: 2, 5: 3, 7: 4}, prime3.ordinal_index)
Beispiel #13
0
 def setUp(self):
     prime3.prime_gen(10)
Beispiel #14
0
 def setUp(self):
     prime3.prime_gen(600)
Beispiel #15
0
 def test_policy_2(self):
     prime3.index_policy = 2
     prime3.prime_gen(10)
     self.assertEqual({2:1, 3:2, 5:3, 7:4}, prime3.ordinal_index)
Beispiel #16
0
 def test_normal_usage(self):
     prime3.prime_gen(541)
     self.assertEqual(prime3.get_ordinal(541), 100)
Beispiel #17
0
 def test_float(self):
     prime3.prime_gen(14.7)
     true_list = [2, 3, 5, 7, 11 ,13]
     self.assertEqual(prime3.prime_list, true_list)
Beispiel #18
0
 def test_small_list_generation(self):
     prime3.prime_gen(10)
     true_list = [2, 3, 5, 7]
     self.assertEqual(true_list, prime3.prime_list)
Beispiel #19
0
 def test_composite(self):
     prime3.prime_gen(10)
     self.assertEqual(7, prime3.latest_prime())
Beispiel #20
0
 def test_composite_request(self):
     prime3.prime_gen(10)
     with self.assertRaises(Exception):
         prime3.get_ordinal(8)
Beispiel #21
0
 def test_small_list_generation(self):
     prime3.prime_gen(10)
     true_list = [2, 3, 5, 7]
     self.assertEqual(true_list, prime3.prime_list)
Beispiel #22
0
#!C:\Python33\python.exe
import sys
import prime3
import timeit

i = 1000
stepsize = 1000000


while i < sys.maxsize:
  print('primes up to', i, 'in')
  comstring = 'primegen.primegen(' + str(i) +', ' + str(stepsize) +')'
  print(comstring)
  prime3.prime_gen(i)
  print(len(prime_list))
  #timeit.timeit(comstring, setup='import primegen')
  #timeit.timeit('primegen.primegen(100,1000000)', setup='import primegen')
  i=i*10

Beispiel #23
0
 def test_composite_request(self):
     prime3.prime_gen(10)
     with self.assertRaises(Exception):
         prime3.get_ordinal(8)
Beispiel #24
0
#!C:\Python33\python.exe
import sys
import prime3
import timeit

i = 1000
stepsize = 1000000

while i < sys.maxsize:
    print('primes up to', i, 'in')
    comstring = 'primegen.primegen(' + str(i) + ', ' + str(stepsize) + ')'
    print(comstring)
    prime3.prime_gen(i)
    print(len(prime3.prime_list))
    #timeit.timeit(comstring, setup='import primegen')
    #timeit.timeit('primegen.primegen(100,1000000)', setup='import primegen')
    i = i * 10