Skip to content

Commit 6f6fd12

Browse files
authored
yacht: Split into one deftest per test (#695)
* add missing tests.toml * update starter file * one deftest per test * rename test functions [no important files changed]
1 parent bf996c2 commit 6f6fd12

File tree

3 files changed

+188
-36
lines changed

3 files changed

+188
-36
lines changed
+97
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
# This is an auto-generated file.
2+
#
3+
# Regenerating this file via `configlet sync` will:
4+
# - Recreate every `description` key/value pair
5+
# - Recreate every `reimplements` key/value pair, where they exist in problem-specifications
6+
# - Remove any `include = true` key/value pair (an omitted `include` key implies inclusion)
7+
# - Preserve any other key/value pair
8+
#
9+
# As user-added comments (using the # character) will be removed when this file
10+
# is regenerated, comments can be added via a `comment` key.
11+
12+
[3060e4a5-4063-4deb-a380-a630b43a84b6]
13+
description = "Yacht"
14+
15+
[15026df2-f567-482f-b4d5-5297d57769d9]
16+
description = "Not Yacht"
17+
18+
[36b6af0c-ca06-4666-97de-5d31213957a4]
19+
description = "Ones"
20+
21+
[023a07c8-6c6e-44d0-bc17-efc5e1b8205a]
22+
description = "Ones, out of order"
23+
24+
[7189afac-cccd-4a74-8182-1cb1f374e496]
25+
description = "No ones"
26+
27+
[793c4292-dd14-49c4-9707-6d9c56cee725]
28+
description = "Twos"
29+
30+
[dc41bceb-d0c5-4634-a734-c01b4233a0c6]
31+
description = "Fours"
32+
33+
[f6125417-5c8a-4bca-bc5b-b4b76d0d28c8]
34+
description = "Yacht counted as threes"
35+
36+
[464fc809-96ed-46e4-acb8-d44e302e9726]
37+
description = "Yacht of 3s counted as fives"
38+
39+
[d054227f-3a71-4565-a684-5c7e621ec1e9]
40+
description = "Fives"
41+
42+
[e8a036e0-9d21-443a-8b5f-e15a9e19a761]
43+
description = "Sixes"
44+
45+
[51cb26db-6b24-49af-a9ff-12f53b252eea]
46+
description = "Full house two small, three big"
47+
48+
[1822ca9d-f235-4447-b430-2e8cfc448f0c]
49+
description = "Full house three small, two big"
50+
51+
[b208a3fc-db2e-4363-a936-9e9a71e69c07]
52+
description = "Two pair is not a full house"
53+
54+
[b90209c3-5956-445b-8a0b-0ac8b906b1c2]
55+
description = "Four of a kind is not a full house"
56+
57+
[32a3f4ee-9142-4edf-ba70-6c0f96eb4b0c]
58+
description = "Yacht is not a full house"
59+
60+
[b286084d-0568-4460-844a-ba79d71d79c6]
61+
description = "Four of a Kind"
62+
63+
[f25c0c90-5397-4732-9779-b1e9b5f612ca]
64+
description = "Yacht can be scored as Four of a Kind"
65+
66+
[9f8ef4f0-72bb-401a-a871-cbad39c9cb08]
67+
description = "Full house is not Four of a Kind"
68+
69+
[b4743c82-1eb8-4a65-98f7-33ad126905cd]
70+
description = "Little Straight"
71+
72+
[7ac08422-41bf-459c-8187-a38a12d080bc]
73+
description = "Little Straight as Big Straight"
74+
75+
[97bde8f7-9058-43ea-9de7-0bc3ed6d3002]
76+
description = "Four in order but not a little straight"
77+
78+
[cef35ff9-9c5e-4fd2-ae95-6e4af5e95a99]
79+
description = "No pairs but not a little straight"
80+
81+
[fd785ad2-c060-4e45-81c6-ea2bbb781b9d]
82+
description = "Minimum is 1, maximum is 5, but not a little straight"
83+
84+
[35bd74a6-5cf6-431a-97a3-4f713663f467]
85+
description = "Big Straight"
86+
87+
[87c67e1e-3e87-4f3a-a9b1-62927822b250]
88+
description = "Big Straight as little straight"
89+
90+
[c1fa0a3a-40ba-4153-a42d-32bc34d2521e]
91+
description = "No pairs but not a big straight"
92+
93+
[207e7300-5d10-43e5-afdd-213e3ac8827d]
94+
description = "Choice"
95+
96+
[b524c0cf-32d2-4b40-8fb3-be3500f3f135]
97+
description = "Yacht as choice"
+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
(ns yacht)
22

3-
(defn score []
3+
(defn score
4+
"Given five dice and a category, it calculates the score of the dice for that category"
5+
[dice category]
6+
;; function body
47
)
+87-35
Original file line numberDiff line numberDiff line change
@@ -1,67 +1,119 @@
11
(ns yacht-test
2-
(:require [clojure.test :refer [deftest testing is run-tests]]
2+
(:require [clojure.test :refer [deftest testing is]]
33
yacht))
44

5-
(deftest score-test
5+
(deftest score_test_1
66
(testing "Yacht"
7-
(is (= 50 (yacht/score [5 5 5 5 5] "yacht"))))
7+
(is (= 50 (yacht/score [5 5 5 5 5] "yacht")))))
8+
9+
(deftest score_test_2
810
(testing "Not Yacht"
9-
(is (= 0 (yacht/score [1 3 3 2 5] "yacht"))))
11+
(is (= 0 (yacht/score [1 3 3 2 5] "yacht")))))
12+
13+
(deftest score_test_3
1014
(testing "Ones"
11-
(is (= 3 (yacht/score [1 1 1 3 5] "ones"))))
15+
(is (= 3 (yacht/score [1 1 1 3 5] "ones")))))
16+
17+
(deftest score_test_4
1218
(testing "Ones, out of order"
13-
(is (= 3 (yacht/score [3 1 1 5 1] "ones"))))
19+
(is (= 3 (yacht/score [3 1 1 5 1] "ones")))))
20+
21+
(deftest score_test_5
1422
(testing "No ones"
15-
(is (= 0 (yacht/score [4 3 6 5 5] "ones"))))
23+
(is (= 0 (yacht/score [4 3 6 5 5] "ones")))))
24+
25+
(deftest score_test_6
1626
(testing "Twos"
17-
(is (= 2 (yacht/score [2 3 4 5 6] "twos"))))
27+
(is (= 2 (yacht/score [2 3 4 5 6] "twos")))))
28+
29+
(deftest score_test_7
1830
(testing "Fours"
19-
(is (= 8 (yacht/score [1 4 1 4 1] "fours"))))
31+
(is (= 8 (yacht/score [1 4 1 4 1] "fours")))))
32+
33+
(deftest score_test_8
2034
(testing "Yacht counted as threes"
21-
(is (= 15 (yacht/score [3 3 3 3 3] "threes"))))
35+
(is (= 15 (yacht/score [3 3 3 3 3] "threes")))))
36+
37+
(deftest score_test_9
2238
(testing "Yacht of 3s counted as fives"
23-
(is (= 0 (yacht/score [3 3 3 3 3] "fives"))))
39+
(is (= 0 (yacht/score [3 3 3 3 3] "fives")))))
40+
41+
(deftest score_test_10
2442
(testing "Fives"
25-
(is (= 10 (yacht/score [1 5 3 5 3] "fives"))))
43+
(is (= 10 (yacht/score [1 5 3 5 3] "fives")))))
44+
45+
(deftest score_test_11
2646
(testing "Sixes"
27-
(is (= 6 (yacht/score [2 3 4 5 6] "sixes"))))
47+
(is (= 6 (yacht/score [2 3 4 5 6] "sixes")))))
48+
49+
(deftest score_test_12
2850
(testing "Full house two small, three big"
29-
(is (= 16 (yacht/score [2 2 4 4 4] "full house"))))
51+
(is (= 16 (yacht/score [2 2 4 4 4] "full house")))))
52+
53+
(deftest score_test_13
3054
(testing "Full house three small, two big"
31-
(is (= 19 (yacht/score [5 3 3 5 3] "full house"))))
55+
(is (= 19 (yacht/score [5 3 3 5 3] "full house")))))
56+
57+
(deftest score_test_14
3258
(testing "Two pair is not a full house"
33-
(is (= 0 (yacht/score [2 2 4 4 5] "full house"))))
59+
(is (= 0 (yacht/score [2 2 4 4 5] "full house")))))
60+
61+
(deftest score_test_15
3462
(testing "Four of a kind is not a full house"
35-
(is (= 0 (yacht/score [1 4 4 4 4] "full house"))))
63+
(is (= 0 (yacht/score [1 4 4 4 4] "full house")))))
64+
65+
(deftest score_test_16
3666
(testing "Yacht is not a full house"
37-
(is (= 0 (yacht/score [2 2 2 2 2] "full house"))))
67+
(is (= 0 (yacht/score [2 2 2 2 2] "full house")))))
68+
69+
(deftest score_test_17
3870
(testing "Four of a Kind"
39-
(is (= 24 (yacht/score [6 6 4 6 6] "four of a kind"))))
71+
(is (= 24 (yacht/score [6 6 4 6 6] "four of a kind")))))
72+
73+
(deftest score_test_18
4074
(testing "Yacht can be scored as Four of a Kind"
41-
(is (= 12 (yacht/score [3 3 3 3 3] "four of a kind"))))
75+
(is (= 12 (yacht/score [3 3 3 3 3] "four of a kind")))))
76+
77+
(deftest score_test_19
4278
(testing "Full house is not Four of a Kind"
43-
(is (= 0 (yacht/score [3 3 3 5 5] "four of a kind"))))
79+
(is (= 0 (yacht/score [3 3 3 5 5] "four of a kind")))))
80+
81+
(deftest score_test_20
4482
(testing "Little Straight"
45-
(is (= 30 (yacht/score [3 5 4 1 2] "little straight"))))
83+
(is (= 30 (yacht/score [3 5 4 1 2] "little straight")))))
84+
85+
(deftest score_test_21
4686
(testing "Little Straight as Big Straight"
47-
(is (= 0 (yacht/score [1 2 3 4 5] "big straight"))))
87+
(is (= 0 (yacht/score [1 2 3 4 5] "big straight")))))
88+
89+
(deftest score_test_22
4890
(testing "Four in order but not a little straight"
49-
(is (= 0 (yacht/score [1 1 2 3 4] "little straight"))))
91+
(is (= 0 (yacht/score [1 1 2 3 4] "little straight")))))
92+
93+
(deftest score_test_23
5094
(testing "No pairs but not a little straight"
51-
(is (= 0 (yacht/score [1 2 3 4 6] "little straight"))))
95+
(is (= 0 (yacht/score [1 2 3 4 6] "little straight")))))
96+
97+
(deftest score_test_24
5298
(testing "Minimum is 1, maximum is 5, but not a little straight"
53-
(is (= 0 (yacht/score [1 1 3 4 5] "little straight"))))
99+
(is (= 0 (yacht/score [1 1 3 4 5] "little straight")))))
100+
101+
(deftest score_test_25
54102
(testing "Big Straight"
55-
(is (= 30 (yacht/score [4 6 2 5 3] "big straight"))))
103+
(is (= 30 (yacht/score [4 6 2 5 3] "big straight")))))
104+
105+
(deftest score_test_26
56106
(testing "Big Straight as little straight"
57-
(is (= 0 (yacht/score [6 5 4 3 2] "little straight"))))
107+
(is (= 0 (yacht/score [6 5 4 3 2] "little straight")))))
108+
109+
(deftest score_test_27
58110
(testing "No pairs but not a big straight"
59-
(is (= 0 (yacht/score [6 5 4 3 1] "big straight"))))
111+
(is (= 0 (yacht/score [6 5 4 3 1] "big straight")))))
112+
113+
(deftest score_test_28
60114
(testing "Choice"
61-
(is (= 23 (yacht/score [3 3 5 6 6] "choice"))))
62-
(testing "Yacht as choice"
63-
(is (= 10 (yacht/score [2 2 2 2 2] "choice")))))
115+
(is (= 23 (yacht/score [3 3 5 6 6] "choice")))))
64116

65-
(comment
66-
(run-tests)
67-
)
117+
(deftest score_test_29
118+
(testing "Yacht as choice"
119+
(is (= 10 (yacht/score [2 2 2 2 2] "choice")))))

0 commit comments

Comments
 (0)