release 0.1.0: fixed bug with object/empty serialization, migrated to newest kotlin
This commit is contained in:
1 parent
47b450c597
commit
3e6c487601
5 files changed
+287
-522
No files matched your search
@@ -46,6 +46,13 @@ data class FoobarF3(val bar: Int, val foo: Int, val other: Int = -1)
|
||||
@CrcProtected()
|
||||
data class FoobarFP1(val bar: Int, val foo: Int, val other: Int = -1)
|
||||
|
||||
@Serializable
|
||||
sealed class SC1 {
|
||||
|
||||
@Serializable
|
||||
class Nested: SC1()
|
||||
}
|
||||
|
||||
class BipackEncoderTest {
|
||||
|
||||
@Serializable
|
||||
@@ -349,7 +356,7 @@ class BipackEncoderTest {
|
||||
@Test
|
||||
fun testInstant() {
|
||||
val x = Clock.System.now()
|
||||
// println( BipackEncoder.encode(x).toDump() )
|
||||
println( BipackEncoder.encode(x).toDump() )
|
||||
val y = BipackDecoder.decode<Instant>(BipackEncoder.encode(x))
|
||||
assertEquals(x.toEpochMilliseconds(), y.toEpochMilliseconds())
|
||||
}
|
||||
@@ -405,4 +412,30 @@ class BipackEncoderTest {
|
||||
println(sf)
|
||||
}
|
||||
|
||||
@Serializable
|
||||
enum class TU1 {
|
||||
N1, N2, N3, N4
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
fun testUnsignedEnums() {
|
||||
val p1 = BipackEncoder.encode(TU1.N4)
|
||||
// val p2 = BipackEncoder.encode(3u)
|
||||
println(p1.toDump())
|
||||
// println(p2.toDump())
|
||||
val t2 = BipackDecoder.decode<TU1>(p1)
|
||||
assertEquals(TU1.N4, t2)
|
||||
assertEquals(0x0cu, p1[0].toUByte())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testClosedSerialization() {
|
||||
val x: SC1 = SC1.Nested()
|
||||
val b = BipackEncoder.encode(x)
|
||||
println(b.toDump())
|
||||
val y = BipackDecoder.decode<SC1>(b)
|
||||
println(y)
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user