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

commonTest.channels.ChannelFactoryTest.kt Maven / Gradle / Ivy

There is a newer version: 1.4.2-native-mt
Show newest version
/*
 * Copyright 2016-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
 */

package kotlinx.coroutines.channels

import kotlinx.coroutines.*
import kotlin.test.*


class ChannelFactoryTest : TestBase() {

    @Test
    fun testRendezvousChannel() {
        assertTrue(Channel() is RendezvousChannel)
        assertTrue(Channel(0) is RendezvousChannel)
    }

    @Test
    fun testLinkedListChannel() {
        assertTrue(Channel(Channel.UNLIMITED) is LinkedListChannel)
    }

    @Test
    fun testConflatedChannel() {
        assertTrue(Channel(Channel.CONFLATED) is ConflatedChannel)
    }

    @Test
    fun testArrayChannel() {
        assertTrue(Channel(1) is ArrayChannel)
        assertTrue(Channel(10) is ArrayChannel)
    }

    @Test
    fun testInvalidCapacityNotSupported() = runTest({ it is IllegalArgumentException }) {
        Channel(-3)
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy