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