Get rid of deprecated annotations and modifiers in stdlib (besides JS)
This commit is contained in:
@@ -4,31 +4,31 @@ import kotlin.test.*
|
||||
import org.junit.Test as test
|
||||
|
||||
class BitwiseOperationsTest {
|
||||
test fun orForInt() {
|
||||
@test fun orForInt() {
|
||||
assertEquals(3, 2 or 1)
|
||||
}
|
||||
|
||||
test fun andForInt() {
|
||||
@test fun andForInt() {
|
||||
assertEquals(0, 1 and 0)
|
||||
}
|
||||
|
||||
test fun xorForInt() {
|
||||
@test fun xorForInt() {
|
||||
assertEquals(1, 2 xor 3)
|
||||
}
|
||||
|
||||
test fun shlForInt() {
|
||||
@test fun shlForInt() {
|
||||
assertEquals(4, 1 shl 2)
|
||||
}
|
||||
|
||||
test fun shrForInt() {
|
||||
@test fun shrForInt() {
|
||||
assertEquals(1, 2 shr 1)
|
||||
}
|
||||
|
||||
test fun ushrForInt() {
|
||||
@test fun ushrForInt() {
|
||||
assertEquals(2147483647, -1 ushr 1)
|
||||
}
|
||||
|
||||
test fun invForInt() {
|
||||
@test fun invForInt() {
|
||||
assertEquals(0, (-1).inv())
|
||||
}
|
||||
}
|
||||
@@ -34,7 +34,7 @@ public class RangeIterationJVMTest {
|
||||
assertEquals(expectedElements, sequence.toList())
|
||||
}
|
||||
|
||||
test fun infiniteSteps() {
|
||||
@test fun infiniteSteps() {
|
||||
doTest(0.0..5.0 step j.Double.POSITIVE_INFINITY, 0.0, 5.0, j.Double.POSITIVE_INFINITY, listOf(0.0))
|
||||
doTest(0.0.toFloat()..5.0.toFloat() step j.Float.POSITIVE_INFINITY, 0.0.toFloat(), 5.0.toFloat(), j.Float.POSITIVE_INFINITY,
|
||||
listOf<Float>(0.0.toFloat()))
|
||||
@@ -43,7 +43,7 @@ public class RangeIterationJVMTest {
|
||||
listOf<Float>(5.0.toFloat()))
|
||||
}
|
||||
|
||||
test fun nanEnds() {
|
||||
@test fun nanEnds() {
|
||||
doTest(j.Double.NaN..5.0, j.Double.NaN, 5.0, 1.0, listOf())
|
||||
doTest(j.Float.NaN.toFloat()..5.0.toFloat(), j.Float.NaN, 5.0.toFloat(), 1.0.toFloat(), listOf())
|
||||
doTest(j.Double.NaN downTo 0.0, j.Double.NaN, 0.0, -1.0, listOf())
|
||||
@@ -60,7 +60,7 @@ public class RangeIterationJVMTest {
|
||||
doTest(j.Float.NaN downTo j.Float.NaN, j.Float.NaN, j.Float.NaN, -1.0.toFloat(), listOf())
|
||||
}
|
||||
|
||||
test fun maxValueToMaxValue() {
|
||||
@test fun maxValueToMaxValue() {
|
||||
doTest(MaxI..MaxI, MaxI, MaxI, 1, listOf(MaxI))
|
||||
doTest(MaxB..MaxB, MaxB, MaxB, 1, listOf(MaxB))
|
||||
doTest(MaxS..MaxS, MaxS, MaxS, 1, listOf(MaxS))
|
||||
@@ -69,7 +69,7 @@ public class RangeIterationJVMTest {
|
||||
doTest(MaxC..MaxC, MaxC, MaxC, 1, listOf(MaxC))
|
||||
}
|
||||
|
||||
test fun maxValueMinusTwoToMaxValue() {
|
||||
@test fun maxValueMinusTwoToMaxValue() {
|
||||
doTest((MaxI - 2)..MaxI, MaxI - 2, MaxI, 1, listOf(MaxI - 2, MaxI - 1, MaxI))
|
||||
doTest((MaxB - 2).toByte()..MaxB, (MaxB - 2).toByte(), MaxB, 1, listOf((MaxB - 2).toByte(), (MaxB - 1).toByte(), MaxB))
|
||||
doTest((MaxS - 2).toShort()..MaxS, (MaxS - 2).toShort(), MaxS, 1, listOf((MaxS - 2).toShort(), (MaxS - 1).toShort(), MaxS))
|
||||
@@ -78,7 +78,7 @@ public class RangeIterationJVMTest {
|
||||
doTest((MaxC - 2)..MaxC, (MaxC - 2), MaxC, 1, listOf((MaxC - 2), (MaxC - 1), MaxC))
|
||||
}
|
||||
|
||||
test fun maxValueToMinValue() {
|
||||
@test fun maxValueToMinValue() {
|
||||
doTest(MaxI..MinI, MaxI, MinI, 1, listOf())
|
||||
doTest(MaxB..MinB, MaxB, MinB, 1, listOf())
|
||||
doTest(MaxS..MinS, MaxS, MinS, 1, listOf())
|
||||
@@ -87,7 +87,7 @@ public class RangeIterationJVMTest {
|
||||
doTest(MaxC..MinC, MaxC, MinC, 1, listOf())
|
||||
}
|
||||
|
||||
test fun progressionMaxValueToMaxValue() {
|
||||
@test fun progressionMaxValueToMaxValue() {
|
||||
doTest(MaxI..MaxI step 1, MaxI, MaxI, 1, listOf(MaxI))
|
||||
doTest(MaxB..MaxB step 1, MaxB, MaxB, 1, listOf(MaxB))
|
||||
doTest(MaxS..MaxS step 1, MaxS, MaxS, 1, listOf(MaxS))
|
||||
@@ -96,7 +96,7 @@ public class RangeIterationJVMTest {
|
||||
doTest(MaxC..MaxC step 1, MaxC, MaxC, 1, listOf(MaxC))
|
||||
}
|
||||
|
||||
test fun progressionMaxValueMinusTwoToMaxValue() {
|
||||
@test fun progressionMaxValueMinusTwoToMaxValue() {
|
||||
doTest((MaxI - 2)..MaxI step 2, MaxI - 2, MaxI, 2, listOf(MaxI - 2, MaxI))
|
||||
doTest((MaxB - 2).toByte()..MaxB step 2, (MaxB - 2).toByte(), MaxB, 2, listOf((MaxB - 2).toByte(), MaxB))
|
||||
doTest((MaxS - 2).toShort()..MaxS step 2, (MaxS - 2).toShort(), MaxS, 2, listOf((MaxS - 2).toShort(), MaxS))
|
||||
@@ -105,7 +105,7 @@ public class RangeIterationJVMTest {
|
||||
doTest((MaxC - 2)..MaxC step 2, (MaxC - 2), MaxC, 2, listOf((MaxC - 2), MaxC))
|
||||
}
|
||||
|
||||
test fun progressionMaxValueToMinValue() {
|
||||
@test fun progressionMaxValueToMinValue() {
|
||||
doTest(MaxI..MinI step 1, MaxI, MinI, 1, listOf())
|
||||
doTest(MaxB..MinB step 1, MaxB, MinB, 1, listOf())
|
||||
doTest(MaxS..MinS step 1, MaxS, MinS, 1, listOf())
|
||||
@@ -114,7 +114,7 @@ public class RangeIterationJVMTest {
|
||||
doTest(MaxC..MinC step 1, MaxC, MinC, 1, listOf())
|
||||
}
|
||||
|
||||
test fun progressionMinValueToMinValue() {
|
||||
@test fun progressionMinValueToMinValue() {
|
||||
doTest(MinI..MinI step 1, MinI, MinI, 1, listOf(MinI))
|
||||
doTest(MinB..MinB step 1, MinB, MinB, 1, listOf(MinB))
|
||||
doTest(MinS..MinS step 1, MinS, MinS, 1, listOf(MinS))
|
||||
@@ -123,7 +123,7 @@ public class RangeIterationJVMTest {
|
||||
doTest(MinC..MinC step 1, MinC, MinC, 1, listOf(MinC))
|
||||
}
|
||||
|
||||
test fun inexactToMaxValue() {
|
||||
@test fun inexactToMaxValue() {
|
||||
doTest((MaxI - 5)..MaxI step 3, MaxI - 5, MaxI, 3, listOf(MaxI - 5, MaxI - 2))
|
||||
doTest((MaxB - 5).toByte()..MaxB step 3, (MaxB - 5).toByte(), MaxB, 3, listOf((MaxB - 5).toByte(), (MaxB - 2).toByte()))
|
||||
doTest((MaxS - 5).toShort()..MaxS step 3, (MaxS - 5).toShort(), MaxS, 3, listOf((MaxS - 5).toShort(), (MaxS - 2).toShort()))
|
||||
@@ -132,7 +132,7 @@ public class RangeIterationJVMTest {
|
||||
doTest((MaxC - 5)..MaxC step 3, (MaxC - 5), MaxC, 3, listOf((MaxC - 5), (MaxC - 2)))
|
||||
}
|
||||
|
||||
test fun progressionDownToMinValue() {
|
||||
@test fun progressionDownToMinValue() {
|
||||
doTest((MinI + 2) downTo MinI step 1, MinI + 2, MinI, -1, listOf(MinI + 2, MinI + 1, MinI))
|
||||
doTest((MinB + 2).toByte() downTo MinB step 1, (MinB + 2).toByte(), MinB, -1, listOf((MinB + 2).toByte(), (MinB + 1).toByte(), MinB))
|
||||
doTest((MinS + 2).toShort() downTo MinS step 1, (MinS + 2).toShort(), MinS, -1, listOf((MinS + 2).toShort(), (MinS + 1).toShort(), MinS))
|
||||
@@ -141,7 +141,7 @@ public class RangeIterationJVMTest {
|
||||
doTest((MinC + 2) downTo MinC step 1, (MinC + 2), MinC, -1, listOf((MinC + 2), (MinC + 1), MinC))
|
||||
}
|
||||
|
||||
test fun inexactDownToMinValue() {
|
||||
@test fun inexactDownToMinValue() {
|
||||
doTest((MinI + 5) downTo MinI step 3, MinI + 5, MinI, -3, listOf(MinI + 5, MinI + 2))
|
||||
doTest((MinB + 5).toByte() downTo MinB step 3, (MinB + 5).toByte(), MinB, -3, listOf((MinB + 5).toByte(), (MinB + 2).toByte()))
|
||||
doTest((MinS + 5).toShort() downTo MinS step 3, (MinS + 5).toShort(), MinS, -3, listOf((MinS + 5).toShort(), (MinS + 2).toShort()))
|
||||
|
||||
@@ -22,7 +22,7 @@ public class RangeIterationTest {
|
||||
assertEquals(expectedElements, sequence.toList())
|
||||
}
|
||||
|
||||
test fun emptyConstant() {
|
||||
@test fun emptyConstant() {
|
||||
doTest(IntRange.EMPTY, 1, 0, 1, listOf())
|
||||
doTest(ByteRange.EMPTY, 1.toByte(), 0.toByte(), 1, listOf())
|
||||
doTest(ShortRange.EMPTY, 1.toShort(), 0.toShort(), 1, listOf())
|
||||
@@ -34,7 +34,7 @@ public class RangeIterationTest {
|
||||
doTest(FloatRange.EMPTY, 1.0.toFloat(), 0.0.toFloat(), 1.0.toFloat(), listOf())
|
||||
}
|
||||
|
||||
test fun emptyRange() {
|
||||
@test fun emptyRange() {
|
||||
doTest(10..5, 10, 5, 1, listOf())
|
||||
doTest(10.toByte()..(-5).toByte(), 10.toByte(), (-5).toByte(), 1, listOf())
|
||||
doTest(10.toShort()..(-5).toShort(), 10.toShort(), (-5).toShort(), 1, listOf())
|
||||
@@ -46,7 +46,7 @@ public class RangeIterationTest {
|
||||
doTest(5.0.toFloat()..-1.0.toFloat(), 5.0.toFloat(), -1.0.toFloat(), 1.toFloat(), listOf())
|
||||
}
|
||||
|
||||
test fun oneElementRange() {
|
||||
@test fun oneElementRange() {
|
||||
doTest(5..5, 5, 5, 1, listOf(5))
|
||||
doTest(5.toByte()..5.toByte(), 5.toByte(), 5.toByte(), 1, listOf(5.toByte()))
|
||||
doTest(5.toShort()..5.toShort(), 5.toShort(), 5.toShort(), 1, listOf(5.toShort()))
|
||||
@@ -58,7 +58,7 @@ public class RangeIterationTest {
|
||||
doTest(5.0.toFloat()..5.0.toFloat(), 5.0.toFloat(), 5.0.toFloat(), 1.toFloat(), listOf(5.0.toFloat()))
|
||||
}
|
||||
|
||||
test fun simpleRange() {
|
||||
@test fun simpleRange() {
|
||||
doTest(3..9, 3, 9, 1, listOf(3, 4, 5, 6, 7, 8, 9))
|
||||
doTest(3.toByte()..9.toByte(), 3.toByte(), 9.toByte(), 1, listOf<Byte>(3, 4, 5, 6, 7, 8, 9))
|
||||
doTest(3.toShort()..9.toShort(), 3.toShort(), 9.toShort(), 1, listOf<Short>(3, 4, 5, 6, 7, 8, 9))
|
||||
@@ -72,7 +72,7 @@ public class RangeIterationTest {
|
||||
}
|
||||
|
||||
|
||||
test fun simpleRangeWithNonConstantEnds() {
|
||||
@test fun simpleRangeWithNonConstantEnds() {
|
||||
doTest((1 + 2)..(10 - 1), 3, 9, 1, listOf(3, 4, 5, 6, 7, 8, 9))
|
||||
doTest((1.toByte() + 2.toByte()).toByte()..(10.toByte() - 1.toByte()).toByte(), 3.toByte(), 9.toByte(), 1, listOf<Byte>(3, 4, 5, 6, 7, 8, 9))
|
||||
doTest((1.toShort() + 2.toShort()).toShort()..(10.toShort() - 1.toShort()).toShort(), 3.toShort(), 9.toShort(), 1, listOf<Short>(3, 4, 5, 6, 7, 8, 9))
|
||||
@@ -85,7 +85,7 @@ public class RangeIterationTest {
|
||||
listOf<Float>(3.0.toFloat(), 4.0.toFloat(), 5.0.toFloat(), 6.0.toFloat(), 7.0.toFloat(), 8.0.toFloat(), 9.0.toFloat()))
|
||||
}
|
||||
|
||||
test fun openRange() {
|
||||
@test fun openRange() {
|
||||
doTest(1 until 5, 1, 4, 1, listOf(1, 2, 3, 4))
|
||||
doTest(1.toByte() until 5.toByte(), 1.toByte(), 4.toByte(), 1, listOf<Byte>(1, 2, 3, 4))
|
||||
doTest(1.toShort() until 5.toShort(), 1.toShort(), 4.toShort(), 1, listOf<Short>(1, 2, 3, 4))
|
||||
@@ -94,7 +94,7 @@ public class RangeIterationTest {
|
||||
}
|
||||
|
||||
|
||||
test fun emptyDownto() {
|
||||
@test fun emptyDownto() {
|
||||
doTest(5 downTo 10, 5, 10, -1, listOf())
|
||||
doTest(5.toByte() downTo 10.toByte(), 5.toByte(), 10.toByte(), -1, listOf())
|
||||
doTest(5.toShort() downTo 10.toShort(), 5.toShort(), 10.toShort(), -1, listOf())
|
||||
@@ -106,7 +106,7 @@ public class RangeIterationTest {
|
||||
doTest(-1.0.toFloat() downTo 5.0.toFloat(), -1.0.toFloat(), 5.0.toFloat(), -1.0.toFloat(), listOf())
|
||||
}
|
||||
|
||||
test fun oneElementDownTo() {
|
||||
@test fun oneElementDownTo() {
|
||||
doTest(5 downTo 5, 5, 5, -1, listOf(5))
|
||||
doTest(5.toByte() downTo 5.toByte(), 5.toByte(), 5.toByte(), -1, listOf(5.toByte()))
|
||||
doTest(5.toShort() downTo 5.toShort(), 5.toShort(), 5.toShort(), -1, listOf(5.toShort()))
|
||||
@@ -118,7 +118,7 @@ public class RangeIterationTest {
|
||||
doTest(5.0.toFloat() downTo 5.0.toFloat(), 5.0.toFloat(), 5.0.toFloat(), -1.0.toFloat(), listOf(5.0.toFloat()))
|
||||
}
|
||||
|
||||
test fun simpleDownTo() {
|
||||
@test fun simpleDownTo() {
|
||||
doTest(9 downTo 3, 9, 3, -1, listOf(9, 8, 7, 6, 5, 4, 3))
|
||||
doTest(9.toByte() downTo 3.toByte(), 9.toByte(), 3.toByte(), -1, listOf<Byte>(9, 8, 7, 6, 5, 4, 3))
|
||||
doTest(9.toShort() downTo 3.toShort(), 9.toShort(), 3.toShort(), -1, listOf<Short>(9, 8, 7, 6, 5, 4, 3))
|
||||
@@ -132,7 +132,7 @@ public class RangeIterationTest {
|
||||
}
|
||||
|
||||
|
||||
test fun simpleSteppedRange() {
|
||||
@test fun simpleSteppedRange() {
|
||||
doTest(3..9 step 2, 3, 9, 2, listOf(3, 5, 7, 9))
|
||||
doTest(3.toByte()..9.toByte() step 2, 3.toByte(), 9.toByte(), 2, listOf<Byte>(3, 5, 7, 9))
|
||||
doTest(3.toShort()..9.toShort() step 2, 3.toShort(), 9.toShort(), 2, listOf<Short>(3, 5, 7, 9))
|
||||
@@ -145,7 +145,7 @@ public class RangeIterationTest {
|
||||
listOf<Float>(4.0.toFloat(), 4.5.toFloat(), 5.0.toFloat(), 5.5.toFloat(), 6.0.toFloat()))
|
||||
}
|
||||
|
||||
test fun simpleSteppedDownTo() {
|
||||
@test fun simpleSteppedDownTo() {
|
||||
doTest(9 downTo 3 step 2, 9, 3, -2, listOf(9, 7, 5, 3))
|
||||
doTest(9.toByte() downTo 3.toByte() step 2, 9.toByte(), 3.toByte(), -2, listOf<Byte>(9, 7, 5, 3))
|
||||
doTest(9.toShort() downTo 3.toShort() step 2, 9.toShort(), 3.toShort(), -2, listOf<Short>(9, 7, 5, 3))
|
||||
@@ -160,7 +160,7 @@ public class RangeIterationTest {
|
||||
|
||||
|
||||
// 'inexact' means last element is not equal to sequence end
|
||||
test fun inexactSteppedRange() {
|
||||
@test fun inexactSteppedRange() {
|
||||
doTest(3..8 step 2, 3, 8, 2, listOf(3, 5, 7))
|
||||
doTest(3.toByte()..8.toByte() step 2, 3.toByte(), 8.toByte(), 2, listOf<Byte>(3, 5, 7))
|
||||
doTest(3.toShort()..8.toShort() step 2, 3.toShort(), 8.toShort(), 2, listOf<Short>(3, 5, 7))
|
||||
@@ -174,7 +174,7 @@ public class RangeIterationTest {
|
||||
}
|
||||
|
||||
// 'inexact' means last element is not equal to sequence end
|
||||
test fun inexactSteppedDownTo() {
|
||||
@test fun inexactSteppedDownTo() {
|
||||
doTest(8 downTo 3 step 2, 8, 3, -2, listOf(8, 6, 4))
|
||||
doTest(8.toByte() downTo 3.toByte() step 2, 8.toByte(), 3.toByte(), -2, listOf<Byte>(8, 6, 4))
|
||||
doTest(8.toShort() downTo 3.toShort() step 2, 8.toShort(), 3.toShort(), -2, listOf<Short>(8, 6, 4))
|
||||
@@ -188,7 +188,7 @@ public class RangeIterationTest {
|
||||
}
|
||||
|
||||
|
||||
test fun reversedEmptyRange() {
|
||||
@test fun reversedEmptyRange() {
|
||||
doTest((5..3).reversed(), 3, 5, -1, listOf())
|
||||
doTest((5.toByte()..3.toByte()).reversed(), 3.toByte(), 5.toByte(), -1, listOf())
|
||||
doTest((5.toShort()..3.toShort()).reversed(), 3.toShort(), 5.toShort(), -1, listOf())
|
||||
@@ -200,7 +200,7 @@ public class RangeIterationTest {
|
||||
doTest((5.0.toFloat()..3.0.toFloat()).reversed(), 3.0.toFloat(), 5.0.toFloat(), -1.toFloat(), listOf())
|
||||
}
|
||||
|
||||
test fun reversedEmptyBackSequence() {
|
||||
@test fun reversedEmptyBackSequence() {
|
||||
doTest((3 downTo 5).reversed(), 5, 3, 1, listOf())
|
||||
doTest((3.toByte() downTo 5.toByte()).reversed(), 5.toByte(), 3.toByte(), 1, listOf())
|
||||
doTest((3.toShort() downTo 5.toShort()).reversed(), 5.toShort(), 3.toShort(), 1, listOf())
|
||||
@@ -212,7 +212,7 @@ public class RangeIterationTest {
|
||||
doTest((3.0.toFloat() downTo 5.0.toFloat()).reversed(), 5.0.toFloat(), 3.0.toFloat(), 1.toFloat(), listOf())
|
||||
}
|
||||
|
||||
test fun reversedRange() {
|
||||
@test fun reversedRange() {
|
||||
doTest((3..5).reversed(), 5, 3, -1, listOf(5, 4, 3))
|
||||
doTest((3.toByte()..5.toByte()).reversed(), 5.toByte(), 3.toByte(), -1, listOf<Byte>(5, 4, 3))
|
||||
doTest((3.toShort()..5.toShort()).reversed(), 5.toShort(), 3.toShort(), -1, listOf<Short>(5, 4, 3))
|
||||
@@ -225,7 +225,7 @@ public class RangeIterationTest {
|
||||
listOf<Float>(5.0.toFloat(), 4.0.toFloat(), 3.0.toFloat()))
|
||||
}
|
||||
|
||||
test fun reversedBackSequence() {
|
||||
@test fun reversedBackSequence() {
|
||||
doTest((5 downTo 3).reversed(), 3, 5, 1, listOf(3, 4, 5))
|
||||
doTest((5.toByte() downTo 3.toByte()).reversed(), 3.toByte(), 5.toByte(), 1, listOf<Byte>(3, 4, 5))
|
||||
doTest((5.toShort() downTo 3.toShort()).reversed(), 3.toShort(), 5.toShort(), 1, listOf<Short>(3, 4, 5))
|
||||
@@ -238,7 +238,7 @@ public class RangeIterationTest {
|
||||
listOf<Float>(3.0.toFloat(), 4.0.toFloat(), 5.0.toFloat()))
|
||||
}
|
||||
|
||||
test fun reversedSimpleSteppedRange() {
|
||||
@test fun reversedSimpleSteppedRange() {
|
||||
doTest((3..9 step 2).reversed(), 9, 3, -2, listOf(9, 7, 5, 3))
|
||||
doTest((3.toByte()..9.toByte() step 2).reversed(), 9.toByte(), 3.toByte(), -2, listOf<Byte>(9, 7, 5, 3))
|
||||
doTest((3.toShort()..9.toShort() step 2).reversed(), 9.toShort(), 3.toShort(), -2, listOf<Short>(9, 7, 5, 3))
|
||||
@@ -252,7 +252,7 @@ public class RangeIterationTest {
|
||||
}
|
||||
|
||||
// 'inexact' means last element is not equal to sequence end
|
||||
test fun reversedInexactSteppedDownTo() {
|
||||
@test fun reversedInexactSteppedDownTo() {
|
||||
doTest((8 downTo 3 step 2).reversed(), 3, 8, 2, listOf(3, 5, 7))
|
||||
doTest((8.toByte() downTo 3.toByte() step 2).reversed(), 3.toByte(), 8.toByte(), 2, listOf<Byte>(3, 5, 7))
|
||||
doTest((8.toShort() downTo 3.toShort() step 2).reversed(), 3.toShort(), 8.toShort(), 2, listOf<Short>(3, 5, 7))
|
||||
|
||||
@@ -7,14 +7,14 @@ import kotlin.test.*
|
||||
|
||||
public class RangeJVMTest {
|
||||
|
||||
test fun doubleRange() {
|
||||
@test fun doubleRange() {
|
||||
val range = -1.0..3.14159265358979
|
||||
assertFalse(jDouble.NEGATIVE_INFINITY in range)
|
||||
assertFalse(jDouble.POSITIVE_INFINITY in range)
|
||||
assertFalse(jDouble.NaN in range)
|
||||
}
|
||||
|
||||
test fun floatRange() {
|
||||
@test fun floatRange() {
|
||||
val range = -1.0f..3.14159f
|
||||
assertFalse(jFloat.NEGATIVE_INFINITY in range)
|
||||
assertFalse(jFloat.POSITIVE_INFINITY in range)
|
||||
@@ -22,7 +22,7 @@ public class RangeJVMTest {
|
||||
assertFalse(jFloat.NaN in range)
|
||||
}
|
||||
|
||||
test fun illegalProgressionCreation() {
|
||||
@test fun illegalProgressionCreation() {
|
||||
fun assertFailsWithIllegalArgument(f: () -> Unit) = assertFailsWith(IllegalArgumentException::class, block = f)
|
||||
// create Progression explicitly with increment = 0
|
||||
assertFailsWithIllegalArgument { IntProgression(0, 5, 0) }
|
||||
|
||||
@@ -4,7 +4,7 @@ import kotlin.test.*
|
||||
import org.junit.Test as test
|
||||
|
||||
public class RangeTest {
|
||||
test fun intRange() {
|
||||
@test fun intRange() {
|
||||
val range = -5..9
|
||||
assertFalse(-1000 in range)
|
||||
assertFalse(-6 in range)
|
||||
@@ -36,7 +36,7 @@ public class RangeTest {
|
||||
assertTrue(fails { 1 until Int.MIN_VALUE } is IllegalArgumentException)
|
||||
}
|
||||
|
||||
test fun byteRange() {
|
||||
@test fun byteRange() {
|
||||
val range = (-5).toByte()..9.toByte()
|
||||
assertFalse((-100).toByte() in range)
|
||||
assertFalse((-6).toByte() in range)
|
||||
@@ -70,7 +70,7 @@ public class RangeTest {
|
||||
|
||||
}
|
||||
|
||||
test fun shortRange() {
|
||||
@test fun shortRange() {
|
||||
val range = (-5).toShort()..9.toShort()
|
||||
assertFalse((-1000).toShort() in range)
|
||||
assertFalse((-6).toShort() in range)
|
||||
@@ -102,7 +102,7 @@ public class RangeTest {
|
||||
assertTrue(fails { 0.toShort() until Short.MIN_VALUE } is IllegalArgumentException)
|
||||
}
|
||||
|
||||
test fun longRange() {
|
||||
@test fun longRange() {
|
||||
val range = -5L..9L
|
||||
assertFalse(-10000000L in range)
|
||||
assertFalse(-6L in range)
|
||||
@@ -135,7 +135,7 @@ public class RangeTest {
|
||||
|
||||
}
|
||||
|
||||
test fun charRange() {
|
||||
@test fun charRange() {
|
||||
val range = 'c'..'w'
|
||||
assertFalse('0' in range)
|
||||
assertFalse('b' in range)
|
||||
@@ -159,7 +159,7 @@ public class RangeTest {
|
||||
assertTrue(fails { 'A' until '\u0000' } is IllegalArgumentException)
|
||||
}
|
||||
|
||||
test fun doubleRange() {
|
||||
@test fun doubleRange() {
|
||||
val range = -1.0..3.14159265358979
|
||||
assertFalse(-1e200 in range)
|
||||
assertFalse(-100.0 in range)
|
||||
@@ -185,7 +185,7 @@ public class RangeTest {
|
||||
assertTrue(1.toFloat() in range)
|
||||
}
|
||||
|
||||
test fun floatRange() {
|
||||
@test fun floatRange() {
|
||||
val range = -1.0f..3.14159f
|
||||
assertFalse(-1e30f in range)
|
||||
assertFalse(-100.0f in range)
|
||||
@@ -213,7 +213,7 @@ public class RangeTest {
|
||||
assertFalse(Double.MAX_VALUE in range)
|
||||
}
|
||||
|
||||
test fun isEmpty() {
|
||||
@test fun isEmpty() {
|
||||
assertTrue((2..1).isEmpty())
|
||||
assertTrue((2L..0L).isEmpty())
|
||||
assertTrue((1.toShort()..-1.toShort()).isEmpty())
|
||||
@@ -232,7 +232,7 @@ public class RangeTest {
|
||||
assertTrue(("range".."progression").isEmpty())
|
||||
}
|
||||
|
||||
test fun emptyEquals() {
|
||||
@test fun emptyEquals() {
|
||||
assertTrue(IntRange.EMPTY == IntRange.EMPTY)
|
||||
assertEquals(IntRange.EMPTY, IntRange.EMPTY)
|
||||
assertEquals(0L..42L, 0L..42L)
|
||||
@@ -259,7 +259,7 @@ public class RangeTest {
|
||||
assertFalse(("aa".."bb") == ("aaa".."bbb"))
|
||||
}
|
||||
|
||||
test fun emptyHashCode() {
|
||||
@test fun emptyHashCode() {
|
||||
assertEquals((0..42).hashCode(), (0..42).hashCode())
|
||||
assertEquals((1.23..4.56).hashCode(), (1.23..4.56).hashCode())
|
||||
|
||||
@@ -279,7 +279,7 @@ public class RangeTest {
|
||||
assertEquals(("range".."progression").hashCode(), ("hashcode".."equals").hashCode())
|
||||
}
|
||||
|
||||
test fun comparableRange() {
|
||||
@test fun comparableRange() {
|
||||
val range = "island".."isle"
|
||||
assertFalse("apple" in range)
|
||||
assertFalse("icicle" in range)
|
||||
|
||||
@@ -41,7 +41,7 @@ val EXPECTED = """
|
||||
class StringExpressionExampleTest {
|
||||
val customer = Customer("James", arrayListOf(Product("Beer", 1.99), Product("Wine", 5.99)))
|
||||
|
||||
test fun testExpressions(): Unit {
|
||||
@test fun testExpressions(): Unit {
|
||||
assertEquals(EXPECTED, customerTemplate(customer))
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user