@@ -11,37 +11,37 @@ import kotlinx.coroutines.channels.Channel.Factory.CONFLATED
11
11
import kotlinx.coroutines.channels.Channel.Factory.RENDEZVOUS
12
12
import kotlinx.coroutines.channels.Channel.Factory.UNLIMITED
13
13
import kotlinx.coroutines.selects.*
14
+ import org.jetbrains.kotlinx.lincheck.*
14
15
import org.jetbrains.kotlinx.lincheck.annotations.*
15
16
import org.jetbrains.kotlinx.lincheck.annotations.Operation
16
17
import org.jetbrains.kotlinx.lincheck.paramgen.*
17
18
import org.jetbrains.kotlinx.lincheck.verifier.*
18
- import org.junit.*
19
19
20
- class RendezvousChannelLCStressTest : ChannelLCStressTestBase (
20
+ class RendezvousChannelLincheckTest : ChannelLincheckTestBase (
21
21
c = Channel (RENDEZVOUS ),
22
22
sequentialSpecification = SequentialRendezvousChannel : :class.java
23
23
)
24
24
class SequentialRendezvousChannel : SequentialIntChannelBase (RENDEZVOUS )
25
25
26
- class Array1ChannelLCStressTest : ChannelLCStressTestBase (
26
+ class Array1ChannelLincheckTest : ChannelLincheckTestBase (
27
27
c = Channel (1),
28
28
sequentialSpecification = SequentialArray1RendezvousChannel : :class.java
29
29
)
30
30
class SequentialArray1RendezvousChannel : SequentialIntChannelBase (1 )
31
31
32
- class Array2ChannelLCStressTest : ChannelLCStressTestBase (
32
+ class Array2ChannelLincheckTest : ChannelLincheckTestBase (
33
33
c = Channel (2),
34
34
sequentialSpecification = SequentialArray2RendezvousChannel : :class.java
35
35
)
36
36
class SequentialArray2RendezvousChannel : SequentialIntChannelBase (2 )
37
37
38
- class UnlimitedChannelLCStressTest : ChannelLCStressTestBase (
38
+ class UnlimitedChannelLincheckTest : ChannelLincheckTestBase (
39
39
c = Channel (UNLIMITED ),
40
40
sequentialSpecification = SequentialUnlimitedChannel : :class.java
41
41
)
42
42
class SequentialUnlimitedChannel : SequentialIntChannelBase (UNLIMITED )
43
43
44
- class ConflatedChannelLCStressTest : ChannelLCStressTestBase (
44
+ class ConflatedChannelLincheckTest : ChannelLincheckTestBase (
45
45
c = Channel (CONFLATED ),
46
46
sequentialSpecification = SequentialConflatedChannel : :class.java
47
47
)
@@ -51,7 +51,10 @@ class SequentialConflatedChannel : SequentialIntChannelBase(CONFLATED)
51
51
Param (name = " value" , gen = IntGen ::class , conf = " 1:5" ),
52
52
Param (name = " closeToken" , gen = IntGen ::class , conf = " 1:3" )
53
53
)
54
- abstract class ChannelLCStressTestBase (private val c : Channel <Int >, private val sequentialSpecification : Class <* >) {
54
+ abstract class ChannelLincheckTestBase (
55
+ private val c : Channel <Int >,
56
+ private val sequentialSpecification : Class <* >
57
+ ) : AbstractLincheckTest() {
55
58
@Operation
56
59
suspend fun send (@Param(name = " value" ) value : Int ): Any = try {
57
60
c.send(value)
@@ -113,11 +116,8 @@ abstract class ChannelLCStressTestBase(private val c: Channel<Int>, private val
113
116
// @Operation
114
117
fun isEmpty () = c.isEmpty
115
118
116
- @Test
117
- fun test () = LCStressOptionsDefault ()
118
- .actorsBefore(0 )
119
- .sequentialSpecification(sequentialSpecification)
120
- .check(this ::class )
119
+ override fun <O : Options <O , * >> O.customize (isStressTest : Boolean ): O =
120
+ actorsBefore(0 ).sequentialSpecification(sequentialSpecification)
121
121
}
122
122
123
123
private class NumberedCancellationException (number : Int ) : CancellationException() {
0 commit comments