on 0b669c7 help sign in
Idris-dev/test/TestData.hs
348 lines 8.8 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 ( 26, ANY )]),
81 ("bignum", "Bignum",
82 [ ( 1, ANY ),
83 ( 2, ANY ),
84 ( 3, C_CG )]),
85 ("bounded", "Bounded",
86 [ ( 1, ANY )]),
87 ("buffer", "Buffer",
88 [ ( 1, C_CG ),
89 ( 2, C_CG )]),
90 ("contrib", "Contrib",
91 [ ( 1, C_CG )]),
92 ("corecords", "Corecords",
93 [ ( 1, ANY ),
94 ( 2, ANY )]),
95 ("delab", "De-elaboration",
96 [ ( 1, ANY )]),
97 ("directives", "Directives",
98 [ ( 1, ANY ),
99 ( 2, ANY ),
100 ( 3, C_CG )]),
101 ("disambig", "Disambiguation",
102 [ ( 2, ANY )]),
103 ("docs", "Documentation",
104 [ ( 1, ANY ),
105 ( 2, ANY ),
106 ( 3, ANY ),
107 ( 4, ANY ),
108 ( 5, ANY ),
109 ( 6, ANY )]),
110 ("dsl", "DSL",
111 [ ( 1, ANY ),
112 ( 2, C_CG ),
113 ( 3, ANY ),
114 ( 4, ANY )]),
115 ("effects", "Effects",
116 [ ( 1, C_CG ),
117 ( 2, C_CG ),
118 ( 3, ANY ),
119 ( 4, ANY ),
120 ( 5, ANY )]),
121 ("error", "Errors",
122 [ ( 1, ANY ),
123 ( 2, ANY ),
124 ( 3, ANY ),
125 ( 4, ANY ),
126 ( 5, ANY ),
127 ( 6, ANY ),
128 ( 7, ANY ),
129 ( 8, ANY ),
130 ( 9, ANY )]),
131 ("ffi", "FFI",
132 [ ( 1, ANY )
133 , ( 2, ANY )
134 , ( 3, ANY )
135 , ( 4, ANY )
136 , ( 5, ANY )
137 , ( 6, C_CG )
138 , ( 7, C_CG )
139 , ( 8, C_CG )
140 , ( 9, C_CG )
141 , ( 10, NODE_CG )
142 , ( 11, NODE_CG )
143 ]),
144 ("folding", "Folding",
145 [ ( 1, ANY )]),
146 ("idrisdoc", "Idris documentation",
147 [ ( 1, ANY ),
148 ( 2, ANY ),
149 ( 3, ANY ),
150 ( 4, ANY ),
151 ( 5, ANY ),
152 ( 6, ANY ),
153 ( 7, ANY ),
154 ( 8, ANY ),
155 ( 9, ANY )]),
156 ("interactive", "Interactive editing",
157 [ ( 1, ANY ),
158 ( 2, ANY ),
159 ( 3, ANY ),
160 ( 4, ANY ),
161 ( 5, ANY ),
162 ( 6, ANY ),
163 ( 7, ANY ),
164 ( 8, ANY ),
165 ( 9, ANY ),
166 ( 10, ANY ),
167 ( 11, ANY ),
168 ( 12, ANY ),
169 ( 13, ANY ),
170 ( 14, C_CG ),
171 ( 15, ANY ),
172 ( 16, ANY ),
173-- FIXME: Re-enable interactive017 once it works with and without node.
174-- FIXME: See https://github.com/idris-lang/Idris-dev/pull/4046#issuecomment-326910042
175-- ( 17, ANY ),
176 ( 18, ANY )]),
177 ("interfaces", "Interfaces",
178 [ ( 1, ANY ),
179 ( 2, ANY ),
180 ( 3, ANY ),
181 ( 4, ANY ),
182-- ( 5, ANY ),
183 ( 6, ANY ),
184 ( 7, ANY ),
185 ( 8, ANY ),
186-- ( 9, ANY ),
187 ( 10, ANY )]),
188 ("interpret", "Interpret",
189 [ ( 1, ANY ),
190 ( 2, ANY ),
191 ( 3, C_CG )]),
192 ("io", "IO monad",
193 [ ( 1, C_CG ),
194 ( 2, ANY ),
195 ( 3, C_CG )]),
196 ("layout", "Layout",
197 [ ( 1, ANY )]),
198 ("literate", "Literate programming",
199 [ ( 1, ANY )]),
200 ("meta", "Meta-programming",
201 [ ( 1, ANY ),
202 ( 2, ANY ),
203 ( 3, ANY ),
204 ( 4, ANY )]),
205 ("pkg", "Packages",
206 [ ( 1, ANY ),
207 ( 2, ANY ),
208 ( 3, ANY ),
209 ( 4, ANY ),
210 ( 5, ANY ),
211 ( 6, ANY ),
212 ( 7, ANY ),
213 ( 8, ANY ),
214 ( 10, ANY )]),
215 ("prelude", "Prelude",
216 [ ( 1, ANY )]),
217 ("primitives", "Primitive types",
218 [ ( 1, ANY ),
219 ( 2, ANY ),
220 ( 3, ANY ),
221 ( 5, C_CG ),
222 ( 6, C_CG )]),
223 ("proof", "Theorem proving",
224 [ ( 1, ANY ),
225 ( 2, ANY ),
226 ( 3, ANY ),
227 ( 4, ANY ),
228 ( 5, ANY ),
229 ( 6, ANY ),
230 ( 7, ANY ),
231 ( 8, ANY ),
232 ( 9, ANY ),
233 ( 10, ANY ),
234 ( 11, ANY )]),
235 ("proofsearch", "Proof search",
236 [ ( 1, ANY ),
237 ( 2, ANY ),
238 ( 3, ANY )]),
239 ("pruviloj", "Pruviloj",
240 [ ( 1, ANY )]),
241 ("quasiquote", "Quasiquotations",
242 [ ( 1, ANY ),
243 ( 2, ANY ),
244 ( 3, ANY ),
245 ( 4, ANY ),
246 ( 5, ANY ),
247 ( 6, ANY )]),
248 ("records", "Records",
249 [ ( 1, ANY ),
250 ( 2, ANY ),
251 ( 3, ANY ),
252 ( 4, ANY ),
253 ( 5, ANY )]),
254 ("reg", "Regressions",
255 [ ( 1, ANY ),
256 ( 2, ANY ),
257 ( 4, ANY ),
258 ( 5, ANY ),
259 ( 13, ANY ),
260 ( 16, ANY ),
261 ( 17, ANY ),
262 ( 20, ANY ),
263 ( 24, ANY ),
264 ( 25, ANY ),
265 ( 27, ANY ),
266 ( 29, C_CG ),
267 ( 31, ANY ),
268 ( 32, ANY ),
269 ( 39, ANY ),
270 ( 40, ANY ),
271 ( 41, ANY ),
272 ( 42, ANY ),
273 ( 45, ANY ),
274 ( 48, ANY ),
275 ( 52, C_CG ),
276 ( 67, ANY ),
277 ( 75, ANY ),
278 ( 76, ANY ),
279 ( 77, ANY )]),
280 ("regression", "Regression",
281 [ ( 1 , ANY ),
282 ( 2 , ANY ),
283 ( 3 , ANY )]),
284 ("sourceLocation", "Source location",
285 [ ( 1 , ANY )]),
286 ("st", "ST",
287 [ ( 1, C_CG),
288 ( 2, C_CG),
289 ( 3, C_CG),
290 ( 4, C_CG),
291 ( 5, C_CG),
292 ( 6, C_CG),
293 ( 7, C_CG)]),
294 ("sugar", "Syntactic sugar",
295 [ ( 1, ANY ),
296 ( 2, ANY ),
297 ( 3, ANY ),
298 ( 4, C_CG ),
299 ( 5, ANY )]),
300 ("syntax", "Syntax extensions",
301 [ ( 1, ANY ),
302 ( 2, ANY )]),
303 ("tactics", "Tactics",
304 [ ( 1, ANY )]),
305 ("totality", "Totality checking",
306 [ ( 1, ANY ),
307 ( 2, ANY ),
308 ( 3, ANY ),
309 ( 4, ANY ),
310 ( 5, ANY ),
311 ( 6, ANY ),
312 ( 7, ANY ),
313 ( 8, ANY ),
314 ( 9, ANY ),
315 ( 10, ANY ),
316 ( 11, ANY ),
317 ( 12, ANY ),
318 ( 13, ANY ),
319 ( 14, ANY ),
320 ( 15, ANY ),
321 ( 16, ANY ),
322 ( 17, ANY ),
323 ( 18, ANY ),
324 ( 19, ANY ),
325 ( 20, ANY ),
326 ( 21, ANY ),
327 ( 22, ANY ),
328 ( 23, ANY ),
329 ( 25, ANY ),
330 ( 26, ANY )]),
331 ("tutorial", "Tutorial examples",
332 [ ( 1, ANY ),
333 ( 2, ANY ),
334 ( 3, ANY ),
335 ( 4, ANY ),
336 ( 5, ANY ),
337 ( 6, ANY ),
338 ( 7, C_CG )]),
339 ("unique", "Uniqueness types",
340 [ ( 1, ANY ),
341 ( 4, ANY )]),
342 ("universes", "Universes",
343 [ ( 1, ANY ),
344 ( 2, ANY )]),
345 ("views", "Views",
346 [ ( 1, ANY ),
347 ( 2, ANY ),
348 ( 3, C_CG )])]