|
4 | 4 | class SieveTest < Minitest::Test |
5 | 5 | def test_no_primes_under_two |
6 | 6 | # skip |
| 7 | + actual = Sieve.new(1).primes |
7 | 8 | expected = [] |
8 | | - assert_equal expected, Sieve.new(1).primes |
| 9 | + assert_equal expected, actual |
9 | 10 | end |
10 | 11 |
|
11 | 12 | def test_find_first_prime |
12 | 13 | skip |
| 14 | + actual = Sieve.new(2).primes |
13 | 15 | expected = [2] |
14 | | - assert_equal expected, Sieve.new(2).primes |
| 16 | + assert_equal expected, actual |
15 | 17 | end |
16 | 18 |
|
17 | 19 | def test_find_primes_up_to_10 |
18 | 20 | skip |
| 21 | + actual = Sieve.new(10).primes |
19 | 22 | expected = [2, 3, 5, 7] |
20 | | - assert_equal expected, Sieve.new(10).primes |
| 23 | + assert_equal expected, actual |
21 | 24 | end |
22 | 25 |
|
23 | 26 | def test_limit_is_prime |
24 | 27 | skip |
| 28 | + actual = Sieve.new(13).primes |
25 | 29 | expected = [2, 3, 5, 7, 11, 13] |
26 | | - assert_equal expected, Sieve.new(13).primes |
| 30 | + assert_equal expected, actual |
27 | 31 | end |
28 | 32 |
|
29 | 33 | def test_find_primes_up_to_1000 |
30 | 34 | skip |
31 | | - expected = [ |
32 | | - 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, |
33 | | - 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, |
34 | | - 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, |
35 | | - 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, |
36 | | - 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, |
37 | | - 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, |
38 | | - 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, |
39 | | - 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, |
40 | | - 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, |
41 | | - 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997 |
42 | | - ] |
43 | | - assert_equal expected, Sieve.new(1000).primes |
| 35 | + actual = Sieve.new(1000).primes |
| 36 | + expected = [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, 101, 103, 107, 109, 113, 127, 131, 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, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997] |
| 37 | + assert_equal expected, actual |
44 | 38 | end |
45 | 39 | end |
0 commit comments