commonTest.channels.ChannelFactoryTest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of kotlinx-coroutines-core-metadata Show documentation
Show all versions of kotlinx-coroutines-core-metadata Show documentation
Coroutines support libraries for Kotlin
/*
* 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