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