Reorganise tests
[darcs-mirrors/vector.git] / tests / Tests / Vector.hs
1 module Tests.Vector (tests) where
2
3 import Boilerplater
4 import Utilities
5
6 import qualified Data.Vector.Generic as V
7 import qualified Data.Vector
8 import qualified Data.Vector.Primitive
9 import qualified Data.Vector.Storable
10 import qualified Data.Vector.Unboxed
11 import qualified Data.Vector.Fusion.Stream as S
12
13 import Test.QuickCheck
14
15 import Test.Framework
16 import Test.Framework.Providers.QuickCheck2
17
18 import Text.Show.Functions ()
19 import Data.List
20 import System.Random (Random)
21
22 #define COMMON_CONTEXT(a, v) \
23 VANILLA_CONTEXT(a, v), VECTOR_CONTEXT(a, v)
24
25 #define VANILLA_CONTEXT(a, v) \
26 Eq a, Show a, Arbitrary a, CoArbitrary a, TestData a, Model a ~ a, EqTest a ~ Property
27
28 #define VECTOR_CONTEXT(a, v) \
29 Eq (v a), Show (v a), Arbitrary (v a), CoArbitrary (v a), TestData (v a), Model (v a) ~ [a], EqTest (v a) ~ Property, V.Vector v a
30
31 -- TODO: implement Vector equivalents of list functions for some of the commented out properties
32
33 -- TODO: test and implement some of these other Prelude functions:
34 -- mapM *
35 -- mapM_ *
36 -- sequence
37 -- sequence_
38 -- sum *
39 -- product *
40 -- scanl *
41 -- scanl1 *
42 -- scanr *
43 -- scanr1 *
44 -- lookup *
45 -- lines
46 -- words
47 -- unlines
48 -- unwords
49 -- NB: this is an exhaustive list of all Prelude list functions that make sense for vectors.
50 -- Ones with *s are the most plausible candidates.
51
52 -- TODO: add tests for the other extra functions
53 -- IVector exports still needing tests:
54 -- copy,
55 -- slice,
56 -- (//), update, bpermute,
57 -- prescanl, prescanl',
58 -- new,
59 -- unsafeSlice, unsafeIndex,
60 -- vlength, vnew
61
62 -- TODO: test non-IVector stuff?
63
64 testSanity :: forall a v. (COMMON_CONTEXT(a, v)) => v a -> [Test]
65 testSanity _ = [
66 testProperty "fromList.toList == id" prop_fromList_toList,
67 testProperty "toList.fromList == id" prop_toList_fromList,
68 testProperty "unstream.stream == id" prop_unstream_stream,
69 testProperty "stream.unstream == id" prop_stream_unstream
70 ]
71 where
72 prop_fromList_toList (v :: v a) = (V.fromList . V.toList) v == v
73 prop_toList_fromList (l :: [a]) = ((V.toList :: v a -> [a]) . V.fromList) l == l
74 prop_unstream_stream (v :: v a) = (V.unstream . V.stream) v == v
75 prop_stream_unstream (s :: S.Stream a) = ((V.stream :: v a -> S.Stream a) . V.unstream) s == s
76
77 testPolymorphicFunctions :: forall a v. (COMMON_CONTEXT(a, v), VECTOR_CONTEXT(Int, v)) => v a -> [Test]
78 testPolymorphicFunctions _ = $(testProperties [
79 'prop_eq,
80
81 -- Length information
82 'prop_length, 'prop_null,
83
84 -- Indexing (FIXME)
85 'prop_index, {- 'prop_safeIndex, -} 'prop_head, 'prop_last,
86 'prop_unsafeIndex, 'prop_unsafeHead, 'prop_unsafeLast,
87
88 -- Monadic indexing (FIXME)
89 {- 'prop_indexM, 'prop_headM, 'prop_lastM,
90 'prop_unsafeIndexM, 'prop_unsafeHeadM, 'prop_unsafeLastM, -}
91
92 -- Subvectors (FIXME)
93 'prop_slice, 'prop_init, 'prop_tail, 'prop_take, 'prop_drop,
94 {- 'prop_splitAt, -}
95 {- 'prop_unsafeSlice, 'prop_unsafeInit, 'prop_unsafeTail,
96 'prop_unsafeTake, 'prop_unsafeDrop, -}
97
98 -- Initialisation (FIXME)
99 'prop_empty, 'prop_singleton, 'prop_replicate,
100 'prop_generate, {- 'prop_iterateN, -}
101
102 -- Monadic initialisation (FIXME)
103 {- 'prop_replicateM, 'prop_generateM, 'prop_create, -}
104
105 -- Unfolding (FIXME)
106 {- 'prop_unfoldr, prop_unfoldrN, -}
107 'prop_constructN, 'prop_constructrN,
108
109 -- Enumeration? (FIXME?)
110
111 -- Concatenation (FIXME)
112 'prop_cons, 'prop_snoc, 'prop_append,
113 {- 'prop_concat, -}
114
115 -- Restricting memory usage
116 'prop_force,
117
118
119 -- Bulk updates (FIXME)
120 'prop_upd,
121 {- 'prop_update, 'prop_update_,
122 'prop_unsafeUpd, 'prop_unsafeUpdate, 'prop_unsafeUpdate_, -}
123
124 -- Accumulations (FIXME)
125 'prop_accum,
126 {- 'prop_accumulate, 'prop_accumulate_,
127 'prop_unsafeAccum, 'prop_unsafeAccumulate, 'prop_unsafeAccumulate_, -}
128
129 -- Permutations
130 'prop_reverse, 'prop_backpermute,
131 {- 'prop_unsafeBackpermute, #-}
132
133 -- Elementwise indexing
134 {- 'prop_indexed, -}
135
136 -- Mapping
137 'prop_map, 'prop_imap, 'prop_concatMap,
138
139 -- Monadic mapping
140 {- 'prop_mapM, 'prop_mapM_, 'prop_forM, 'prop_forM_, -}
141
142 -- Zipping
143 'prop_zipWith, 'prop_zipWith3, {- ... -}
144 'prop_izipWith, 'prop_izipWith3, {- ... -}
145 {- 'prop_zip, ... -}
146
147 -- Monadic zipping
148 {- 'prop_zipWithM, 'prop_zipWithM_, -}
149
150 -- Unzipping
151 {- 'prop_unzip, ... -}
152
153 -- Filtering
154 'prop_filter, 'prop_ifilter, {- prop_filterM, -}
155 'prop_takeWhile, 'prop_dropWhile,
156
157 -- Paritioning
158 'prop_partition, {- 'prop_unstablePartition, -}
159 'prop_span, 'prop_break,
160
161 -- Searching
162 'prop_elem, 'prop_notElem,
163 'prop_find, 'prop_findIndex, 'prop_findIndices,
164 'prop_elemIndex, 'prop_elemIndices,
165
166 -- Folding
167 'prop_foldl, 'prop_foldl1, 'prop_foldl', 'prop_foldl1',
168 'prop_foldr, 'prop_foldr1, 'prop_foldr', 'prop_foldr1',
169 'prop_ifoldl, 'prop_ifoldl', 'prop_ifoldr, 'prop_ifoldr',
170
171 -- Specialised folds
172 'prop_all, 'prop_any,
173 {- ... -}
174
175 -- Monadic folds
176 {- ... -}
177
178 -- Monadic sequencing
179 {- ... -}
180
181 -- Scans
182 'prop_prescanl, 'prop_prescanl',
183 'prop_postscanl, 'prop_postscanl',
184 'prop_scanl, 'prop_scanl', 'prop_scanl1, 'prop_scanl1',
185
186 'prop_prescanr, 'prop_prescanr',
187 'prop_postscanr, 'prop_postscanr',
188 'prop_scanr, 'prop_scanr', 'prop_scanr1, 'prop_scanr1'
189 ])
190 where
191 -- Prelude
192 prop_eq :: P (v a -> v a -> Bool) = (==) `eq` (==)
193
194 prop_length :: P (v a -> Int) = V.length `eq` length
195 prop_null :: P (v a -> Bool) = V.null `eq` null
196
197 prop_empty :: P (v a) = V.empty `eq` []
198 prop_singleton :: P (a -> v a) = V.singleton `eq` singleton
199 prop_replicate :: P (Int -> a -> v a)
200 = (\n _ -> n < 1000) ===> V.replicate `eq` replicate
201 prop_cons :: P (a -> v a -> v a) = V.cons `eq` (:)
202 prop_snoc :: P (v a -> a -> v a) = V.snoc `eq` snoc
203 prop_append :: P (v a -> v a -> v a) = (V.++) `eq` (++)
204 prop_force :: P (v a -> v a) = V.force `eq` id
205 prop_generate :: P (Int -> (Int -> a) -> v a)
206 = (\n _ -> n < 1000) ===> V.generate `eq` generate
207
208 prop_head :: P (v a -> a) = not . V.null ===> V.head `eq` head
209 prop_last :: P (v a -> a) = not . V.null ===> V.last `eq` last
210 prop_index = \xs ->
211 not (V.null xs) ==>
212 forAll (choose (0, V.length xs-1)) $ \i ->
213 unP prop xs i
214 where
215 prop :: P (v a -> Int -> a) = (V.!) `eq` (!!)
216 prop_unsafeHead :: P (v a -> a) = not . V.null ===> V.unsafeHead `eq` head
217 prop_unsafeLast :: P (v a -> a) = not . V.null ===> V.unsafeLast `eq` last
218 prop_unsafeIndex = \xs ->
219 not (V.null xs) ==>
220 forAll (choose (0, V.length xs-1)) $ \i ->
221 unP prop xs i
222 where
223 prop :: P (v a -> Int -> a) = V.unsafeIndex `eq` (!!)
224
225 prop_slice = \xs ->
226 forAll (choose (0, V.length xs)) $ \i ->
227 forAll (choose (0, V.length xs - i)) $ \n ->
228 unP prop i n xs
229 where
230 prop :: P (Int -> Int -> v a -> v a) = V.slice `eq` slice
231
232 prop_tail :: P (v a -> v a) = not . V.null ===> V.tail `eq` tail
233 prop_init :: P (v a -> v a) = not . V.null ===> V.init `eq` init
234 prop_take :: P (Int -> v a -> v a) = V.take `eq` take
235 prop_drop :: P (Int -> v a -> v a) = V.drop `eq` drop
236
237 prop_accum = \f xs ->
238 forAll (index_value_pairs (V.length xs)) $ \ps ->
239 unP prop f xs ps
240 where
241 prop :: P ((a -> a -> a) -> v a -> [(Int,a)] -> v a)
242 = V.accum `eq` accum
243
244 prop_upd = \xs ->
245 forAll (index_value_pairs (V.length xs)) $ \ps ->
246 unP prop xs ps
247 where
248 prop :: P (v a -> [(Int,a)] -> v a) = (V.//) `eq` (//)
249
250 prop_backpermute = \xs ->
251 forAll (indices (V.length xs)) $ \is ->
252 unP prop xs (V.fromList is)
253 where
254 prop :: P (v a -> v Int -> v a) = V.backpermute `eq` backpermute
255
256 prop_reverse :: P (v a -> v a) = V.reverse `eq` reverse
257
258 prop_map :: P ((a -> a) -> v a -> v a) = V.map `eq` map
259 prop_zipWith :: P ((a -> a -> a) -> v a -> v a -> v a) = V.zipWith `eq` zipWith
260 prop_zipWith3 :: P ((a -> a -> a -> a) -> v a -> v a -> v a -> v a)
261 = V.zipWith3 `eq` zipWith3
262 prop_imap :: P ((Int -> a -> a) -> v a -> v a) = V.imap `eq` imap
263 prop_izipWith :: P ((Int -> a -> a -> a) -> v a -> v a -> v a) = V.izipWith `eq` izipWith
264 prop_izipWith3 :: P ((Int -> a -> a -> a -> a) -> v a -> v a -> v a -> v a)
265 = V.izipWith3 `eq` izipWith3
266
267 prop_filter :: P ((a -> Bool) -> v a -> v a) = V.filter `eq` filter
268 prop_ifilter :: P ((Int -> a -> Bool) -> v a -> v a) = V.ifilter `eq` ifilter
269 prop_takeWhile :: P ((a -> Bool) -> v a -> v a) = V.takeWhile `eq` takeWhile
270 prop_dropWhile :: P ((a -> Bool) -> v a -> v a) = V.dropWhile `eq` dropWhile
271 prop_partition :: P ((a -> Bool) -> v a -> (v a, v a))
272 = V.partition `eq` partition
273 prop_span :: P ((a -> Bool) -> v a -> (v a, v a)) = V.span `eq` span
274 prop_break :: P ((a -> Bool) -> v a -> (v a, v a)) = V.break `eq` break
275
276 prop_elem :: P (a -> v a -> Bool) = V.elem `eq` elem
277 prop_notElem :: P (a -> v a -> Bool) = V.notElem `eq` notElem
278 prop_find :: P ((a -> Bool) -> v a -> Maybe a) = V.find `eq` find
279 prop_findIndex :: P ((a -> Bool) -> v a -> Maybe Int)
280 = V.findIndex `eq` findIndex
281 prop_findIndices :: P ((a -> Bool) -> v a -> v Int)
282 = V.findIndices `eq` findIndices
283 prop_elemIndex :: P (a -> v a -> Maybe Int) = V.elemIndex `eq` elemIndex
284 prop_elemIndices :: P (a -> v a -> v Int) = V.elemIndices `eq` elemIndices
285
286 prop_foldl :: P ((a -> a -> a) -> a -> v a -> a) = V.foldl `eq` foldl
287 prop_foldl1 :: P ((a -> a -> a) -> v a -> a) = notNull2 ===>
288 V.foldl1 `eq` foldl1
289 prop_foldl' :: P ((a -> a -> a) -> a -> v a -> a) = V.foldl' `eq` foldl'
290 prop_foldl1' :: P ((a -> a -> a) -> v a -> a) = notNull2 ===>
291 V.foldl1' `eq` foldl1'
292 prop_foldr :: P ((a -> a -> a) -> a -> v a -> a) = V.foldr `eq` foldr
293 prop_foldr1 :: P ((a -> a -> a) -> v a -> a) = notNull2 ===>
294 V.foldr1 `eq` foldr1
295 prop_foldr' :: P ((a -> a -> a) -> a -> v a -> a) = V.foldr' `eq` foldr
296 prop_foldr1' :: P ((a -> a -> a) -> v a -> a) = notNull2 ===>
297 V.foldr1' `eq` foldr1
298 prop_ifoldl :: P ((a -> Int -> a -> a) -> a -> v a -> a)
299 = V.ifoldl `eq` ifoldl
300 prop_ifoldl' :: P ((a -> Int -> a -> a) -> a -> v a -> a)
301 = V.ifoldl' `eq` ifoldl
302 prop_ifoldr :: P ((Int -> a -> a -> a) -> a -> v a -> a)
303 = V.ifoldr `eq` ifoldr
304 prop_ifoldr' :: P ((Int -> a -> a -> a) -> a -> v a -> a)
305 = V.ifoldr' `eq` ifoldr
306
307 prop_all :: P ((a -> Bool) -> v a -> Bool) = V.all `eq` all
308 prop_any :: P ((a -> Bool) -> v a -> Bool) = V.any `eq` any
309
310 prop_prescanl :: P ((a -> a -> a) -> a -> v a -> v a)
311 = V.prescanl `eq` prescanl
312 prop_prescanl' :: P ((a -> a -> a) -> a -> v a -> v a)
313 = V.prescanl' `eq` prescanl
314 prop_postscanl :: P ((a -> a -> a) -> a -> v a -> v a)
315 = V.postscanl `eq` postscanl
316 prop_postscanl' :: P ((a -> a -> a) -> a -> v a -> v a)
317 = V.postscanl' `eq` postscanl
318 prop_scanl :: P ((a -> a -> a) -> a -> v a -> v a)
319 = V.scanl `eq` scanl
320 prop_scanl' :: P ((a -> a -> a) -> a -> v a -> v a)
321 = V.scanl' `eq` scanl
322 prop_scanl1 :: P ((a -> a -> a) -> v a -> v a) = notNull2 ===>
323 V.scanl1 `eq` scanl1
324 prop_scanl1' :: P ((a -> a -> a) -> v a -> v a) = notNull2 ===>
325 V.scanl1' `eq` scanl1
326
327 prop_prescanr :: P ((a -> a -> a) -> a -> v a -> v a)
328 = V.prescanr `eq` prescanr
329 prop_prescanr' :: P ((a -> a -> a) -> a -> v a -> v a)
330 = V.prescanr' `eq` prescanr
331 prop_postscanr :: P ((a -> a -> a) -> a -> v a -> v a)
332 = V.postscanr `eq` postscanr
333 prop_postscanr' :: P ((a -> a -> a) -> a -> v a -> v a)
334 = V.postscanr' `eq` postscanr
335 prop_scanr :: P ((a -> a -> a) -> a -> v a -> v a)
336 = V.scanr `eq` scanr
337 prop_scanr' :: P ((a -> a -> a) -> a -> v a -> v a)
338 = V.scanr' `eq` scanr
339 prop_scanr1 :: P ((a -> a -> a) -> v a -> v a) = notNull2 ===>
340 V.scanr1 `eq` scanr1
341 prop_scanr1' :: P ((a -> a -> a) -> v a -> v a) = notNull2 ===>
342 V.scanr1' `eq` scanr1
343
344 prop_concatMap = forAll arbitrary $ \xs ->
345 forAll (sized (\n -> resize (n `div` V.length xs) arbitrary)) $ \f -> unP prop f xs
346 where
347 prop :: P ((a -> v a) -> v a -> v a) = V.concatMap `eq` concatMap
348
349 --prop_span = (V.span :: (a -> Bool) -> v a -> (v a, v a)) `eq2` span
350 --prop_break = (V.break :: (a -> Bool) -> v a -> (v a, v a)) `eq2` break
351 --prop_splitAt = (V.splitAt :: Int -> v a -> (v a, v a)) `eq2` splitAt
352 --prop_all = (V.all :: (a -> Bool) -> v a -> Bool) `eq2` all
353 --prop_any = (V.any :: (a -> Bool) -> v a -> Bool) `eq2` any
354
355 -- Data.List
356 --prop_findIndices = V.findIndices `eq2` (findIndices :: (a -> Bool) -> v a -> v Int)
357 --prop_isPrefixOf = V.isPrefixOf `eq2` (isPrefixOf :: v a -> v a -> Bool)
358 --prop_elemIndex = V.elemIndex `eq2` (elemIndex :: a -> v a -> Maybe Int)
359 --prop_elemIndices = V.elemIndices `eq2` (elemIndices :: a -> v a -> v Int)
360 --
361 --prop_mapAccumL = eq3
362 -- (V.mapAccumL :: (X -> W -> (X,W)) -> X -> B -> (X, B))
363 -- ( mapAccumL :: (X -> W -> (X,W)) -> X -> [W] -> (X, [W]))
364 --
365 --prop_mapAccumR = eq3
366 -- (V.mapAccumR :: (X -> W -> (X,W)) -> X -> B -> (X, B))
367 -- ( mapAccumR :: (X -> W -> (X,W)) -> X -> [W] -> (X, [W]))
368
369 -- Because the vectors are strict, we need to be totally sure that the unfold eventually terminates. This
370 -- is achieved by injecting our own bit of state into the unfold - the maximum number of unfolds allowed.
371 limitUnfolds f (theirs, ours) | ours >= 0
372 , Just (out, theirs') <- f theirs = Just (out, (theirs', ours - 1))
373 | otherwise = Nothing
374 prop_unfoldr :: P (Int -> (Int -> Maybe (a,Int)) -> Int -> v a)
375 = (\n f a -> V.unfoldr (limitUnfolds f) (a, n))
376 `eq` (\n f a -> unfoldr (limitUnfolds f) (a, n))
377
378 prop_constructN = \f -> forAll (choose (0,20)) $ \n -> unP prop n f
379 where
380 prop :: P (Int -> (v a -> a) -> v a) = V.constructN `eq` constructN []
381
382 constructN xs 0 _ = xs
383 constructN xs n f = constructN (xs ++ [f xs]) (n-1) f
384
385 prop_constructrN = \f -> forAll (choose (0,20)) $ \n -> unP prop n f
386 where
387 prop :: P (Int -> (v a -> a) -> v a) = V.constructrN `eq` constructrN []
388
389 constructrN xs 0 _ = xs
390 constructrN xs n f = constructrN (f xs : xs) (n-1) f
391
392 testTuplyFunctions:: forall a v. (COMMON_CONTEXT(a, v), VECTOR_CONTEXT((a, a), v), VECTOR_CONTEXT((a, a, a), v)) => v a -> [Test]
393 testTuplyFunctions _ = $(testProperties ['prop_zip, 'prop_zip3, 'prop_unzip, 'prop_unzip3])
394 where
395 prop_zip :: P (v a -> v a -> v (a, a)) = V.zip `eq` zip
396 prop_zip3 :: P (v a -> v a -> v a -> v (a, a, a)) = V.zip3 `eq` zip3
397 prop_unzip :: P (v (a, a) -> (v a, v a)) = V.unzip `eq` unzip
398 prop_unzip3 :: P (v (a, a, a) -> (v a, v a, v a)) = V.unzip3 `eq` unzip3
399
400 testOrdFunctions :: forall a v. (COMMON_CONTEXT(a, v), Ord a, Ord (v a)) => v a -> [Test]
401 testOrdFunctions _ = $(testProperties
402 ['prop_compare,
403 'prop_maximum, 'prop_minimum,
404 'prop_minIndex, 'prop_maxIndex ])
405 where
406 prop_compare :: P (v a -> v a -> Ordering) = compare `eq` compare
407 prop_maximum :: P (v a -> a) = not . V.null ===> V.maximum `eq` maximum
408 prop_minimum :: P (v a -> a) = not . V.null ===> V.minimum `eq` minimum
409 prop_minIndex :: P (v a -> Int) = not . V.null ===> V.minIndex `eq` minIndex
410 prop_maxIndex :: P (v a -> Int) = not . V.null ===> V.maxIndex `eq` maxIndex
411
412 testEnumFunctions :: forall a v. (COMMON_CONTEXT(a, v), Enum a, Ord a, Num a, Random a) => v a -> [Test]
413 testEnumFunctions _ = $(testProperties
414 [ 'prop_enumFromN, 'prop_enumFromThenN,
415 'prop_enumFromTo, 'prop_enumFromThenTo])
416 where
417 prop_enumFromN :: P (a -> Int -> v a)
418 = (\_ n -> n < 1000)
419 ===> V.enumFromN `eq` (\x n -> take n $ scanl (+) x $ repeat 1)
420
421 prop_enumFromThenN :: P (a -> a -> Int -> v a)
422 = (\_ _ n -> n < 1000)
423 ===> V.enumFromStepN `eq` (\x y n -> take n $ scanl (+) x $ repeat y)
424
425 prop_enumFromTo = \m ->
426 forAll (choose (-2,100)) $ \n ->
427 unP prop m (m+n)
428 where
429 prop :: P (a -> a -> v a) = V.enumFromTo `eq` enumFromTo
430
431 prop_enumFromThenTo = \i j ->
432 j /= i ==>
433 forAll (choose (ks i j)) $ \k ->
434 unP prop i j k
435 where
436 prop :: P (a -> a -> a -> v a) = V.enumFromThenTo `eq` enumFromThenTo
437
438 ks i j | j < i = (i-d*100, i+d*2)
439 | otherwise = (i-d*2, i+d*100)
440 where
441 d = abs (j-i)
442
443 testBoolFunctions :: forall v. (COMMON_CONTEXT(Bool, v)) => v Bool -> [Test]
444 testBoolFunctions _ = $(testProperties ['prop_and, 'prop_or])
445 where
446 prop_and :: P (v Bool -> Bool) = V.and `eq` and
447 prop_or :: P (v Bool -> Bool) = V.or `eq` or
448
449 testNumFunctions :: forall a v. (COMMON_CONTEXT(a, v), Num a) => v a -> [Test]
450 testNumFunctions _ = $(testProperties ['prop_sum, 'prop_product])
451 where
452 prop_sum :: P (v a -> a) = V.sum `eq` sum
453 prop_product :: P (v a -> a) = V.product `eq` product
454
455 testNestedVectorFunctions :: forall a v. (COMMON_CONTEXT(a, v)) => v a -> [Test]
456 testNestedVectorFunctions _ = $(testProperties [])
457 where
458 -- Prelude
459 --prop_concat = (V.concat :: [v a] -> v a) `eq1` concat
460
461 -- Data.List
462 --prop_transpose = V.transpose `eq1` (transpose :: [v a] -> [v a])
463 --prop_group = V.group `eq1` (group :: v a -> [v a])
464 --prop_inits = V.inits `eq1` (inits :: v a -> [v a])
465 --prop_tails = V.tails `eq1` (tails :: v a -> [v a])
466
467
468 testGeneralBoxedVector dummy = concatMap ($ dummy) [
469 testSanity,
470 testPolymorphicFunctions,
471 testOrdFunctions,
472 testTuplyFunctions,
473 testNestedVectorFunctions
474 ]
475
476 testBoolBoxedVector dummy = concatMap ($ dummy)
477 [
478 testGeneralBoxedVector
479 , testBoolFunctions
480 ]
481
482 testNumericBoxedVector dummy = concatMap ($ dummy)
483 [
484 testGeneralBoxedVector
485 , testNumFunctions
486 , testEnumFunctions
487 ]
488
489
490
491 testGeneralPrimitiveVector dummy = concatMap ($ dummy) [
492 testSanity,
493 testPolymorphicFunctions,
494 testOrdFunctions
495 ]
496
497 testBoolPrimitiveVector dummy = concatMap ($ dummy)
498 [
499 testGeneralPrimitiveVector
500 , testBoolFunctions
501 ]
502
503 testNumericPrimitiveVector dummy = concatMap ($ dummy)
504 [
505 testGeneralPrimitiveVector
506 , testNumFunctions
507 , testEnumFunctions
508 ]
509
510
511
512 testGeneralStorableVector dummy = concatMap ($ dummy) [
513 testSanity,
514 testPolymorphicFunctions,
515 testOrdFunctions
516 ]
517
518 testNumericStorableVector dummy = concatMap ($ dummy)
519 [
520 testGeneralStorableVector
521 , testNumFunctions
522 , testEnumFunctions
523 ]
524
525
526
527 testGeneralUnboxedVector dummy = concatMap ($ dummy) [
528 testSanity,
529 testPolymorphicFunctions,
530 testOrdFunctions
531 ]
532
533 testUnitUnboxedVector dummy = concatMap ($ dummy)
534 [
535 testGeneralUnboxedVector
536 ]
537
538 testBoolUnboxedVector dummy = concatMap ($ dummy)
539 [
540 testGeneralUnboxedVector
541 , testBoolFunctions
542 ]
543
544 testNumericUnboxedVector dummy = concatMap ($ dummy)
545 [
546 testGeneralUnboxedVector
547 , testNumFunctions
548 , testEnumFunctions
549 ]
550
551 testTupleUnboxedVector dummy = concatMap ($ dummy)
552 [
553 testGeneralUnboxedVector
554 ]
555
556 tests = [
557 testGroup "Data.Vector.Vector (Bool)" (testBoolBoxedVector (undefined :: Data.Vector.Vector Bool)),
558 testGroup "Data.Vector.Vector (Int)" (testNumericBoxedVector (undefined :: Data.Vector.Vector Int)),
559
560 testGroup "Data.Vector.Primitive.Vector (Int)" (testNumericPrimitiveVector (undefined :: Data.Vector.Primitive.Vector Int)),
561 testGroup "Data.Vector.Primitive.Vector (Double)" (testNumericPrimitiveVector (undefined :: Data.Vector.Primitive.Vector Double)),
562
563 testGroup "Data.Vector.Storable.Vector (Int)" (testNumericStorableVector (undefined :: Data.Vector.Storable.Vector Int)),
564 testGroup "Data.Vector.Storable.Vector (Double)" (testNumericStorableVector (undefined :: Data.Vector.Storable.Vector Double)),
565
566 testGroup "Data.Vector.Unboxed.Vector ()" (testUnitUnboxedVector (undefined :: Data.Vector.Unboxed.Vector ())),
567 testGroup "Data.Vector.Unboxed.Vector (Int)" (testNumericUnboxedVector (undefined :: Data.Vector.Unboxed.Vector Int)),
568 testGroup "Data.Vector.Unboxed.Vector (Double)" (testNumericUnboxedVector (undefined :: Data.Vector.Unboxed.Vector Double)),
569 testGroup "Data.Vector.Unboxed.Vector (Int,Bool)" (testTupleUnboxedVector (undefined :: Data.Vector.Unboxed.Vector (Int,Bool))),
570 testGroup "Data.Vector.Unboxed.Vector (Int,Bool,Int)" (testTupleUnboxedVector (undefined :: Data.Vector.Unboxed.Vector (Int,Bool,Int)))
571
572 ]
573