From a4cf3fe8ee2b4513ccebc6eb8a4d346365459d24 Mon Sep 17 00:00:00 2001 From: sergeych Date: Sat, 24 Aug 2024 07:14:10 +0200 Subject: [PATCH] readme fix --- .../kotlin/bipack/BipackEncoderTest.kt | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/commonTest/kotlin/bipack/BipackEncoderTest.kt b/src/commonTest/kotlin/bipack/BipackEncoderTest.kt index 1d35c50..304b116 100644 --- a/src/commonTest/kotlin/bipack/BipackEncoderTest.kt +++ b/src/commonTest/kotlin/bipack/BipackEncoderTest.kt @@ -30,6 +30,7 @@ data class Foobar2(val bar: Int, val foo: Int, val other: Int = -1) @Framed data class FoobarF1(val bar: Int, val foo: Int = 117) +@Suppress("unused") @Serializable @Framed @SerialName("bipack.FoobarF1") @@ -440,4 +441,21 @@ class BipackEncoderTest { println(y) } + + @Serializable + data class T1(@Fixed val i: Byte) + + @Test + fun testFixedByte() { + fun t1(i: Int) { + val packed = BipackEncoder.encode(T1(i.toByte())) + println(packed.toDump()) + assertEquals(1, packed.size) + assertEquals(i, BipackDecoder.decode(packed).i.toInt()) + } + t1(127) + t1(-127) + t1(1) + t1(-1) + } } \ No newline at end of file