Skip to content

Commit 65679cd

Browse files
144: Add a reproducer from the issue #144
1 parent 5c3af1e commit 65679cd

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

core/commonTest/src/contract/set/PersistentHashSetTest.kt

+17
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
package tests.contract.set
77

88
import kotlinx.collections.immutable.persistentHashSetOf
9+
import kotlinx.collections.immutable.minus
10+
import kotlinx.collections.immutable.toPersistentHashSet
911
import kotlin.test.Test
1012
import kotlin.test.assertEquals
1113
import kotlin.test.assertTrue
@@ -27,4 +29,19 @@ class PersistentHashSetTest {
2729
assertEquals(set2, builder.build().toSet())
2830
assertEquals(set2, builder.build())
2931
}
32+
33+
/**
34+
* Test from issue: https://github.com/Kotlin/kotlinx.collections.immutable/issues/144
35+
*/
36+
@Test
37+
fun reproducer() {
38+
val firstBatch = listOf(4554, 9380, 4260, 6602)
39+
val secondBatch = listOf(1188, 14794)
40+
val extraElement = 7450
41+
42+
val set = firstBatch.plus(secondBatch).plus(extraElement).toPersistentHashSet()
43+
val result = set.minus(firstBatch.toPersistentHashSet()).minus(secondBatch)
44+
assertEquals(1, result.size)
45+
assertEquals(extraElement, result.first())
46+
}
3047
}

0 commit comments

Comments
 (0)