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