From e17fe32ae24829a2de4d21f23797fa52dcbb85d1 Mon Sep 17 00:00:00 2001 From: Roland Grinis Date: Tue, 6 Jul 2021 12:50:52 +0100 Subject: [PATCH] testing in progress --- kmath-noa/build.gradle.kts | 2 +- .../main/java/space/kscience/kmath/noa/JNoa.java | 5 +++-- .../resources/space_kscience_kmath_noa_JNoa.h | 6 +++--- .../kotlin/space/kscience/kmath/noa/TestUtils.kt | 15 ++++++--------- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/kmath-noa/build.gradle.kts b/kmath-noa/build.gradle.kts index 3a51a2e0b..175bd9133 100644 --- a/kmath-noa/build.gradle.kts +++ b/kmath-noa/build.gradle.kts @@ -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 diff --git a/kmath-noa/src/main/java/space/kscience/kmath/noa/JNoa.java b/kmath-noa/src/main/java/space/kscience/kmath/noa/JNoa.java index eda41e5ae..a38de844e 100644 --- a/kmath-noa/src/main/java/space/kscience/kmath/noa/JNoa.java +++ b/kmath-noa/src/main/java/space/kscience/kmath/noa/JNoa.java @@ -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(); } diff --git a/kmath-noa/src/main/resources/space_kscience_kmath_noa_JNoa.h b/kmath-noa/src/main/resources/space_kscience_kmath_noa_JNoa.h index ef6ef9f92..465e67e6a 100644 --- a/kmath-noa/src/main/resources/space_kscience_kmath_noa_JNoa.h +++ b/kmath-noa/src/main/resources/space_kscience_kmath_noa_JNoa.h @@ -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 diff --git a/kmath-noa/src/test/kotlin/space/kscience/kmath/noa/TestUtils.kt b/kmath-noa/src/test/kotlin/space/kscience/kmath/noa/TestUtils.kt index 663a558a3..e5f142b3c 100644 --- a/kmath-noa/src/test/kotlin/space/kscience/kmath/noa/TestUtils.kt +++ b/kmath-noa/src/test/kotlin/space/kscience/kmath/noa/TestUtils.kt @@ -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) } } \ No newline at end of file