test/sieve_test.rb in rubylabs-0.6.2 vs test/sieve_test.rb in rubylabs-0.6.4

- old
+ new

@@ -3,26 +3,29 @@ include SieveLab class TestSieve < Test::Unit::TestCase + def test_00_banner + print "\nSieveLab" + end + # Compare list generated by sieve method with list from Wikipedia. Test both the main # version (sieve) and the simple prototype that iterates until the worklist is empty. def test_01_first_25 - print "\n sieve" 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] assert_equal expected, sieve(100) assert_equal expected, proto_sieve(100) end # Check length of list generated by sieve with expected number of primes (also from Wikipedia). # pi[i] is the number of primes less than 10**i. Note: calling sieve(n) with n less than 2 # should quietly return an empty list. - def test_02_pi - pi = [0, 4, 25, 168, 1229, 9592] - for i in 0..(pi.length-1) - assert_equal pi[i], sieve(10**i).length - end - end + def test_02_pi + pi = [0, 4, 25, 168, 1229] # 9592 + for i in 0..(pi.length-1) + assert_equal pi[i], sieve(10**i).length + end + end end