Add more tests in uncommonCases folder
1) dataClass.kt - test with data class 2) receiver.kt - test with Int extension receiver 3) delegation.kt - test with implementation by delegation
This commit is contained in:
committed by
Mikhail Glukhikh
parent
b8ef09a157
commit
262f57d938
@@ -0,0 +1,55 @@
|
||||
data class Vector(val x: Int, val y: Int) {
|
||||
// Vector
|
||||
// │ constructor Vector(Int, Int)
|
||||
// │ │ val (Vector).x: Int
|
||||
// │ │ │ fun (Int).plus(Int): Int
|
||||
// │ │ │ │ Vector.plus.other: Vector
|
||||
// │ │ │ │ │ val (Vector).x: Int
|
||||
// │ │ │ │ │ │ val (Vector).y: Int
|
||||
// │ │ │ │ │ │ │ fun (Int).plus(Int): Int
|
||||
// │ │ │ │ │ │ │ │ Vector.plus.other: Vector
|
||||
// │ │ │ │ │ │ │ │ │ val (Vector).y: Int
|
||||
// │ │ │ │ │ │ │ │ │ │
|
||||
fun plus(other: Vector): Vector = Vector(x + other.x, y + other.y)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
// Vector
|
||||
// │ constructor Vector(Int, Int)
|
||||
// │ │ Int
|
||||
// │ │ │ Int
|
||||
// │ │ │ │
|
||||
val a = Vector(1, 2)
|
||||
// Vector
|
||||
// │ constructor Vector(Int, Int)
|
||||
// │ │ fun (Int).unaryMinus(): Int
|
||||
// │ │ │Int
|
||||
// │ │ ││ Int
|
||||
// │ │ ││ │
|
||||
val b = Vector(-1, 10)
|
||||
|
||||
// fun io/println(Any?): Unit
|
||||
// │ val main.a: Vector
|
||||
// │ │ val main.b: Vector
|
||||
// │ │ │ fun (Vector).toString(): String
|
||||
// │ │ │ │
|
||||
println("a = $a, b = ${b.toString()}")
|
||||
// fun io/println(Any?): Unit
|
||||
// │ fun (String).plus(Any?): String
|
||||
// │ │ val main.a: Vector
|
||||
// │ │ │ fun (Vector).plus(Vector): Vector
|
||||
// │ │ │ │ val main.b: Vector
|
||||
// │ │ │ │ │
|
||||
println("a + b = " + (a + b))
|
||||
// fun io/println(Any?): Unit
|
||||
// │ val main.a: Vector
|
||||
// │ │ fun (Vector).hashCode(): Int
|
||||
// │ │ │
|
||||
println("a hash - ${a.hashCode()}")
|
||||
|
||||
// val main.a: Vector
|
||||
// │ fun (Vector).equals(Any?): Boolean
|
||||
// fun io/println(Any?): Unit │ │ val main.b: Vector
|
||||
// │ │ │ │
|
||||
println("a is equal to b ${a.equals(b)}")
|
||||
}
|
||||
Reference in New Issue
Block a user