Jni engine (#3995)
* JNI for test coverage #3965 * JNI for test coverage #3965 * JNI for test coverage #3965
This commit is contained in:
parent
aa319d7456
commit
9d0f1fe64a
|
@ -30,7 +30,13 @@ extern bool printTriggerTrace;
|
|||
extern bool printFuelDebug;
|
||||
extern int minCrankingRpm;
|
||||
|
||||
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
|
||||
timeNowUs = 0;
|
||||
minCrankingRpm = 0;
|
||||
|
|
|
@ -9,7 +9,16 @@
|
|||
#include "com_rusefi_native__EngineLogic.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) {
|
||||
const char msg[60] = "Hello from unit tests";
|
||||
|
@ -23,7 +32,6 @@ JNIEXPORT jbyteArray JNICALL Java_com_rusefi_native_1_EngineLogic_getConfigurati
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
JNIEXPORT void JNICALL Java_com_rusefi_native_1_EngineLogic_setConfiguration(JNIEnv *env, jobject instance,
|
||||
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
|
||||
(JNIEnv *, jobject) {
|
||||
|
||||
EngineTestHelper* eth = getEth();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue