At least IR browseer tests can now be run
This commit is contained in:
10 files changed
+62
-15
No files matched your search
+5
-4
@@ -3,6 +3,7 @@ package com.ionspin.kotlin.crypto.hash
|
||||
import com.ionspin.kotlin.crypto.LibsodiumInitializer
|
||||
import com.ionspin.kotlin.crypto.util.encodeToUByteArray
|
||||
import com.ionspin.kotlin.crypto.util.hexStringToUByteArray
|
||||
import com.ionspin.kotlin.crypto.util.runTest
|
||||
import com.ionspin.kotlin.crypto.util.toHexString
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertTrue
|
||||
@@ -31,8 +32,8 @@ class HashTest {
|
||||
|
||||
|
||||
@Test
|
||||
fun hashTestSha256() {
|
||||
LibsodiumInitializer.initializeWithCallback {
|
||||
fun hashTestSha256() = runTest {
|
||||
LibsodiumInitializer.initialize()
|
||||
val input = ("Input for various hash functions").encodeToUByteArray()
|
||||
val expected = ("2bb078ec5993b5428355ba49bf030b1ac7" +
|
||||
"1519e635aebc2f28124fac2aef9264").hexStringToUByteArray()
|
||||
@@ -48,12 +49,12 @@ class HashTest {
|
||||
assertTrue {
|
||||
multipartResult.contentEquals(expected)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hashTestSha512() {
|
||||
fun hashTestSha512() = runTest {
|
||||
LibsodiumInitializer.initializeWithCallback {
|
||||
val input = ("Input for various hash functions").encodeToUByteArray()
|
||||
val expected = ("34fcbcdcfe9e6aa3e6d5a64649afcfafb449c4b8435a65e5e7b7c2b6af3b04da350acee" +
|
||||
|
||||
+3
@@ -16,6 +16,7 @@
|
||||
|
||||
package com.ionspin.kotlin.crypto.util
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlin.coroutines.Continuation
|
||||
import kotlin.coroutines.EmptyCoroutineContext
|
||||
import kotlin.coroutines.startCoroutine
|
||||
@@ -35,4 +36,6 @@ fun testBlocking(block : suspend () -> Unit) {
|
||||
block.startCoroutine(continuation)
|
||||
}
|
||||
|
||||
expect fun runTest(block: suspend (scope : CoroutineScope) -> Unit)
|
||||
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.ionspin.kotlin.crypto.debug
|
||||
|
||||
/**
|
||||
* Created by Ugljesa Jovanovic
|
||||
* ugljesa.jovanovic@ionspin.com
|
||||
* on 08-Feb-2021
|
||||
*/
|
||||
class DebugTest {
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.ionspin.kotlin.crypto.util
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.GlobalScope
|
||||
import kotlinx.coroutines.promise
|
||||
|
||||
actual fun runTest(block: suspend (scope : CoroutineScope) -> Unit): dynamic = GlobalScope.promise { block(this) }
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.ionspin.kotlin.crypto.util
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
actual fun runTest(block: suspend (scope : CoroutineScope) -> Unit) = runBlocking { block(this) }
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.ionspin.kotlin.crypto.util
|
||||
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.runBlocking
|
||||
|
||||
actual fun runTest(block: suspend (scope : CoroutineScope) -> Unit) = runBlocking { block(this) }
|
||||
|
||||
Reference in new issue
Block a user