Skip to content

Commit ebd87c9

Browse files
committed
fix test vector
1 parent 397c5c2 commit ebd87c9

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

formats/cbor/commonTest/src/kotlinx/serialization/cbor/CborDecoderTest.kt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ class CborDecoderTest {
4040
HexConverter.parseHexBinary("cafe"),
4141
HexConverter.parseHexBinary("cafe")
4242
)
43-
// with maps, lists & strings of indefinite length
43+
// with maps, lists & strings of indefinite length (note: this test vector did not correspond to proper encoding before, but decoded fine)
44+
// this collapsing bytes wrapped in a bytes string into a byte string could be an indicator of a buggy (as in: too lenient) decoder.
4445
val hex =
45-
"bf637374726d48656c6c6f2c20776f726c64216169182a686e756c6c61626c65f6646c6973749f61616162ff636d6170bf01f502f4ff65696e6e6572bf6161636c6f6cff6a696e6e6572734c6973749fbf6161636b656bffff6a62797465537472696e675f42cafeff696279746541727261799f383521ffff"
46+
"bf637374726d48656c6c6f2c20776f726c64216169182a686e756c6c61626c65f6646c6973749f61616162ff636d6170bf01f502f4ff65696e6e6572bf6161636c6f6cff6a696e6e6572734c6973749fbf6161636b656bffff6a62797465537472696e6742cafe696279746541727261799f383521ffff"
4647
assertEquals(
4748
test, Cbor.decodeFromHexString(
4849
TypesUmbrella.serializer(),
@@ -54,9 +55,7 @@ class CborDecoderTest {
5455
assertEquals(Cbor.encodeToCbor(test), struct)
5556
assertEquals(test, Cbor.decodeFromCbor(TypesUmbrella.serializer(), struct))
5657

57-
5858
assertEquals(hex, Cbor.encodeToHexString(TypesUmbrella.serializer(), test))
59-
6059
assertEquals(hex, Cbor.encodeToHexString(CborElement.serializer(), struct))
6160

6261

0 commit comments

Comments
 (0)