Skip to content

Commit f2221c6

Browse files
committed
Update tests
1 parent d098fd9 commit f2221c6

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/Main.purs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ main = do
3232
log "readString"
3333
testReadString
3434

35+
log "copy"
36+
testCopy
37+
38+
log "fill"
39+
testFill
40+
3541
testReadWrite :: Test
3642
testReadWrite = do
3743
buf <- create 1
@@ -84,6 +90,25 @@ testReadString = do
8490

8591
assertEq "world" strOut
8692

93+
testCopy :: Test
94+
testCopy = do
95+
buf1 <- fromArray [1,2,3,4,5]
96+
buf2 <- fromArray [10,9,8,7,6]
97+
98+
copied <- copy 0 3 buf1 2 buf2
99+
out <- toArray buf2
100+
101+
assertEq copied 3
102+
assertEq out [10,9,1,2,3]
103+
104+
testFill :: Test
105+
testFill = do
106+
buf <- fromArray [1,1,1,1,1]
107+
fill 42 2 4 buf
108+
out <- toArray buf
109+
110+
assertEq [1,1,42,42,1] out
111+
87112
assertEq :: forall a. (Eq a, Show a) => a -> a -> Test
88113
assertEq x y =
89114
if x == y

0 commit comments

Comments
 (0)