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