switch to signed-first approach
All checks were successful
/ test (pull_request) Successful in 2m47s

It turns out signed math is more performant
This commit is contained in:
2026-01-15 14:10:14 +01:00
parent d06e523914
commit ff0e17b5ad
35 changed files with 862 additions and 826 deletions

View File

@@ -0,0 +1,120 @@
package com.infendro.bytes.bytearray
import com.infendro.bytes.ByteOrder.LITTLE_ENDIAN
import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertEquals
class ByteArrayConversionTest {
@Test
fun toInt() {
val expected = 0x12345678
val actual = arrayOf(
byteArrayOf(0x12, 0x34, 0x56, 0x78).toInt(),
byteArrayOf(0x78, 0x56, 0x34, 0x12).toInt(order = LITTLE_ENDIAN),
)
assertEquals(expected, actual[0])
assertEquals(expected, actual[1])
}
@Test
fun toUInt() {
val expected = 0x12345678U
val actual = arrayOf(
byteArrayOf(0x12, 0x34, 0x56, 0x78).toUInt(),
byteArrayOf(0x78, 0x56, 0x34, 0x12).toUInt(order = LITTLE_ENDIAN),
)
assertEquals(expected, actual[0])
assertEquals(expected, actual[1])
}
@Test
fun toIntArray() {
val expected = intArrayOf(0x12345678, 0x78563412)
val actual = arrayOf(
byteArrayOf(
0x12, 0x34, 0x56, 0x78,
0x78, 0x56, 0x34, 0x12,
).toIntArray(),
byteArrayOf(
0x78, 0x56, 0x34, 0x12,
0x12, 0x34, 0x56, 0x78,
).toIntArray(LITTLE_ENDIAN),
)
assertContentEquals(expected, actual[0])
assertContentEquals(expected, actual[1])
}
@Test
fun toUIntArray() {
val expected = uintArrayOf(0x12345678U, 0x78563412U)
val actual = arrayOf(
byteArrayOf(
0x12, 0x34, 0x56, 0x78,
0x78, 0x56, 0x34, 0x12,
).toUIntArray(),
byteArrayOf(
0x78, 0x56, 0x34, 0x12,
0x12, 0x34, 0x56, 0x78,
).toUIntArray(LITTLE_ENDIAN),
)
assertContentEquals(expected, actual[0])
assertContentEquals(expected, actual[1])
}
@Test
fun toLong() {
val expected = 0x1234567878563412L
val actual = arrayOf(
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x78, 0x56, 0x34, 0x12).toLong(),
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x78, 0x56, 0x34, 0x12).toLong(order = LITTLE_ENDIAN),
)
assertEquals(expected, actual[0])
assertEquals(expected, actual[1])
}
@Test
fun toULong() {
val expected = 0x1234567878563412UL
val actual = arrayOf(
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x78, 0x56, 0x34, 0x12).toULong(),
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x78, 0x56, 0x34, 0x12).toULong(order = LITTLE_ENDIAN),
)
assertEquals(expected, actual[0])
assertEquals(expected, actual[1])
}
@Test
fun toLongArray() {
val expected = longArrayOf(0x1234567812345678L, 0x1234567812345678L)
val actual = arrayOf(
byteArrayOf(
0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
).toLongArray(),
byteArrayOf(
0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12,
0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12,
).toLongArray(LITTLE_ENDIAN),
)
assertContentEquals(expected, actual[0])
assertContentEquals(expected, actual[1])
}
@Test
fun toULongArray() {
val expected = ulongArrayOf(0x1234567812345678UL, 0x1234567812345678UL)
val actual = arrayOf(
byteArrayOf(
0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
).toULongArray(),
byteArrayOf(
0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12,
0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12,
).toULongArray(LITTLE_ENDIAN),
)
assertContentEquals(expected, actual[0])
assertContentEquals(expected, actual[1])
}
}

View File

@@ -0,0 +1,65 @@
package com.infendro.bytes.bytearray
import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertFails
class ByteArrayOperatorsTest {
@Test
fun inv() {
val expected = ubyteArrayOf(0xFFU, 0xE0U).asByteArray()
val actual = byteArrayOf(0x00, 0x1F).inv()
assertContentEquals(expected, actual)
}
@Test
fun andSize() {
assertFails {
byteArrayOf() and byteArrayOf(0x00)
}
assertFails {
byteArrayOf(0x00) and byteArrayOf()
}
}
@Test
fun and() {
val expected = byteArrayOf(0x18, 0x00)
val actual = byteArrayOf(0x5C, 0x70) and byteArrayOf(0x3A, 0x0F)
assertContentEquals(expected, actual)
}
@Test
fun orSize() {
assertFails {
byteArrayOf() or byteArrayOf(0x00)
}
assertFails {
byteArrayOf(0x00) or byteArrayOf()
}
}
@Test
fun or() {
val expected = byteArrayOf(0x7E, 0x7F)
val actual = byteArrayOf(0x5C, 0x70) or byteArrayOf(0x3A, 0x0F)
assertContentEquals(expected, actual)
}
@Test
fun xorSize() {
assertFails {
byteArrayOf() xor byteArrayOf(0x00)
}
assertFails {
byteArrayOf(0x00) xor byteArrayOf()
}
}
@Test
fun xor() {
val expected = byteArrayOf(0x66, 0x7F)
val actual = byteArrayOf(0x5C, 0x70) xor byteArrayOf(0x3A, 0x0F)
assertContentEquals(expected, actual)
}
}

View File

@@ -0,0 +1,37 @@
package com.infendro.bytes.int
import com.infendro.bytes.ByteOrder.LITTLE_ENDIAN
import kotlin.test.Test
import kotlin.test.assertContentEquals
class IntConversionTest {
@Test
fun toByteArray() {
val expected = arrayOf(
byteArrayOf(0x12, 0x34, 0x56, 0x78),
byteArrayOf(0x78, 0x56, 0x34, 0x12),
)
val actual = arrayOf(
0x12345678.toByteArray(),
0x12345678.toByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
@Test
fun toUByteArray() {
val expected = arrayOf(
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U),
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U),
)
val actual = arrayOf(
0x12345678.toUByteArray(),
0x12345678.toUByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
}

View File

@@ -0,0 +1,61 @@
package com.infendro.bytes.intarray
import com.infendro.bytes.ByteOrder.LITTLE_ENDIAN
import kotlin.test.Test
import kotlin.test.assertContentEquals
class IntArrayConversionTest {
@Test
fun toByteArray() {
val expected = arrayOf(
byteArrayOf(
0x12, 0x34, 0x56, 0x78,
0x12, 0x34, 0x56, 0x78,
),
byteArrayOf(
0x78, 0x56, 0x34, 0x12,
0x78, 0x56, 0x34, 0x12,
),
)
val actual = arrayOf(
intArrayOf(
0x12345678,
0x12345678,
).toByteArray(),
intArrayOf(
0x12345678,
0x12345678,
).toByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
@Test
fun toUByteArray() {
val expected = arrayOf(
ubyteArrayOf(
0x12U, 0x34U, 0x56U, 0x78U,
0x12U, 0x34U, 0x56U, 0x78U,
),
ubyteArrayOf(
0x78U, 0x56U, 0x34U, 0x12U,
0x78U, 0x56U, 0x34U, 0x12U,
),
)
val actual = arrayOf(
intArrayOf(
0x12345678,
0x12345678,
).toUByteArray(),
intArrayOf(
0x12345678,
0x12345678,
).toUByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
}

View File

@@ -0,0 +1,37 @@
package com.infendro.bytes.long
import com.infendro.bytes.ByteOrder.LITTLE_ENDIAN
import kotlin.test.Test
import kotlin.test.assertContentEquals
class LongConversionTest {
@Test
fun toByteArray() {
val expected = arrayOf(
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78),
byteArrayOf(0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12),
)
val actual = arrayOf(
0x1234567812345678L.toByteArray(),
0x1234567812345678L.toByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
@Test
fun toUByteArray() {
val expected = arrayOf(
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U),
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U),
)
val actual = arrayOf(
0x1234567812345678L.toUByteArray(),
0x1234567812345678L.toUByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
}

View File

@@ -0,0 +1,61 @@
package com.infendro.bytes.longarray
import com.infendro.bytes.ByteOrder.LITTLE_ENDIAN
import kotlin.test.Test
import kotlin.test.assertContentEquals
class LongArrayConversionTest {
@Test
fun toByteArray() {
val expected = arrayOf(
byteArrayOf(
0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
),
byteArrayOf(
0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12,
0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12,
),
)
val actual = arrayOf(
longArrayOf(
0x1234567812345678L,
0x1234567812345678L,
).toByteArray(),
longArrayOf(
0x1234567812345678L,
0x1234567812345678L,
).toByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
@Test
fun toUByteArray() {
val expected = arrayOf(
ubyteArrayOf(
0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U,
0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U,
),
ubyteArrayOf(
0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U,
0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U,
),
)
val actual = arrayOf(
longArrayOf(
0x1234567812345678L,
0x1234567812345678L,
).toUByteArray(),
longArrayOf(
0x1234567812345678L,
0x1234567812345678L,
).toUByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
}

View File

@@ -1,120 +0,0 @@
package com.infendro.bytes.ubytearray
import com.infendro.bytes.ByteOrder.LITTLE_ENDIAN
import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertEquals
class `UByteArray Conversion Test` {
@Test
fun toUInt() {
val expected = 0x12345678U
val actual = arrayOf(
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U).toUInt(),
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U).toUInt(order = LITTLE_ENDIAN),
)
assertEquals(expected, actual[0])
assertEquals(expected, actual[1])
}
@Test
fun toInt() {
val expected = 0x12345678
val actual = arrayOf(
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U).toInt(),
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U).toInt(order = LITTLE_ENDIAN),
)
assertEquals(expected, actual[0])
assertEquals(expected, actual[1])
}
@Test
fun toUIntArray() {
val expected = uintArrayOf(0x12345678U, 0x12345678U)
val actual = arrayOf(
ubyteArrayOf(
0x12U, 0x34U, 0x56U, 0x78U,
0x12U, 0x34U, 0x56U, 0x78U,
).toUIntArray(),
ubyteArrayOf(
0x78U, 0x56U, 0x34U, 0x12U,
0x78U, 0x56U, 0x34U, 0x12U,
).toUIntArray(LITTLE_ENDIAN),
)
assertContentEquals(expected, actual[0])
assertContentEquals(expected, actual[1])
}
@Test
fun toIntArray() {
val expected = intArrayOf(0x12345678, 0x12345678)
val actual = arrayOf(
ubyteArrayOf(
0x12U, 0x34U, 0x56U, 0x78U,
0x12U, 0x34U, 0x56U, 0x78U,
).toIntArray(),
ubyteArrayOf(
0x78U, 0x56U, 0x34U, 0x12U,
0x78U, 0x56U, 0x34U, 0x12U,
).toIntArray(LITTLE_ENDIAN),
)
assertContentEquals(expected, actual[0])
assertContentEquals(expected, actual[1])
}
@Test
fun toULong() {
val expected = 0x1234567812345678UL
val actual = arrayOf(
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U).toULong(),
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U).toULong(order = LITTLE_ENDIAN),
)
assertEquals(expected, actual[0])
assertEquals(expected, actual[1])
}
@Test
fun toLong() {
val expected = 0x1234567812345678L
val actual = arrayOf(
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U).toLong(),
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U).toLong(order = LITTLE_ENDIAN),
)
assertEquals(expected, actual[0])
assertEquals(expected, actual[1])
}
@Test
fun toULongArray() {
val expected = ulongArrayOf(0x1234567812345678UL, 0x1234567812345678UL)
val actual = arrayOf(
ubyteArrayOf(
0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U,
0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U,
).toULongArray(),
ubyteArrayOf(
0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U,
0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U,
).toULongArray(LITTLE_ENDIAN),
)
assertContentEquals(expected, actual[0])
assertContentEquals(expected, actual[1])
}
@Test
fun toLongArray() {
val expected = longArrayOf(0x1234567812345678L, 0x1234567812345678L)
val actual = arrayOf(
ubyteArrayOf(
0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U,
0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U,
).toLongArray(),
ubyteArrayOf(
0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U,
0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U,
).toLongArray(LITTLE_ENDIAN),
)
assertContentEquals(expected, actual[0])
assertContentEquals(expected, actual[1])
}
}

View File

@@ -1,65 +0,0 @@
package com.infendro.bytes.ubytearray
import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertFails
class `UByteArray Operators Test` {
@Test
fun inv() {
val expected = ubyteArrayOf(0xFFU, 0xE0U)
val actual = ubyteArrayOf(0x00U, 0x1FU).inv()
assertContentEquals(expected, actual)
}
@Test
fun `and - size`() {
assertFails {
ubyteArrayOf() and ubyteArrayOf(0x00U)
}
assertFails {
ubyteArrayOf(0x00U) and ubyteArrayOf()
}
}
@Test
fun and() {
val expected = ubyteArrayOf(0x18U, 0x00U)
val actual = ubyteArrayOf(0x5CU, 0x70U) and ubyteArrayOf(0x3AU, 0x0FU)
assertContentEquals(expected, actual)
}
@Test
fun `or - size`() {
assertFails {
ubyteArrayOf() or ubyteArrayOf(0x00U)
}
assertFails {
ubyteArrayOf(0x00U) or ubyteArrayOf()
}
}
@Test
fun or() {
val expected = ubyteArrayOf(0x7EU, 0x7FU)
val actual = ubyteArrayOf(0x5CU, 0x70U) or ubyteArrayOf(0x3AU, 0x0FU)
assertContentEquals(expected, actual)
}
@Test
fun `xor - size`() {
assertFails {
ubyteArrayOf() xor ubyteArrayOf(0x00U)
}
assertFails {
ubyteArrayOf(0x00U) xor ubyteArrayOf()
}
}
@Test
fun xor() {
val expected = ubyteArrayOf(0x66U, 0x7FU)
val actual = ubyteArrayOf(0x5CU, 0x70U) xor ubyteArrayOf(0x3AU, 0x0FU)
assertContentEquals(expected, actual)
}
}

View File

@@ -4,7 +4,7 @@ import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertEquals
class `UByteArray String Test` {
class UByteArrayStringTest {
@Test
fun encodeToUByteArray() {
val expected = ubyteArrayOf(0x50U, 0x41U, 0x53U, 0x53U, 0x57U, 0x4FU, 0x52U, 0x44U)

View File

@@ -1,91 +0,0 @@
package com.infendro.bytes.uint
import com.infendro.bytes.ByteOrder.LITTLE_ENDIAN
import kotlin.test.Test
import kotlin.test.assertContentEquals
class `UInt Conversion Test` {
@Test
fun toUByteArray() {
val expected = arrayOf(
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U),
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U),
)
val actual = arrayOf(
0x12345678U.toUByteArray(),
0x12345678U.toUByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
@Test
fun toByteArray() {
val expected = arrayOf(
byteArrayOf(0x12, 0x34, 0x56, 0x78),
byteArrayOf(0x78, 0x56, 0x34, 0x12),
)
val actual = arrayOf(
0x12345678U.toByteArray(),
0x12345678U.toByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
@Test
fun `Array toUByteArray`() {
val expected = arrayOf(
ubyteArrayOf(
0x12U, 0x34U, 0x56U, 0x78U,
0x12U, 0x34U, 0x56U, 0x78U,
),
ubyteArrayOf(
0x78U, 0x56U, 0x34U, 0x12U,
0x78U, 0x56U, 0x34U, 0x12U,
),
)
val actual = arrayOf(
uintArrayOf(
0x12345678U,
0x12345678U,
).toUByteArray(),
uintArrayOf(
0x12345678U,
0x12345678U,
).toUByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
@Test
fun `Array toByteArray`() {
val expected = arrayOf(
byteArrayOf(
0x12, 0x34, 0x56, 0x78,
0x12, 0x34, 0x56, 0x78,
),
byteArrayOf(
0x78, 0x56, 0x34, 0x12,
0x78, 0x56, 0x34, 0x12,
),
)
val actual = arrayOf(
uintArrayOf(
0x12345678U,
0x12345678U,
).toByteArray(),
uintArrayOf(
0x12345678U,
0x12345678U,
).toByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
}

View File

@@ -1,91 +0,0 @@
package com.infendro.bytes.ulong
import com.infendro.bytes.ByteOrder.LITTLE_ENDIAN
import kotlin.test.Test
import kotlin.test.assertContentEquals
class `ULong Conversion Test` {
@Test
fun toUByteArray() {
val expected = arrayOf(
ubyteArrayOf(0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U),
ubyteArrayOf(0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U),
)
val actual = arrayOf(
0x1234567812345678UL.toUByteArray(),
0x1234567812345678UL.toUByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
@Test
fun toByteArray() {
val expected = arrayOf(
byteArrayOf(0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78),
byteArrayOf(0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12),
)
val actual = arrayOf(
0x1234567812345678UL.toByteArray(),
0x1234567812345678UL.toByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
@Test
fun `Array toUByteArray`() {
val expected = arrayOf(
ubyteArrayOf(
0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U,
0x12U, 0x34U, 0x56U, 0x78U, 0x12U, 0x34U, 0x56U, 0x78U,
),
ubyteArrayOf(
0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U,
0x78U, 0x56U, 0x34U, 0x12U, 0x78U, 0x56U, 0x34U, 0x12U,
),
)
val actual = arrayOf(
ulongArrayOf(
0x1234567812345678UL,
0x1234567812345678UL,
).toUByteArray(),
ulongArrayOf(
0x1234567812345678UL,
0x1234567812345678UL,
).toUByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
@Test
fun `Array toByteArray`() {
val expected = arrayOf(
byteArrayOf(
0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
0x12, 0x34, 0x56, 0x78, 0x12, 0x34, 0x56, 0x78,
),
byteArrayOf(
0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12,
0x78, 0x56, 0x34, 0x12, 0x78, 0x56, 0x34, 0x12,
),
)
val actual = arrayOf(
ulongArrayOf(
0x1234567812345678UL,
0x1234567812345678UL,
).toByteArray(),
ulongArrayOf(
0x1234567812345678UL,
0x1234567812345678UL,
).toByteArray(LITTLE_ENDIAN),
)
for (i in 0..1) {
assertContentEquals(expected[i], actual[i])
}
}
}