Skip to content

Commit acd9a37

Browse files
committed
Move test to Prelude
1 parent 91e0bd4 commit acd9a37

File tree

4 files changed

+25
-69
lines changed

4 files changed

+25
-69
lines changed

streamly.cabal

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,7 @@ extra-source-files:
101101
test/Streamly/Test/Data/Array/Prim/Pinned.hs
102102
test/Streamly/Test/Data/Array/Foreign.hs
103103
test/Streamly/Test/Data/Array/Stream/Foreign.hs
104-
test/Streamly/Test/Data/Parser/ParserD.hs
105-
test/Streamly/Test/Data/Stream/Top.hs
104+
test/Streamly/Test/Data/Parser/ParserD.hs
106105
test/Streamly/Test/FileSystem/Event.hs
107106
test/Streamly/Test/FileSystem/Event/Common.hs
108107
test/Streamly/Test/FileSystem/Event/Darwin.hs

test/Streamly/Test/Data/Stream/Top.hs

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

test/Streamly/Test/Prelude/Top.hs

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
module Main (main) where
1+
module Main (main)
2+
where
23

3-
import Data.List (sort)
4+
import Data.List (intersect, sort)
45
import Test.QuickCheck
56
( Gen
67
, Property
@@ -65,10 +66,26 @@ joinInnerMap =
6566
]
6667
assert (v1 == v2)
6768

68-
-------------------------------------------------------------------------------
69-
-- Main
70-
-------------------------------------------------------------------------------
69+
intersectBySorted :: Property
70+
intersectBySorted =
71+
forAll (listOf (chooseInt (min_value, max_value))) $ \ls0 ->
72+
forAll (listOf (chooseInt (min_value, max_value))) $ \ls1 ->
73+
monadicIO $ action (sort ls0) (sort ls1)
74+
75+
where
7176

77+
action ls0 ls1 = do
78+
v1 <-
79+
run
80+
$ S.toList
81+
$ Top.intersectBySorted
82+
compare
83+
(S.fromList ls0)
84+
(S.fromList ls1)
85+
let v2 = intersect ls0 ls1
86+
assert (v1 == sort v2)
87+
88+
-------------------------------------------------------------------------------
7289
moduleName :: String
7390
moduleName = "Prelude.Top"
7491

@@ -79,3 +96,5 @@ main = hspec $ do
7996

8097
prop "joinInner" Main.joinInner
8198
prop "joinInnerMap" Main.joinInnerMap
99+
-- intersect
100+
prop "intersectBySorted" Main.intersectBySorted

test/streamly-tests.cabal

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -434,8 +434,3 @@ test-suite version-bounds
434434
import: test-options
435435
type: exitcode-stdio-1.0
436436
main-is: version-bounds.hs
437-
438-
test-suite Data.Stream.Top
439-
import: test-options
440-
type: exitcode-stdio-1.0
441-
main-is: Streamly/Test/Data/Stream/Top.hs

0 commit comments

Comments
 (0)