ETB JNI test progress

This commit is contained in:
Andrey 2022-11-29 09:58:35 -05:00
parent cf63cea45f
commit 85c22ac971
4 changed files with 22 additions and 0 deletions

View File

@ -9,6 +9,9 @@ package com.rusefi.native_;
public class EngineLogic {
public native String getVersion();
// huh? I am having trouble making this method static?
public native void resetTest();
public native void setSensor(String sensorTypeName, double value);
public native byte[] getConfiguration();

View File

@ -5,6 +5,7 @@ import com.rusefi.config.Field;
import com.rusefi.config.generated.Fields;
import com.rusefi.core.Sensor;
import com.rusefi.enums.SensorType;
import org.junit.Before;
import org.junit.Test;
import java.nio.ByteBuffer;
@ -15,6 +16,11 @@ import static com.rusefi.core.FileUtil.littleEndianWrap;
import static junit.framework.Assert.*;
public class JniUnitTest {
@Before
public void reset() {
new EngineLogic().resetTest();
}
@Test
public void run() {
JniSandbox.loadLibrary();

View File

@ -15,6 +15,14 @@ extern "C" {
JNIEXPORT jstring JNICALL Java_com_rusefi_native_1_EngineLogic_getVersion
(JNIEnv *, jobject);
/*
* Class: com_rusefi_native__EngineLogic
* Method: resetTest
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_resetTest
(JNIEnv *, jobject);
/*
* Class: com_rusefi_native__EngineLogic
* Method: setSensor

View File

@ -24,6 +24,11 @@ static EngineTestHelper* getEth() {
return ethPtr.get();
}
JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_resetTest
(JNIEnv *, jobject) {
ethPtr = nullptr;
}
JNIEXPORT jstring JNICALL Java_com_rusefi_native_1_EngineLogic_getVersion(JNIEnv * env, jobject) {
const char msg[60] = "Hello from unit tests";
const char* fileName = msg;