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

commonTest.com.arkivanov.mvikotlin.timetravel.proto.internal.data.AbstractReadWriteTest.kt Maven / Gradle / Ivy

There is a newer version: 4.2.0
Show newest version
package com.arkivanov.mvikotlin.timetravel.proto.internal.data

import com.arkivanov.mvikotlin.timetravel.proto.internal.io.DataReader
import com.arkivanov.mvikotlin.timetravel.proto.internal.io.DataWriter
import kotlin.test.assertEquals

internal abstract class AbstractReadWriteTest {

    protected fun testWriteRead(obj: T) {
        val writer = DataWriter()
        writer.writeObject(obj)
        val reader = DataReader(writer.data)
        val readObj = reader.readObject()

        assertEquals(obj, readObj)
    }

    protected abstract fun DataWriter.writeObject(obj: T)

    protected abstract fun DataReader.readObject(): T
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy