Skip to content

Commit 153046a

Browse files
authored
list-ops: Add the ability to select which tests to run (#881)
[no important files changed]
1 parent ff6d28a commit 153046a

File tree

3 files changed

+39
-31
lines changed

3 files changed

+39
-31
lines changed

exercises/practice/list-ops/.meta/generator.tpl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,53 +3,53 @@
33
list-ops))
44

55
{{#test_cases.append}}
6-
(deftest append_test_{{idx}}
6+
(deftest ^:append append_test_{{idx}}
77
(testing {{context}}
88
(is (= {{expected}}
99
(list-ops/append {{input.list1}} {{input.list2}})))))
1010
{{/test_cases.append}}
1111

1212
{{#test_cases.concat}}
13-
(deftest concatenate_test_{{idx}}
13+
(deftest ^:concatenate concatenate_test_{{idx}}
1414
(testing {{context}}
1515
(is (= {{expected}}
1616
(list-ops/concatenate {{input.lists}})))))
1717
{{/test_cases.concat}}
1818

1919
{{#test_cases.filter}}
20-
(deftest select-if_test_{{idx}}
20+
(deftest ^:select-if select-if_test_{{idx}}
2121
(testing {{context}}
2222
(is (= {{expected}}
2323
(list-ops/select-if {{input.function}} {{input.list}})))))
2424
{{/test_cases.filter}}
2525

2626
{{#test_cases.length}}
27-
(deftest length_test_{{idx}}
27+
(deftest ^:length length_test_{{idx}}
2828
(testing {{context}}
2929
(is (= {{expected}} (list-ops/length {{input.list}})))))
3030
{{/test_cases.length}}
3131

3232
{{#test_cases.map}}
33-
(deftest apply-to-each_test_{{idx}}
33+
(deftest ^:apply-to-each apply-to-each_test_{{idx}}
3434
(testing {{context}}
3535
(is (= {{expected}}
3636
(list-ops/apply-to-each {{input.function}} {{input.list}})))))
3737
{{/test_cases.map}}
3838

3939
{{#test_cases.foldl}}
40-
(deftest foldl_test_{{idx}}
40+
(deftest ^:foldl foldl_test_{{idx}}
4141
(testing {{context}}
4242
(is (= {{expected}} (list-ops/foldl {{input.function}} {{input.list}} {{input.initial}})))))
4343
{{/test_cases.foldl}}
4444

4545
{{#test_cases.foldr}}
46-
(deftest foldr_test_{{idx}}
46+
(deftest ^:foldr foldr_test_{{idx}}
4747
(testing {{context}}
4848
(is (= {{expected}} (list-ops/foldr {{input.function}} {{input.list}} {{input.initial}})))))
4949
{{/test_cases.foldr}}
5050

5151
{{#test_cases.reverse}}
52-
(deftest reverse-order_test_{{idx}}
52+
(deftest ^:reverse-order reverse-order_test_{{idx}}
5353
(testing {{context}}
5454
(is (= {{expected}}
5555
(list-ops/reverse-order {{input.list}})))))
Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
(defproject list-ops "0.1.0-SNAPSHOT"
22
:description "list-ops exercise."
33
:url "https://github.com/exercism/clojure/tree/main/exercises/list-ops"
4-
:dependencies [[org.clojure/clojure "1.12.0"]])
4+
:dependencies [[org.clojure/clojure "1.12.0"]]
5+
:test-selectors {:append :append
6+
:concatenate :concatenate
7+
:select-if :select-if
8+
:length :length
9+
:apply-to-each :apply-to-each
10+
:foldl :foldl
11+
:foldr :foldr
12+
:reverse-order :reverse-order})

exercises/practice/list-ops/test/list_ops_test.clj

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

5-
(deftest append_test_1
5+
(deftest ^:append append_test_1
66
(testing "Append ▶ empty vectors"
77
(is (= []
88
(list-ops/append [] [])))))
99

10-
(deftest append_test_2
10+
(deftest ^:append append_test_2
1111
(testing "Append ▶ vector to empty vector"
1212
(is (= [1 2 3 4]
1313
(list-ops/append [] [1 2 3 4])))))
1414

15-
(deftest append_test_3
15+
(deftest ^:append append_test_3
1616
(testing "Append ▶ empty vector to vector"
1717
(is (= [1 2 3 4]
1818
(list-ops/append [1 2 3 4] [])))))
1919

20-
(deftest append_test_4
20+
(deftest ^:append append_test_4
2121
(testing "Append ▶ non-empty vectors"
2222
(is (= [1 2 2 3 4 5]
2323
(list-ops/append [1 2] [2 3 4 5])))))
2424

25-
(deftest concatenate_test_1
25+
(deftest ^:concatenate concatenate_test_1
2626
(testing "Concatenate ▶ empty vector"
2727
(is (= []
2828
(list-ops/concatenate [])))))
2929

30-
(deftest concatenate_test_2
30+
(deftest ^:concatenate concatenate_test_2
3131
(testing "Concatenate ▶ vector of vectors"
3232
(is (= [1 2 3 4 5 6]
3333
(list-ops/concatenate [[1 2] [3] [] [4 5 6]])))))
3434

35-
(deftest concatenate_test_3
35+
(deftest ^:concatenate concatenate_test_3
3636
(testing "Concatenate ▶ vector of nested vectors"
3737
(is (= [[1] [2] [3] [] [4 5 6]]
3838
(list-ops/concatenate [[[1] [2]] [[3]] [[]] [[4 5 6]]])))))
3939

40-
(deftest select-if_test_1
40+
(deftest ^:select-if select-if_test_1
4141
(testing "Filter ▶ empty vector"
4242
(is (= []
4343
(list-ops/select-if odd? [])))))
4444

45-
(deftest select-if_test_2
45+
(deftest ^:select-if select-if_test_2
4646
(testing "Filter ▶ non-empty vector"
4747
(is (= [1 3 5]
4848
(list-ops/select-if odd? [1 2 3 5])))))
4949

50-
(deftest length_test_1
50+
(deftest ^:length length_test_1
5151
(testing "Length ▶ empty vector"
5252
(is (= 0 (list-ops/length [])))))
5353

54-
(deftest length_test_2
54+
(deftest ^:length length_test_2
5555
(testing "Length ▶ non-empty vector"
5656
(is (= 4 (list-ops/length [1 2 3 4])))))
5757

58-
(deftest apply-to-each_test_1
58+
(deftest ^:apply-to-each apply-to-each_test_1
5959
(testing "Map ▶ empty vector"
6060
(is (= []
6161
(list-ops/apply-to-each inc [])))))
6262

63-
(deftest apply-to-each_test_2
63+
(deftest ^:apply-to-each apply-to-each_test_2
6464
(testing "Map ▶ non-empty vector"
6565
(is (= [2 4 6 8]
6666
(list-ops/apply-to-each inc [1 3 5 7])))))
6767

68-
(deftest foldl_test_1
68+
(deftest ^:foldl foldl_test_1
6969
(testing "Foldl ▶ empty vector"
7070
(is (= 2 (list-ops/foldl (fn [acc el] (* el acc)) [] 2)))))
7171

72-
(deftest foldl_test_2
72+
(deftest ^:foldl foldl_test_2
7373
(testing "Foldl ▶ direction independent function applied to non-empty vector"
7474
(is (= 15 (list-ops/foldl (fn [acc el] (+ el acc)) [1 2 3 4] 5)))))
7575

76-
(deftest foldl_test_3
76+
(deftest ^:foldl foldl_test_3
7777
(testing "Foldl ▶ direction dependent function applied to non-empty vector"
7878
(is (= 64 (list-ops/foldl (fn [acc el] (/ el acc)) [1 2 3 4] 24)))))
7979

80-
(deftest foldr_test_1
80+
(deftest ^:foldr foldr_test_1
8181
(testing "Foldr ▶ empty vector"
8282
(is (= 2 (list-ops/foldr (fn [acc el] (* el acc)) [] 2)))))
8383

84-
(deftest foldr_test_2
84+
(deftest ^:foldr foldr_test_2
8585
(testing "Foldr ▶ direction independent function applied to non-empty vector"
8686
(is (= 15 (list-ops/foldr (fn [acc el] (+ el acc)) [1 2 3 4] 5)))))
8787

88-
(deftest foldr_test_3
88+
(deftest ^:foldr foldr_test_3
8989
(testing "Foldr ▶ direction dependent function applied to non-empty vector"
9090
(is (= 9 (list-ops/foldr (fn [acc el] (/ el acc)) [1 2 3 4] 24)))))
9191

92-
(deftest reverse-order_test_1
92+
(deftest ^:reverse-order reverse-order_test_1
9393
(testing "Reverse ▶ empty vector"
9494
(is (= []
9595
(list-ops/reverse-order [])))))
9696

97-
(deftest reverse-order_test_2
97+
(deftest ^:reverse-order reverse-order_test_2
9898
(testing "Reverse ▶ non-empty vector"
9999
(is (= [7 5 3 1]
100100
(list-ops/reverse-order [1 3 5 7])))))
101101

102-
(deftest reverse-order_test_3
102+
(deftest ^:reverse-order reverse-order_test_3
103103
(testing "Reverse ▶ vector of vectors is not flattened"
104104
(is (= [[4 5 6] [] [3] [1 2]]
105105
(list-ops/reverse-order [[1 2] [3] [] [4 5 6]])))))

0 commit comments

Comments
 (0)