@@ -1,12 +1,12 @@
11-- |
2−-- Module : Streamly.Test.Data.Array.Foreign
2+-- Module : Streamly.Test.Data.Array.Unboxed
33-- Copyright : (c) 2019 Composewell technologies
44-- License : BSD-3-Clause
55-- Maintainer : streamly@composewell.com
66-- Stability : experimental
77-- Portability : GHC
88
9−module Streamly.Test.Data.Array.Foreign (main) where
9+module Streamly.Test.Data.Array.Unboxed (main) where
1010
1111#include "Streamly/Test/Data/Array/CommonImports.hs"
1212
@@ -27,7 +27,7 @@ import qualified Streamly.Internal.Data.Array.Stream.Foreign as AS
2727type Array = A.Array
2828
2929moduleName :: String
30−moduleName = "Data.Array.Foreign"
30+moduleName = "Data.Array.Unboxed"
3131
3232#include "Streamly/Test/Data/Array/Common.hs"
3333
@@ -43,7 +43,7 @@ testFromList =
4343 forAll (vectorOf len (arbitrary :: Gen Int)) $ \list ->
4444 monadicIO $ do
4545 let arr = A.fromList list
46− xs <- run $ S.toList $ (S.unfold A.read) arr
46+ xs <- run $ S.toList $ S.unfold A.read arr
4747 assert (xs == list)
4848
4949testLengthFromStream :: Property
@@ -133,7 +133,7 @@ concatArrayW8 =
133133
134134unsafeSlice :: Int -> Int -> [Int] -> Bool
135135unsafeSlice i n list =
136− let lst = take n $ drop i $ list
136+ let lst = take n $ drop i list
137137 arr = A.toList $ A.getSliceUnsafe i n $ A.fromList list
138138 in arr == lst
139139
@@ -190,7 +190,7 @@ testByteLengthWithMA _ = do
190190 let arrW8 = MA.castUnsafe arrA :: MA.Array Word8
191191 MA.byteLength arrA `shouldBe` MA.length arrW8
192192
193−testBreakOn :: [Word8] -> Word8 -> [Word8] -> (Maybe [Word8]) -> IO ()
193+testBreakOn :: [Word8] -> Word8 -> [Word8] -> Maybe [Word8] -> IO ()
194194testBreakOn inp sep bef aft = do
195195 (bef_, aft_) <- A.breakOn sep (A.fromList inp)
196196 bef_ `shouldBe` A.fromList bef
@@ -207,7 +207,7 @@ testFromToList inp = A.toList (A.fromList inp) `shouldBe` inp
207207testUnsafeIndxedFromList :: [Char] -> IO ()
208208testUnsafeIndxedFromList inp =
209209 let arr = A.fromList inp
210− in fmap (flip A.unsafeIndex arr) [0 .. (length inp - 1)] `shouldBe` inp
210+ in fmap (`A.unsafeIndex` arr) [0 .. (length inp - 1)] `shouldBe` inp
211211
212212testAsPtrUnsafeMA :: IO ()
213213testAsPtrUnsafeMA = do
@@ -257,7 +257,7 @@ main =
257257 prop "fromList" testFromList
258258 prop "foldMany with writeNUnsafe concats to original"
259259 (foldManyWith (\n -> Fold.take n (A.writeNUnsafe n)))
260− prop "AS.concat . (A.fromList . (:[]) <$>) === id" $ concatArrayW8
260+ prop "AS.concat . (A.fromList . (:[]) <$>) === id" concatArrayW8
261261 describe "unsafeSlice" $ do
262262 it "partial" $ unsafeSlice 2 4 [1..10]
263263 it "none" $ unsafeSlice 10 0 [1..10]
@@ -267,7 +267,7 @@ main =
267267 it "middle" (unsafeWriteIndex [1..10] 5 0 `shouldReturn` True)
268268 it "last" (unsafeWriteIndex [1..10] 9 0 `shouldReturn` True)
269269 describe "Fold" $ do
270− prop "writeLastN : 0 <= n <= len" $ testLastN
270+ prop "writeLastN : 0 <= n <= len" testLastN
271271 describe "writeLastN boundary conditions" $ do
272272 it "writeLastN -1" (testLastN_LN 10 (-1) `shouldReturn` True)
273273 it "writeLastN 0" (testLastN_LN 10 0 `shouldReturn` True)