Skip to content

Commit a0da6ad

Browse files
committed
Add test for concat'
1 parent ec5254f commit a0da6ad

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

bower.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"devDependencies": {
1616
"purescript-assert": "~0.1.1",
17-
"purescript-console": "~0.1.1"
17+
"purescript-console": "~0.1.1",
18+
"purescript-foldable-traversable": "~0.4.1"
1819
}
1920
}

test/Main.purs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
module Test.Main where
22

33
import Prelude
4+
import Data.Traversable (traverse)
45
import Control.Monad.Eff
56
import Control.Monad.Eff.Console (log, CONSOLE())
67
import Test.Assert
@@ -38,6 +39,9 @@ main = do
3839
log "fill"
3940
testFill
4041

42+
log "concat'"
43+
testConcat'
44+
4145
testReadWrite :: Test
4246
testReadWrite = do
4347
buf <- create 1
@@ -109,6 +113,14 @@ testFill = do
109113

110114
assertEq [1,1,42,42,1] out
111115

116+
testConcat' :: Test
117+
testConcat' = do
118+
bufs <- traverse fromArray $ map (\x -> [x, x+1, x+2]) [0,3,6,9,12]
119+
buf <- concat' bufs 10
120+
out <- toArray buf
121+
122+
assertEq [0,1,2,3,4,5,6,7,8,9] out
123+
112124
assertEq :: forall a. (Eq a, Show a) => a -> a -> Test
113125
assertEq x y =
114126
if x == y

0 commit comments

Comments
 (0)