on 2fc1fc6 help sign in
Idris-dev/test/TestData.hs
316 lines 7.9 kB history raw
1module TestData where
3import Data.IntMap as IMap
4import Data.Map.Strict as Map
5import Data.Set as Set
7data Codegen = C | JS deriving (Show, Eq, Ord)
8type Index = Int
9data CompatCodegen = ANY | C_CG | NODE_CG | NONE
11-- A TestFamily groups tests that share the same theme
12data TestFamily = TestFamily {
13 -- A shorter lowcase name to use in filenames
14 id :: String,
15 -- A proper name for the test family that will be displayed
16 name :: String,
17 -- A map of test metadata:
18 -- - The key is the index (>=1 && <1000)
19 -- - The value is the set of compatible code generators,
20 -- or Nothing if the test doesn't depend on a code generator
21 tests :: IntMap (Maybe (Set Codegen))
22} deriving (Show)
24toCodegenSet :: CompatCodegen -> Maybe (Set Codegen)
25toCodegenSet compatCodegen = fmap Set.fromList mList where
26 mList = case compatCodegen of
27 ANY -> Just [ C, JS ]
28 C_CG -> Just [ C ]
29 NODE_CG -> Just [ JS ]
30 NONE -> Nothing
32testFamilies :: [TestFamily]
33testFamilies = fmap instantiate testFamiliesData where
34 instantiate (id, name, testsData) = TestFamily id name tests where
35 tests = IMap.fromList (fmap makeSetCodegen testsData)
36 makeSetCodegen (index, codegens) = (index, toCodegenSet codegens)
38testFamiliesForCodegen :: Codegen -> [TestFamily]
39testFamiliesForCodegen codegen =
40 fmap (\testFamily -> testFamily {tests = IMap.filter f (tests testFamily)})
41 testFamilies
42 where
43 f mCodegens = case mCodegens of
44 Just codegens -> Set.member codegen codegens
45 Nothing -> True
47-- The data to instanciate testFamilies
48-- The first column is the id
49-- The second column is the proper name (the prefix of the subfolders)
50-- The third column is the data for each test
51testFamiliesData :: [(String, String, [(Index, CompatCodegen)])]
52testFamiliesData = [
53 ("base", "Base",
54 [ ( 1, C_CG )]),
55 ("basic", "Basic",
56 [ ( 1, ANY ),
57 ( 2, ANY ),
58 ( 3, ANY ),
59 ( 4, ANY ),
60 ( 5, ANY ),
61 ( 6, ANY ),
62 ( 7, C_CG ),
63 ( 8, ANY ),
64 ( 9, ANY ),
65 ( 10, ANY ),
66 ( 11, C_CG ),
67 ( 12, ANY ),
68 ( 13, ANY ),
69 ( 14, ANY ),
70 ( 15, ANY ),
71 ( 16, ANY ),
72 ( 17, ANY ),
73 ( 18, ANY ),
74 ( 19, ANY )]),
75 ("bignum", "Bignum",
76 [ ( 1, ANY ),
77 ( 2, ANY )]),
78 ("bounded", "Bounded",
79 [ ( 1, ANY )]),
80 ("buffer", "Buffer",
81 [ ( 1, C_CG )]),
82 ("corecords", "Corecords",
83 [ ( 1, ANY ),
84 ( 2, ANY )]),
85 ("delab", "De-elaboration",
86 [ ( 1, ANY )]),
87 ("directives", "Directives",
88 [ ( 1, ANY ),
89 ( 2, ANY )]),
90 ("disambig", "Disambiguation",
91 [ ( 2, ANY )]),
92 ("docs", "Documentation",
93 [ ( 1, ANY ),
94 ( 2, ANY ),
95 ( 3, ANY ),
96 ( 4, ANY ),
97 ( 5, ANY ),
98 ( 6, ANY )]),
99 ("dsl", "DSL",
100 [ ( 1, ANY ),
101 ( 2, C_CG ),
102 ( 3, ANY ),
103 ( 4, ANY )]),
104 ("effects", "Effects",
105 [ ( 1, C_CG ),
106 ( 2, C_CG ),
107 ( 3, ANY ),
108 ( 4, ANY ),
109 ( 5, ANY )]),
110 ("error", "Errors",
111 [ ( 1, ANY ),
112 ( 2, ANY ),
113 ( 3, ANY ),
114 ( 4, ANY ),
115 ( 5, ANY ),
116 ( 6, ANY ),
117 ( 7, ANY ),
118 ( 8, ANY ),
119 ( 9, ANY )]),
120 ("ffi", "FFI",
121 [ ( 1, ANY )
122 , ( 2, ANY )
123 , ( 3, ANY )
124 , ( 4, ANY )
125 , ( 5, ANY )
126 , ( 6, C_CG )
127 , ( 7, C_CG )
128 , ( 8, C_CG )
129 , ( 9, C_CG )
130 , ( 10, NODE_CG )
131 ]),
132 ("folding", "Folding",
133 [ ( 1, ANY )]),
134 ("idrisdoc", "Idris documentation",
135 [ ( 1, ANY ),
136 ( 2, ANY ),
137 ( 3, ANY ),
138 ( 4, ANY ),
139 ( 5, ANY ),
140 ( 6, ANY ),
141 ( 7, ANY ),
142 ( 8, ANY ),
143 ( 9, ANY )]),
144 ("interactive", "Interactive editing",
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 ( 10, ANY ),
155 ( 11, ANY ),
156 ( 12, ANY ),
157 ( 13, ANY ),
158 ( 14, C_CG ),
159 ( 15, ANY ),
160 ( 16, ANY )]),
161 ("interfaces", "Interfaces",
162 [ ( 1, ANY ),
163 ( 2, ANY ),
164 ( 3, ANY ),
165 ( 4, ANY ),
166-- ( 5, ANY ),
167 ( 6, ANY ),
168 ( 7, ANY )]),
169 ("interpret", "Interpret",
170 [ ( 1, ANY ),
171 ( 2, ANY )]),
172 ("io", "IO monad",
173 [ ( 1, C_CG ),
174 ( 2, ANY ),
175 ( 3, C_CG )]),
176 ("layout", "Layout",
177 [ ( 1, ANY )]),
178 ("literate", "Literate programming",
179 [ ( 1, ANY )]),
180 ("meta", "Meta-programming",
181 [ ( 1, ANY ),
182 ( 2, ANY ),
183 ( 3, ANY ),
184 ( 4, ANY )]),
185 ("pkg", "Packages",
186 [ ( 1, ANY ),
187 ( 2, ANY ),
188 ( 3, ANY ),
189 ( 4, ANY ),
190 ( 5, ANY ),
191 ( 6, ANY ),
192 ( 7, ANY ),
193 ( 8, ANY )]),
194 ("prelude", "Prelude",
195 [ ( 1, ANY )]),
196 ("primitives", "Primitive types",
197 [ ( 1, ANY ),
198 ( 2, ANY ),
199 ( 3, ANY ),
200 ( 5, C_CG ),
201 ( 6, C_CG )]),
202 ("proof", "Theorem proving",
203 [ ( 1, ANY ),
204 ( 2, ANY ),
205 ( 3, ANY ),
206 ( 4, ANY ),
207 ( 5, ANY ),
208 ( 6, ANY ),
209 ( 7, ANY ),
210 ( 8, ANY ),
211 ( 9, ANY ),
212 ( 10, ANY ),
213 ( 11, ANY )]),
214 ("proofsearch", "Proof search",
215 [ ( 1, ANY ),
216 ( 2, ANY ),
217 ( 3, ANY )]),
218 ("pruviloj", "Pruviloj",
219 [ ( 1, ANY )]),
220 ("quasiquote", "Quasiquotations",
221 [ ( 1, ANY ),
222 ( 2, ANY ),
223 ( 3, ANY ),
224 ( 4, ANY ),
225 ( 5, ANY ),
226 ( 6, ANY )]),
227 ("records", "Records",
228 [ ( 1, ANY ),
229 ( 2, ANY ),
230 ( 3, ANY ),
231 ( 4, ANY ),
232 ( 5, ANY )]),
233 ("reg", "Regressions",
234 [ ( 1, ANY ),
235 ( 2, ANY ),
236 ( 4, ANY ),
237 ( 5, ANY ),
238 ( 13, ANY ),
239 ( 16, ANY ),
240 ( 17, ANY ),
241 ( 20, ANY ),
242 ( 24, ANY ),
243 ( 25, ANY ),
244 ( 27, ANY ),
245 ( 29, C_CG ),
246 ( 31, ANY ),
247 ( 32, ANY ),
248 ( 39, ANY ),
249 ( 40, ANY ),
250 ( 41, ANY ),
251 ( 42, ANY ),
252 ( 45, ANY ),
253 ( 48, ANY ),
254 ( 52, C_CG ),
255 ( 67, ANY ),
256 ( 75, ANY ),
257 ( 76, ANY ),
258 ( 77, ANY )]),
259 ("regression", "Regression",
260 [ ( 1 , ANY ),
261 ( 2 , ANY )]),
262 ("sourceLocation", "Source location",
263 [ ( 1 , ANY )]),
264 ("sugar", "Syntactic sugar",
265 [ ( 1, ANY ),
266 ( 2, ANY ),
267 ( 3, ANY ),
268 ( 4, C_CG ),
269 ( 5, ANY )]),
270 ("syntax", "Syntax extensions",
271 [ ( 1, ANY ),
272 ( 2, ANY )]),
273 ("tactics", "Tactics",
274 [ ( 1, ANY )]),
275 ("totality", "Totality checking",
276 [ ( 1, ANY ),
277 ( 2, ANY ),
278 ( 3, ANY ),
279 ( 4, ANY ),
280 ( 5, ANY ),
281 ( 6, ANY ),
282 ( 7, ANY ),
283 ( 8, ANY ),
284 ( 9, ANY ),
285 ( 10, ANY ),
286 ( 11, ANY ),
287 ( 12, ANY ),
288 ( 13, ANY ),
289 ( 14, ANY ),
290 ( 15, ANY ),
291 ( 16, ANY ),
292 ( 17, ANY ),
293 ( 18, ANY ),
294 ( 19, ANY ),
295 ( 20, ANY ),
296 ( 21, ANY ),
297 ( 22, ANY ),
298 ( 23, ANY )]),
299 ("tutorial", "Tutorial examples",
300 [ ( 1, ANY ),
301 ( 2, ANY ),
302 ( 3, ANY ),
303 ( 4, ANY ),
304 ( 5, ANY ),
305 ( 6, ANY ),
306 ( 7, C_CG )]),
307 ("unique", "Uniqueness types",
308 [ ( 1, ANY ),
309 ( 4, ANY )]),
310 ("universes", "Universes",
311 [ ( 1, ANY ),
312 ( 2, ANY )]),
313 ("views", "Views",
314 [ ( 1, ANY ),
315 ( 2, ANY ),
316 ( 3, C_CG )])]