Skip to content

Commit 3923a5e

Browse files
committed
introduce internal lib "examples" and move test to "test-examples"
1 parent 2011cfc commit 3923a5e

File tree

8 files changed

+43
-37
lines changed

8 files changed

+43
-37
lines changed

examples/Simple/Quicksort.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
{-# LANGUAGE NoImplicitPrelude #-}
33

44
-- | This module implements quicksort with mutable arrays from linear-base
5-
module Simple.Quicksort (quickSort) where
5+
module Simple.Quicksort where
66

77
import Data.Array.Mutable.Linear (Array)
88
import qualified Data.Array.Mutable.Linear as Array

examples/Test/Generic.hs

Lines changed: 0 additions & 11 deletions
This file was deleted.

linear-base.cabal

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,23 @@ library
145145
vector >=0.12.2,
146146
primitive
147147

148+
library examples
149+
import: build-opts
150+
hs-source-dirs: examples
151+
exposed-modules:
152+
Foreign.List
153+
Foreign.Heap
154+
Simple.FileIO
155+
Simple.Pure
156+
Simple.Quicksort
157+
Simple.TopSort
158+
build-depends:
159+
base,
160+
linear-base,
161+
storable-tuple,
162+
vector,
163+
text
164+
148165
test-suite test
149166
import: build-opts
150167
import: rts-opts-multithread
@@ -158,6 +175,7 @@ test-suite test
158175
Test.Data.Mutable.HashMap
159176
Test.Data.Mutable.Set
160177
Test.Data.Polarized
178+
Test.Data.Functor.Linear
161179
Test.Data.V
162180
Test.Data.Replicator
163181
default-language: Haskell2010
@@ -171,38 +189,28 @@ test-suite test
171189
tasty,
172190
tasty-hedgehog >= 1.2,
173191
mmorph,
174-
vector
192+
vector,
193+
linear-generics
175194

176-
test-suite examples
195+
test-suite test-examples
177196
import: build-opts
178197
import: rts-opts-multithread
179198
type: exitcode-stdio-1.0
180199
main-is: Main.hs
181-
hs-source-dirs: examples
200+
hs-source-dirs: test-examples
182201
other-modules:
183202
Test.Foreign
184-
Test.Quicksort
185-
Test.Generic
186-
Foreign.List
187-
Foreign.Heap
188-
Simple.FileIO
189-
Simple.Pure
190-
Simple.Quicksort
191-
Simple.TopSort
192-
Generic.Traverse
203+
Test.Simple.Quicksort
193204
default-language: Haskell2010
194205
build-depends:
195206
base,
196207
linear-base,
197208
tasty,
198209
tasty-hedgehog,
199210
hedgehog,
200-
storable-tuple,
201-
vector,
202-
text,
203-
linear-generics
211+
examples
204212

205-
benchmark mutable-data
213+
benchmark bench
206214
import: build-opts
207215
import: rts-opts-monothread
208216
type: exitcode-stdio-1.0
@@ -224,4 +232,5 @@ benchmark mutable-data
224232
random-shuffle,
225233
tasty-bench >= 0.3,
226234
unordered-containers,
227-
MonadRandom
235+
MonadRandom,
236+
examples
Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
module Main where
22

33
import Test.Foreign (foreignGCTests)
4-
import Test.Generic (genericTests)
5-
import Test.Quicksort (quickSortTests)
4+
import Test.Simple.Quicksort (quickSortTests)
65
import Test.Tasty
76

87
main :: IO ()
@@ -13,6 +12,5 @@ allTests =
1312
testGroup
1413
"All tests"
1514
[ foreignGCTests,
16-
quickSortTests,
17-
genericTests
15+
quickSortTests
1816
]
File renamed without changes.

examples/Test/Quicksort.hs renamed to test-examples/Test/Simple/Quicksort.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{-# LANGUAGE OverloadedStrings #-}
22

3-
module Test.Quicksort (quickSortTests) where
3+
module Test.Simple.Quicksort (quickSortTests) where
44

55
import Data.List (sort)
66
import Hedgehog

test/Main.hs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import Test.Data.Mutable.HashMap (mutHMTests)
99
import Test.Data.Mutable.Set (mutSetTests)
1010
import Test.Data.Mutable.Vector (mutVecTests)
1111
import Test.Data.Polarized (polarizedArrayTests)
12+
import Test.Data.Functor.Linear (genericTests)
1213
import Test.Data.Replicator (replicatorInspectionTests)
1314
import Test.Data.V (vInspectionTests)
1415
import Test.Tasty
@@ -27,7 +28,8 @@ allTests =
2728
mutHMTests,
2829
mutSetTests,
2930
destArrayTests,
30-
polarizedArrayTests
31+
polarizedArrayTests,
32+
genericTests
3133
],
3234
testGroup
3335
"Inspection tests"

examples/Generic/Traverse.hs renamed to test/Test/Data/Functor/Linear.hs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
{-# LANGUAGE TypeFamilies #-}
1111
{-# LANGUAGE NoImplicitPrelude #-}
1212

13-
module Generic.Traverse (genericTraverseTests) where
13+
module Test.Data.Functor.Linear (genericTests) where
1414

1515
import Data.Functor.Linear (genericTraverse)
1616
import qualified Data.Functor.Linear as Data
@@ -32,6 +32,13 @@ instance Data.Functor Pair where
3232
instance Data.Traversable Pair where
3333
traverse = genericTraverse
3434

35+
genericTests :: TestTree
36+
genericTests =
37+
testGroup
38+
"Generic tests"
39+
[ genericTraverseTests
40+
]
41+
3542
genericTraverseTests :: TestTree
3643
genericTraverseTests =
3744
testGroup
@@ -50,3 +57,4 @@ propertyPairTest =
5057
(MkPair 3 4 :: Pair Int)
5158
)
5259
=== (Sum 2, (MkPair 6 8))
60+

0 commit comments

Comments
 (0)