@@ -2,58 +2,76 @@ module main
22
33fn test_measure_using_bucket_one_of_size_3_and_bucket_two_of_size_5___start_with_bucket_one () {
44 expected := Solution{
5- moves: 4
6- goal_bucket: BucketId.one
5+ moves: 4
6+ goal_bucket: BucketId.one
77 other_bucket: 5
88 }
99 assert measure (3 , 5 , 1 , BucketId.one)! == expected
1010}
1111
1212fn test_measure_using_bucket_one_of_size_3_and_bucket_two_of_size_5___start_with_bucket_two () {
1313 expected := Solution{
14- moves: 8
15- goal_bucket: BucketId.two
14+ moves: 8
15+ goal_bucket: BucketId.two
1616 other_bucket: 3
1717 }
1818 assert measure (3 , 5 , 1 , BucketId.two)! == expected
1919}
2020
2121fn test_measure_using_bucket_one_of_size_7_and_bucket_two_of_size_11___start_with_bucket_one () {
2222 expected := Solution{
23- moves: 14
24- goal_bucket: BucketId.one
23+ moves: 14
24+ goal_bucket: BucketId.one
2525 other_bucket: 11
2626 }
2727 assert measure (7 , 11 , 2 , BucketId.one)! == expected
2828}
2929
3030fn test_measure_using_bucket_one_of_size_7_and_bucket_two_of_size_11___start_with_bucket_two () {
3131 expected := Solution{
32- moves: 18
33- goal_bucket: BucketId.two
32+ moves: 18
33+ goal_bucket: BucketId.two
3434 other_bucket: 7
3535 }
3636 assert measure (7 , 11 , 2 , BucketId.two)! == expected
3737}
3838
3939fn test_measure_one_step_using_bucket_one_of_size_1_and_bucket_two_of_size_3___start_with_bucket_two () {
4040 expected := Solution{
41- moves: 1
42- goal_bucket: BucketId.two
41+ moves: 1
42+ goal_bucket: BucketId.two
4343 other_bucket: 0
4444 }
4545 assert measure (1 , 3 , 3 , BucketId.two)! == expected
4646}
4747
4848fn test_measure_using_bucket_one_of_size_2_and_bucket_two_of_size_3___start_with_bucket_one_and_end_with_bucket_two () {
4949 expected := Solution{
50- moves: 2
51- goal_bucket: BucketId.two
50+ moves: 2
51+ goal_bucket: BucketId.two
5252 other_bucket: 2
5353 }
5454 assert measure (2 , 3 , 3 , BucketId.one)! == expected
5555}
5656
57+ fn test_measure_using_bucket_one_much_bigger_than_bucket_two () {
58+ expected := Solution{
59+ moves: 6
60+ goal_bucket: BucketId.one
61+ other_bucket: 1
62+ }
63+ assert measure (5 , 1 , 2 , BucketId.one)! == expected
64+ }
65+
66+ fn test_measure_using_bucket_one_much_smaller_than_bucket_two () {
67+ expected := Solution{
68+ moves: 6
69+ goal_bucket: BucketId.two
70+ other_bucket: 0
71+ }
72+ assert measure (3 , 15 , 9 , BucketId.one)! == expected
73+ }
74+
5775fn test_not_possible_to_reach_the_goal () {
5876 if res := measure (6 , 15 , 5 , BucketId.one) {
5977 assert false , 'Not possible to reach the goal should return an error'
@@ -64,8 +82,8 @@ fn test_not_possible_to_reach_the_goal() {
6482
6583fn test_with_the_same_buckets_but_a_different_goal_then_it_is_possible () {
6684 expected := Solution{
67- moves: 10
68- goal_bucket: BucketId.two
85+ moves: 10
86+ goal_bucket: BucketId.two
6987 other_bucket: 0
7088 }
7189 assert measure (6 , 15 , 9 , BucketId.one)! == expected
0 commit comments