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