Skip to content

Commit ee3b2e2

Browse files
authored
card-games: Add the ability to select which tests to run (#873)
1 parent b548835 commit ee3b2e2

2 files changed

Lines changed: 22 additions & 8 deletions

File tree

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,18 @@
11
(defproject bird-watcher "0.1.0-SNAPSHOT"
22
:description "card-games exercise."
33
:url "https://github.com/exercism/clojure/tree/main/exercises/concept/card-games"
4-
:dependencies [[org.clojure/clojure "1.12.0"]])
4+
:dependencies [[org.clojure/clojure "1.12.0"]]
5+
:test-selectors {:task-1 :task-1
6+
:task-2 :task-2
7+
:task-3 :task-3
8+
:task-4 :task-4
9+
:task-5 :task-5
10+
:task-6 :task-6
11+
:task-7 :task-7
12+
:rounds :rounds
13+
:concat-rounds :concat-rounds
14+
:contains-round? :contains-round?
15+
:card-average :card-average
16+
:approx-average? :approx-average?
17+
:average-even-odd? :average-even-odd?
18+
:maybe-double-last :maybe-double-last})

exercises/concept/card-games/test/card_games_test.clj

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
(:require [clojure.test :refer [deftest is testing]]
33
card-games))
44

5-
(deftest rounds-test
5+
(deftest ^{:task-1 true :rounds true} rounds-test
66
(is (= '((0 1 2) (1 2 3) (10 11 12)
77
(27 28 29) (99 100 101) (666 667 668))
88
(map card-games/rounds '(0 1 10 27 99 666)))))
99

10-
(deftest concat-rounds-test
10+
(deftest ^{:task-2 true :concat-rounds true} concat-rounds-test
1111
(is (= '(() (0 1) (1 2) (1 2)
1212
(27 28 29 35 36)
1313
(1 2 3 4 5 6))
@@ -16,29 +16,29 @@
1616
((1) (2)) ((27 28 29) (35 36))
1717
((1 2 3) (4 5 6)))))))
1818

19-
(deftest contains-round-test
19+
(deftest ^{:task-3 true :contains-round? true} contains-round-test
2020
(is (= '(false false false true true true)
2121
(map #(apply card-games/contains-round? %)
2222
'(([], 1), ([1, 2, 3], 0), ([27, 28, 29, 35, 36], 30),
2323
([1], 1), ([1, 2, 3], 1), ([27, 28, 29, 35, 36], 29))))))
2424

25-
(deftest card-average-test
25+
(deftest ^{:task-4 true :card-average true} card-average-test
2626
(is (= '(1.0 6.0 2.5 37.0)
2727
(map card-games/card-average '((1) (5 6 7) (1 2 3 4) (1 10 100))))))
2828

29-
(deftest approx-average-test
29+
(deftest ^{:task-5 true :approx-average? true} approx-average-test
3030
(is (= '(false false false false true true true true)
3131
(map card-games/approx-average?
3232
'((0 1 5) (3 6 9 12 150) (1 2 3 5 9)
3333
(2 3 4 7 8) (1 2 3) (2 3 4)
3434
(2 3 4 8 8) (1 2 4 5 8))))))
3535

36-
(deftest average-even-odd-test
36+
(deftest ^{:task-6 true :average-even-odd? true} average-even-odd-test
3737
(is (= '(false false true true true)
3838
(map card-games/average-even-odd?
3939
'((5 6 8) (1 2 3 4) (1 2 3) (5 6 7) (1 3 5 7 9))))))
4040

41-
(deftest maybe-double-last-test
41+
(deftest ^{:task-7 true :maybe-double-last true} maybe-double-last-test
4242
(is (= '((1 2 22) (5 9 22) (5 9 10) (1 2 3))
4343
(map card-games/maybe-double-last
4444
'((1 2 11) (5 9 11) (5 9 10) (1 2 3))))))

0 commit comments

Comments
 (0)