Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
normanmaurer authored and luben committed Mar 22, 2024
1 parent 9c75768 commit c66db1e
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/test/scala/Zstd.scala
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import java.nio.channels.FileChannel
import java.nio.channels.FileChannel.MapMode
import java.nio.charset.Charset
import java.nio.file.StandardOpenOption
import java.util.concurrent.CountDownLatch
import scala.annotation.unused
import scala.collection.mutable.WrappedArray
import scala.io._
Expand Down Expand Up @@ -1095,14 +1096,14 @@ class ZstdSpec extends AnyFlatSpec with ScalaCheckPropertyChecks {
assert(largeBuf6.array.length >= 10)
}

"Zstd" should "validate when extracting backing arrays from ByteBuffers" in {
"Zstd" should "validate when ByteBuffers from the BufferPool" in {
val directPoolLatch = new CountDownLatch(1)
val directPool = new BufferPool {
override def get(capacity: Int): ByteBuffer = {
ByteBuffer.allocateDirect(capacity)
}

override def release(buffer: ByteBuffer) = {
override def release(buffer: ByteBuffer): Unit = {
directPoolLatch.countDown();
}
}
Expand All @@ -1114,12 +1115,12 @@ class ZstdSpec extends AnyFlatSpec with ScalaCheckPropertyChecks {
val slicingPoolLatch = new CountDownLatch(1)
val slicingPool = new BufferPool {
override def get(capacity: Int): ByteBuffer = {
ByteBuffer.allocate(capacity);
buf.putInt(1);
var buffer = ByteBuffer.allocate(capacity);
buffer.putInt(1);
buffer.slice
}

override def release(buffer: ByteBuffer) = {
override def release(buffer: ByteBuffer): Unit = {
slicingPoolLatch.countDown();
}
}
Expand Down

0 comments on commit c66db1e

Please sign in to comment.