tests moved to common
This commit is contained in:
parent
be03163a96
commit
ee2c958445
@ -1,11 +1,10 @@
|
|||||||
package net.sergeych.bipack
|
package bipack
|
||||||
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import net.sergeych.bintools.toDump
|
import net.sergeych.bintools.toDump
|
||||||
import org.junit.jupiter.api.Assertions.assertEquals
|
import net.sergeych.bipack.*
|
||||||
import org.junit.jupiter.api.Assertions.assertThrows
|
import kotlin.test.*
|
||||||
import org.junit.jupiter.api.Test
|
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Foobar1N(val bar: Int, val foo: Int = 117)
|
data class Foobar1N(val bar: Int, val foo: Int = 117)
|
||||||
@ -16,7 +15,6 @@ data class Foobar1(val bar: Int, val foo: Int = 117)
|
|||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
@ExtendableFormat
|
@ExtendableFormat
|
||||||
@SerialName("net.sergeych.bipack.Foobar1")
|
|
||||||
data class Foobar2(val bar: Int, val foo: Int,val other: Int = -1)
|
data class Foobar2(val bar: Int, val foo: Int,val other: Int = -1)
|
||||||
@Serializable
|
@Serializable
|
||||||
@Framed
|
@Framed
|
||||||
@ -26,7 +24,7 @@ data class FoobarF1(val bar: Int, val foo: Int = 117)
|
|||||||
@Serializable
|
@Serializable
|
||||||
@Framed
|
@Framed
|
||||||
@ExtendableFormat
|
@ExtendableFormat
|
||||||
@SerialName("net.sergeych.bipack.FoobarF1")
|
@SerialName("bipack.FoobarF1")
|
||||||
data class FoobarF2(val bar: Int, val foo: Int,val other: Int = -1)
|
data class FoobarF2(val bar: Int, val foo: Int,val other: Int = -1)
|
||||||
@Serializable
|
@Serializable
|
||||||
@Framed
|
@Framed
|
||||||
@ -54,7 +52,7 @@ class BipackEncoderTest {
|
|||||||
val c = BipackDecoder.decode<FoobarF2>(BipackEncoder.encode(a))
|
val c = BipackDecoder.decode<FoobarF2>(BipackEncoder.encode(a))
|
||||||
assertEquals(-1, c.other)
|
assertEquals(-1, c.other)
|
||||||
assertEquals(a.bar, c.bar)
|
assertEquals(a.bar, c.bar)
|
||||||
assertThrows(InvalidFrameException::class.java) {
|
assertFailsWith(InvalidFrameException::class) {
|
||||||
BipackDecoder.decode<FoobarF3>(BipackEncoder.encode(a))
|
BipackDecoder.decode<FoobarF3>(BipackEncoder.encode(a))
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user