1
exercism fetch rust prime-factors

tests/prime-factors.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
extern crate prime_factors;

use prime_factors::factors;

#[test]
fn test_no_factors() {
    assert_eq!(factors(1), vec![]);
}

#[test]
#[ignore]
fn test_prime_number() {
    assert_eq!(factors(2), vec![2]);
}

#[test]
#[ignore]
fn test_square_of_a_prime() {
    assert_eq!(factors(9), vec![3, 3]);
}

#[test]
#[ignore]
fn test_cube_of_a_prime() {
    assert_eq!(factors(8), vec![2, 2, 2]);
}

#[test]
#[ignore]
fn test_product_of_primes_and_non_primes() {
    assert_eq!(factors(12), vec![2, 2, 3]);
}

#[test]
#[ignore]
fn test_product_of_primes() {
    assert_eq!(factors(901255), vec![5, 17, 23, 461]);
}

#[test]
#[ignore]
fn test_factors_include_large_prime() {
    assert_eq!(factors(93819012551), vec![11, 9539, 894119]);
}