test for inner class CrcProtection bug

This commit is contained in:
Sergey Chernov 2023-03-13 23:19:48 +01:00
parent 8aa82bb42f
commit e4f2644169

View File

@ -183,4 +183,23 @@ class BipackEncoderTest {
// println(d.decodeFromBipack<Types1>()) // println(d.decodeFromBipack<Types1>())
assertEquals(t1, 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())
}
} }