Adjust testData to isEmpty/key/value transformations

This commit is contained in:
Denis Zharkov
2015-10-09 14:16:51 +03:00
parent 83b680935b
commit 97ed8c83a0
28 changed files with 56 additions and 56 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ class StrList : List<String?> {
override val size: Int override val size: Int
get() = throw UnsupportedOperationException() get() = throw UnsupportedOperationException()
override fun isEmpty(): Boolean { override val isEmpty: Boolean get() {
throw UnsupportedOperationException() throw UnsupportedOperationException()
} }
@@ -1,6 +1,6 @@
class MyCollection<T>: Collection<T> { class MyCollection<T>: Collection<T> {
override val size: Int get() = 0 override val size: Int get() = 0
override fun isEmpty(): Boolean = true override val isEmpty: Boolean get() = true
override fun contains(o: T): Boolean = false override fun contains(o: T): Boolean = false
override fun iterator(): Iterator<T> = throw UnsupportedOperationException() override fun iterator(): Iterator<T> = throw UnsupportedOperationException()
override fun containsAll(c: Collection<T>): Boolean = false override fun containsAll(c: Collection<T>): Boolean = false
+1 -1
View File
@@ -1,6 +1,6 @@
class MyList<T>: List<T> { class MyList<T>: List<T> {
override val size: Int get() = 0 override val size: Int get() = 0
override fun isEmpty(): Boolean = true override val isEmpty: Boolean get() = true
override fun contains(o: T): Boolean = false override fun contains(o: T): Boolean = false
override fun iterator(): Iterator<T> = throw Error() override fun iterator(): Iterator<T> = throw Error()
override fun containsAll(c: Collection<T>): Boolean = false override fun containsAll(c: Collection<T>): Boolean = false
@@ -1,6 +1,6 @@
class MyList<T>(val v: T): List<T> { class MyList<T>(val v: T): List<T> {
override val size: Int get() = 0 override val size: Int get() = 0
override fun isEmpty(): Boolean = true override val isEmpty: Boolean get() = true
override fun contains(o: T): Boolean = false override fun contains(o: T): Boolean = false
override fun iterator(): Iterator<T> = throw Error() override fun iterator(): Iterator<T> = throw Error()
override fun containsAll(c: Collection<T>): Boolean = false override fun containsAll(c: Collection<T>): Boolean = false
@@ -13,7 +13,7 @@ open class Super<T>(val v: T) {
class MyList<T>(v: T): Super<T>(v), List<T> { class MyList<T>(v: T): Super<T>(v), List<T> {
override val size: Int get() = 0 override val size: Int get() = 0
override fun isEmpty(): Boolean = true override val isEmpty: Boolean get() = true
override fun contains(o: T): Boolean = false override fun contains(o: T): Boolean = false
override fun iterator(): Iterator<T> = throw Error() override fun iterator(): Iterator<T> = throw Error()
override fun containsAll(c: Collection<T>): Boolean = false override fun containsAll(c: Collection<T>): Boolean = false
+1 -1
View File
@@ -1,6 +1,6 @@
class MyMap<K, V>: Map<K, V> { class MyMap<K, V>: Map<K, V> {
override val size: Int get() = 0 override val size: Int get() = 0
override fun isEmpty(): Boolean = true override val isEmpty: Boolean get() = true
override fun containsKey(key: Any?): Boolean = false override fun containsKey(key: Any?): Boolean = false
override fun containsValue(value: Any?): Boolean = false override fun containsValue(value: Any?): Boolean = false
override fun get(key: Any?): V? = null override fun get(key: Any?): V? = null
@@ -1,8 +1,8 @@
class MyMapEntry<K, V>: Map.Entry<K, V> { class MyMapEntry<K, V>: Map.Entry<K, V> {
override fun hashCode(): Int = 0 override fun hashCode(): Int = 0
override fun equals(other: Any?): Boolean = false override fun equals(other: Any?): Boolean = false
override fun getKey(): K = throw UnsupportedOperationException() override val key: K get() = throw UnsupportedOperationException()
override fun getValue(): V = throw UnsupportedOperationException() override val value: V get() = throw UnsupportedOperationException()
} }
fun box(): String { fun box(): String {
@@ -1,8 +1,8 @@
class MyMapEntry<K, V>: Map.Entry<K, V> { class MyMapEntry<K, V>: Map.Entry<K, V> {
override fun hashCode(): Int = 0 override fun hashCode(): Int = 0
override fun equals(other: Any?): Boolean = false override fun equals(other: Any?): Boolean = false
override fun getKey(): K = throw UnsupportedOperationException() override val key: K get() = throw UnsupportedOperationException()
override fun getValue(): V = throw UnsupportedOperationException() override val value: V get() = throw UnsupportedOperationException()
public fun setValue(value: V): V = value public fun setValue(value: V): V = value
} }
@@ -1,6 +1,6 @@
class MyMap<K, V>: Map<K, V> { class MyMap<K, V>: Map<K, V> {
override val size: Int get() = 0 override val size: Int get() = 0
override fun isEmpty(): Boolean = true override val isEmpty: Boolean get() = true
override fun containsKey(key: Any?): Boolean = false override fun containsKey(key: Any?): Boolean = false
override fun containsValue(value: Any?): Boolean = false override fun containsValue(value: Any?): Boolean = false
override fun get(key: Any?): V? = null override fun get(key: Any?): V? = null
@@ -1,6 +1,6 @@
class MyList: List<String> { class MyList: List<String> {
override val size: Int get() = 0 override val size: Int get() = 0
override fun isEmpty(): Boolean = true override val isEmpty: Boolean get() = true
override fun contains(o: String): Boolean = false override fun contains(o: String): Boolean = false
override fun iterator(): Iterator<String> = throw Error() override fun iterator(): Iterator<String> = throw Error()
override fun containsAll(c: Collection<String>): Boolean = false override fun containsAll(c: Collection<String>): Boolean = false
@@ -4,7 +4,7 @@ interface Addable {
class C : Addable, List<String> { class C : Addable, List<String> {
override val size: Int get() = null!! override val size: Int get() = null!!
override fun isEmpty(): Boolean = null!! override val isEmpty: Boolean get() = null!!
override fun contains(o: String): Boolean = null!! override fun contains(o: String): Boolean = null!!
override fun iterator(): Iterator<String> = null!! override fun iterator(): Iterator<String> = null!!
override fun containsAll(c: Collection<String>): Boolean = null!! override fun containsAll(c: Collection<String>): Boolean = null!!
@@ -6,7 +6,7 @@ open class SetStringImpl {
class S : Set<String>, SetStringImpl() { class S : Set<String>, SetStringImpl() {
override val size: Int get() = 0 override val size: Int get() = 0
override fun isEmpty(): Boolean = true override val isEmpty: Boolean get() = true
override fun contains(o: String): Boolean = false override fun contains(o: String): Boolean = false
override fun iterator(): Iterator<String> = null!! override fun iterator(): Iterator<String> = null!!
override fun containsAll(c: Collection<String>) = false override fun containsAll(c: Collection<String>) = false
@@ -2,10 +2,10 @@ import java.util.Collections
class A<U : Number, V : U, W : V> : Set<W> { class A<U : Number, V : U, W : V> : Set<W> {
override val size: Int get() = 0 override val size: Int get() = 0
override fun isEmpty(): Boolean = true override val isEmpty: Boolean get() = true
override fun contains(o: W): Boolean = false override fun contains(o: W): Boolean = false
override fun iterator(): Iterator<W> = Collections.emptySet<W>().iterator() override fun iterator(): Iterator<W> = Collections.emptySet<W>().iterator()
override fun containsAll(c: Collection<W>): Boolean = c.isEmpty() override fun containsAll(c: Collection<W>): Boolean = c.isEmpty
} }
fun expectUoe(block: () -> Any) { fun expectUoe(block: () -> Any) {
@@ -3,7 +3,7 @@ import java.util.ArrayList
class MyCollection<T> : Collection<List<Iterator<T>>> { class MyCollection<T> : Collection<List<Iterator<T>>> {
override fun iterator() = null!! override fun iterator() = null!!
override val size: Int get() = null!! override val size: Int get() = null!!
override fun isEmpty(): Boolean = null!! override val isEmpty: Boolean get() = null!!
override fun contains(o: List<Iterator<T>>): Boolean = null!! override fun contains(o: List<Iterator<T>>): Boolean = null!!
override fun containsAll(c: Collection<List<Iterator<T>>>): Boolean = null!! override fun containsAll(c: Collection<List<Iterator<T>>>): Boolean = null!!
} }
@@ -5,7 +5,7 @@ interface A0 {
} }
class B0 : Collection<String>, A0 { class B0 : Collection<String>, A0 {
override fun isEmpty() = throw UnsupportedOperationException() override val isEmpty: Boolean get() = throw UnsupportedOperationException()
override fun contains(o: String) = throw UnsupportedOperationException() override fun contains(o: String) = throw UnsupportedOperationException()
override fun iterator() = throw UnsupportedOperationException() override fun iterator() = throw UnsupportedOperationException()
override fun containsAll(c: Collection<String>) = throw UnsupportedOperationException() override fun containsAll(c: Collection<String>) = throw UnsupportedOperationException()
@@ -16,7 +16,7 @@ open class A1 {
} }
class B1 : Collection<String>, A1() { class B1 : Collection<String>, A1() {
override fun isEmpty() = throw UnsupportedOperationException() override val isEmpty: Boolean get() = throw UnsupportedOperationException()
override fun contains(o: String) = throw UnsupportedOperationException() override fun contains(o: String) = throw UnsupportedOperationException()
override fun iterator() = throw UnsupportedOperationException() override fun iterator() = throw UnsupportedOperationException()
override fun containsAll(c: Collection<String>) = throw UnsupportedOperationException() override fun containsAll(c: Collection<String>) = throw UnsupportedOperationException()
@@ -41,7 +41,7 @@ interface I4<T> {
} }
class B4 : Collection<String>, I4<Int> { class B4 : Collection<String>, I4<Int> {
override fun isEmpty() = throw UnsupportedOperationException() override val isEmpty: Boolean get() = throw UnsupportedOperationException()
override fun contains(o: String) = throw UnsupportedOperationException() override fun contains(o: String) = throw UnsupportedOperationException()
override fun iterator() = throw UnsupportedOperationException() override fun iterator() = throw UnsupportedOperationException()
override fun containsAll(c: Collection<String>) = throw UnsupportedOperationException() override fun containsAll(c: Collection<String>) = throw UnsupportedOperationException()
@@ -52,7 +52,7 @@ interface I5 : Collection<String> {
} }
class B5 : I5 { class B5 : I5 {
override fun isEmpty() = throw UnsupportedOperationException() override val isEmpty: Boolean get() = throw UnsupportedOperationException()
override fun contains(o: String) = throw UnsupportedOperationException() override fun contains(o: String) = throw UnsupportedOperationException()
override fun iterator() = throw UnsupportedOperationException() override fun iterator() = throw UnsupportedOperationException()
override fun containsAll(c: Collection<String>) = throw UnsupportedOperationException() override fun containsAll(c: Collection<String>) = throw UnsupportedOperationException()
@@ -2,7 +2,7 @@ class A1 : MutableCollection<String> {
override val size: Int override val size: Int
get() = 56 get() = 56
override fun isEmpty(): Boolean { override val isEmpty: Boolean get() {
throw UnsupportedOperationException() throw UnsupportedOperationException()
} }
+1 -1
View File
@@ -1,7 +1,7 @@
class A : Map<String, String> { class A : Map<String, String> {
override val size: Int get() = 56 override val size: Int get() = 56
override fun isEmpty(): Boolean { override val isEmpty: Boolean get() {
throw UnsupportedOperationException() throw UnsupportedOperationException()
} }
@@ -1,6 +1,6 @@
abstract class C : Test.A, List<String> { abstract class C : Test.A, List<String> {
override val size: Int get() = null!! override val size: Int get() = null!!
override fun isEmpty(): Boolean = null!! override val isEmpty: Boolean get() = null!!
override fun contains(o: String): Boolean = null!! override fun contains(o: String): Boolean = null!!
override fun iterator(): Iterator<String> = null!! override fun iterator(): Iterator<String> = null!!
override fun containsAll(c: Collection<String>): Boolean = null!! override fun containsAll(c: Collection<String>): Boolean = null!!
@@ -58,7 +58,7 @@ open class KList<E> : MutableList<E> {
override val size: Int override val size: Int
get() = throw UnsupportedOperationException() get() = throw UnsupportedOperationException()
override fun isEmpty(): Boolean { override val isEmpty: Boolean get() {
throw UnsupportedOperationException() throw UnsupportedOperationException()
} }
@@ -2,7 +2,7 @@ open class KList : MutableList<String> {
override val size: Int override val size: Int
get() = throw UnsupportedOperationException() get() = throw UnsupportedOperationException()
override fun isEmpty(): Boolean { override val isEmpty: Boolean get() {
throw UnsupportedOperationException() throw UnsupportedOperationException()
} }
@@ -18,13 +18,13 @@ class M : Map<String, String> by HashMap<String, String>()
class MM : MutableMap<String, String> by HashMap<String, String>() class MM : MutableMap<String, String> by HashMap<String, String>()
class ME : Map.Entry<String, String> { class ME : Map.Entry<String, String> {
override fun getKey(): String = throw UnsupportedOperationException() override val key: String get() = throw UnsupportedOperationException()
override fun getValue(): String = throw UnsupportedOperationException() override val value: String get() = throw UnsupportedOperationException()
} }
class MME : MutableMap.MutableEntry<String, String> { class MME : MutableMap.MutableEntry<String, String> {
override fun getKey(): String = throw UnsupportedOperationException() override val key: String get() = throw UnsupportedOperationException()
override fun getValue(): String = throw UnsupportedOperationException() override val value: String get() = throw UnsupportedOperationException()
override fun setValue(value: String): String = throw UnsupportedOperationException() override fun setValue(value: String): String = throw UnsupportedOperationException()
} }
@@ -18,13 +18,13 @@ class M : Map<String, String> by HashMap<String, String>()
class MM : MutableMap<String, String> by HashMap<String, String>() class MM : MutableMap<String, String> by HashMap<String, String>()
class ME : Map.Entry<String, String> { class ME : Map.Entry<String, String> {
override fun getKey(): String = throw UnsupportedOperationException() override val key: String get() = throw UnsupportedOperationException()
override fun getValue(): String = throw UnsupportedOperationException() override val value: String get() = throw UnsupportedOperationException()
} }
class MME : MutableMap.MutableEntry<String, String> { class MME : MutableMap.MutableEntry<String, String> {
override fun getKey(): String = throw UnsupportedOperationException() override val key: String get() = throw UnsupportedOperationException()
override fun getValue(): String = throw UnsupportedOperationException() override val value: String get() = throw UnsupportedOperationException()
override fun setValue(value: String): String = throw UnsupportedOperationException() override fun setValue(value: String): String = throw UnsupportedOperationException()
} }
@@ -18,13 +18,13 @@ class M : Map<String, String> by HashMap<String, String>()
class MM : MutableMap<String, String> by HashMap<String, String>() class MM : MutableMap<String, String> by HashMap<String, String>()
class ME : Map.Entry<String, String> { class ME : Map.Entry<String, String> {
override fun getKey(): String = throw UnsupportedOperationException() override val key: String get() = throw UnsupportedOperationException()
override fun getValue(): String = throw UnsupportedOperationException() override val value: String get() = throw UnsupportedOperationException()
} }
class MME : MutableMap.MutableEntry<String, String> { class MME : MutableMap.MutableEntry<String, String> {
override fun getKey(): String = throw UnsupportedOperationException() override val key: String get() = throw UnsupportedOperationException()
override fun getValue(): String = throw UnsupportedOperationException() override val value: String get() = throw UnsupportedOperationException()
override fun setValue(value: String): String = throw UnsupportedOperationException() override fun setValue(value: String): String = throw UnsupportedOperationException()
} }
@@ -18,13 +18,13 @@ class M : Map<String, String> by HashMap<String, String>()
class MM : MutableMap<String, String> by HashMap<String, String>() class MM : MutableMap<String, String> by HashMap<String, String>()
class ME : Map.Entry<String, String> { class ME : Map.Entry<String, String> {
override fun getKey(): String = throw UnsupportedOperationException() override val key: String get() = throw UnsupportedOperationException()
override fun getValue(): String = throw UnsupportedOperationException() override val value: String get() = throw UnsupportedOperationException()
} }
class MME : MutableMap.MutableEntry<String, String> { class MME : MutableMap.MutableEntry<String, String> {
override fun getKey(): String = throw UnsupportedOperationException() override val key: String get() = throw UnsupportedOperationException()
override fun getValue(): String = throw UnsupportedOperationException() override val value: String get() = throw UnsupportedOperationException()
override fun setValue(value: String): String = throw UnsupportedOperationException() override fun setValue(value: String): String = throw UnsupportedOperationException()
} }
@@ -18,13 +18,13 @@ class M : Map<String, String> by HashMap<String, String>()
class MM : MutableMap<String, String> by HashMap<String, String>() class MM : MutableMap<String, String> by HashMap<String, String>()
class ME : Map.Entry<String, String> { class ME : Map.Entry<String, String> {
override fun getKey(): String = throw UnsupportedOperationException() override val key: String get() = throw UnsupportedOperationException()
override fun getValue(): String = throw UnsupportedOperationException() override val value: String get() = throw UnsupportedOperationException()
} }
class MME : MutableMap.MutableEntry<String, String> { class MME : MutableMap.MutableEntry<String, String> {
override fun getKey(): String = throw UnsupportedOperationException() override val key: String get() = throw UnsupportedOperationException()
override fun getValue(): String = throw UnsupportedOperationException() override val value: String get() = throw UnsupportedOperationException()
override fun setValue(value: String): String = throw UnsupportedOperationException() override fun setValue(value: String): String = throw UnsupportedOperationException()
} }
@@ -18,13 +18,13 @@ class M : Map<String, String> by HashMap<String, String>()
class MM : MutableMap<String, String> by HashMap<String, String>() class MM : MutableMap<String, String> by HashMap<String, String>()
class ME : Map.Entry<String, String> { class ME : Map.Entry<String, String> {
override fun getKey(): String = throw UnsupportedOperationException() override val key: String get() = throw UnsupportedOperationException()
override fun getValue(): String = throw UnsupportedOperationException() override val value: String get() = throw UnsupportedOperationException()
} }
class MME : MutableMap.MutableEntry<String, String> { class MME : MutableMap.MutableEntry<String, String> {
override fun getKey(): String = throw UnsupportedOperationException() override val key: String get() = throw UnsupportedOperationException()
override fun getValue(): String = throw UnsupportedOperationException() override val value: String get() = throw UnsupportedOperationException()
override fun setValue(value: String): String = throw UnsupportedOperationException() override fun setValue(value: String): String = throw UnsupportedOperationException()
} }
@@ -3,8 +3,8 @@ fun unsupported(): Nothing = throw UnsupportedOperationException()
class Weird : Iterator<String>, MutableIterable<String>, MutableMap.MutableEntry<String, String> { class Weird : Iterator<String>, MutableIterable<String>, MutableMap.MutableEntry<String, String> {
override fun next(): String = unsupported() override fun next(): String = unsupported()
override fun hasNext(): Boolean = unsupported() override fun hasNext(): Boolean = unsupported()
override fun getKey(): String = unsupported() override val key: String get() = unsupported()
override fun getValue(): String = unsupported() override val value: String get() = unsupported()
override fun setValue(value: String): String = unsupported() override fun setValue(value: String): String = unsupported()
override fun iterator(): MutableIterator<String> = unsupported() override fun iterator(): MutableIterator<String> = unsupported()
} }
+4 -4
View File
@@ -2,7 +2,7 @@ package collections
fun <T> testCollection(c: Collection<T>, t: T) { fun <T> testCollection(c: Collection<T>, t: T) {
c.size c.size
c.isEmpty() c.isEmpty
c.contains(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>) c.contains(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>)
val <!UNUSED_VARIABLE!>iterator<!>: Iterator<T> = c.iterator() val <!UNUSED_VARIABLE!>iterator<!>: Iterator<T> = c.iterator()
c.containsAll(c) c.containsAll(c)
@@ -18,7 +18,7 @@ fun <T> testCollection(c: Collection<T>, t: T) {
} }
fun <T> testMutableCollection(c: MutableCollection<T>, t: T) { fun <T> testMutableCollection(c: MutableCollection<T>, t: T) {
c.size c.size
c.isEmpty() c.isEmpty
c.contains(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>) c.contains(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>)
val <!UNUSED_VARIABLE!>iterator<!>: Iterator<T> = c.iterator() val <!UNUSED_VARIABLE!>iterator<!>: Iterator<T> = c.iterator()
c.containsAll(c) c.containsAll(c)
@@ -60,7 +60,7 @@ fun <T> testMutableList(l: MutableList<T>, t: T) {
fun <T> testSet(s: Set<T>, t: T) { fun <T> testSet(s: Set<T>, t: T) {
s.size s.size
s.isEmpty() s.isEmpty
s.contains(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>) s.contains(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>)
val <!UNUSED_VARIABLE!>iterator<!>: Iterator<T> = s.iterator() val <!UNUSED_VARIABLE!>iterator<!>: Iterator<T> = s.iterator()
s.containsAll(s) s.containsAll(s)
@@ -76,7 +76,7 @@ fun <T> testSet(s: Set<T>, t: T) {
} }
fun <T> testMutableSet(s: MutableSet<T>, t: T) { fun <T> testMutableSet(s: MutableSet<T>, t: T) {
s.size s.size
s.isEmpty() s.isEmpty
s.contains(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>) s.contains(<!CONSTANT_EXPECTED_TYPE_MISMATCH!>1<!>)
val <!UNUSED_VARIABLE!>iterator<!>: Iterator<T> = s.iterator() val <!UNUSED_VARIABLE!>iterator<!>: Iterator<T> = s.iterator()
s.containsAll(s) s.containsAll(s)