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>
Graham 4 years ago
parent 4aa75c8fee
commit 9ddce82df4
  1. 14
      cache/src/test/kotlin/org/openrs2/cache/Js5MasterIndexTest.kt
  2. 16
      protocol/src/test/kotlin/org/openrs2/protocol/Rs2DecoderTest.kt
  3. 16
      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(
private val decoded = Js5MasterIndex(
mutableListOf(
Js5MasterIndex.Entry(0, 1),
Js5MasterIndex.Entry(2, 3),
Js5MasterIndex.Entry(4, 5)
))
)
)
@Test
fun testCreate() {
@ -22,7 +24,9 @@ object Js5MasterIndexTest {
Js5MasterIndex.create(store)
}
assertEquals(Js5MasterIndex(mutableListOf(
assertEquals(
Js5MasterIndex(
mutableListOf(
Js5MasterIndex.Entry(0, 379203374),
Js5MasterIndex.Entry(0x12345678, -717247318),
Js5MasterIndex.Entry(0, 0),
@ -30,7 +34,9 @@ object Js5MasterIndexTest {
Js5MasterIndex.Entry(0, 0),
Js5MasterIndex.Entry(0, 0),
Js5MasterIndex.Entry(0xAA55AA55.toInt(), -627983571)
)), index)
)
), index
)
}
@Test

@ -70,14 +70,18 @@ object Rs2DecoderTest {
}
private fun testDecode(buf: ByteArray, expected: Packet) {
val channel = EmbeddedChannel(Rs2Decoder(Protocol(
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(
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(
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(
val channel = EmbeddedChannel(
Rs2Encoder(
Protocol(
FixedPacketCodec,
VariableBytePacketCodec,
VariableShortPacketCodec,
VariableByteOptimisedPacketCodec,
VariableShortOptimisedPacketCodec,
TestEmptyPacketCodec
)))
)
)
)
channel.writeOutbound(packet)
channel.readOutbound<ByteBuf>().use { actual ->

Loading…
Cancel
Save