Fix deprecations in testData: BlackBoxWithStdLibCodegenTest

This commit is contained in:
Ilya Gorbunov
2015-09-15 18:28:32 +03:00
parent 74e1dbff76
commit 9c974b6c5c
36 changed files with 109 additions and 109 deletions
+4 -4
View File
@@ -1,5 +1,5 @@
fun ok1(): Boolean {
val queue = linkedList(1, 2, 3)
val queue = linkedListOf(1, 2, 3)
while (!queue.isEmpty()) {
queue.poll()
for (y in 1..3) {
@@ -12,8 +12,8 @@ fun ok1(): Boolean {
}
fun ok2(): Boolean {
val queue = linkedList(1, 2, 3)
val array = array(1, 2, 3)
val queue = linkedListOf(1, 2, 3)
val array = arrayOf(1, 2, 3)
while (!queue.isEmpty()) {
queue.poll()
for (y in array) {
@@ -26,7 +26,7 @@ fun ok2(): Boolean {
}
fun ok3(): Boolean {
val queue = linkedList(1, 2, 3)
val queue = linkedListOf(1, 2, 3)
while (!queue.isEmpty()) {
queue.poll()
var x = 0
+1 -1
View File
@@ -4,7 +4,7 @@ fun box(): String {
}
class A: B() {
override var foo = array<Int?>(12, 13)
override var foo = arrayOf<Int?>(12, 13)
}
abstract class B {
@@ -36,18 +36,18 @@ fun <T> testMutableCollectionIterator(c: MutableCollection<T>, t: T) {
assertEquals(0, c.size())
}
fun <T> testMutableCollectionAddAll(c: MutableCollection<T>, t1: T, t2: T) {
c.addAll(arrayList(t1, t2))
assertEquals(arrayList(t1, t2), c)
c.addAll(arrayListOf(t1, t2))
assertEquals(arrayListOf(t1, t2), c)
}
fun <T> testMutableCollectionRemoveAll(c: MutableCollection<T>, t1: T, t2: T) {
c.addAll(arrayList(t1, t2))
c.removeAll(arrayList(t1))
assertEquals(arrayList(t2), c)
c.addAll(arrayListOf(t1, t2))
c.removeAll(arrayListOf(t1))
assertEquals(arrayListOf(t2), c)
}
fun <T> testMutableCollectionRetainAll(c: MutableCollection<T>, t1: T, t2: T) {
c.addAll(arrayList(t1, t2))
c.retainAll(arrayList(t1))
assertEquals(arrayList(t1), c)
c.addAll(arrayListOf(t1, t2))
c.retainAll(arrayListOf(t1))
assertEquals(arrayListOf(t1), c)
}
fun <T> testMutableCollectionClear(c: MutableCollection<T>) {
c.clear()
@@ -55,27 +55,27 @@ fun <T> testMutableCollectionClear(c: MutableCollection<T>) {
}
fun testCollection() {
testCollectionSize(arrayList<Int>())
testCollectionIsEmpty(arrayList<String>())
testCollectionContains(arrayList(1))
testCollectionIterator(arrayList(1))
testCollectionContainsAll(arrayList("a", "b"))
testCollectionSize(arrayListOf<Int>())
testCollectionIsEmpty(arrayListOf<String>())
testCollectionContains(arrayListOf(1))
testCollectionIterator(arrayListOf(1))
testCollectionContainsAll(arrayListOf("a", "b"))
testMutableCollectionAdd(arrayList(), "")
testMutableCollectionRemove(arrayList("a"), "a")
testMutableCollectionIterator(arrayList(), 1)
testMutableCollectionAddAll(arrayList(), 1, 2)
testMutableCollectionRemoveAll(arrayList(), 1, 2)
testMutableCollectionRetainAll(arrayList(), 1, 2)
testMutableCollectionClear(arrayList(1, 2))
testMutableCollectionAdd(arrayListOf(), "")
testMutableCollectionRemove(arrayListOf("a"), "a")
testMutableCollectionIterator(arrayListOf(), 1)
testMutableCollectionAddAll(arrayListOf(), 1, 2)
testMutableCollectionRemoveAll(arrayListOf(), 1, 2)
testMutableCollectionRetainAll(arrayListOf(), 1, 2)
testMutableCollectionClear(arrayListOf(1, 2))
}
fun <T> testListGet(l: List<T>, t: T) = assertEquals(t, l.get(0))
fun <T> testListIndexOf(l: List<T>, t: T) = assertEquals(0, l.indexOf(t))
fun <T> testListIterator(l: List<T>, t1 : T, t2 : T) {
val indexes = arrayList<Int>()
val result = arrayList<T>()
val indexes = arrayListOf<Int>()
val result = arrayListOf<T>()
val it = l.listIterator()
while (it.hasNext()) {
indexes.add(it.nextIndex())
@@ -85,14 +85,14 @@ fun <T> testListIterator(l: List<T>, t1 : T, t2 : T) {
indexes.add(it.previousIndex())
result.add(it.previous())
}
assertEquals(arrayList(0, 1, 1, 0), indexes)
assertEquals(arrayList(t1, t2, t2, t1), result)
assertEquals(arrayListOf(0, 1, 1, 0), indexes)
assertEquals(arrayListOf(t1, t2, t2, t1), result)
}
fun <T> testListSublist(l: List<T>, t: T) = assertEquals(arrayList(t), l.subList(0, 1))
fun <T> testListSublist(l: List<T>, t: T) = assertEquals(arrayListOf(t), l.subList(0, 1))
fun <T> testMutableListSet(l: MutableList<T>, t: T) {
l.set(0, t)
assertEquals(arrayList(t), l)
assertEquals(arrayListOf(t), l)
}
fun <T> testMutableListIterator(l: MutableList<T>, t1: T, t2: T, t3: T) {
val it = l.listIterator()
@@ -100,22 +100,22 @@ fun <T> testMutableListIterator(l: MutableList<T>, t1: T, t2: T, t3: T) {
it.next()
it.add(t3)
}
assertEquals(arrayList(t1, t3, t2, t3), l)
assertEquals(arrayListOf(t1, t3, t2, t3), l)
}
fun testList() {
testListGet(arrayList(1), 1)
testListIndexOf(arrayList(1), 1)
testListIterator(arrayList("a", "b"), "a", "b")
testListSublist(arrayList(1, 2), 1)
testListGet(arrayListOf(1), 1)
testListIndexOf(arrayListOf(1), 1)
testListIterator(arrayListOf("a", "b"), "a", "b")
testListSublist(arrayListOf(1, 2), 1)
testMutableListSet(arrayList(2), 4)
testMutableListIterator(arrayList(1, 2), 1, 2, 3)
testMutableListSet(arrayListOf(2), 4)
testMutableListIterator(arrayListOf(1, 2), 1, 2, 3)
}
fun <K, V> testMapContainsKey(map: Map<K, V>, k: K) = assertTrue(map.containsKey(k))
fun <K, V> testMapKeys(map: Map<K, V>, k1: K, k2: K) = assertEqualCollections(hashSet(k1, k2), map.keySet())
fun <K, V> testMapValues(map: Map<K, V>, v1: V, v2: V) = assertEqualCollections(hashSet(v1, v2), map.values())
fun <K, V> testMapKeys(map: Map<K, V>, k1: K, k2: K) = assertEqualCollections(hashSetOf(k1, k2), map.keySet())
fun <K, V> testMapValues(map: Map<K, V>, v1: V, v2: V) = assertEqualCollections(hashSetOf(v1, v2), map.values())
fun <K, V> testMapEntrySet(map: Map<K, V>, k : K, v: V) {
for (entry in map.entrySet()) {
assertEquals(k, entry.key)
@@ -126,16 +126,16 @@ fun <K, V> testMutableMapEntry(map: MutableMap<K, V>, k1 : K, v: V) {
for (entry in map.entrySet()) {
entry.setValue(v)
}
assertEquals(hashMap(k1 to v), map)
assertEquals(hashMapOf(k1 to v), map)
}
fun testMap() {
testMapContainsKey(hashMap(1 to 'a', 2 to 'b'), 2)
testMapKeys(hashMap(1 to 'a', 2 to 'b'), 1, 2)
testMapValues(hashMap(1 to 'a', 2 to 'b'), 'a', 'b')
testMapEntrySet(hashMap(1 to 'a'), 1, 'a')
testMutableMapEntry(hashMap(1 to 'a'), 1, 'b')
testMapContainsKey(hashMapOf(1 to 'a', 2 to 'b'), 2)
testMapKeys(hashMapOf(1 to 'a', 2 to 'b'), 1, 2)
testMapValues(hashMapOf(1 to 'a', 2 to 'b'), 'a', 'b')
testMapEntrySet(hashMapOf(1 to 'a'), 1, 'a')
testMutableMapEntry(hashMapOf(1 to 'a'), 1, 'b')
}
fun box() : String {
@@ -145,4 +145,4 @@ fun box() : String {
return "OK"
}
fun <T> assertEqualCollections(c1: Collection<T>, c2: Collection<T>) = assertEquals(c1.toCollection(hashSet<T>()), c2.toCollection(hashSet<T>()))
fun <T> assertEqualCollections(c1: Collection<T>, c2: Collection<T>) = assertEquals(c1.toCollection(hashSetOf<T>()), c2.toCollection(hashSetOf<T>()))
@@ -13,7 +13,7 @@ World""");
val list1 = sample().useLines{it.toArrayList()}
val list2 = sample().useLines<ArrayList<String>>{it.toArrayList()}
if(arrayList("Hello", "World") != list1) return "fail"
if(arrayList("Hello", "World") != list2) return "fail"
if(arrayListOf("Hello", "World") != list1) return "fail"
if(arrayListOf("Hello", "World") != list2) return "fail"
return "OK"
}