-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tests.hs
40 lines (34 loc) · 1.24 KB
/
Tests.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
module Tests where
import Test.QuickCheck
import Data.Vector.Primitive
import qualified Data.List as L
import qualified Data.Vector.Sort.Quick as Q
import qualified Data.Vector.Sort.Parallel.Quick as PQ
import qualified Data.Vector.Sort.Merge as M
import qualified Data.Vector.Sort.Parallel.Merge as PM
import qualified Data.Vector.Sort.Insertion as I
import qualified Data.Vector.Sort.Insertion.Binary as IB
import qualified Data.Vector.Sort.Tim as T
import qualified Data.Vector.Sort.Parallel.Tim as PT
import qualified Data.Vector.Sort.Heap.Binary as H
import qualified Data.Vector.Sort.Radix as R
import qualified Data.Vector.Sort.Intro as Intro
import qualified Data.Vector.Sort.Parallel.Tim as PT
import qualified Data.Vector.Sort.Parallel.Radix as PR
implementations :: [(String, Vector Int -> Vector Int)]
implementations = [
("insertion", I.sort),
("insertion-binary", IB.sort),
("quick", Q.sort),
("p-quick", PQ.sort),
("merge", M.sort),
("p-merge", PM.sort),
("tim", T.sort),
("radix", R.sort),
("heap", H.sort),
("intro", Intro.sort),
("p-radix", PR.sort),
("p-tim", PT.sort)]
main = quickCheck (\ xs -> conjoin
[printTestCase sortImpl $ L.sort xs == toList (theSort (fromList xs))
| (sortImpl, theSort) <- implementations])