no output lookup in unit tests (#5381)
* no output lookup in unit tests * only get outputs in non-test land --------- Co-authored-by: rusefillc <sdfsdfqsf2334234234> Co-authored-by: Matthew Kennedy <matthewkennedy@outlook.com>
This commit is contained in:
parent
6ccf1fe426
commit
9395f6c794
|
@ -814,12 +814,14 @@ void configureRusefiLuaHooks(lua_State* l) {
|
|||
return 1;
|
||||
});
|
||||
|
||||
#if EFI_PROD_CODE || EFI_SIMULATOR
|
||||
lua_register(l, "getOutput", [](lua_State* l) {
|
||||
auto propertyName = luaL_checklstring(l, 1, nullptr);
|
||||
auto result = getOutputValueByName(propertyName);
|
||||
lua_pushnumber(l, result);
|
||||
return 1;
|
||||
});
|
||||
#endif // EFI_PROD_CODE || EFI_SIMULATOR
|
||||
|
||||
#if EFI_SHAFT_POSITION_INPUT
|
||||
lua_register(l, "getEngineState", [](lua_State* l) {
|
||||
|
|
|
@ -21,7 +21,8 @@ public class GetOutputValueConsumerTest {
|
|||
outputValueConsumer.conditional = "EFI_BOOST_CONTROL";
|
||||
state.readBufferedReader(test, (outputValueConsumer));
|
||||
assertEquals(
|
||||
"// generated by GetOutputValueConsumer.java\n" +
|
||||
"#if !EFI_UNIT_TEST\n" +
|
||||
"// generated by GetOutputValueConsumer.java\n" +
|
||||
"#include \"pch.h\"\n" +
|
||||
"#include \"value_lookup.h\"\n" +
|
||||
"float getOutputValueByName(const char *name) {\n" +
|
||||
|
@ -44,7 +45,8 @@ public class GetOutputValueConsumerTest {
|
|||
"#endif\n" +
|
||||
"\t}\n" +
|
||||
"\treturn EFI_ERROR_CODE;\n" +
|
||||
"}\n", outputValueConsumer.getContent());
|
||||
"}\n" +
|
||||
"#endif\n", outputValueConsumer.getContent());
|
||||
}
|
||||
|
||||
|
||||
|
@ -64,7 +66,8 @@ public class GetOutputValueConsumerTest {
|
|||
|
||||
state.readBufferedReader(test, (outputValueConsumer));
|
||||
assertEquals(
|
||||
"// generated by GetOutputValueConsumer.java\n" +
|
||||
"#if !EFI_UNIT_TEST\n" +
|
||||
"// generated by GetOutputValueConsumer.java\n" +
|
||||
"#include \"pch.h\"\n" +
|
||||
"#include \"value_lookup.h\"\n" +
|
||||
"float getOutputValueByName(const char *name) {\n" +
|
||||
|
@ -84,6 +87,7 @@ public class GetOutputValueConsumerTest {
|
|||
"\t\t\treturn engine->module<FuelPumpController>()->ignitionOn;\n" +
|
||||
"\t}\n" +
|
||||
"\treturn EFI_ERROR_CODE;\n" +
|
||||
"}\n", outputValueConsumer.getContent());
|
||||
"}\n" +
|
||||
"#endif\n", outputValueConsumer.getContent());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,10 +84,12 @@ public class GetOutputValueConsumer implements ConfigurationConsumer {
|
|||
|
||||
String fullSwitch = wrapSwitchStatement(switchBody);
|
||||
|
||||
return GetConfigValueConsumer.getHeader(getClass()) +
|
||||
return "#if !EFI_UNIT_TEST\n" +
|
||||
GetConfigValueConsumer.getHeader(getClass()) +
|
||||
"float getOutputValueByName(const char *name) {\n" +
|
||||
fullSwitch +
|
||||
getterBody + GetConfigValueConsumer.GET_METHOD_FOOTER;
|
||||
getterBody + GetConfigValueConsumer.GET_METHOD_FOOTER +
|
||||
"#endif\n";
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
|
Loading…
Reference in New Issue