K2, stdlib tests: make unsigned conversions explicit

Allow using K2 to compile stdlib tests
related to #KT-56379
This commit is contained in:
Ilya Chernikov
2023-02-16 12:27:51 +01:00
committed by Space Team
parent edcde79c02
commit 8a8b204e11
3 changed files with 334 additions and 338 deletions
@@ -3,8 +3,6 @@
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/ */
@file:Suppress("SIGNED_CONSTANT_CONVERTED_TO_UNSIGNED")
package test.collections package test.collections
import test.assertStaticTypeIs import test.assertStaticTypeIs
@@ -987,20 +985,20 @@ class ArraysTest {
doTest( doTest(
UIntArray::copyInto, { e, a, msg -> assertTrue(e contentEquals a, msg) }, UIntArray::contentToString, UIntArray::copyInto, { e, a, msg -> assertTrue(e contentEquals a, msg) }, UIntArray::contentToString,
uintArrayOf(1, 2, 3), uintArrayOf(4, 5, 6), uintArrayOf(1u, 2u, 3u), uintArrayOf(4u, 5u, 6u),
uintArrayOf(5, 6, 3), uintArrayOf(6, 3, 3), uintArrayOf(6, 6, 3) uintArrayOf(5u, 6u, 3u), uintArrayOf(6u, 3u, 3u), uintArrayOf(6u, 6u, 3u)
) )
doTest( doTest(
ULongArray::copyInto, { e, a, msg -> assertTrue(e contentEquals a, msg) }, ULongArray::contentToString, ULongArray::copyInto, { e, a, msg -> assertTrue(e contentEquals a, msg) }, ULongArray::contentToString,
ulongArrayOf(1, 2, 3), ulongArrayOf(4, 5, 6), ulongArrayOf(1u, 2u, 3u), ulongArrayOf(4u, 5u, 6u),
ulongArrayOf(5, 6, 3), ulongArrayOf(6, 3, 3), ulongArrayOf(6, 6, 3) ulongArrayOf(5u, 6u, 3u), ulongArrayOf(6u, 3u, 3u), ulongArrayOf(6u, 6u, 3u)
) )
doTest( doTest(
UByteArray::copyInto, { e, a, msg -> assertTrue(e contentEquals a, msg) }, UByteArray::contentToString, UByteArray::copyInto, { e, a, msg -> assertTrue(e contentEquals a, msg) }, UByteArray::contentToString,
ubyteArrayOf(1, 2, 3), ubyteArrayOf(4, 5, 6), ubyteArrayOf(1u, 2u, 3u), ubyteArrayOf(4u, 5u, 6u),
ubyteArrayOf(5, 6, 3), ubyteArrayOf(6, 3, 3), ubyteArrayOf(6, 6, 3) ubyteArrayOf(5u, 6u, 3u), ubyteArrayOf(6u, 3u, 3u), ubyteArrayOf(6u, 6u, 3u)
) )
} }
File diff suppressed because it is too large Load Diff
@@ -233,17 +233,16 @@ class StringNumberConversionTest {
assertFailsOrNull(" ") assertFailsOrNull(" ")
} }
@Suppress("SIGNED_CONSTANT_CONVERTED_TO_UNSIGNED")
compareConversionWithRadix(String::toUInt, String::toUIntOrNull) { compareConversionWithRadix(String::toUInt, String::toUIntOrNull) {
assertProduces(10, "0", 0u) assertProduces(10, "0", 0u)
assertProduces(10, "473", 473u) assertProduces(10, "473", 473u)
assertProduces(10, "+42", 42u) assertProduces(10, "+42", 42u)
assertProduces(10, "2147483647", 2147483647u) assertProduces(10, "2147483647", 2147483647u)
assertProduces(16, "FF", 255) assertProduces(16, "FF", 255u)
assertProduces(16, "ffFFff01", 0u - 255u) assertProduces(16, "ffFFff01", 0u - 255u)
assertProduces(2, "1100110", 102) assertProduces(2, "1100110", 102u)
assertProduces(27, "Kona", 411787) assertProduces(27, "Kona", 411787u)
assertFailsOrNull(10, "-0") assertFailsOrNull(10, "-0")
assertFailsOrNull(10, "42949672940") assertFailsOrNull(10, "42949672940")