implement tests
Some checks failed
/ publish (push) Has been cancelled

also fix MD5
This commit is contained in:
2025-11-10 17:42:15 +01:00
parent 9b93fbd093
commit d033d895da
28 changed files with 469 additions and 30 deletions

View File

@@ -0,0 +1,30 @@
package com.infendro.hash.md
import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertEquals
class `MD5 Test` {
val function = MD5
@Test
fun `bytes and block`() {
assertEquals(16, function.bytes)
assertEquals(128, function.bits)
assertEquals(64, function.block)
}
@Test
fun `empty bytearray`() {
val expected = ubyteArrayOf(
0xd4U, 0x1dU, 0x8cU, 0xd9U,
0x8fU, 0x00U, 0xb2U, 0x04U,
0xe9U, 0x80U, 0x09U, 0x98U,
0xecU, 0xf8U, 0x42U, 0x7eU,
)
val actual = function.hash(
ubyteArrayOf()
)
assertContentEquals(expected, actual)
}
}