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