implement optimizations
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package com.infendro.bytes.ubytearray
|
||||
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertContentEquals
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
class `UByteArray String Test` {
|
||||
@Test
|
||||
fun encodeToUByteArray() {
|
||||
val expected = ubyteArrayOf(0x50U, 0x41U, 0x53U, 0x53U, 0x57U, 0x4FU, 0x52U, 0x44U)
|
||||
val actual = "PASSWORD".encodeToUByteArray()
|
||||
assertContentEquals(expected, actual)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun decodeToString() {
|
||||
val expected = "PASSWORD"
|
||||
val actual = ubyteArrayOf(0x50U, 0x41U, 0x53U, 0x53U, 0x57U, 0x4FU, 0x52U, 0x44U).decodeToString()
|
||||
assertEquals(expected, actual)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user