Skip to content

Commit e08fd07

Browse files
ndkovalqwwdfsad
authored andcommitted
* Implement equals and hashCode functions for the verification process;
* Use 3 parallel threads, 4 threads with 5 operations in each one is too much.
1 parent 19a2a30 commit e08fd07

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

core/kotlinx-coroutines-core/test/linearizability/LockFreeListLinearizabilityTest.kt

+19-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,25 @@ class LockFreeListLinearizabilityTest : TestBase() {
4848
val options = StressOptions()
4949
.iterations(100)
5050
.invocationsPerIteration(1000 * stressTestMultiplier)
51-
.threads(4)
51+
.threads(3)
5252
LinChecker.check(LockFreeListLinearizabilityTest::class.java, options)
5353
}
54+
55+
private var _curElements: ArrayList<Int>? = null
56+
private val curElements: ArrayList<Int> get() {
57+
if (_curElements == null) {
58+
_curElements = ArrayList()
59+
q.forEach<Node> { _curElements!!.add(it.value) }
60+
}
61+
return _curElements!!
62+
}
63+
64+
override fun equals(other: Any?): Boolean {
65+
other as LockFreeListLinearizabilityTest
66+
return curElements == other.curElements
67+
}
68+
69+
override fun hashCode(): Int {
70+
return curElements.hashCode()
71+
}
5472
}

0 commit comments

Comments
 (0)