From e4f2644169294d2cc5ebaacefc8e7ce689270cd0 Mon Sep 17 00:00:00 2001 From: sergeych Date: Mon, 13 Mar 2023 23:19:48 +0100 Subject: [PATCH] test for inner class CrcProtection bug --- .../kotlin/bipack/BipackEncoderTest.kt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/commonTest/kotlin/bipack/BipackEncoderTest.kt b/src/commonTest/kotlin/bipack/BipackEncoderTest.kt index 43bb310..fe05346 100644 --- a/src/commonTest/kotlin/bipack/BipackEncoderTest.kt +++ b/src/commonTest/kotlin/bipack/BipackEncoderTest.kt @@ -183,4 +183,23 @@ class BipackEncoderTest { // println(d.decodeFromBipack()) assertEquals(t1, d.decodeFromBipack()) } + + @Serializable +// @CrcProtected +// @Framed + data class Inner(val bar: String, val foo: Int) + + @Serializable +// @Framed + @CrcProtected + data class Outer(val i1: Inner,val i2: Inner) + + @Test + fun testNEstedProtected() { + val x = Outer(Inner("foo", 42), Inner("bar", 117)) + val d = BipackEncoder.encode(x) + println(d.toDump()) + assertEquals(x, d.decodeFromBipack()) + } + } \ No newline at end of file