Stdlib tests: cleanup warnings
This commit is contained in:
@@ -136,14 +136,14 @@ class IndexOverflowJVMTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun foldIndexedOverflow() {
|
fun foldIndexedOverflow() {
|
||||||
assertIndexOverflow { maxIndexSequence.foldIndexed("") { index, acc, s -> checkIndexPositive(index); s } }
|
assertIndexOverflow { maxIndexSequence.foldIndexed("") { index, _, s -> checkIndexPositive(index); s } }
|
||||||
assertIndexOverflow { maxIndexIterable.foldIndexed("") { index, acc, s -> checkIndexPositive(index); s } }
|
assertIndexOverflow { maxIndexIterable.foldIndexed("") { index, _, s -> checkIndexPositive(index); s } }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun reduceIndexedOverflow() {
|
fun reduceIndexedOverflow() {
|
||||||
assertIndexOverflow { maxIndexSequence.reduceIndexed { index, acc, s -> checkIndexPositive(index); s } }
|
assertIndexOverflow { maxIndexSequence.reduceIndexed { index, _, s -> checkIndexPositive(index); s } }
|
||||||
assertIndexOverflow { maxIndexIterable.reduceIndexed { index, acc, s -> checkIndexPositive(index); s } }
|
assertIndexOverflow { maxIndexIterable.reduceIndexed { index, _, s -> checkIndexPositive(index); s } }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -233,12 +233,6 @@ class ArraysTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test fun contentDeepToString() {
|
@Test fun contentDeepToString() {
|
||||||
// Don't run this test unless primitive array `is` checks are supported (KT-17137)
|
|
||||||
if ((intArrayOf() as Any) is Array<*>) {
|
|
||||||
assertTrue(true)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val arr = arrayOf(
|
val arr = arrayOf(
|
||||||
"aa", 1, null, arrayOf(arrayOf("foo")), charArrayOf('d'), booleanArrayOf(false),
|
"aa", 1, null, arrayOf(arrayOf("foo")), charArrayOf('d'), booleanArrayOf(false),
|
||||||
intArrayOf(-1), longArrayOf(-1), shortArrayOf(-1), byteArrayOf(-1),
|
intArrayOf(-1), longArrayOf(-1), shortArrayOf(-1), byteArrayOf(-1),
|
||||||
|
|||||||
@@ -154,8 +154,10 @@ public class SequenceTest {
|
|||||||
assertFailsWith<IllegalArgumentException> { fibonacci().drop(-1) }
|
assertFailsWith<IllegalArgumentException> { fibonacci().drop(-1) }
|
||||||
|
|
||||||
val dropMax = fibonacci().drop(Int.MAX_VALUE)
|
val dropMax = fibonacci().drop(Int.MAX_VALUE)
|
||||||
val dropMore = dropMax.drop(Int.MAX_VALUE)
|
run @Suppress("UNUSED_VARIABLE") {
|
||||||
val takeMore = dropMax.take(Int.MAX_VALUE)
|
val dropMore = dropMax.drop(Int.MAX_VALUE)
|
||||||
|
val takeMore = dropMax.take(Int.MAX_VALUE)
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -296,11 +296,12 @@ public class RangeTest {
|
|||||||
assertTrue(Double.MAX_VALUE in halfInfRange)
|
assertTrue(Double.MAX_VALUE in halfInfRange)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("EmptyRange")
|
||||||
@Test fun isEmpty() {
|
@Test fun isEmpty() {
|
||||||
assertTrue((2..1).isEmpty())
|
assertTrue((2..1).isEmpty())
|
||||||
assertTrue((2L..0L).isEmpty())
|
assertTrue((2L..0L).isEmpty())
|
||||||
assertTrue((1.toShort()..-1.toShort()).isEmpty())
|
assertTrue((1.toShort()..(-1).toShort()).isEmpty())
|
||||||
assertTrue((0.toByte()..-1.toByte()).isEmpty())
|
assertTrue((0.toByte()..(-1).toByte()).isEmpty())
|
||||||
assertTrue((0f..-3.14f).isEmpty())
|
assertTrue((0f..-3.14f).isEmpty())
|
||||||
assertTrue((-2.72..-3.14).isEmpty())
|
assertTrue((-2.72..-3.14).isEmpty())
|
||||||
assertTrue(('z'..'x').isEmpty())
|
assertTrue(('z'..'x').isEmpty())
|
||||||
@@ -315,6 +316,7 @@ public class RangeTest {
|
|||||||
assertTrue(("range".."progression").isEmpty())
|
assertTrue(("range".."progression").isEmpty())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("ReplaceAssertBooleanWithAssertEquality", "EmptyRange")
|
||||||
@Test fun emptyEquals() {
|
@Test fun emptyEquals() {
|
||||||
assertTrue(IntRange.EMPTY == IntRange.EMPTY)
|
assertTrue(IntRange.EMPTY == IntRange.EMPTY)
|
||||||
assertEquals(IntRange.EMPTY, IntRange.EMPTY)
|
assertEquals(IntRange.EMPTY, IntRange.EMPTY)
|
||||||
@@ -340,14 +342,15 @@ public class RangeTest {
|
|||||||
assertFalse(("aa".."bb") == ("aaa".."bbb"))
|
assertFalse(("aa".."bb") == ("aaa".."bbb"))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Suppress("EmptyRange")
|
||||||
@Test fun emptyHashCode() {
|
@Test fun emptyHashCode() {
|
||||||
assertEquals((0..42).hashCode(), (0..42).hashCode())
|
assertEquals((0..42).hashCode(), (0..42).hashCode())
|
||||||
assertEquals((1.23..4.56).hashCode(), (1.23..4.56).hashCode())
|
assertEquals((1.23..4.56).hashCode(), (1.23..4.56).hashCode())
|
||||||
|
|
||||||
assertEquals((0..-1).hashCode(), IntRange.EMPTY.hashCode())
|
assertEquals((0..-1).hashCode(), IntRange.EMPTY.hashCode())
|
||||||
assertEquals((2L..1L).hashCode(), (1L..0L).hashCode())
|
assertEquals((2L..1L).hashCode(), (1L..0L).hashCode())
|
||||||
assertEquals((0.toShort()..-1.toShort()).hashCode(), (42.toShort()..0.toShort()).hashCode())
|
assertEquals((0.toShort()..(-1).toShort()).hashCode(), (42.toShort()..0.toShort()).hashCode())
|
||||||
assertEquals((0.toByte()..-1.toByte()).hashCode(), (42.toByte()..0.toByte()).hashCode())
|
assertEquals((0.toByte()..(-1).toByte()).hashCode(), (42.toByte()..0.toByte()).hashCode())
|
||||||
assertEquals((0f..-3.14f).hashCode(), (2.39f..1.41f).hashCode())
|
assertEquals((0f..-3.14f).hashCode(), (2.39f..1.41f).hashCode())
|
||||||
assertEquals((0.0..-10.0).hashCode(), (10.0..0.0).hashCode())
|
assertEquals((0.0..-10.0).hashCode(), (10.0..0.0).hashCode())
|
||||||
assertEquals(('z'..'x').hashCode(), ('l'..'k').hashCode())
|
assertEquals(('z'..'x').hashCode(), ('l'..'k').hashCode())
|
||||||
@@ -390,8 +393,8 @@ public class RangeTest {
|
|||||||
assertFailsWithIllegalArgument { 'a'..'z' step 0 }
|
assertFailsWithIllegalArgument { 'a'..'z' step 0 }
|
||||||
|
|
||||||
assertFailsWithIllegalArgument { 0 downTo -5 step 0 }
|
assertFailsWithIllegalArgument { 0 downTo -5 step 0 }
|
||||||
assertFailsWithIllegalArgument { 0.toByte() downTo -5.toByte() step 0 }
|
assertFailsWithIllegalArgument { 0.toByte() downTo (-5).toByte() step 0 }
|
||||||
assertFailsWithIllegalArgument { 0.toShort() downTo -5.toShort() step 0 }
|
assertFailsWithIllegalArgument { 0.toShort() downTo (-5).toShort() step 0 }
|
||||||
assertFailsWithIllegalArgument { 0L downTo -5L step 0L }
|
assertFailsWithIllegalArgument { 0L downTo -5L step 0L }
|
||||||
assertFailsWithIllegalArgument { 'z' downTo 'a' step 0 }
|
assertFailsWithIllegalArgument { 'z' downTo 'a' step 0 }
|
||||||
|
|
||||||
@@ -403,8 +406,8 @@ public class RangeTest {
|
|||||||
|
|
||||||
|
|
||||||
assertFailsWithIllegalArgument { 0 downTo -5 step -2 }
|
assertFailsWithIllegalArgument { 0 downTo -5 step -2 }
|
||||||
assertFailsWithIllegalArgument { 0.toByte() downTo -5.toByte() step -2 }
|
assertFailsWithIllegalArgument { 0.toByte() downTo (-5).toByte() step -2 }
|
||||||
assertFailsWithIllegalArgument { 0.toShort() downTo -5.toShort() step -2 }
|
assertFailsWithIllegalArgument { 0.toShort() downTo (-5).toShort() step -2 }
|
||||||
assertFailsWithIllegalArgument { 0L downTo -5L step -2L }
|
assertFailsWithIllegalArgument { 0L downTo -5L step -2L }
|
||||||
assertFailsWithIllegalArgument { 'z' downTo 'a' step -2 }
|
assertFailsWithIllegalArgument { 'z' downTo 'a' step -2 }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user