Completed ByteIterator tests in ByteStringSpec
This commit is contained in:
parent
7231b48c05
commit
f01d5c619e
1 changed files with 22 additions and 0 deletions
|
|
@ -266,6 +266,16 @@ class ByteStringSpec extends WordSpec with MustMatchers with Checkers {
|
|||
}
|
||||
}
|
||||
|
||||
"calling take and drop" in {
|
||||
check { slice: ByteStringSlice ⇒
|
||||
slice match {
|
||||
case (xs, from, until) ⇒ likeVecIt(xs)({
|
||||
_.drop(from).take(until - from).toSeq
|
||||
}, strict = false)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"calling copyToArray" in {
|
||||
check { slice: ByteStringSlice ⇒
|
||||
slice match {
|
||||
|
|
@ -320,6 +330,18 @@ class ByteStringSpec extends WordSpec with MustMatchers with Checkers {
|
|||
((output.length < 1) || (input.asInputStream.read(output, 0, 1) == -1))
|
||||
}
|
||||
}
|
||||
|
||||
"calling copyToBuffer" in {
|
||||
check { bytes: ByteString ⇒
|
||||
import java.nio.ByteBuffer
|
||||
val buffer = ByteBuffer.allocate(bytes.size)
|
||||
bytes.copyToBuffer(buffer)
|
||||
buffer.flip()
|
||||
val array = Array.ofDim[Byte](bytes.size)
|
||||
buffer.get(array)
|
||||
bytes == array.toSeq
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
"decode data correctly" when {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue