1
exercism fetch rust two-bucket

tests/two-bucket.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
extern crate two_bucket;

use two_bucket::{solve, Bucket, BucketStats};

#[test]
fn test_case_1() {
    assert_eq!(
        solve(3, 5, 1, &Bucket::One),
        BucketStats {
            moves: 4,
            goal_bucket: Bucket::One,
            other_bucket: 5,
        }
    );
}

#[test]
#[ignore]
fn test_case_2() {
    assert_eq!(
        solve(3, 5, 1, &Bucket::Two),
        BucketStats {
            moves: 8,
            goal_bucket: Bucket::Two,
            other_bucket: 3,
        }
    );
}

#[test]
#[ignore]
fn test_case_3() {
    assert_eq!(
        solve(7, 11, 2, &Bucket::One),
        BucketStats {
            moves: 14,
            goal_bucket: Bucket::One,
            other_bucket: 11,
        }
    );
}

#[test]
#[ignore]
fn test_case_4() {
    assert_eq!(
        solve(7, 11, 2, &Bucket::Two),
        BucketStats {
            moves: 18,
            goal_bucket: Bucket::Two,
            other_bucket: 7,
        }
    );
}

#[test]
#[ignore]
fn test_case_5() {
    assert_eq!(
        solve(1, 3, 3, &Bucket::Two),
        BucketStats {
            moves: 1,
            goal_bucket: Bucket::Two,
            other_bucket: 0,
        }
    );
}

#[test]
#[ignore]
fn test_case_6() {
    assert_eq!(
        solve(2, 3, 3, &Bucket::One),
        BucketStats {
            moves: 2,
            goal_bucket: Bucket::Two,
            other_bucket: 2,
        }
    );
}