From 9ddce82df4f6083c2fa1bf07f41f0eabaf1d50e0 Mon Sep 17 00:00:00 2001 From: Graham Date: Thu, 24 Dec 2020 22:34:17 +0000 Subject: [PATCH] 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 --- .../org/openrs2/cache/Js5MasterIndexTest.kt | 34 ++++++++++------- .../org/openrs2/protocol/Rs2DecoderTest.kt | 38 +++++++++++-------- .../org/openrs2/protocol/Rs2EncoderTest.kt | 32 ++++++++++------ 3 files changed, 63 insertions(+), 41 deletions(-) diff --git a/cache/src/test/kotlin/org/openrs2/cache/Js5MasterIndexTest.kt b/cache/src/test/kotlin/org/openrs2/cache/Js5MasterIndexTest.kt index 41f07abd..443cbb43 100644 --- a/cache/src/test/kotlin/org/openrs2/cache/Js5MasterIndexTest.kt +++ b/cache/src/test/kotlin/org/openrs2/cache/Js5MasterIndexTest.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 diff --git a/protocol/src/test/kotlin/org/openrs2/protocol/Rs2DecoderTest.kt b/protocol/src/test/kotlin/org/openrs2/protocol/Rs2DecoderTest.kt index 75c0b63f..51ed5f26 100644 --- a/protocol/src/test/kotlin/org/openrs2/protocol/Rs2DecoderTest.kt +++ b/protocol/src/test/kotlin/org/openrs2/protocol/Rs2DecoderTest.kt @@ -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() @@ -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)) diff --git a/protocol/src/test/kotlin/org/openrs2/protocol/Rs2EncoderTest.kt b/protocol/src/test/kotlin/org/openrs2/protocol/Rs2EncoderTest.kt index 5763b2d1..5fc505ea 100644 --- a/protocol/src/test/kotlin/org/openrs2/protocol/Rs2EncoderTest.kt +++ b/protocol/src/test/kotlin/org/openrs2/protocol/Rs2EncoderTest.kt @@ -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().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().use { actual ->