on e61c630 help sign in
Idris-dev/test/TestData.hs
329 lines 8.4 kB history raw
1module TestData where
3import Data.IntMap as IMap
4import Data.Set as Set
6data Codegen = C | JS deriving (Show, Eq, Ord)
7type Index = Int
8data CompatCodegen = ANY | C_CG | NODE_CG | NONE
10-- A TestFamily groups tests that share the same theme
11data TestFamily = TestFamily {
12 -- A shorter lowcase name to use in filenames
13 id :: String,
14 -- A proper name for the test family that will be displayed
15 name :: String,
16 -- A map of test metadata:
17 -- - The key is the index (>=1 && <1000)
18 -- - The value is the set of compatible code generators,
19 -- or Nothing if the test doesn't depend on a code generator
20 tests :: IntMap (Maybe (Set Codegen))
21} deriving (Show)
23toCodegenSet :: CompatCodegen -> Maybe (Set Codegen)
24toCodegenSet compatCodegen = fmap Set.fromList mList where
25 mList = case compatCodegen of
26 ANY -> Just [ C, JS ]
27 C_CG -> Just [ C ]
28 NODE_CG -> Just [ JS ]
29 NONE -> Nothing
31testFamilies :: [TestFamily]
32testFamilies = fmap instantiate testFamiliesData where
33 instantiate (id, name, testsData) = TestFamily id name tests where
34 tests = IMap.fromList (fmap makeSetCodegen testsData)
35 makeSetCodegen (index, codegens) = (index, toCodegenSet codegens)
37testFamiliesForCodegen :: Codegen -> [TestFamily]
38testFamiliesForCodegen codegen =
39 fmap (\testFamily -> testFamily {tests = IMap.filter f (tests testFamily)})
40 testFamilies
41 where
42 f mCodegens = case mCodegens of
43 Just codegens -> Set.member codegen codegens
44 Nothing -> True
46-- The data to instanciate testFamilies
47-- The first column is the id
48-- The second column is the proper name (the prefix of the subfolders)
49-- The third column is the data for each test
50testFamiliesData :: [(String, String, [(Index, CompatCodegen)])]
51testFamiliesData = [
52 ("base", "Base",
53 [ ( 1, C_CG )]),
54 ("basic", "Basic",
55 [ ( 1, ANY ),
56 ( 2, ANY ),
57 ( 3, ANY ),
58 ( 4, ANY ),
59 ( 5, ANY ),
60 ( 6, ANY ),
61 ( 7, C_CG ),
62 ( 8, ANY ),
63 ( 9, ANY ),
64 ( 10, ANY ),
65 ( 11, C_CG ),
66 ( 12, ANY ),
67 ( 13, ANY ),
68 ( 14, ANY ),
69 ( 15, ANY ),
70 ( 16, ANY ),
71 ( 17, ANY ),
72 ( 18, ANY ),
73 ( 19, ANY ),
74 ( 20, ANY ),
75 ( 21, C_CG ),
76 ( 22, NODE_CG ),
77 ( 23, ANY ),
78 ( 24, ANY ),
79 ( 25, ANY )]),
80 ("bignum", "Bignum",
81 [ ( 1, ANY ),
82 ( 2, ANY )]),
83 ("bounded", "Bounded",
84 [ ( 1, ANY )]),
85 ("buffer", "Buffer",
86 [ ( 1, C_CG )]),
87 ("corecords", "Corecords",
88 [ ( 1, ANY ),
89 ( 2, ANY )]),
90 ("delab", "De-elaboration",
91 [ ( 1, ANY )]),
92 ("directives", "Directives",
93 [ ( 1, ANY ),
94 ( 2, ANY ),
95 ( 3, C_CG )]),
96 ("disambig", "Disambiguation",
97 [ ( 2, ANY )]),
98 ("docs", "Documentation",
99 [ ( 1, ANY ),
100 ( 2, ANY ),
101 ( 3, ANY ),
102 ( 4, ANY ),
103 ( 5, ANY ),
104 ( 6, ANY )]),
105 ("dsl", "DSL",
106 [ ( 1, ANY ),
107 ( 2, C_CG ),
108 ( 3, ANY ),
109 ( 4, ANY )]),
110 ("effects", "Effects",
111 [ ( 1, C_CG ),
112 ( 2, C_CG ),
113 ( 3, ANY ),
114 ( 4, ANY ),
115 ( 5, ANY )]),
116 ("error", "Errors",
117 [ ( 1, ANY ),
118 ( 2, ANY ),
119 ( 3, ANY ),
120 ( 4, ANY ),
121 ( 5, ANY ),
122 ( 6, ANY ),
123 ( 7, ANY ),
124 ( 8, ANY ),
125 ( 9, ANY )]),
126 ("ffi", "FFI",
127 [ ( 1, ANY )
128 , ( 2, ANY )
129 , ( 3, ANY )
130 , ( 4, ANY )
131 , ( 5, ANY )
132 , ( 6, C_CG )
133 , ( 7, C_CG )
134 , ( 8, C_CG )
135 , ( 9, C_CG )
136 , ( 10, NODE_CG )
137 , ( 11, NODE_CG )
138 ]),
139 ("folding", "Folding",
140 [ ( 1, ANY )]),
141 ("idrisdoc", "Idris documentation",
142 [ ( 1, ANY ),
143 ( 2, ANY ),
144 ( 3, ANY ),
145 ( 4, ANY ),
146 ( 5, ANY ),
147 ( 6, ANY ),
148 ( 7, ANY ),
149 ( 8, ANY ),
150 ( 9, ANY )]),
151 ("interactive", "Interactive editing",
152 [ ( 1, ANY ),
153 ( 2, ANY ),
154 ( 3, ANY ),
155 ( 4, ANY ),
156 ( 5, ANY ),
157 ( 6, ANY ),
158 ( 7, ANY ),
159 ( 8, ANY ),
160 ( 9, ANY ),
161 ( 10, ANY ),
162 ( 11, ANY ),
163 ( 12, ANY ),
164 ( 13, ANY ),
165 ( 14, C_CG ),
166 ( 15, ANY ),
167 ( 16, ANY ),
168-- FIXME: Re-enable interactive017 once it works with and without node.
169-- FIXME: See https://github.com/idris-lang/Idris-dev/pull/4046#issuecomment-326910042
170-- ( 17, ANY ),
171 ( 18, ANY )]),
172 ("interfaces", "Interfaces",
173 [ ( 1, ANY ),
174 ( 2, ANY ),
175 ( 3, ANY ),
176 ( 4, ANY ),
177-- ( 5, ANY ),
178 ( 6, ANY ),
179 ( 7, ANY ),
180 ( 8, ANY )]),
181 ("interpret", "Interpret",
182 [ ( 1, ANY ),
183 ( 2, ANY )]),
184 ("io", "IO monad",
185 [ ( 1, C_CG ),
186 ( 2, ANY ),
187 ( 3, C_CG )]),
188 ("layout", "Layout",
189 [ ( 1, ANY )]),
190 ("literate", "Literate programming",
191 [ ( 1, ANY )]),
192 ("meta", "Meta-programming",
193 [ ( 1, ANY ),
194 ( 2, ANY ),
195 ( 3, ANY ),
196 ( 4, ANY )]),
197 ("pkg", "Packages",
198 [ ( 1, ANY ),
199 ( 2, ANY ),
200 ( 3, ANY ),
201 ( 4, ANY ),
202 ( 5, ANY ),
203 ( 6, ANY ),
204 ( 7, ANY ),
205 ( 8, ANY )]),
206 ("prelude", "Prelude",
207 [ ( 1, ANY )]),
208 ("primitives", "Primitive types",
209 [ ( 1, ANY ),
210 ( 2, ANY ),
211 ( 3, ANY ),
212 ( 5, C_CG ),
213 ( 6, C_CG )]),
214 ("proof", "Theorem proving",
215 [ ( 1, ANY ),
216 ( 2, ANY ),
217 ( 3, ANY ),
218 ( 4, ANY ),
219 ( 5, ANY ),
220 ( 6, ANY ),
221 ( 7, ANY ),
222 ( 8, ANY ),
223 ( 9, ANY ),
224 ( 10, ANY ),
225 ( 11, ANY )]),
226 ("proofsearch", "Proof search",
227 [ ( 1, ANY ),
228 ( 2, ANY ),
229 ( 3, ANY )]),
230 ("pruviloj", "Pruviloj",
231 [ ( 1, ANY )]),
232 ("quasiquote", "Quasiquotations",
233 [ ( 1, ANY ),
234 ( 2, ANY ),
235 ( 3, ANY ),
236 ( 4, ANY ),
237 ( 5, ANY ),
238 ( 6, ANY )]),
239 ("records", "Records",
240 [ ( 1, ANY ),
241 ( 2, ANY ),
242 ( 3, ANY ),
243 ( 4, ANY ),
244 ( 5, ANY )]),
245 ("reg", "Regressions",
246 [ ( 1, ANY ),
247 ( 2, ANY ),
248 ( 4, ANY ),
249 ( 5, ANY ),
250 ( 13, ANY ),
251 ( 16, ANY ),
252 ( 17, ANY ),
253 ( 20, ANY ),
254 ( 24, ANY ),
255 ( 25, ANY ),
256 ( 27, ANY ),
257 ( 29, C_CG ),
258 ( 31, ANY ),
259 ( 32, ANY ),
260 ( 39, ANY ),
261 ( 40, ANY ),
262 ( 41, ANY ),
263 ( 42, ANY ),
264 ( 45, ANY ),
265 ( 48, ANY ),
266 ( 52, C_CG ),
267 ( 67, ANY ),
268 ( 75, ANY ),
269 ( 76, ANY ),
270 ( 77, ANY )]),
271 ("regression", "Regression",
272 [ ( 1 , ANY ),
273 ( 2 , ANY ),
274 ( 3 , ANY )]),
275 ("sourceLocation", "Source location",
276 [ ( 1 , ANY )]),
277 ("sugar", "Syntactic sugar",
278 [ ( 1, ANY ),
279 ( 2, ANY ),
280 ( 3, ANY ),
281 ( 4, C_CG ),
282 ( 5, ANY )]),
283 ("syntax", "Syntax extensions",
284 [ ( 1, ANY ),
285 ( 2, ANY )]),
286 ("tactics", "Tactics",
287 [ ( 1, ANY )]),
288 ("totality", "Totality checking",
289 [ ( 1, ANY ),
290 ( 2, ANY ),
291 ( 3, ANY ),
292 ( 4, ANY ),
293 ( 5, ANY ),
294 ( 6, ANY ),
295 ( 7, ANY ),
296 ( 8, ANY ),
297 ( 9, ANY ),
298 ( 10, ANY ),
299 ( 11, ANY ),
300 ( 12, ANY ),
301 ( 13, ANY ),
302 ( 14, ANY ),
303 ( 15, ANY ),
304 ( 16, ANY ),
305 ( 17, ANY ),
306 ( 18, ANY ),
307 ( 19, ANY ),
308 ( 20, ANY ),
309 ( 21, ANY ),
310 ( 22, ANY ),
311 ( 23, ANY )]),
312 ("tutorial", "Tutorial examples",
313 [ ( 1, ANY ),
314 ( 2, ANY ),
315 ( 3, ANY ),
316 ( 4, ANY ),
317 ( 5, ANY ),
318 ( 6, ANY ),
319 ( 7, C_CG )]),
320 ("unique", "Uniqueness types",
321 [ ( 1, ANY ),
322 ( 4, ANY )]),
323 ("universes", "Universes",
324 [ ( 1, ANY ),
325 ( 2, ANY )]),
326 ("views", "Views",
327 [ ( 1, ANY ),
328 ( 2, ANY ),
329 ( 3, C_CG )])]