@@ -10,6 +10,7 @@ module Streamly.Test.Data.Array.Foreign (main) where
11#include "Streamly/Test/Data/Array/CommonImports.hs"
11#include "Streamly/Test/Data/Array/CommonImports.hs"
13+import Data.Char (isLower)
13import Data.Word(Word8)
14import Data.Word(Word8)
15import qualified Streamly.Internal.Data.Fold as Fold
16import qualified Streamly.Internal.Data.Fold as Fold
@@ -72,6 +73,48 @@ testLastN_LN len n = do
72 let l2 = lastN n list
73 let l2 = lastN n list
73 return $ l1 == l2
74 return $ l1 == l2
78+ dt <- MA.fromList "abcDEFgeh"
79+ dt' <- MA.strip isLower dt
83+testStripLeft :: IO Bool
85+ dt <- MA.fromList "abcDEF"
86+ dt' <- MA.strip isLower dt
90+testStripRight :: IO Bool
92+ dt <- MA.fromList "DEFgeh"
93+ dt' <- MA.strip isLower dt
97+testStripZero :: IO Bool
99+ dt <- MA.fromList "DEF"
100+ dt' <- MA.strip isLower dt
104+testStripEmpty :: IO Bool
106+ dt <- MA.fromList "abc"
107+ dt' <- MA.strip isLower dt
111+testStripNull :: IO Bool
113+ dt <- MA.fromList ""
114+ dt' <- MA.strip isLower dt
75-- Instead of hard coding 10000 here we can have maxStreamLength for operations
118-- Instead of hard coding 10000 here we can have maxStreamLength for operations
76-- that use stream of arrays.
119-- that use stream of arrays.
77concatArrayW8 :: Property
120concatArrayW8 :: Property
@@ -118,3 +161,10 @@ main =
118 it "writeLastN 0" (testLastN_LN 10 0 `shouldReturn` True)
161 it "writeLastN 0" (testLastN_LN 10 0 `shouldReturn` True)
119 it "writeLastN length" (testLastN_LN 10 10 `shouldReturn` True)
162 it "writeLastN length" (testLastN_LN 10 10 `shouldReturn` True)
120 it "writeLastN (length + 1)" (testLastN_LN 10 11 `shouldReturn` True)
163 it "writeLastN (length + 1)" (testLastN_LN 10 11 `shouldReturn` True)
164+ describe "Strip" $ do
165+ it "strip" (testStrip `shouldReturn` True)
166+ it "stripLeft" (testStripLeft `shouldReturn` True)
167+ it "stripRight" (testStripRight `shouldReturn` True)
168+ it "stripZero" (testStripZero `shouldReturn` True)
169+ it "stripEmpty" (testStripEmpty `shouldReturn` True)
170+ it "stripNull" (testStripNull `shouldReturn` True)