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