on 19a87f3 help sign in
Idris-dev/test/TestData.hs
349 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 , ( 12, NODE_CG )
144 ]),
145 ("folding", "Folding",
146 [ ( 1, ANY )]),
147 ("idrisdoc", "Idris documentation",
148 [ ( 1, ANY ),
149 ( 2, ANY ),
150 ( 3, ANY ),
151 ( 4, ANY ),
152 ( 5, ANY ),
153 ( 6, ANY ),
154 ( 7, ANY ),
155 ( 8, ANY ),
156 ( 9, ANY )]),
157 ("interactive", "Interactive editing",
158 [ ( 1, ANY ),
159 ( 2, ANY ),
160 ( 3, ANY ),
161 ( 4, ANY ),
162 ( 5, ANY ),
163 ( 6, ANY ),
164 ( 7, ANY ),
165 ( 8, ANY ),
166 ( 9, ANY ),
167 ( 10, ANY ),
168 ( 11, ANY ),
169 ( 12, ANY ),
170 ( 13, ANY ),
171 ( 14, C_CG ),
172 ( 15, ANY ),
173 ( 16, ANY ),
174-- FIXME: Re-enable interactive017 once it works with and without node.
175-- FIXME: See https://github.com/idris-lang/Idris-dev/pull/4046#issuecomment-326910042
176-- ( 17, ANY ),
177 ( 18, ANY )]),
178 ("interfaces", "Interfaces",
179 [ ( 1, ANY ),
180 ( 2, ANY ),
181 ( 3, ANY ),
182 ( 4, ANY ),
183-- ( 5, ANY ),
184 ( 6, ANY ),
185 ( 7, ANY ),
186 ( 8, ANY ),
187-- ( 9, ANY ),
188 ( 10, ANY )]),
189 ("interpret", "Interpret",
190 [ ( 1, ANY ),
191 ( 2, ANY ),
192 ( 3, C_CG )]),
193 ("io", "IO monad",
194 [ ( 1, C_CG ),
195 ( 2, ANY ),
196 ( 3, C_CG )]),
197 ("layout", "Layout",
198 [ ( 1, ANY )]),
199 ("literate", "Literate programming",
200 [ ( 1, ANY )]),
201 ("meta", "Meta-programming",
202 [ ( 1, ANY ),
203 ( 2, ANY ),
204 ( 3, ANY ),
205 ( 4, ANY )]),
206 ("pkg", "Packages",
207 [ ( 1, ANY ),
208 ( 2, ANY ),
209 ( 3, ANY ),
210 ( 4, ANY ),
211 ( 5, ANY ),
212 ( 6, ANY ),
213 ( 7, ANY ),
214 ( 8, ANY ),
215 ( 10, ANY )]),
216 ("prelude", "Prelude",
217 [ ( 1, ANY )]),
218 ("primitives", "Primitive types",
219 [ ( 1, ANY ),
220 ( 2, ANY ),
221 ( 3, ANY ),
222 ( 5, C_CG ),
223 ( 6, C_CG )]),
224 ("proof", "Theorem proving",
225 [ ( 1, ANY ),
226 ( 2, ANY ),
227 ( 3, ANY ),
228 ( 4, ANY ),
229 ( 5, ANY ),
230 ( 6, ANY ),
231 ( 7, ANY ),
232 ( 8, ANY ),
233 ( 9, ANY ),
234 ( 10, ANY ),
235 ( 11, ANY )]),
236 ("proofsearch", "Proof search",
237 [ ( 1, ANY ),
238 ( 2, ANY ),
239 ( 3, ANY )]),
240 ("pruviloj", "Pruviloj",
241 [ ( 1, ANY )]),
242 ("quasiquote", "Quasiquotations",
243 [ ( 1, ANY ),
244 ( 2, ANY ),
245 ( 3, ANY ),
246 ( 4, ANY ),
247 ( 5, ANY ),
248 ( 6, ANY )]),
249 ("records", "Records",
250 [ ( 1, ANY ),
251 ( 2, ANY ),
252 ( 3, ANY ),
253 ( 4, ANY ),
254 ( 5, ANY )]),
255 ("reg", "Regressions",
256 [ ( 1, ANY ),
257 ( 2, ANY ),
258 ( 4, ANY ),
259 ( 5, ANY ),
260 ( 13, ANY ),
261 ( 16, ANY ),
262 ( 17, ANY ),
263 ( 20, ANY ),
264 ( 24, ANY ),
265 ( 25, ANY ),
266 ( 27, ANY ),
267 ( 29, C_CG ),
268 ( 31, ANY ),
269 ( 32, ANY ),
270 ( 39, ANY ),
271 ( 40, ANY ),
272 ( 41, ANY ),
273 ( 42, ANY ),
274 ( 45, ANY ),
275 ( 48, ANY ),
276 ( 52, C_CG ),
277 ( 67, ANY ),
278 ( 75, ANY ),
279 ( 76, ANY ),
280 ( 77, ANY )]),
281 ("regression", "Regression",
282 [ ( 1 , ANY ),
283 ( 2 , ANY ),
284 ( 3 , ANY )]),
285 ("sourceLocation", "Source location",
286 [ ( 1 , ANY )]),
287 ("st", "ST",
288 [ ( 1, C_CG),
289 ( 2, C_CG),
290 ( 3, C_CG),
291 ( 4, C_CG),
292 ( 5, C_CG),
293 ( 6, C_CG),
294 ( 7, C_CG)]),
295 ("sugar", "Syntactic sugar",
296 [ ( 1, ANY ),
297 ( 2, ANY ),
298 ( 3, ANY ),
299 ( 4, C_CG ),
300 ( 5, ANY )]),
301 ("syntax", "Syntax extensions",
302 [ ( 1, ANY ),
303 ( 2, ANY )]),
304 ("tactics", "Tactics",
305 [ ( 1, ANY )]),
306 ("totality", "Totality checking",
307 [ ( 1, ANY ),
308 ( 2, ANY ),
309 ( 3, ANY ),
310 ( 4, ANY ),
311 ( 5, ANY ),
312 ( 6, ANY ),
313 ( 7, ANY ),
314 ( 8, ANY ),
315 ( 9, ANY ),
316 ( 10, ANY ),
317 ( 11, ANY ),
318 ( 12, ANY ),
319 ( 13, ANY ),
320 ( 14, ANY ),
321 ( 15, ANY ),
322 ( 16, ANY ),
323 ( 17, ANY ),
324 ( 18, ANY ),
325 ( 19, ANY ),
326 ( 20, ANY ),
327 ( 21, ANY ),
328 ( 22, ANY ),
329 ( 23, ANY ),
330 ( 25, ANY ),
331 ( 26, ANY )]),
332 ("tutorial", "Tutorial examples",
333 [ ( 1, ANY ),
334 ( 2, ANY ),
335 ( 3, ANY ),
336 ( 4, ANY ),
337 ( 5, ANY ),
338 ( 6, ANY ),
339 ( 7, C_CG )]),
340 ("unique", "Uniqueness types",
341 [ ( 1, ANY ),
342 ( 4, ANY )]),
343 ("universes", "Universes",
344 [ ( 1, ANY ),
345 ( 2, ANY )]),
346 ("views", "Views",
347 [ ( 1, ANY ),
348 ( 2, ANY ),
349 ( 3, C_CG )])]