All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonTest.kotlinx.serialization.protobuf.MapEntryTest.kt Maven / Gradle / Ivy

The newest version!
/*
 * Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

package kotlinx.serialization.protobuf

import kotlinx.serialization.*
import kotlin.test.*

class MapEntryTest {

    @Serializable
    data class Wrapper(val e: Map.Entry)

    @Test
    fun testEntry() {
        val e = Wrapper(mapOf(1 to 1).entries.single())
        val output = ProtoBuf.encodeToHexString(Wrapper.serializer(), e)
        assertEquals("0a0408011001", output)
        assertEquals(e.e.toPair(), ProtoBuf.decodeFromHexString(Wrapper.serializer(), output).e.toPair())
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy