testing in progress

This commit is contained in:
Roland Grinis 2021-07-06 12:50:52 +01:00
parent cd362c749e
commit e17fe32ae2
4 changed files with 13 additions and 15 deletions

View File

@ -180,7 +180,7 @@ val buildCpp by tasks.registering {
}
}
tasks["compileJava"].dependsOn(buildCpp)
//tasks["compileJava"].dependsOn(buildCpp)
readme {
maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE

View File

@ -9,7 +9,8 @@ public class JNoa {
static {
String jNoaPath = System.getProperty("user.home") +
"/.konan/third-party/kmath-noa-0.3.0-dev-14/cpp-build/kmath/libjnoa.so";
"/devspace/noa/cmake-build-release/kmath/libjnoa.so";
//"/.konan/third-party/kmath-noa-0.3.0-dev-14/cpp-build/kmath/libjnoa.so";
try {
System.load(jNoaPath);
@ -20,6 +21,6 @@ public class JNoa {
}
}
public static native void testException();
public static native int testException(int seed);
public static native boolean cudaIsAvailable();
}

View File

@ -10,10 +10,10 @@ extern "C" {
/*
* Class: space_kscience_kmath_noa_JNoa
* Method: testException
* Signature: ()V
* Signature: (I)I
*/
JNIEXPORT void JNICALL Java_space_kscience_kmath_noa_JNoa_testException
(JNIEnv *, jclass);
JNIEXPORT jint JNICALL Java_space_kscience_kmath_noa_JNoa_testException
(JNIEnv *, jclass, jint);
/*
* Class: space_kscience_kmath_noa_JNoa

View File

@ -6,20 +6,17 @@
package space.kscience.kmath.noa
import kotlin.test.Test
import kotlin.test.assertEquals
class TestUtils {
@Test
fun throwingExceptions() {
try {
JNoa.testException()
} catch(e:NoaException) {
println("Caught NoaException in JVM\n:$e")
val i = try {
JNoa.testException(5)
} catch (e: NoaException) {
10
}
}
@Test
fun cudaSupport() {
println("CUDA support available: ${cudaAvailable()}")
assertEquals(i, 10)
}
}