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 { readme {
maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE maturity = ru.mipt.npm.gradle.Maturity.PROTOTYPE

View File

@ -9,7 +9,8 @@ public class JNoa {
static { static {
String jNoaPath = System.getProperty("user.home") + 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 { try {
System.load(jNoaPath); 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(); public static native boolean cudaIsAvailable();
} }

View File

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

View File

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