Skip to content

Commit a53f7c9

Browse files
author
Abduqodiri Qurbonzoda
committed
Split tests to stress and contract tests
1 parent bbebbaa commit a53f7c9

File tree

15 files changed

+105
-137
lines changed

15 files changed

+105
-137
lines changed

kotlinx-collections-immutable/tests/src/main/kotlin/ImmutableArrayList.kt

Lines changed: 0 additions & 72 deletions
This file was deleted.

kotlinx-collections-immutable/tests/src/test/kotlin/kotlinx.collections.immutable/ImmutableListJavaTest.java

Lines changed: 0 additions & 27 deletions
This file was deleted.

kotlinx-collections-immutable/tests/src/test/kotlin/CollectionBehaviors.kt renamed to kotlinx-collections-immutable/tests/src/test/kotlin/kotlinx.collections.immutable/contractTests/CollectionBehaviors.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2010-2015 JetBrains s.r.o.
2+
* Copyright 2016-2019 JetBrains s.r.o.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,9 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package test.collections.behaviors
18-
19-
import test.collections.CompareContext
17+
package kotlinx.collections.immutable.contractTests
2018

2119
public fun <T> CompareContext<List<T>>.listBehavior() {
2220
equalityBehavior()

kotlinx-collections-immutable/tests/src/test/kotlin/ComparisonDSL.kt renamed to kotlinx-collections-immutable/tests/src/test/kotlin/kotlinx.collections.immutable/contractTests/ComparisonDSL.kt

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,24 @@
1-
package test.collections
1+
/*
2+
* Copyright 2016-2019 JetBrains s.r.o.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package kotlinx.collections.immutable.contractTests
218

319
import kotlin.test.*
420

5-
public fun <T> compare(expected: T, actual: T, block:CompareContext<T>.() -> Unit) {
21+
public fun <T> compare(expected: T, actual: T, block: CompareContext<T>.() -> Unit) {
622
CompareContext(expected, actual).block()
723
}
824

kotlinx-collections-immutable/tests/src/test/kotlin/kotlinx.collections.immutable/ImmutableListTest.kt renamed to kotlinx-collections-immutable/tests/src/test/kotlin/kotlinx.collections.immutable/contractTests/immutableList/ImmutableListTest.kt

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,25 @@
1-
package kotlinx.collections.immutable
2-
1+
/*
2+
* Copyright 2016-2019 JetBrains s.r.o.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package kotlinx.collections.immutable.contractTests.immutableList
18+
19+
import kotlinx.collections.immutable.*
20+
import kotlinx.collections.immutable.contractTests.compare
21+
import kotlinx.collections.immutable.contractTests.listBehavior
322
import org.junit.Test
4-
import test.collections.behaviors.listBehavior
5-
import test.collections.compare
623
import kotlin.test.*
724

825
class ImmutableListTest {

kotlinx-collections-immutable/tests/src/test/kotlin/kotlinx.collections.immutable/ImmutableMapTest.kt renamed to kotlinx-collections-immutable/tests/src/test/kotlin/kotlinx.collections.immutable/contractTests/immutableMap/ImmutableMapTest.kt

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
1-
package kotlinx.collections.immutable
2-
1+
/*
2+
* Copyright 2016-2019 JetBrains s.r.o.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package kotlinx.collections.immutable.contractTests.immutableMap
18+
19+
import kotlinx.collections.immutable.*
20+
import kotlinx.collections.immutable.contractTests.collectionBehavior
21+
import kotlinx.collections.immutable.contractTests.compare
22+
import kotlinx.collections.immutable.contractTests.mapBehavior
23+
import kotlinx.collections.immutable.contractTests.setBehavior
324
import org.junit.Test
4-
import test.collections.behaviors.*
5-
import test.collections.compare
625
import java.util.*
726
import kotlin.test.*
827

928
class ImmutableHashMapTest : ImmutableMapTest() {
10-
override fun <K, V> immutableMapOf(vararg pairs: Pair<K, V>): PersistentMap<K, V> = kotlinx.collections.immutable.persistentHashMapOf(*pairs)
29+
override fun <K, V> immutableMapOf(vararg pairs: Pair<K, V>): PersistentMap<K, V> = persistentHashMapOf(*pairs)
1130
}
1231
class ImmutableOrderedMapTest : ImmutableMapTest() {
13-
override fun <K, V> immutableMapOf(vararg pairs: Pair<K, V>): PersistentMap<K, V> = kotlinx.collections.immutable.persistentMapOf(*pairs)
32+
override fun <K, V> immutableMapOf(vararg pairs: Pair<K, V>): PersistentMap<K, V> = persistentMapOf(*pairs)
1433
override fun <K, V> compareMaps(expected: Map<K, V>, actual: Map<K, V>) = compare(expected, actual) { mapBehavior(ordered = true) }
1534

1635
@Test fun iterationOrder() {

kotlinx-collections-immutable/tests/src/test/kotlin/kotlinx.collections.immutable/ImmutableSetTest.kt renamed to kotlinx-collections-immutable/tests/src/test/kotlin/kotlinx.collections.immutable/contractTests/immutableSet/ImmutableSetTest.kt

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,31 @@
1-
package kotlinx.collections.immutable
2-
1+
/*
2+
* Copyright 2016-2019 JetBrains s.r.o.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package kotlinx.collections.immutable.contractTests.immutableSet
18+
19+
import kotlinx.collections.immutable.*
320
import org.junit.Test
421
import kotlin.test.*
522

623
class ImmutableSetTest : ImmutableSetTestBase() {
7-
override fun <T> immutableSetOf(vararg elements: T) = kotlinx.collections.immutable.persistentSetOf(*elements)
24+
override fun <T> immutableSetOf(vararg elements: T) = persistentSetOf(*elements)
825
}
926

1027
class ImmutableHashSetTest : ImmutableSetTestBase() {
11-
override fun <T> immutableSetOf(vararg elements: T) = kotlinx.collections.immutable.persistentHashSetOf(*elements)
28+
override fun <T> immutableSetOf(vararg elements: T) = persistentHashSetOf(*elements)
1229

1330
override fun empty() {
1431
val empty1 = immutableSetOf<Int>()
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o.
2+
* Copyright 2016-2019 JetBrains s.r.o.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package kotlinx.collections.immutable.implementations
17+
package kotlinx.collections.immutable.stressTests
1818

1919
class ObjectWrapper<K: Comparable<K>>(val obj: K, val hashCode: Int) : Comparable<ObjectWrapper<K>> {
2020
override fun hashCode(): Int {
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2016-2018 JetBrains s.r.o.
2+
* Copyright 2016-2019 JetBrains s.r.o.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package kotlinx.collections.immutable.implementations
17+
package kotlinx.collections.immutable.stressTests
1818

1919
import java.util.*
2020

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
package kotlinx.collections.immutable.implementations.immutableList
17+
package kotlinx.collections.immutable.stressTests.immutableList
1818

1919
import kotlinx.collections.immutable.persistentListOf
2020
import org.junit.Test

0 commit comments

Comments
 (0)