mirror of https://github.com/FOME-Tech/fome-fw.git
ETB JNI test progress
This commit is contained in:
parent
1d4a454f0c
commit
2c13af3324
|
@ -9,6 +9,9 @@ package com.rusefi.native_;
|
||||||
public class EngineLogic {
|
public class EngineLogic {
|
||||||
public native String getVersion();
|
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 void setSensor(String sensorTypeName, double value);
|
||||||
|
|
||||||
public native byte[] getConfiguration();
|
public native byte[] getConfiguration();
|
||||||
|
|
|
@ -5,6 +5,7 @@ import com.rusefi.config.Field;
|
||||||
import com.rusefi.config.generated.Fields;
|
import com.rusefi.config.generated.Fields;
|
||||||
import com.rusefi.core.Sensor;
|
import com.rusefi.core.Sensor;
|
||||||
import com.rusefi.enums.SensorType;
|
import com.rusefi.enums.SensorType;
|
||||||
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
import java.nio.ByteBuffer;
|
import java.nio.ByteBuffer;
|
||||||
|
@ -15,6 +16,11 @@ import static com.rusefi.core.FileUtil.littleEndianWrap;
|
||||||
import static junit.framework.Assert.*;
|
import static junit.framework.Assert.*;
|
||||||
|
|
||||||
public class JniUnitTest {
|
public class JniUnitTest {
|
||||||
|
@Before
|
||||||
|
public void reset() {
|
||||||
|
new EngineLogic().resetTest();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void run() {
|
public void run() {
|
||||||
JniSandbox.loadLibrary();
|
JniSandbox.loadLibrary();
|
||||||
|
|
|
@ -15,6 +15,14 @@ extern "C" {
|
||||||
JNIEXPORT jstring JNICALL Java_com_rusefi_native_1_EngineLogic_getVersion
|
JNIEXPORT jstring JNICALL Java_com_rusefi_native_1_EngineLogic_getVersion
|
||||||
(JNIEnv *, jobject);
|
(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
|
* Class: com_rusefi_native__EngineLogic
|
||||||
* Method: setSensor
|
* Method: setSensor
|
||||||
|
|
|
@ -24,6 +24,11 @@ static EngineTestHelper* getEth() {
|
||||||
return ethPtr.get();
|
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) {
|
JNIEXPORT jstring JNICALL Java_com_rusefi_native_1_EngineLogic_getVersion(JNIEnv * env, jobject) {
|
||||||
const char msg[60] = "Hello from unit tests";
|
const char msg[60] = "Hello from unit tests";
|
||||||
const char* fileName = msg;
|
const char* fileName = msg;
|
||||||
|
|
Loading…
Reference in New Issue