implement tests

This commit is contained in:
2025-11-18 11:22:05 +01:00
parent 12344283f7
commit 9e4109c9f3
7 changed files with 183 additions and 0 deletions

View File

@@ -0,0 +1,34 @@
package com.infendro.encoding
import kotlin.test.Test
import kotlin.test.assertContentEquals
class `Base8 Test` {
val encoding: Encoding
get() = Base8
val `Hello World!` = ubyteArrayOf(
0x48U, 0x65U, 0x6cU, 0x6cU,
0x6fU, 0x20U, 0x57U, 0x6fU,
0x72U, 0x6cU, 0x64U, 0x21U,
)
@Test
fun `encode empty ByteArray`() {
val expected = ubyteArrayOf()
val actual = encoding.encode(ubyteArrayOf())
assertContentEquals(expected, actual)
}
@Test
fun `encode "Hello, World!"`() {
val expected = ubyteArrayOf(
0x32U, 0x32U, 0x30U, 0x36U, 0x32U, 0x35U, 0x35U, 0x34U,
0x33U, 0x33U, 0x30U, 0x36U, 0x37U, 0x34U, 0x34U, 0x30U,
0x32U, 0x35U, 0x36U, 0x36U, 0x37U, 0x35U, 0x36U, 0x32U,
0x33U, 0x33U, 0x30U, 0x36U, 0x32U, 0x30U, 0x34U, 0x31U,
)
val actual = encoding.encode(`Hello World!`)
assertContentEquals(expected, actual)
}
}