[Tests] Add irText tests
This commit is contained in:
committed by
TeamCityServer
parent
a3cf1a11bf
commit
3f50b675b1
+90
@@ -0,0 +1,90 @@
|
||||
data class Pair<A : Any?, B : Any?> {
|
||||
constructor(first: A, second: B) /* primary */ {
|
||||
super/*Any*/()
|
||||
/* <init>() */
|
||||
|
||||
}
|
||||
|
||||
val first: A
|
||||
field = first
|
||||
get
|
||||
|
||||
val second: B
|
||||
field = second
|
||||
get
|
||||
|
||||
operator fun component1(): A {
|
||||
return <this>.#first
|
||||
}
|
||||
|
||||
operator fun component2(): B {
|
||||
return <this>.#second
|
||||
}
|
||||
|
||||
fun copy(first: A = <this>.#first, second: B = <this>.#second): Pair<A, B> {
|
||||
return Pair<A, B>(first = first, second = second)
|
||||
}
|
||||
|
||||
override fun toString(): String {
|
||||
return "Pair(" + "first=" + <this>.#first + ", " + "second=" + <this>.#second + ")"
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result: Int = when {
|
||||
EQEQ(arg0 = <this>.#first, arg1 = null) -> 0
|
||||
else -> <this>.#first.hashCode()
|
||||
}
|
||||
result = result.times(other = 31).plus(other = when {
|
||||
EQEQ(arg0 = <this>.#second, arg1 = null) -> 0
|
||||
else -> <this>.#second.hashCode()
|
||||
})
|
||||
return result
|
||||
}
|
||||
|
||||
override operator fun equals(other: Any?): Boolean {
|
||||
when {
|
||||
EQEQEQ(arg0 = <this>, arg1 = other) -> return true
|
||||
}
|
||||
when {
|
||||
other !is Pair<A, B> -> return false
|
||||
}
|
||||
val tmp0_other_with_cast: Pair<A, B> = other as Pair<A, B>
|
||||
when {
|
||||
EQEQ(arg0 = <this>.#first, arg1 = tmp0_other_with_cast.#first).not() -> return false
|
||||
}
|
||||
when {
|
||||
EQEQ(arg0 = <this>.#second, arg1 = tmp0_other_with_cast.#second).not() -> return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
infix operator fun <T : Any?> T.compareTo(<this>: Comparator<T>, other: T): Int {
|
||||
return <this>.compare(p0 = <this>, p1 = other)
|
||||
}
|
||||
|
||||
val <T : Any?> Pair<T, T>.min: T
|
||||
get(<this>: Comparator<T>): T {
|
||||
return when {
|
||||
less(arg0 = <this>.<get-first>().compareTo<T>(<this> = <this> /*as T */, other = <this>.<get-second>()), arg1 = 0) -> <this>.<get-first>()
|
||||
else -> <this>.<get-second>()
|
||||
}
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
val comparator: Comparator<String> = local fun <anonymous>(a: @FlexibleNullability String?, b: @FlexibleNullability String?): Int {
|
||||
return when {
|
||||
when {
|
||||
EQEQ(arg0 = a, arg1 = null) -> true
|
||||
else -> EQEQ(arg0 = b, arg1 = null)
|
||||
} -> 0
|
||||
else -> a /*!! String */.<get-length>().compareTo(other = b /*!! String */.<get-length>())
|
||||
}
|
||||
}
|
||||
/*-> Comparator<String> */
|
||||
return with<Comparator<String>, String>(receiver = comparator, block = local fun Comparator<String>.<anonymous>(): String {
|
||||
return Pair<String, String>(first = "OK", second = "fail").<get-min><String>(<this> = $this$with)
|
||||
}
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user