Skip to content

Commit 7d22aa3

Browse files
sync two-bucket tests (#268)
1 parent c5e5819 commit 7d22aa3

File tree

2 files changed

+38
-14
lines changed

2 files changed

+38
-14
lines changed

exercises/practice/two-bucket/.meta/tests.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ description = "Measure one step using bucket one of size 1 and bucket two of siz
2020
[eb329c63-5540-4735-b30b-97f7f4df0f84]
2121
description = "Measure using bucket one of size 2 and bucket two of size 3 - start with bucket one and end with bucket two"
2222

23+
[58d70152-bf2b-46bb-ad54-be58ebe94c03]
24+
description = "Measure using bucket one much bigger than bucket two"
25+
26+
[9dbe6499-caa5-4a58-b5ce-c988d71b8981]
27+
description = "Measure using bucket one much smaller than bucket two"
28+
2329
[449be72d-b10a-4f4b-a959-ca741e333b72]
2430
description = "Not possible to reach the goal"
2531

exercises/practice/two-bucket/run_test.v

Lines changed: 32 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,58 +2,76 @@ module main
22

33
fn 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

1212
fn 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

2121
fn 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

3030
fn 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

3939
fn 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

4848
fn 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+
5775
fn 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

6583
fn 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

Comments
 (0)