Removing usages of tuples from test data

(KT-2358 Drop tuples)
 #KT-2358 In progress
This commit is contained in:
Andrey Breslav
2012-09-18 13:48:20 +04:00
parent dee5152f9b
commit 5eaa5b396b
64 changed files with 172 additions and 330 deletions
@@ -1,3 +1,18 @@
class T4(
val c1: Boolean,
val c2: Boolean,
val c3: Boolean,
val c4: String
) {
fun equals(o: Any?): Boolean {
if (o !is T4) return false;
return c1 == o.c1 &&
c2 == o.c2 &&
c3 == o.c3 &&
c4 == o.c4
}
}
fun reformat(
str : String,
normalizeCase : Boolean = true,
@@ -5,11 +20,11 @@ fun reformat(
divideByCamelHumps : Boolean = true,
wordSeparator : String = " "
) =
#(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator)
T4(normalizeCase, uppercaseFirstLetter, divideByCamelHumps, wordSeparator)
fun box() : String {
val expected = #(true, true, true, " ")
val expected = T4(true, true, true, " ")
if(reformat("", true, true, true, " ") != expected) return "fail1"
if(reformat("", true, true, true) != expected) return "fail2"
if(reformat("", true, true) != expected) return "fail3"
@@ -1,15 +0,0 @@
package foo
fun box() : Boolean {
if (#(1, 2, 3)._1 != 1) return false;
if (#("a", "b")._2 != "b") return false;
val x = #("1", 2, "3", 4, "5", 6);
if (x._1 != "1") return false;
if (x._2 != 2) return false;
if (x._2 != 2) return false;
if (x._6 != 6) return false;
if (x._5 != "5") return false;
if (x._3 != "3") return false;
if (#(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)._21 != 1) return false;
return true;
}
@@ -1,31 +0,0 @@
package foo
class A(val i: Int = 2) {
fun equals(other: Any?): Boolean {
if (other !is A) {
return false
}
return i % 2 == other.i % 2
}
}
fun box(): Boolean {
val c = #(3, 1)
if (c != #(3, 1)) {
return false
}
if (c == #(1, 3)) {
return false
}
val b = #(A(2), A(1))
if (b != #(A(0), A(3))) {
return false
}
if (b == #(A(2), A(4))) {
return false
}
if (#("aaa") != #("aaa")) {
return false
}
return true
}
@@ -1,6 +0,0 @@
package foo
fun box() : Boolean {
val a : #(Int, Int) = #(1, 2)
return ((a._1 == 1) && (a._2 == 2))
}
@@ -156,7 +156,7 @@ class Creature(override var pos: Vector, val state: CanvasState): Shape() {
val gradientCentre = position + directionToLogo * (radius / 4)
val gradient = context.createRadialGradient(gradientCentre.x, gradientCentre.y, 1.0, gradientCentre.x, gradientCentre.y, 2 * radius)!!
for (colorStop in colorStops) {
gradient.addColorStop(colorStop._1, colorStop._2)
gradient.addColorStop(colorStop.first, colorStop.second)
}
return gradient
}
@@ -287,23 +287,23 @@ class CanvasState(val canvas: HTMLCanvasElement) {
}
class RadialGradientGenerator(val context: CanvasContext) {
val gradients = ArrayList<Array<#(Double, String)>>()
val gradients = ArrayList<Array<Pair<Double, String>>>()
var current = 0
fun newColorStops(vararg colorStops: #(Double, String)) {
fun newColorStops(vararg colorStops: Pair<Double, String>) {
gradients.add(colorStops)
}
{
newColorStops(#(0.0, "#F59898"), #(0.5, "#F57373"), #(1.0, "#DB6B6B"))
newColorStops(#(0.39, "rgb(140,167,209)"), #(0.7, "rgb(104,139,209)"), #(0.85, "rgb(67,122,217)"))
newColorStops(#(0.0, "rgb(255,222,255)"), #(0.5, "rgb(255,185,222)"), #(1.0, "rgb(230,154,185)"))
newColorStops(#(0.0, "rgb(255,209,114)"), #(0.5, "rgb(255,174,81)"), #(1.0, "rgb(241,145,54)"))
newColorStops(#(0.0, "rgb(132,240,135)"), #(0.5, "rgb(91,240,96)"), #(1.0, "rgb(27,245,41)"))
newColorStops(#(0.0, "rgb(250,147,250)"), #(0.5, "rgb(255,80,255)"), #(1.0, "rgb(250,0,217)"))
newColorStops(Pair(0.0, "#F59898"), Pair(0.5, "#F57373"), Pair(1.0, "#DB6B6B"))
newColorStops(Pair(0.39, "rgb(140,167,209)"), Pair(0.7, "rgb(104,139,209)"), Pair(0.85, "rgb(67,122,217)"))
newColorStops(Pair(0.0, "rgb(255,222,255)"), Pair(0.5, "rgb(255,185,222)"), Pair(1.0, "rgb(230,154,185)"))
newColorStops(Pair(0.0, "rgb(255,209,114)"), Pair(0.5, "rgb(255,174,81)"), Pair(1.0, "rgb(241,145,54)"))
newColorStops(Pair(0.0, "rgb(132,240,135)"), Pair(0.5, "rgb(91,240,96)"), Pair(1.0, "rgb(27,245,41)"))
newColorStops(Pair(0.0, "rgb(250,147,250)"), Pair(0.5, "rgb(255,80,255)"), Pair(1.0, "rgb(250,0,217)"))
}
fun getNext(): Array<#(Double, String)> {
fun getNext(): Array<Pair<Double, String>> {
val result = gradients.get(current)
current = (current + 1) % gradients.size()
return result