|
10 | 10 |
|
11 | 11 |
|
12 | 12 | (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} |
16 | 13 | (should (equal (measure 3 5 1 'one) '(4 one 5)))) |
17 | 14 |
|
18 | 15 |
|
19 | 16 | (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} |
23 | 17 | (should (equal (measure 3 5 1 'two) '(8 two 3)))) |
24 | 18 |
|
25 | 19 |
|
26 | 20 | (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} |
30 | 21 | (should (equal (measure 7 11 2 'one) '(14 one 11)))) |
31 | 22 |
|
32 | 23 |
|
33 | 24 | (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} |
37 | 25 | (should (equal (measure 7 11 2 'two) '(18 two 7)))) |
38 | 26 |
|
39 | 27 |
|
40 | 28 | (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} |
44 | 29 | (should (equal (measure 1 3 3 'two) '(1 two 0)))) |
45 | 30 |
|
46 | 31 |
|
47 | 32 | (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} |
51 | 33 | (should (equal (measure 2 3 3 'one) '(2 two 2)))) |
52 | 34 |
|
53 | 35 |
|
| 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 | + |
54 | 44 | (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"} |
58 | 45 | (should-error (measure 6 15 5 'one) :type 'goal-not-possible)) |
59 | 46 |
|
60 | 47 |
|
61 | 48 | (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} |
65 | 49 | (should (equal (measure 6 15 9 'one) '(10 two 0)))) |
66 | 50 |
|
67 | 51 |
|
68 | 52 | (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"} |
72 | 53 | (should-error (measure 5 7 8 'one) :type 'goal-not-possible)) |
73 | 54 |
|
74 | 55 |
|
75 | 56 | (provide 'two-bucket-test) |
76 | 57 | ;;; two-bucket-test.el ends here |
77 | | - |
0 commit comments