Jni engine (#3995)
* JNI for test coverage #3965 * JNI for test coverage #3965 * JNI for test coverage #3965
This commit is contained in:
parent
7518054c56
commit
65ff145a8d
|
@ -30,7 +30,13 @@ extern bool printTriggerTrace;
|
||||||
extern bool printFuelDebug;
|
extern bool printFuelDebug;
|
||||||
extern int minCrankingRpm;
|
extern int minCrankingRpm;
|
||||||
|
|
||||||
EngineTestHelperBase::EngineTestHelperBase(Engine * eng, engine_configuration_s * econfig, persistent_config_s * pers) {
|
bool isTestingInitialized = false;
|
||||||
|
|
||||||
|
EngineTestHelperBase::EngineTestHelperBase(Engine * eng, engine_configuration_s * econfig, persistent_config_s * pers) {
|
||||||
|
if (!isTestingInitialized) {
|
||||||
|
testing::InitGoogleTest();
|
||||||
|
isTestingInitialized = true;
|
||||||
|
}
|
||||||
// todo: make this not a global variable, we need currentTimeProvider interface on engine
|
// todo: make this not a global variable, we need currentTimeProvider interface on engine
|
||||||
timeNowUs = 0;
|
timeNowUs = 0;
|
||||||
minCrankingRpm = 0;
|
minCrankingRpm = 0;
|
||||||
|
|
|
@ -9,7 +9,16 @@
|
||||||
#include "com_rusefi_native__EngineLogic.h"
|
#include "com_rusefi_native__EngineLogic.h"
|
||||||
#include "auto_generated_sensor.h"
|
#include "auto_generated_sensor.h"
|
||||||
|
|
||||||
//static EngineTestHelper eth(TEST_ENGINE);
|
#include <memory>
|
||||||
|
|
||||||
|
static std::unique_ptr<EngineTestHelper> eth;
|
||||||
|
|
||||||
|
static EngineTestHelper* getEth() {
|
||||||
|
if (!eth) {
|
||||||
|
eth = std::make_unique<EngineTestHelper>(TEST_ENGINE);
|
||||||
|
}
|
||||||
|
return eth.get();
|
||||||
|
}
|
||||||
|
|
||||||
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";
|
||||||
|
@ -23,7 +32,6 @@ JNIEXPORT jbyteArray JNICALL Java_com_rusefi_native_1_EngineLogic_getConfigurati
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_setConfiguration(JNIEnv *env, jobject instance,
|
JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_setConfiguration(JNIEnv *env, jobject instance,
|
||||||
jbyteArray data, jint offset, jint size) {
|
jbyteArray data, jint offset, jint size) {
|
||||||
|
|
||||||
|
@ -47,4 +55,5 @@ JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_setSensor
|
||||||
JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_invokePeriodicCallback
|
JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_invokePeriodicCallback
|
||||||
(JNIEnv *, jobject) {
|
(JNIEnv *, jobject) {
|
||||||
|
|
||||||
|
EngineTestHelper* eth = getEth();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue