1
1
(ns yacht-test
2
- (:require [clojure.test :refer [deftest testing is run-tests ]]
2
+ (:require [clojure.test :refer [deftest testing is]]
3
3
yacht))
4
4
5
- (deftest score-test
5
+ (deftest score_test_1
6
6
(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
8
10
(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
10
14
(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
12
18
(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
14
22
(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
16
26
(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
18
30
(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
20
34
(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
22
38
(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
24
42
(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
26
46
(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
28
50
(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
30
54
(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
32
58
(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
34
62
(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
36
66
(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
38
70
(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
40
74
(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
42
78
(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
44
82
(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
46
86
(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
48
90
(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
50
94
(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
52
98
(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
54
102
(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
56
106
(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
58
110
(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
60
114
(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" )))))
64
116
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