Skip to content

Commit 5754a00

Browse files
author
Jani Rahkola
committed
numbered tests
1 parent fdadda6 commit 5754a00

File tree

1 file changed

+27
-27
lines changed

1 file changed

+27
-27
lines changed

test/p_p_p_pokerface_test.clj

+27-27
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,13 @@
22
(:use midje.sweet
33
p-p-p-pokerface))
44

5-
(facts "rank"
5+
(facts "1 suit"
6+
(suit "2H") => "H"
7+
(suit "2D") => "D"
8+
(suit "2C") => "C"
9+
(suit "3S") => "S")
10+
11+
(facts "2 rank"
612
(rank "2H") => 2
713
(rank "4S") => 4
814
(rank "TS") => 10
@@ -11,12 +17,6 @@
1117
(rank "KS") => 13
1218
(rank "AS") => 14)
1319

14-
(facts "suit"
15-
(suit "2H") => "H"
16-
(suit "2D") => "D"
17-
(suit "2C") => "C"
18-
(suit "3S") => "S")
19-
2020
(def high-seven ["2H" "3S" "4C" "5C" "7D"])
2121

2222
(def pair-hands #{["2H" "2S" "4C" "5C" "7D"]
@@ -38,25 +38,34 @@
3838
(def low-ace-straight-flush-hand ["2D" "3D" "4D" "5D" "AD"])
3939
(def high-ace-straight-flush-hand ["TS" "AS" "QS" "KS" "JS"])
4040

41-
(facts "pair"
41+
(facts "3 pair?"
4242
(every? pair? pair-hands) => true
4343
(pair? high-seven) => false)
4444

45-
(facts "two-pairs?"
46-
(two-pairs? two-pairs-hand) => true
47-
(two-pairs? three-of-a-kind-hand) => false
48-
(two-pairs? pair-hand) => false)
49-
50-
(facts "three-of-a-kind?"
45+
(facts "4 three-of-a-kind?"
5146
(three-of-a-kind? two-pairs-hand) => false
5247
(three-of-a-kind? three-of-a-kind-hand) => true)
5348

54-
(facts "four-of-a-kind?"
49+
(facts "5 four-of-a-kind?"
5550
(four-of-a-kind? two-pairs-hand) => false
5651
(four-of-a-kind? four-of-a-kind-hand) => true)
5752

53+
(facts "6 flush?"
54+
(flush? pair-hand) => false
55+
(flush? flush-hand) => true)
56+
57+
(facts "7 full-house?"
58+
(full-house? three-of-a-kind-hand) => false
59+
(full-house? four-of-a-kind-hand) => false
60+
(full-house? full-house-hand) => true)
61+
62+
(facts "8 two-pairs?"
63+
(two-pairs? two-pairs-hand) => true
64+
(two-pairs? three-of-a-kind-hand) => false
65+
(two-pairs? pair-hand) => false)
66+
5867
(tabular
59-
(facts "straight?"
68+
(facts "9 straight?"
6069
(straight? ?hand) => ?result)
6170
?hand ?result
6271
two-pairs-hand false
@@ -66,23 +75,14 @@
6675
["2H" "3H" "3D" "4H" "6H"] false
6776
high-ace-straight-hand true)
6877

69-
(facts "flush?"
70-
(flush? pair-hand) => false
71-
(flush? flush-hand) => true)
72-
73-
(facts "full-house?"
74-
(full-house? three-of-a-kind-hand) => false
75-
(full-house? four-of-a-kind-hand) => false
76-
(full-house? full-house-hand) => true)
77-
78-
(facts "straight-flush?"
78+
(facts "10 straight-flush?"
7979
(straight-flush? straight-hand) => false
8080
(straight-flush? flush-hand) => false
8181
(straight-flush? straight-flush-hand) => true
8282
(straight-flush? low-ace-straight-flush-hand) => true
8383
(straight-flush? high-ace-straight-flush-hand) => true)
8484

85-
(facts "value"
85+
(facts "11 value"
8686
(value high-seven) => 0
8787
(every? (partial = 1) (map value pair-hands)) => 1
8888
(value two-pairs-hand) => 2

0 commit comments

Comments
 (0)