@@ -14,20 +14,39 @@ import kotlin.test.*
14
14
15
15
@OpGroupConfigs(OpGroupConfig (name = " consumer" , nonParallel = true ))
16
16
@Param(name = " value" , gen = IntGen ::class , conf = " 1:3" )
17
- class LockFreeTaskQueueLinearizabilityTestSC : LockFreeTaskQueueLinearizabilityTestBase (singleConsumer = true )
17
+ class LockFreeTaskQueueLinearizabilityTestSC : LockFreeTaskQueueLinearizabilityTestBase () {
18
+ private lateinit var q: LockFreeTaskQueue <Int >
19
+
20
+ @Reset
21
+ fun resetQueue () {
22
+ q = LockFreeTaskQueue (singleConsumer = true ) // SINGLE-CONSUMER !!!
23
+ }
24
+
25
+ @Operation
26
+ fun close () = q.close()
27
+
28
+ @Operation
29
+ fun addLast (@Param(name = " value" ) value : Int ) = q.addLast(value)
30
+
31
+ /* *
32
+ * Note, that removeFirstOrNull is not linearizable w.r.t. to addLast, so here
33
+ * we test only linearizability of close.
34
+ */
35
+ // @Operation(group = "consumer")
36
+ // fun removeFirstOrNull() = q.removeFirstOrNull()
37
+
38
+ @Test
39
+ fun testSC () = linTest()
40
+ }
18
41
19
42
@OpGroupConfigs(OpGroupConfig (name = " consumer" , nonParallel = true ))
20
43
@Param(name = " value" , gen = IntGen ::class , conf = " 1:3" )
21
- class LockFreeTaskQueueLinearizabilityTestMC : LockFreeTaskQueueLinearizabilityTestBase (singleConsumer = false )
22
-
23
- open class LockFreeTaskQueueLinearizabilityTestBase (
24
- private val singleConsumer : Boolean
25
- ) : TestBase() {
44
+ class LockFreeTaskQueueLinearizabilityTestMC : LockFreeTaskQueueLinearizabilityTestBase () {
26
45
private lateinit var q: LockFreeTaskQueue <Int >
27
46
28
47
@Reset
29
48
fun resetQueue () {
30
- q = LockFreeTaskQueue (singleConsumer)
49
+ q = LockFreeTaskQueue (singleConsumer = false ) // MULTI-CONSUMER !!!
31
50
}
32
51
33
52
@Operation
@@ -44,6 +63,10 @@ open class LockFreeTaskQueueLinearizabilityTestBase(
44
63
// fun removeFirstOrNull() = q.removeFirstOrNull()
45
64
46
65
@Test
66
+ fun testMC () = linTest()
67
+ }
68
+
69
+ open class LockFreeTaskQueueLinearizabilityTestBase : TestBase () {
47
70
fun linTest () {
48
71
val options = StressOptions ()
49
72
.iterations(100 * stressTestMultiplierSqrt)
0 commit comments