Skip to content

Commit 7ab17f6

Browse files
sync two-bucket tests (#501)
1 parent 0cbbdf5 commit 7ab17f6

File tree

2 files changed

+14
-28
lines changed

2 files changed

+14
-28
lines changed

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

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

30+
[58d70152-bf2b-46bb-ad54-be58ebe94c03]
31+
description = "Measure using bucket one much bigger than bucket two"
32+
33+
[9dbe6499-caa5-4a58-b5ce-c988d71b8981]
34+
description = "Measure using bucket one much smaller than bucket two"
35+
3036
[449be72d-b10a-4f4b-a959-ca741e333b72]
3137
description = "Not possible to reach the goal"
3238

exercises/practice/two-bucket/two-bucket-test.el

Lines changed: 8 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -10,68 +10,48 @@
1010

1111

1212
(ert-deftest measure-using-bucket-one-of-size-3-and-bucket-two-of-size-5-start-with-bucket-one ()
13-
;; Function under test: measure
14-
;; Input: {"bucketOne":3,"bucketTwo":5,"goal":1,"startBucket":"one"}
15-
;; Expected: {"moves":4,"goalBucket":"one","otherBucket":5}
1613
(should (equal (measure 3 5 1 'one) '(4 one 5))))
1714

1815

1916
(ert-deftest measure-using-bucket-one-of-size-3-and-bucket-two-of-size-5-start-with-bucket-two ()
20-
;; Function under test: measure
21-
;; Input: {"bucketOne":3,"bucketTwo":5,"goal":1,"startBucket":"two"}
22-
;; Expected: {"moves":8,"goalBucket":"two","otherBucket":3}
2317
(should (equal (measure 3 5 1 'two) '(8 two 3))))
2418

2519

2620
(ert-deftest measure-using-bucket-one-of-size-7-and-bucket-two-of-size-11-start-with-bucket-one ()
27-
;; Function under test: measure
28-
;; Input: {"bucketOne":7,"bucketTwo":11,"goal":2,"startBucket":"one"}
29-
;; Expected: {"moves":14,"goalBucket":"one","otherBucket":11}
3021
(should (equal (measure 7 11 2 'one) '(14 one 11))))
3122

3223

3324
(ert-deftest measure-using-bucket-one-of-size-7-and-bucket-two-of-size-11-start-with-bucket-two ()
34-
;; Function under test: measure
35-
;; Input: {"bucketOne":7,"bucketTwo":11,"goal":2,"startBucket":"two"}
36-
;; Expected: {"moves":18,"goalBucket":"two","otherBucket":7}
3725
(should (equal (measure 7 11 2 'two) '(18 two 7))))
3826

3927

4028
(ert-deftest measure-one-step-using-bucket-one-of-size-1-and-bucket-two-of-size-3-start-with-bucket-two ()
41-
;; Function under test: measure
42-
;; Input: {"bucketOne":1,"bucketTwo":3,"goal":3,"startBucket":"two"}
43-
;; Expected: {"moves":1,"goalBucket":"two","otherBucket":0}
4429
(should (equal (measure 1 3 3 'two) '(1 two 0))))
4530

4631

4732
(ert-deftest measure-using-bucket-one-of-size-2-and-bucket-two-of-size-3-start-with-bucket-one-and-end-with-bucket-two ()
48-
;; Function under test: measure
49-
;; Input: {"bucketOne":2,"bucketTwo":3,"goal":3,"startBucket":"one"}
50-
;; Expected: {"moves":2,"goalBucket":"two","otherBucket":2}
5133
(should (equal (measure 2 3 3 'one) '(2 two 2))))
5234

5335

36+
(ert-deftest measure-using-bucket-one-much-bigger-than-bucket-two ()
37+
(should (equal (measure 5 1 2 'one) '(6 one 1))))
38+
39+
40+
(ert-deftest measure-using-bucket-one-much-smaller-than-bucket-two ()
41+
(should (equal (measure 3 15 9 'one) '(6 two 0))))
42+
43+
5444
(ert-deftest not-possible-to-reach-the-goal ()
55-
;; Function under test: measure
56-
;; Input: {"bucketOne":6,"bucketTwo":15,"goal":5,"startBucket":"one"}
57-
;; Expected: {"error":"impossible"}
5845
(should-error (measure 6 15 5 'one) :type 'goal-not-possible))
5946

6047

6148
(ert-deftest with-the-same-buckets-but-a-different-goal-then-it-is-possible ()
62-
;; Function under test: measure
63-
;; Input: {"bucketOne":6,"bucketTwo":15,"goal":9,"startBucket":"one"}
64-
;; Expected: {"moves":10,"goalBucket":"two","otherBucket":0}
6549
(should (equal (measure 6 15 9 'one) '(10 two 0))))
6650

6751

6852
(ert-deftest goal-larger-than-both-buckets-is-impossible ()
69-
;; Function under test: measure
70-
;; Input: {"bucketOne":5,"bucketTwo":7,"goal":8,"startBucket":"one"}
71-
;; Expected: {"error":"impossible"}
7253
(should-error (measure 5 7 8 'one) :type 'goal-not-possible))
7354

7455

7556
(provide 'two-bucket-test)
7657
;;; two-bucket-test.el ends here
77-

0 commit comments

Comments
 (0)