Add diagnostic spec tests generator and validator, helper functions and classes

This commit is contained in:
victor.petukhov
2018-08-10 17:48:09 +03:00
parent e989cf2bf4
commit 0a58898817
13 changed files with 623 additions and 2 deletions
@@ -0,0 +1,29 @@
fun getInt(arg: Any = Any()) = arg.hashCode()
fun getShort(arg: Any = Any()) = arg.hashCode().toShort()
fun getLong(arg: Any = Any()) = arg.hashCode().toLong()
fun getFloat(arg: Any = Any()) = arg.hashCode().toFloat()
fun getDouble(arg: Any = Any()) = arg.hashCode().toDouble()
fun getByte(arg: Any = Any()) = arg.hashCode().toByte()
fun getChar(arg: Any = Any()) = arg.hashCode().toChar()
fun getString(arg: Any = Any()) = arg.hashCode().toString()
fun getBoolean(arg: Any = Any()) = arg.hashCode() % 2 == 0
fun getNothing(): Nothing = throw Exception()
fun getUnit() = {}
fun getAny() = Any()
fun getList() = mutableListOf<Int>()
class _BasicTypesProvider {
fun getInt(arg: Any = Any()) = arg.hashCode()
fun getShort(arg: Any = Any()) = arg.hashCode().toShort()
fun getLong(arg: Any = Any()) = arg.hashCode().toLong()
fun getFloat(arg: Any = Any()) = arg.hashCode().toFloat()
fun getDouble(arg: Any = Any()) = arg.hashCode().toDouble()
fun getByte(arg: Any = Any()) = arg.hashCode().toByte()
fun getChar(arg: Any = Any()) = arg.hashCode().toChar()
fun getString(arg: Any = Any()) = arg.hashCode().toString()
fun getBoolean(arg: Any = Any()) = arg.hashCode() % 2 == 0
fun getNothing(): Nothing = throw Exception()
fun getUnit() = {}
fun getAny() = Any()
fun getList() = mutableListOf<Int>()
}
@@ -0,0 +1,35 @@
class _Class {
val prop_1 = 1
val prop_2 = 2
val prop_3 = 3
fun fun_1(): (Int) -> (Int) -> Int = {number: Int -> { number * 5 }}
fun fun_2(value: Int): Int = value * 2
fun fun_3(value1: Int): (Int) -> Int = fun(value2: Int): Int = value1 * value2 * 2
operator fun contains(a: Int): Boolean = a > 30
operator fun contains(a: Long): Boolean = a > 30L
operator fun contains(a: Char): Boolean = a > 30.toChar()
fun getIntArray(value: Int): IntArray = intArrayOf(1, 2, 3, value, 91923, 14, 123124)
fun getLongArray(value: Long): LongArray = longArrayOf(1L, 2L, 3L, value, 9192323244L, 14L, 123124L)
fun getCharArray(value: Char): CharArray = charArrayOf(1.toChar(), 2.toChar(), 3.toChar(), value)
class _NestedClass {
val prop_4 = 4
val prop_5 = 5
}
}
class _EmptyClass {}
class _ClassWithCompanionObject {
companion object {}
}
open class _ClassLevel1 {}
open class _ClassLevel2: _ClassLevel1() {}
open class _ClassLevel3: _ClassLevel2() {}
open class _ClassLevel4: _ClassLevel3() {}
open class _ClassLevel5: _ClassLevel4() {}
class _ClassLevel6: _ClassLevel5() {}
@@ -0,0 +1,9 @@
enum class _EnumClass {
NORTH, SOUTH, WEST, EAST
}
enum class _EnumClassSingle {
EVERYTHING
}
enum class _EnumClassEmpty
@@ -0,0 +1,3 @@
fun _funWithoutArgs(): Int {
return Any().hashCode().toInt()
}
@@ -0,0 +1 @@
object _EmptyObject {}
@@ -0,0 +1,36 @@
sealed class _SealedClass
data class _SealedChild1(val number: Int) : _SealedClass()
data class _SealedChild2(val e1: Int, val e2: Int) : _SealedClass()
data class _SealedChild3(val m1: Int, val m2: Int) : _SealedClass()
sealed class _SealedClassWithObjects
object _SealedWithObjectsChild1 : _SealedClassWithObjects()
object _SealedWithObjectsChild2 : _SealedClassWithObjects()
object _SealedWithObjectsChild3 : _SealedClassWithObjects()
sealed class _SealedClassSingle
data class _SealedSingleChild1(val number: Int) : _SealedClassSingle()
sealed class _SealedClassSingleWithObject
object _SealedSingleWithObjectChild1: Expr3() {}
sealed class _SealedClassEmpty
sealed class _SealedClassWithMethods
class _SealedWithMethodsChild1() : _SealedClassWithMethods() {
fun m1() = this.hashCode().toString()
}
class _SealedWithMethodsChild2() : _SealedClassWithMethods() {
fun m2() = this.hashCode().toString()
}
class _SealedWithMethodsChild3() : _SealedClassWithMethods() {
fun m3() = this.hashCode().toString()
}
sealed class _SealedClassMixed
data class _SealedMixedChild1(val number: Int) : _SealedClassMixed()
data class _SealedMixedChild2(val e1: Int, val e2: Int) : _SealedClassMixed()
data class _SealedMixedChild3(val m1: Int, val m2: Int) : _SealedClassMixed()
object _SealedMixedChildObject1 : _SealedClassMixed()
object _SealedMixedChildObject2 : _SealedClassMixed()
object _SealedMixedChildObject3 : _SealedClassMixed()
@@ -0,0 +1,4 @@
typealias _TypeAliasAny = Any
typealias _TypeAliasUnit = Unit
typealias _TypeAliasNothing = Nothing
typealias _TypeAliasInt = Int