tests moved to common

This commit is contained in:
Sergey Chernov 2023-03-12 23:27:21 +01:00
parent be03163a96
commit ee2c958445

View File

@ -1,11 +1,10 @@
package net.sergeych.bipack
package bipack
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import net.sergeych.bintools.toDump
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertThrows
import org.junit.jupiter.api.Test
import net.sergeych.bipack.*
import kotlin.test.*
@Serializable
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
@ExtendableFormat
@SerialName("net.sergeych.bipack.Foobar1")
data class Foobar2(val bar: Int, val foo: Int,val other: Int = -1)
@Serializable
@Framed
@ -26,7 +24,7 @@ data class FoobarF1(val bar: Int, val foo: Int = 117)
@Serializable
@Framed
@ExtendableFormat
@SerialName("net.sergeych.bipack.FoobarF1")
@SerialName("bipack.FoobarF1")
data class FoobarF2(val bar: Int, val foo: Int,val other: Int = -1)
@Serializable
@Framed
@ -54,7 +52,7 @@ class BipackEncoderTest {
val c = BipackDecoder.decode<FoobarF2>(BipackEncoder.encode(a))
assertEquals(-1, c.other)
assertEquals(a.bar, c.bar)
assertThrows(InvalidFrameException::class.java) {
assertFailsWith(InvalidFrameException::class) {
BipackDecoder.decode<FoobarF3>(BipackEncoder.encode(a))
}
}