mirror of https://github.com/rusefi/rusefi.git
ETB JNI test progress
This commit is contained in:
parent
cf63cea45f
commit
85c22ac971
|
@ -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();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue