Skip to content

Commit 166c96c

Browse files
authored
bird-watcher: Add the ability to select which tests to run (#874)
1 parent ee3b2e2 commit 166c96c

2 files changed

Lines changed: 28 additions & 14 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 "bird-watcher exercise."
33
:url "https://github.com/exercism/clojure/tree/main/exercises/concept/bird-watcher"
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+
:last-week :last-week
13+
:today :today
14+
:inc-bird :inc-bird
15+
:day-without-birds? :day-without-birds?
16+
:n-days-count :n-days-count
17+
:busy-days :busy-days
18+
:odd-week? :odd-week?})

exercises/concept/bird-watcher/test/bird_watcher_test.clj

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,53 +2,53 @@
22
(:require bird-watcher
33
[clojure.test :refer [deftest is testing]]))
44

5-
(deftest ^{:task 1} last-week-test
5+
(deftest ^{:task 1 :task-1 true :last-week true} last-week-test
66
(is (= [0 2 5 3 7 8 4] bird-watcher/last-week)))
77

8-
(deftest ^{:task 2} today-disappointing-week-test
8+
(deftest ^{:task 2 :task-2 true :today true} today-disappointing-week-test
99
(testing "Today's bird count of disappointing week"
1010
(is (= 0 (bird-watcher/today [0 0 2 0 0 1 0])))))
1111

12-
(deftest ^{:task 2} today-busy-week-test
12+
(deftest ^{:task 2 :task-2 true :today true} today-busy-week-test
1313
(testing "Today's bird count of busy week"
1414
(is (= 10 (bird-watcher/today [8 8 9 5 4 7 10])))))
1515

16-
(deftest ^{:task 3} increment-bird-no-visits-test
16+
(deftest ^{:task 3 :task-3 true :inc-bird true} increment-bird-no-visits-test
1717
(testing "Increment today's count with no previous visits"
1818
(is (= [6 5 5 11 2 5 1] (bird-watcher/inc-bird [6 5 5 11 2 5 0])))))
1919

20-
(deftest ^{:task 3} increment-bird-multiple-visits-test
20+
(deftest ^{:task 3 :task-3 true :inc-bird true} increment-bird-multiple-visits-test
2121
(testing "Increment today's count with multiple previous visits"
2222
(is (= [5 2 4 2 4 5 8] (bird-watcher/inc-bird [5 2 4 2 4 5 7])))))
2323

24-
(deftest ^{:task 4} day-without-birds-test
24+
(deftest ^{:task 4 :task-4 true :day-without-birds? true} day-without-birds-test
2525
(testing "Has day without birds with day without birds"
2626
(is (= true (bird-watcher/day-without-birds? [5 5 4 0 7 6 7])))))
2727

28-
(deftest ^{:task 4} no-day-without-birds-test
28+
(deftest ^{:task 4 :task-4 true :day-without-birds? true} no-day-without-birds-test
2929
(testing "Has day without birds with no day without birds"
3030
(is (= false (bird-watcher/day-without-birds? [5 5 4 1 7 6 7])))))
3131

32-
(deftest ^{:task 5} n-days-count-disappointing-week-test
32+
(deftest ^{:task 5 :task-5 true :n-days-count true} n-days-count-disappointing-week-test
3333
(testing "Count for first three days of disappointing week"
3434
(is (= 1 (bird-watcher/n-days-count [0, 0, 1, 0, 0, 1, 0] 3)))))
3535

36-
(deftest ^{:task 5} n-days-count-busy-week-test
36+
(deftest ^{:task 5 :task-5 true :n-days-count true} n-days-count-busy-week-test
3737
(testing "Count for first 6 days of busy week"
3838
(is (= 48 (bird-watcher/n-days-count [5, 9, 12, 6, 8, 8, 17] 6)))))
3939

40-
(deftest ^{:task 6} busy-days-disappointing-week-test
40+
(deftest ^{:task 6 :task-6 true :busy-days true} busy-days-disappointing-week-test
4141
(testing "Busy days for disappointing week"
4242
(is (= 0 (bird-watcher/busy-days [1 1 1 0 0 0 0])))))
4343

44-
(deftest ^{:task 6} busy-days-busy-week-test
44+
(deftest ^{:task 6 :task-6 true :busy-days true} busy-days-busy-week-test
4545
(testing "Busy days for busy week"
4646
(is (= 5 (bird-watcher/busy-days [4 9 5 7 8 8 2])))))
4747

48-
(deftest ^{:task 7} odd-week-matching-test
48+
(deftest ^{:task 7 :task-7 true :odd-week? true} odd-week-matching-test
4949
(testing "Odd week for week matching odd pattern"
5050
(is (= true (bird-watcher/odd-week? [1 0 1 0 1 0 1])))))
5151

52-
(deftest ^{:task 7} odd-week-not-matching-test
52+
(deftest ^{:task 7 :task-7 true :odd-week? true} odd-week-not-matching-test
5353
(testing "Odd week for week that does not match pattern"
5454
(is (= false (bird-watcher/odd-week? [2 2 1 0 1 1 1])))))

0 commit comments

Comments
 (0)