|
|
@ -5,7 +5,7 @@ import dev.openrs2.crypto.XteaKey |
|
|
|
import io.netty.buffer.ByteBuf |
|
|
|
import io.netty.buffer.ByteBuf |
|
|
|
import io.netty.buffer.Unpooled |
|
|
|
import io.netty.buffer.Unpooled |
|
|
|
import org.junit.jupiter.api.assertThrows |
|
|
|
import org.junit.jupiter.api.assertThrows |
|
|
|
import java.io.EOFException |
|
|
|
import java.io.IOException |
|
|
|
import kotlin.test.Test |
|
|
|
import kotlin.test.Test |
|
|
|
import kotlin.test.assertEquals |
|
|
|
import kotlin.test.assertEquals |
|
|
|
import kotlin.test.assertNotEquals |
|
|
|
import kotlin.test.assertNotEquals |
|
|
@ -260,7 +260,7 @@ object Js5CompressionTest { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun testInvalidType() { |
|
|
|
fun testInvalidType() { |
|
|
|
read("invalid-type.dat").use { compressed -> |
|
|
|
read("invalid-type.dat").use { compressed -> |
|
|
|
assertThrows<IllegalArgumentException> { |
|
|
|
assertThrows<IOException> { |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -269,7 +269,7 @@ object Js5CompressionTest { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun testInvalidLength() { |
|
|
|
fun testInvalidLength() { |
|
|
|
read("invalid-length.dat").use { compressed -> |
|
|
|
read("invalid-length.dat").use { compressed -> |
|
|
|
assertThrows<IllegalArgumentException> { |
|
|
|
assertThrows<IOException> { |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -278,7 +278,7 @@ object Js5CompressionTest { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun testInvalidUncompressedLength() { |
|
|
|
fun testInvalidUncompressedLength() { |
|
|
|
read("invalid-uncompressed-length.dat").use { compressed -> |
|
|
|
read("invalid-uncompressed-length.dat").use { compressed -> |
|
|
|
assertThrows<IllegalArgumentException> { |
|
|
|
assertThrows<IOException> { |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -287,7 +287,7 @@ object Js5CompressionTest { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun testNoneEof() { |
|
|
|
fun testNoneEof() { |
|
|
|
read("none-eof.dat").use { compressed -> |
|
|
|
read("none-eof.dat").use { compressed -> |
|
|
|
assertThrows<IndexOutOfBoundsException> { |
|
|
|
assertThrows<IOException> { |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -296,7 +296,7 @@ object Js5CompressionTest { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun testBzip2Eof() { |
|
|
|
fun testBzip2Eof() { |
|
|
|
read("bzip2-eof.dat").use { compressed -> |
|
|
|
read("bzip2-eof.dat").use { compressed -> |
|
|
|
assertThrows<EOFException> { |
|
|
|
assertThrows<IOException> { |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -305,7 +305,7 @@ object Js5CompressionTest { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun testGzipEof() { |
|
|
|
fun testGzipEof() { |
|
|
|
read("gzip-eof.dat").use { compressed -> |
|
|
|
read("gzip-eof.dat").use { compressed -> |
|
|
|
assertThrows<EOFException> { |
|
|
|
assertThrows<IOException> { |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -314,7 +314,7 @@ object Js5CompressionTest { |
|
|
|
@Test |
|
|
|
@Test |
|
|
|
fun testLzmaEof() { |
|
|
|
fun testLzmaEof() { |
|
|
|
read("lzma-eof.dat").use { compressed -> |
|
|
|
read("lzma-eof.dat").use { compressed -> |
|
|
|
assertThrows<EOFException> { |
|
|
|
assertThrows<IOException> { |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
Js5Compression.uncompress(compressed).release() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|