At least IR browseer tests can now be run
This commit is contained in:
parent
5fdcc62b15
commit
8e295feb46
@ -48,7 +48,7 @@ object Deps {
|
|||||||
val stdLib = "stdlib-common"
|
val stdLib = "stdlib-common"
|
||||||
val test = "test-common"
|
val test = "test-common"
|
||||||
val testAnnotation = "test-annotations-common"
|
val testAnnotation = "test-annotations-common"
|
||||||
val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:${Versions.kotlinCoroutines}"
|
val coroutines = "org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutines}"
|
||||||
val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.kotlinSerialization}"
|
val serialization = "org.jetbrains.kotlinx:kotlinx-serialization-json:${Versions.kotlinSerialization}"
|
||||||
val atomicfu = "com.ionspin.kotlin.atomicfu:atomicfu:${Versions.atomicfu}"
|
val atomicfu = "com.ionspin.kotlin.atomicfu:atomicfu:${Versions.atomicfu}"
|
||||||
|
|
||||||
|
@ -17,7 +17,6 @@ org.gradle.parallel=true
|
|||||||
|
|
||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
|
|
||||||
kotlin.js.compiler=ir
|
|
||||||
#kotlin.js.experimental.generateKotlinExternals=true
|
#kotlin.js.experimental.generateKotlinExternals=true
|
||||||
#kotlin.mpp.enableGranularSourceSetsMetadata=true
|
#kotlin.mpp.enableGranularSourceSetsMetadata=true
|
||||||
kotlin.native.disableCompilerDaemon=true
|
kotlin.native.disableCompilerDaemon=true
|
||||||
|
@ -44,7 +44,7 @@ kotlin {
|
|||||||
val hostOsName = getHostOsName()
|
val hostOsName = getHostOsName()
|
||||||
runningOnLinuxx86_64 {
|
runningOnLinuxx86_64 {
|
||||||
jvm()
|
jvm()
|
||||||
js {
|
js() {
|
||||||
browser {
|
browser {
|
||||||
testTask {
|
testTask {
|
||||||
enabled = false //Until I sort out testing on travis
|
enabled = false //Until I sort out testing on travis
|
||||||
@ -284,12 +284,12 @@ tasks {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val jsNodeTest by getting(KotlinJsTest::class) {
|
// val jsNodeTest by getting(KotlinJsTest::class) {
|
||||||
testLogging {
|
// testLogging {
|
||||||
events("PASSED", "FAILED", "SKIPPED")
|
// events("PASSED", "FAILED", "SKIPPED")
|
||||||
showStandardStreams = true
|
// showStandardStreams = true
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
// val legacyjsNodeTest by getting(KotlinJsTest::class) {
|
// val legacyjsNodeTest by getting(KotlinJsTest::class) {
|
||||||
//
|
//
|
||||||
|
@ -83,7 +83,7 @@ kotlin {
|
|||||||
runningOnLinuxx86_64 {
|
runningOnLinuxx86_64 {
|
||||||
println("Configuring Linux X86-64 targets")
|
println("Configuring Linux X86-64 targets")
|
||||||
jvm()
|
jvm()
|
||||||
js {
|
js(IR) {
|
||||||
browser {
|
browser {
|
||||||
testTask {
|
testTask {
|
||||||
isRunningInGitlabCi {
|
isRunningInGitlabCi {
|
||||||
@ -258,6 +258,7 @@ kotlin {
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation(kotlin(Deps.Common.test))
|
implementation(kotlin(Deps.Common.test))
|
||||||
implementation(kotlin(Deps.Common.testAnnotation))
|
implementation(kotlin(Deps.Common.testAnnotation))
|
||||||
|
implementation(Deps.Common.coroutines)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -627,7 +628,6 @@ tasks {
|
|||||||
showStackTraces = true
|
showStackTraces = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
val jsNodeTest by getting(KotlinJsTest::class) {
|
val jsNodeTest by getting(KotlinJsTest::class) {
|
||||||
testLogging {
|
testLogging {
|
||||||
events("PASSED", "FAILED", "SKIPPED")
|
events("PASSED", "FAILED", "SKIPPED")
|
||||||
@ -653,6 +653,20 @@ tasks {
|
|||||||
showStandardStreams = true
|
showStandardStreams = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// val jsLegacyBrowserTest by getting(KotlinJsTest::class) {
|
||||||
|
// testLogging {
|
||||||
|
// events("PASSED", "FAILED", "SKIPPED")
|
||||||
|
// showStandardStreams = true
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// val jsIrBrowserTest by getting(KotlinJsTest::class) {
|
||||||
|
// testLogging {
|
||||||
|
// events("PASSED", "FAILED", "SKIPPED")
|
||||||
|
// showStandardStreams = true
|
||||||
|
// }
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getHostOsName() == "windows") {
|
if (getHostOsName() == "windows") {
|
||||||
|
@ -3,6 +3,7 @@ package com.ionspin.kotlin.crypto.hash
|
|||||||
import com.ionspin.kotlin.crypto.LibsodiumInitializer
|
import com.ionspin.kotlin.crypto.LibsodiumInitializer
|
||||||
import com.ionspin.kotlin.crypto.util.encodeToUByteArray
|
import com.ionspin.kotlin.crypto.util.encodeToUByteArray
|
||||||
import com.ionspin.kotlin.crypto.util.hexStringToUByteArray
|
import com.ionspin.kotlin.crypto.util.hexStringToUByteArray
|
||||||
|
import com.ionspin.kotlin.crypto.util.runTest
|
||||||
import com.ionspin.kotlin.crypto.util.toHexString
|
import com.ionspin.kotlin.crypto.util.toHexString
|
||||||
import kotlin.test.Test
|
import kotlin.test.Test
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
@ -31,8 +32,8 @@ class HashTest {
|
|||||||
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun hashTestSha256() {
|
fun hashTestSha256() = runTest {
|
||||||
LibsodiumInitializer.initializeWithCallback {
|
LibsodiumInitializer.initialize()
|
||||||
val input = ("Input for various hash functions").encodeToUByteArray()
|
val input = ("Input for various hash functions").encodeToUByteArray()
|
||||||
val expected = ("2bb078ec5993b5428355ba49bf030b1ac7" +
|
val expected = ("2bb078ec5993b5428355ba49bf030b1ac7" +
|
||||||
"1519e635aebc2f28124fac2aef9264").hexStringToUByteArray()
|
"1519e635aebc2f28124fac2aef9264").hexStringToUByteArray()
|
||||||
@ -48,12 +49,12 @@ class HashTest {
|
|||||||
assertTrue {
|
assertTrue {
|
||||||
multipartResult.contentEquals(expected)
|
multipartResult.contentEquals(expected)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun hashTestSha512() {
|
fun hashTestSha512() = runTest {
|
||||||
LibsodiumInitializer.initializeWithCallback {
|
LibsodiumInitializer.initializeWithCallback {
|
||||||
val input = ("Input for various hash functions").encodeToUByteArray()
|
val input = ("Input for various hash functions").encodeToUByteArray()
|
||||||
val expected = ("34fcbcdcfe9e6aa3e6d5a64649afcfafb449c4b8435a65e5e7b7c2b6af3b04da350acee" +
|
val expected = ("34fcbcdcfe9e6aa3e6d5a64649afcfafb449c4b8435a65e5e7b7c2b6af3b04da350acee" +
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.ionspin.kotlin.crypto.util
|
package com.ionspin.kotlin.crypto.util
|
||||||
|
|
||||||
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlin.coroutines.Continuation
|
import kotlin.coroutines.Continuation
|
||||||
import kotlin.coroutines.EmptyCoroutineContext
|
import kotlin.coroutines.EmptyCoroutineContext
|
||||||
import kotlin.coroutines.startCoroutine
|
import kotlin.coroutines.startCoroutine
|
||||||
@ -35,4 +36,6 @@ fun testBlocking(block : suspend () -> Unit) {
|
|||||||
block.startCoroutine(continuation)
|
block.startCoroutine(continuation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
expect fun runTest(block: suspend (scope : CoroutineScope) -> Unit)
|
||||||
|
|
||||||
|
|
||||||
|
@ -0,0 +1,9 @@
|
|||||||
|
package com.ionspin.kotlin.crypto.debug
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Ugljesa Jovanovic
|
||||||
|
* ugljesa.jovanovic@ionspin.com
|
||||||
|
* on 08-Feb-2021
|
||||||
|
*/
|
||||||
|
class DebugTest {
|
||||||
|
}
|
@ -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) }
|
@ -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) }
|
||||||
|
|
@ -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) }
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user