Rename ByteArray getters

This commit is contained in:
Pavel Punegov
2018-09-28 16:15:47 +03:00
committed by Pavel Punegov
parent 5d1c1c89a6
commit 366bb0c5e6
3 changed files with 23 additions and 23 deletions
@@ -12,13 +12,13 @@ import kotlin.test.*
val array = ByteArray(42)
array.setLongAt(5, 0x1234_5678_9abc_def0)
expect(0xdef0.toInt()) { array.charAt(5).toInt() }
expect(0x9abc.toShort()) { array.shortAt(7) }
expect(0x1234_5678) { array.intAt(9) }
expect(0xdef0_0000u) { array.uintAt(3) }
expect(0xf0_00u) { array.ushortAt(4) }
expect(0xf0u) { array.ubyteAt(5) }
expect(0x1234_5678_9abcuL) { array.ulongAt(7) }
expect(0xdef0.toInt()) { array.getCharAt(5).toInt() }
expect(0x9abc.toShort()) { array.getShortAt(7) }
expect(0x1234_5678) { array.getIntAt(9) }
expect(0xdef0_0000u) { array.getUIntAt(3) }
expect(0xf0_00u) { array.getUShortAt(4) }
expect(0xf0u) { array.getUByteAt(5) }
expect(0x1234_5678_9abcuL) { array.getULongAt(7) }
println("OK")
}
@@ -12,32 +12,32 @@ import kotlin.test.*
val results = mutableSetOf<Any>()
var counter = 0
try {
results += array.shortAt(16)
results += array.getShortAt(16)
} catch (e: ArrayIndexOutOfBoundsException) {
counter++
}
try {
results += array.charAt(22)
results += array.getCharAt(22)
} catch (e: ArrayIndexOutOfBoundsException) {
counter++
}
try {
results += array.intAt(15)
results += array.getIntAt(15)
} catch (e: ArrayIndexOutOfBoundsException) {
counter++
}
try {
results += array.longAt(14)
results += array.getLongAt(14)
} catch (e: ArrayIndexOutOfBoundsException) {
counter++
}
try {
results += array.floatAt(14)
results += array.getFloatAt(14)
} catch (e: ArrayIndexOutOfBoundsException) {
counter++
}
try {
results += array.doubleAt(13)
results += array.getDoubleAt(13)
} catch (e: ArrayIndexOutOfBoundsException) {
counter++
}