Skip to content

Commit 2648838

Browse files
authored
allergies: Add the ability to select which tests to run (#877)
[no important files changed]
1 parent 0a0782b commit 2648838

3 files changed

Lines changed: 55 additions & 53 deletions

File tree

exercises/practice/allergies/.meta/generator.tpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
allergies))
44

55
{{#test_cases.allergicTo}}
6-
(deftest allergic-to?_test_{{idx}}
6+
(deftest ^:allergic-to? allergic-to?_test_{{idx}}
77
(testing {{context}}
88
(is ({{#expected}}true?{{else}}false?{{/expected}} (allergies/allergic-to? {{input.score}} {{input.item}})))))
99
{{/test_cases.allergicTo}}
1010

1111
{{#test_cases.list}}
12-
(deftest allergies_test_{{idx}}
12+
(deftest ^:allergies allergies_test_{{idx}}
1313
(testing {{context}}
1414
(is (= {{expected}}
1515
(allergies/allergies {{input.score}})))))
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
(defproject allergies "0.1.0-SNAPSHOT"
22
:description "allergies exercise."
33
:url "https://github.com/exercism/clojure/tree/main/exercises/practice/allergies"
4-
:dependencies [[org.clojure/clojure "1.12.0"]])
4+
:dependencies [[org.clojure/clojure "1.12.0"]]
5+
:test-selectors {:allergic-to? :allergic-to?
6+
:allergies :allergies})

exercises/practice/allergies/test/allergies_test.clj

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

5-
(deftest allergic-to?_test_1
5+
(deftest ^:allergic-to? allergic-to?_test_1
66
(testing "check for eggs allergy ▶ not allergic to anything"
77
(is (false? (allergies/allergic-to? 0 :eggs)))))
88

9-
(deftest allergic-to?_test_2
9+
(deftest ^:allergic-to? allergic-to?_test_2
1010
(testing "check for eggs allergy ▶ allergic only to eggs"
1111
(is (true? (allergies/allergic-to? 1 :eggs)))))
1212

13-
(deftest allergic-to?_test_3
13+
(deftest ^:allergic-to? allergic-to?_test_3
1414
(testing "check for eggs allergy ▶ allergic to eggs and something else"
1515
(is (true? (allergies/allergic-to? 3 :eggs)))))
1616

17-
(deftest allergic-to?_test_4
17+
(deftest ^:allergic-to? allergic-to?_test_4
1818
(testing "check for eggs allergy ▶ allergic to something, but not eggs"
1919
(is (false? (allergies/allergic-to? 2 :eggs)))))
2020

21-
(deftest allergic-to?_test_5
21+
(deftest ^:allergic-to? allergic-to?_test_5
2222
(testing "check for eggs allergy ▶ allergic to everything"
2323
(is (true? (allergies/allergic-to? 255 :eggs)))))
2424

25-
(deftest allergic-to?_test_6
25+
(deftest ^:allergic-to? allergic-to?_test_6
2626
(testing "check for peanuts allergy ▶ not allergic to anything"
2727
(is (false? (allergies/allergic-to? 0 :peanuts)))))
2828

29-
(deftest allergic-to?_test_7
29+
(deftest ^:allergic-to? allergic-to?_test_7
3030
(testing "check for peanuts allergy ▶ allergic only to peanuts"
3131
(is (true? (allergies/allergic-to? 2 :peanuts)))))
3232

33-
(deftest allergic-to?_test_8
33+
(deftest ^:allergic-to? allergic-to?_test_8
3434
(testing "check for peanuts allergy ▶ allergic to peanuts and something else"
3535
(is (true? (allergies/allergic-to? 7 :peanuts)))))
3636

37-
(deftest allergic-to?_test_9
37+
(deftest ^:allergic-to? allergic-to?_test_9
3838
(testing "check for peanuts allergy ▶ allergic to something, but not peanuts"
3939
(is (false? (allergies/allergic-to? 5 :peanuts)))))
4040

41-
(deftest allergic-to?_test_10
41+
(deftest ^:allergic-to? allergic-to?_test_10
4242
(testing "check for peanuts allergy ▶ allergic to everything"
4343
(is (true? (allergies/allergic-to? 255 :peanuts)))))
4444

45-
(deftest allergic-to?_test_11
45+
(deftest ^:allergic-to? allergic-to?_test_11
4646
(testing "check for shellfish allergy ▶ not allergic to anything"
4747
(is (false? (allergies/allergic-to? 0 :shellfish)))))
4848

49-
(deftest allergic-to?_test_12
49+
(deftest ^:allergic-to? allergic-to?_test_12
5050
(testing "check for shellfish allergy ▶ allergic only to shellfish"
5151
(is (true? (allergies/allergic-to? 4 :shellfish)))))
5252

53-
(deftest allergic-to?_test_13
53+
(deftest ^:allergic-to? allergic-to?_test_13
5454
(testing "check for shellfish allergy ▶ allergic to shellfish and something else"
5555
(is (true? (allergies/allergic-to? 14 :shellfish)))))
5656

57-
(deftest allergic-to?_test_14
57+
(deftest ^:allergic-to? allergic-to?_test_14
5858
(testing "check for shellfish allergy ▶ allergic to something, but not shellfish"
5959
(is (false? (allergies/allergic-to? 10 :shellfish)))))
6060

61-
(deftest allergic-to?_test_15
61+
(deftest ^:allergic-to? allergic-to?_test_15
6262
(testing "check for shellfish allergy ▶ allergic to everything"
6363
(is (true? (allergies/allergic-to? 255 :shellfish)))))
6464

65-
(deftest allergic-to?_test_16
65+
(deftest ^:allergic-to? allergic-to?_test_16
6666
(testing "check for strawberries allergy ▶ not allergic to anything"
6767
(is (false? (allergies/allergic-to? 0 :strawberries)))))
6868

69-
(deftest allergic-to?_test_17
69+
(deftest ^:allergic-to? allergic-to?_test_17
7070
(testing "check for strawberries allergy ▶ allergic only to strawberries"
7171
(is (true? (allergies/allergic-to? 8 :strawberries)))))
7272

73-
(deftest allergic-to?_test_18
73+
(deftest ^:allergic-to? allergic-to?_test_18
7474
(testing "check for strawberries allergy ▶ allergic to strawberries and something else"
7575
(is (true? (allergies/allergic-to? 28 :strawberries)))))
7676

77-
(deftest allergic-to?_test_19
77+
(deftest ^:allergic-to? allergic-to?_test_19
7878
(testing "check for strawberries allergy ▶ allergic to something, but not strawberries"
7979
(is (false? (allergies/allergic-to? 20 :strawberries)))))
8080

81-
(deftest allergic-to?_test_20
81+
(deftest ^:allergic-to? allergic-to?_test_20
8282
(testing "check for strawberries allergy ▶ allergic to everything"
8383
(is (true? (allergies/allergic-to? 255 :strawberries)))))
8484

85-
(deftest allergic-to?_test_21
85+
(deftest ^:allergic-to? allergic-to?_test_21
8686
(testing "check for tomatoes allergy ▶ not allergic to anything"
8787
(is (false? (allergies/allergic-to? 0 :tomatoes)))))
8888

89-
(deftest allergic-to?_test_22
89+
(deftest ^:allergic-to? allergic-to?_test_22
9090
(testing "check for tomatoes allergy ▶ allergic only to tomatoes"
9191
(is (true? (allergies/allergic-to? 16 :tomatoes)))))
9292

93-
(deftest allergic-to?_test_23
93+
(deftest ^:allergic-to? allergic-to?_test_23
9494
(testing "check for tomatoes allergy ▶ allergic to tomatoes and something else"
9595
(is (true? (allergies/allergic-to? 56 :tomatoes)))))
9696

97-
(deftest allergic-to?_test_24
97+
(deftest ^:allergic-to? allergic-to?_test_24
9898
(testing "check for tomatoes allergy ▶ allergic to something, but not tomatoes"
9999
(is (false? (allergies/allergic-to? 40 :tomatoes)))))
100100

101-
(deftest allergic-to?_test_25
101+
(deftest ^:allergic-to? allergic-to?_test_25
102102
(testing "check for tomatoes allergy ▶ allergic to everything"
103103
(is (true? (allergies/allergic-to? 255 :tomatoes)))))
104104

105-
(deftest allergic-to?_test_26
105+
(deftest ^:allergic-to? allergic-to?_test_26
106106
(testing "check for chocolate allergy ▶ not allergic to anything"
107107
(is (false? (allergies/allergic-to? 0 :chocolate)))))
108108

109-
(deftest allergic-to?_test_27
109+
(deftest ^:allergic-to? allergic-to?_test_27
110110
(testing "check for chocolate allergy ▶ allergic only to chocolate"
111111
(is (true? (allergies/allergic-to? 32 :chocolate)))))
112112

113-
(deftest allergic-to?_test_28
113+
(deftest ^:allergic-to? allergic-to?_test_28
114114
(testing "check for chocolate allergy ▶ allergic to chocolate and something else"
115115
(is (true? (allergies/allergic-to? 112 :chocolate)))))
116116

117-
(deftest allergic-to?_test_29
117+
(deftest ^:allergic-to? allergic-to?_test_29
118118
(testing "check for chocolate allergy ▶ allergic to something, but not chocolate"
119119
(is (false? (allergies/allergic-to? 80 :chocolate)))))
120120

121-
(deftest allergic-to?_test_30
121+
(deftest ^:allergic-to? allergic-to?_test_30
122122
(testing "check for chocolate allergy ▶ allergic to everything"
123123
(is (true? (allergies/allergic-to? 255 :chocolate)))))
124124

125-
(deftest allergic-to?_test_31
125+
(deftest ^:allergic-to? allergic-to?_test_31
126126
(testing "check for pollen allergy ▶ not allergic to anything"
127127
(is (false? (allergies/allergic-to? 0 :pollen)))))
128128

129-
(deftest allergic-to?_test_32
129+
(deftest ^:allergic-to? allergic-to?_test_32
130130
(testing "check for pollen allergy ▶ allergic only to pollen"
131131
(is (true? (allergies/allergic-to? 64 :pollen)))))
132132

133-
(deftest allergic-to?_test_33
133+
(deftest ^:allergic-to? allergic-to?_test_33
134134
(testing "check for pollen allergy ▶ allergic to pollen and something else"
135135
(is (true? (allergies/allergic-to? 224 :pollen)))))
136136

137-
(deftest allergic-to?_test_34
137+
(deftest ^:allergic-to? allergic-to?_test_34
138138
(testing "check for pollen allergy ▶ allergic to something, but not pollen"
139139
(is (false? (allergies/allergic-to? 160 :pollen)))))
140140

141-
(deftest allergic-to?_test_35
141+
(deftest ^:allergic-to? allergic-to?_test_35
142142
(testing "check for pollen allergy ▶ allergic to everything"
143143
(is (true? (allergies/allergic-to? 255 :pollen)))))
144144

145-
(deftest allergic-to?_test_36
145+
(deftest ^:allergic-to? allergic-to?_test_36
146146
(testing "check for cats allergy ▶ not allergic to anything"
147147
(is (false? (allergies/allergic-to? 0 :cats)))))
148148

149-
(deftest allergic-to?_test_37
149+
(deftest ^:allergic-to? allergic-to?_test_37
150150
(testing "check for cats allergy ▶ allergic only to cats"
151151
(is (true? (allergies/allergic-to? 128 :cats)))))
152152

153-
(deftest allergic-to?_test_38
153+
(deftest ^:allergic-to? allergic-to?_test_38
154154
(testing "check for cats allergy ▶ allergic to cats and something else"
155155
(is (true? (allergies/allergic-to? 192 :cats)))))
156156

157-
(deftest allergic-to?_test_39
157+
(deftest ^:allergic-to? allergic-to?_test_39
158158
(testing "check for cats allergy ▶ allergic to something, but not cats"
159159
(is (false? (allergies/allergic-to? 64 :cats)))))
160160

161-
(deftest allergic-to?_test_40
161+
(deftest ^:allergic-to? allergic-to?_test_40
162162
(testing "check for cats allergy ▶ allergic to everything"
163163
(is (true? (allergies/allergic-to? 255 :cats)))))
164164

165-
(deftest allergies_test_1
165+
(deftest ^:allergies allergies_test_1
166166
(testing "allergies ▶ no allergies"
167167
(is (= []
168168
(allergies/allergies 0)))))
169169

170-
(deftest allergies_test_2
170+
(deftest ^:allergies allergies_test_2
171171
(testing "allergies ▶ just eggs"
172172
(is (= [:eggs]
173173
(allergies/allergies 1)))))
174174

175-
(deftest allergies_test_3
175+
(deftest ^:allergies allergies_test_3
176176
(testing "allergies ▶ just peanuts"
177177
(is (= [:peanuts]
178178
(allergies/allergies 2)))))
179179

180-
(deftest allergies_test_4
180+
(deftest ^:allergies allergies_test_4
181181
(testing "allergies ▶ just strawberries"
182182
(is (= [:strawberries]
183183
(allergies/allergies 8)))))
184184

185-
(deftest allergies_test_5
185+
(deftest ^:allergies allergies_test_5
186186
(testing "allergies ▶ eggs and peanuts"
187187
(is (= [:eggs :peanuts]
188188
(allergies/allergies 3)))))
189189

190-
(deftest allergies_test_6
190+
(deftest ^:allergies allergies_test_6
191191
(testing "allergies ▶ more than eggs but not peanuts"
192192
(is (= [:eggs :shellfish]
193193
(allergies/allergies 5)))))
194194

195-
(deftest allergies_test_7
195+
(deftest ^:allergies allergies_test_7
196196
(testing "allergies ▶ lots of stuff"
197197
(is (= [:strawberries :tomatoes :chocolate :pollen :cats]
198198
(allergies/allergies 248)))))
199199

200-
(deftest allergies_test_8
200+
(deftest ^:allergies allergies_test_8
201201
(testing "allergies ▶ everything"
202202
(is (= [:eggs :peanuts :shellfish :strawberries :tomatoes :chocolate :pollen :cats]
203203
(allergies/allergies 255)))))
204204

205-
(deftest allergies_test_9
205+
(deftest ^:allergies allergies_test_9
206206
(testing "allergies ▶ no allergen score parts"
207207
(is (= [:eggs :shellfish :strawberries :tomatoes :chocolate :pollen :cats]
208208
(allergies/allergies 509)))))
209209

210-
(deftest allergies_test_10
210+
(deftest ^:allergies allergies_test_10
211211
(testing "allergies ▶ no allergen score parts without highest valid score"
212212
(is (= [:eggs]
213213
(allergies/allergies 257)))))

0 commit comments

Comments
 (0)