on master help sign in
Move unboxed array tests under test-core flag (#1797)
64e471bRanjeet Ranjan
test/Streamly/Test/Data/Array.hs−1
@@ -11,7 +11,6 @@ module Streamly.Test.Data.Array (main) where
11#include "Streamly/Test/Data/Array/CommonImports.hs"
11#include "Streamly/Test/Data/Array/CommonImports.hs"
12
12
13import qualified Streamly.Internal.Data.Array as A
13import qualified Streamly.Internal.Data.Array as A
14−import qualified Streamly.Internal.Data.Fold as Fold
15
14
16type Array = A.Array
15type Array = A.Array
17
16
test/Streamly/Test/Data/Array/Common.hs+3−3
@@ -47,7 +47,7 @@ genericTestFromTo arrFold arrUnfold listEq =
47 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
47 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
48 monadicIO $ do
48 monadicIO $ do
49 arr <- run $ arrFold len $ S.fromList list
49 arr <- run $ arrFold len $ S.fromList list
50− xs <- run $ S.toList $ arrUnfold arr
50+ xs <- run $ S.fold Fold.toList $ arrUnfold arr
51 assert (listEq xs list)
51 assert (listEq xs list)
52
52
53
53
@@ -79,7 +79,7 @@ testFromListN =
79 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
79 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
80 monadicIO $ do
80 monadicIO $ do
81 let arr = A.fromListN n list
81 let arr = A.fromListN n list
82− xs <- run $ S.toList $ S.unfold A.read arr
82+ xs <- run $ S.fold Fold.toList $ S.unfold A.read arr
83 listEquals (==) xs (take n list)
83 listEquals (==) xs (take n list)
84
84
85foldManyWith :: (Int -> Fold IO Int (Array Int)) -> Property
85foldManyWith :: (Int -> Fold IO Int (Array Int)) -> Property
@@ -88,7 +88,7 @@ foldManyWith f =
88 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
88 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
89 monadicIO $ do
89 monadicIO $ do
90 xs <- run
90 xs <- run
91− $ S.toList
91+ $ S.fold Fold.toList
92 $ S.unfoldMany A.read
92 $ S.unfoldMany A.read
93 $ S.foldMany (f 240)
93 $ S.foldMany (f 240)
94 $ S.fromList list
94 $ S.fromList list
test/Streamly/Test/Data/Array/CommonImports.hs+1
@@ -10,4 +10,5 @@ import Streamly.Data.Fold (Fold)
10import Streamly.Internal.Data.Stream (Stream)
10import Streamly.Internal.Data.Stream (Stream)
11import Streamly.Test.Common (listEquals)
11import Streamly.Test.Common (listEquals)
12
12
13+import qualified Streamly.Data.Fold as Fold
13import qualified Streamly.Prelude as S
14import qualified Streamly.Prelude as S
test/Streamly/Test/Data/Array/Unboxed.hs+12−5
@@ -8,20 +8,27 @@
8
8
9module Streamly.Test.Data.Array.Unboxed (main) where
9module Streamly.Test.Data.Array.Unboxed (main) where
10
10
11−#include "Streamly/Test/Data/Array/CommonImports.hs"
12−
13import Data.Char (isLower)
11import Data.Char (isLower)
14import Data.List (sort)
12import Data.List (sort)
15import Data.Word(Word8)
13import Data.Word(Word8)
16import Foreign.Storable (peek)
14import Foreign.Storable (peek)
17−import Streamly.Internal.Data.Unboxed (Unboxed)
18−import Test.QuickCheck (chooseInt, listOf)
19import GHC.Ptr (plusPtr)
15import GHC.Ptr (plusPtr)
16+import Streamly.Data.Fold (Fold)
17+import Streamly.Internal.Data.Stream (Stream)
18+import Streamly.Internal.Data.Unboxed (Unboxed, sizeOf)
19+import Streamly.Test.Common (listEquals)
20
20
21+import qualified Streamly.Data.Fold as Fold
21import qualified Streamly.Internal.Data.Array.Unboxed as A
22import qualified Streamly.Internal.Data.Array.Unboxed as A
22import qualified Streamly.Internal.Data.Array.Unboxed.Type as A
23import qualified Streamly.Internal.Data.Array.Unboxed.Type as A
23import qualified Streamly.Internal.Data.Array.Unboxed.Mut.Type as MA
24import qualified Streamly.Internal.Data.Array.Unboxed.Mut.Type as MA
24−import qualified Streamly.Internal.Data.Fold as Fold
25+import qualified Streamly.Internal.Data.Stream as S
26+
27+import Test.Hspec as H
28+import Test.Hspec.QuickCheck
29+import Test.QuickCheck (Property, chooseInt, listOf
30+ , forAll, Gen, vectorOf, arbitrary, choose)
31+import Test.QuickCheck.Monadic (monadicIO, assert, run)
25
32
26type Array = A.Array
33type Array = A.Array
27
34
test/streamly-tests.cabal−2
@@ -238,8 +238,6 @@ test-suite Data.Array.Unboxed
238 type: exitcode-stdio-1.0
238 type: exitcode-stdio-1.0
239 main-is: Streamly/Test/Data/Array/Unboxed.hs
239 main-is: Streamly/Test/Data/Array/Unboxed.hs
240 ghc-options: -main-is Streamly.Test.Data.Array.Unboxed.main
240 ghc-options: -main-is Streamly.Test.Data.Array.Unboxed.main
241− if flag(test-core)
242− buildable: False
243
241
244test-suite Data.Array.Unboxed.Mut
242test-suite Data.Array.Unboxed.Mut
245 import: test-options
243 import: test-options