Exemplo n.º 1
0
 def test__find_primes__when_one_arg__then_same_as_two_args_with_zero_as_min(
 ):
     # when
     result1 = find_primes(100)
     result2 = find_primes(0, 100)
     # then
     assert_that(list(result1)).is_equal_to(list(result2))
Exemplo n.º 2
0
 def test__find_primes__when_max_is_prime__then_primes_less_than_arg():
     # when
     result = find_primes(67)
     # then
     assert_that(list(result)).is_equal_to([
         2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61
     ])
Exemplo n.º 3
0
 def test__find_primes__when_one_arg__then_primes_less_than_arg():
     # when
     result = find_primes(100)
     # then
     assert_that(list(result)).is_equal_to([
         2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61,
         67, 71, 73, 79, 83, 89, 97
     ])
Exemplo n.º 4
0
 def test__find_primes__when_two_args__then_primes_between():
     # when
     result = find_primes(30, 200)
     # then
     assert_that(list(result)).is_equal_to([
         31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101,
         103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167,
         173, 179, 181, 191, 193, 197, 199
     ])
Exemplo n.º 5
0
 def test__find_primes__when_min_and_max_are_primes__then_primes_between_with_min_inclusive(
 ):
     # when
     result = find_primes(137, 317)
     # then
     assert_that(list(result)).is_equal_to([
         137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197,
         199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271,
         277, 281, 283, 293, 307, 311, 313
     ])
Exemplo n.º 6
0
 def test__find_primes__when_min_less_than_sqrt_of_max__then_primes_between(
 ):
     # when
     result = find_primes(5, 150)
     # then
     assert_that(list(result)).is_equal_to([
         5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67,
         71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137,
         139, 149
     ])
Exemplo n.º 7
0
 def test__find_primes__when_at_most_two():
     # when
     result = find_primes(2)
     # then
     assert_that(list(result)).is_empty()
Exemplo n.º 8
0
 def test__find_primes__when_two_args_descending__then_empty_generator():
     # when
     result = find_primes(100, 30)
     # then
     assert_that(list(result)).is_empty()
Exemplo n.º 9
0
 def function():
     find_primes(20, 200, 10)
Exemplo n.º 10
0
 def function():
     find_primes()
Exemplo n.º 11
0
 def test__find_primes__when_min_equals_max_and_composite__then_empty():
     # when
     result = find_primes(91, 91)
     # then
     assert_that(list(result)).is_empty()
Exemplo n.º 12
0
 def test__find_primes__when_min_equals_max_and_prime__then_empty_list():
     # when
     result = find_primes(41, 41)
     # then
     assert_that(list(result)).is_empty()