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