extern crate prime_suspects; use prime_suspects::{eratosthenes_sieve, segmented_sieve, segmented_sieve_parallel}; #[test] fn simple_eratosthenes_100 () { let test_100_primes = eratosthenes_sieve(100); assert_eq!( vec![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], test_100_primes); } #[test] fn no_end_sieve_misses_100k_segmented() { let test_100k_primes = segmented_sieve(100000, 300); assert!(!test_100k_primes.contains(&99999)); } #[test] fn no_end_sieve_misses_100k_parallel() { let test_100k_primes = segmented_sieve_parallel(100000, 300); assert!(!test_100k_primes.contains(&99999)); } #[test] fn no_end_sieve_misses_100m_segmented() { let test_100m_primes = segmented_sieve(1000000, 350); assert!(test_100m_primes.contains(&999983)); assert!(!test_100m_primes.contains(&999997)); } #[test] fn no_end_sieve_misses_100m_parallel() { let test_100m_primes = segmented_sieve_parallel(1000000, 350); assert!(test_100m_primes.contains(&999983)); assert!(!test_100m_primes.contains(&999997)); }