Format code

This new indentation style for nested calls is annoying, I need to see
if it can be turned off somehow...

Signed-off-by: Graham <gpe@openrs2.org>
bzip2
Graham 4 years ago
parent 4aa75c8fee
commit 9ddce82df4
  1. 34
      cache/src/test/kotlin/org/openrs2/cache/Js5MasterIndexTest.kt
  2. 38
      protocol/src/test/kotlin/org/openrs2/protocol/Rs2DecoderTest.kt
  3. 32
      protocol/src/test/kotlin/org/openrs2/protocol/Rs2EncoderTest.kt

@ -10,11 +10,13 @@ import kotlin.test.assertEquals
object Js5MasterIndexTest {
private val ROOT = Paths.get(FlatFileStoreTest::class.java.getResource("master-index").toURI())
private val encoded = byteArrayOf(0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0, 2, 0, 0, 0, 5, 0, 0, 0, 4)
private val decoded = Js5MasterIndex(mutableListOf(
Js5MasterIndex.Entry(0, 1),
Js5MasterIndex.Entry(2, 3),
Js5MasterIndex.Entry(4, 5)
))
private val decoded = Js5MasterIndex(
mutableListOf(
Js5MasterIndex.Entry(0, 1),
Js5MasterIndex.Entry(2, 3),
Js5MasterIndex.Entry(4, 5)
)
)
@Test
fun testCreate() {
@ -22,15 +24,19 @@ object Js5MasterIndexTest {
Js5MasterIndex.create(store)
}
assertEquals(Js5MasterIndex(mutableListOf(
Js5MasterIndex.Entry(0, 379203374),
Js5MasterIndex.Entry(0x12345678, -717247318),
Js5MasterIndex.Entry(0, 0),
Js5MasterIndex.Entry(0x9ABCDEF0.toInt(), 895417101),
Js5MasterIndex.Entry(0, 0),
Js5MasterIndex.Entry(0, 0),
Js5MasterIndex.Entry(0xAA55AA55.toInt(), -627983571)
)), index)
assertEquals(
Js5MasterIndex(
mutableListOf(
Js5MasterIndex.Entry(0, 379203374),
Js5MasterIndex.Entry(0x12345678, -717247318),
Js5MasterIndex.Entry(0, 0),
Js5MasterIndex.Entry(0x9ABCDEF0.toInt(), 895417101),
Js5MasterIndex.Entry(0, 0),
Js5MasterIndex.Entry(0, 0),
Js5MasterIndex.Entry(0xAA55AA55.toInt(), -627983571)
)
), index
)
}
@Test

@ -70,14 +70,18 @@ object Rs2DecoderTest {
}
private fun testDecode(buf: ByteArray, expected: Packet) {
val channel = EmbeddedChannel(Rs2Decoder(Protocol(
FixedPacketCodec,
VariableBytePacketCodec,
VariableShortPacketCodec,
VariableByteOptimisedPacketCodec,
VariableShortOptimisedPacketCodec,
TestEmptyPacketCodec
)))
val channel = EmbeddedChannel(
Rs2Decoder(
Protocol(
FixedPacketCodec,
VariableBytePacketCodec,
VariableShortPacketCodec,
VariableByteOptimisedPacketCodec,
VariableShortOptimisedPacketCodec,
TestEmptyPacketCodec
)
)
)
channel.writeInbound(Unpooled.wrappedBuffer(buf))
val actual = channel.readInbound<Packet>()
@ -85,13 +89,17 @@ object Rs2DecoderTest {
}
private fun testFragmented(buf: ByteArray, expected: Packet) {
val channel = EmbeddedChannel(Rs2Decoder(Protocol(
FixedPacketCodec,
VariableBytePacketCodec,
VariableShortPacketCodec,
VariableByteOptimisedPacketCodec,
VariableShortOptimisedPacketCodec
)))
val channel = EmbeddedChannel(
Rs2Decoder(
Protocol(
FixedPacketCodec,
VariableBytePacketCodec,
VariableShortPacketCodec,
VariableByteOptimisedPacketCodec,
VariableShortOptimisedPacketCodec
)
)
)
for (b in buf) {
channel.writeInbound(wrappedBuffer(b))

@ -21,10 +21,14 @@ object Rs2EncoderTest {
@Test
fun testTooLong() {
val channel = EmbeddedChannel(Rs2Encoder(Protocol(
VariableBytePacketCodec,
VariableShortPacketCodec
)))
val channel = EmbeddedChannel(
Rs2Encoder(
Protocol(
VariableBytePacketCodec,
VariableShortPacketCodec
)
)
)
channel.writeOutbound(VariableShortPacket(ByteArray(255)))
channel.readOutbound<ByteBuf>().release()
@ -108,14 +112,18 @@ object Rs2EncoderTest {
}
private fun testEncode(packet: Packet, expected: ByteArray) {
val channel = EmbeddedChannel(Rs2Encoder(Protocol(
FixedPacketCodec,
VariableBytePacketCodec,
VariableShortPacketCodec,
VariableByteOptimisedPacketCodec,
VariableShortOptimisedPacketCodec,
TestEmptyPacketCodec
)))
val channel = EmbeddedChannel(
Rs2Encoder(
Protocol(
FixedPacketCodec,
VariableBytePacketCodec,
VariableShortPacketCodec,
VariableByteOptimisedPacketCodec,
VariableShortOptimisedPacketCodec,
TestEmptyPacketCodec
)
)
)
channel.writeOutbound(packet)
channel.readOutbound<ByteBuf>().use { actual ->

Loading…
Cancel
Save