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,31 @@
package com.infendro.hash.sha1
import kotlin.test.Test
import kotlin.test.assertContentEquals
import kotlin.test.assertEquals
class `SHA1 Test` {
val function = SHA1
@Test
fun `bytes and block`() {
assertEquals(20, function.bytes)
assertEquals(160, function.bits)
assertEquals(64, function.block)
}
@Test
fun `empty bytearray`() {
val expected = ubyteArrayOf(
0xdaU, 0x39U, 0xa3U, 0xeeU,
0x5eU, 0x6bU, 0x4bU, 0x0dU,
0x32U, 0x55U, 0xbfU, 0xefU,
0x95U, 0x60U, 0x18U, 0x90U,
0xafU, 0xd8U, 0x07U, 0x09U,
)
val actual = function.hash(
ubyteArrayOf()
)
assertContentEquals(expected, actual)
}
}