on master help sign in
Move unboxed array tests under test-core flag (#1797)
commit64e471b91ab856fdbee9872d0d77cd868fd8c5fb authorRanjeet Ranjan <ranjeetr@composewell.com> dateMon 22 Aug 2022, 22:01 (4 years ago) parente576de8
5 files changed+16−11
test/Streamly/Test/Data/Array.hs−1 test/Streamly/Test/Data/Array/Common.hs+3−3 test/Streamly/Test/Data/Array/CommonImports.hs+1 test/Streamly/Test/Data/Array/Unboxed.hs+12−5 test/streamly-tests.cabal−2
test/Streamly/Test/Data/Array.hs−1
@@ -11,7 +11,6 @@ module Streamly.Test.Data.Array (main) where
1111#include "Streamly/Test/Data/Array/CommonImports.hs"
1212
1313import qualified Streamly.Internal.Data.Array as A
14−import qualified Streamly.Internal.Data.Fold as Fold
1514
1615type Array = A.Array
1716
test/Streamly/Test/Data/Array/Common.hs+3−3
@@ -47,7 +47,7 @@ genericTestFromTo arrFold arrUnfold listEq =
4747 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
4848 monadicIO $ do
4949 arr <- run $ arrFold len $ S.fromList list
50− xs <- run $ S.toList $ arrUnfold arr
50+ xs <- run $ S.fold Fold.toList $ arrUnfold arr
5151 assert (listEq xs list)
5252
5353
@@ -79,7 +79,7 @@ testFromListN =
7979 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
8080 monadicIO $ do
8181 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
8383 listEquals (==) xs (take n list)
8484
8585foldManyWith :: (Int -> Fold IO Int (Array Int)) -> Property
@@ -88,7 +88,7 @@ foldManyWith f =
8888 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
8989 monadicIO $ do
9090 xs <- run
91− $ S.toList
91+ $ S.fold Fold.toList
9292 $ S.unfoldMany A.read
9393 $ S.foldMany (f 240)
9494 $ S.fromList list
test/Streamly/Test/Data/Array/CommonImports.hs+1
@@ -10,4 +10,5 @@ import Streamly.Data.Fold (Fold)
1010import Streamly.Internal.Data.Stream (Stream)
1111import Streamly.Test.Common (listEquals)
1212
13+import qualified Streamly.Data.Fold as Fold
1314import qualified Streamly.Prelude as S
test/Streamly/Test/Data/Array/Unboxed.hs+12−5
@@ -8,20 +8,27 @@
88
99module Streamly.Test.Data.Array.Unboxed (main) where
1010
11−#include "Streamly/Test/Data/Array/CommonImports.hs"
12−
1311import Data.Char (isLower)
1412import Data.List (sort)
1513import Data.Word(Word8)
1614import Foreign.Storable (peek)
17−import Streamly.Internal.Data.Unboxed (Unboxed)
18−import Test.QuickCheck (chooseInt, listOf)
1915import 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)
2020
21+import qualified Streamly.Data.Fold as Fold
2122import qualified Streamly.Internal.Data.Array.Unboxed as A
2223import qualified Streamly.Internal.Data.Array.Unboxed.Type as A
2324import 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)
2532
2633type Array = A.Array
2734
test/streamly-tests.cabal−2
@@ -238,8 +238,6 @@ test-suite Data.Array.Unboxed
238238 type: exitcode-stdio-1.0
239239 main-is: Streamly/Test/Data/Array/Unboxed.hs
240240 ghc-options: -main-is Streamly.Test.Data.Array.Unboxed.main
241− if flag(test-core)
242− buildable: False
243241
244242test-suite Data.Array.Unboxed.Mut
245243 import: test-options