bbaldino
03/11/2019, 9:50 PMimport io.kotlintest.data.forall
import io.kotlintest.should
import io.kotlintest.specs.ShouldSpec
import io.kotlintest.shouldBe
import io.kotlintest.tables.row
import org.jitsi.test_helpers.matchers.haveSameContentAs
class ByteArrayExtensionsKtTest : ShouldSpec() {
init {
"ByteArray.getShort/putShort" {
should("parse the short correctly") {
forall(
row(byteArrayOf(0x00, 0x00), 0.toShort()),
row(byteArrayOf(0xFF, 0xFF), 65535.toShort())
) { buf, expectedShort ->
buf.getShort(0) shouldBe expectedShort
val array = ByteArray(2)
array.putShort(0, expectedShort)
array should haveSameContentAs(buf)
}
}
}
}
}