parent
87f859d70b
commit
65c9cf7519
|
@ -7,6 +7,9 @@ import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static com.rusefi.AssertCompatibility.assertEquals;
|
import static com.rusefi.AssertCompatibility.assertEquals;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see LiveDataProcessorTest for most integrated test
|
||||||
|
*/
|
||||||
public class GetOutputValueConsumerTest {
|
public class GetOutputValueConsumerTest {
|
||||||
@Test
|
@Test
|
||||||
public void generateGetOutputs() {
|
public void generateGetOutputs() {
|
||||||
|
|
|
@ -146,7 +146,7 @@ public class LiveDataProcessor {
|
||||||
|
|
||||||
SdCardFieldsContent sdCardFieldsConsumer = new SdCardFieldsContent();
|
SdCardFieldsContent sdCardFieldsConsumer = new SdCardFieldsContent();
|
||||||
|
|
||||||
GetOutputValueConsumer outputValueConsumer = new GetOutputValueConsumer("controllers/lua/generated/output_lookup_generated.cpp", fileFactory);
|
GetOutputValueConsumer outputValueConsumer = new GetOutputValueConsumer(getOutputLookupFileName(), fileFactory);
|
||||||
|
|
||||||
EntryHandler handler = new EntryHandler() {
|
EntryHandler handler = new EntryHandler() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -341,6 +341,10 @@ public class LiveDataProcessor {
|
||||||
return startingPosition.get();
|
return startingPosition.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static @NotNull String getOutputLookupFileName() {
|
||||||
|
return "controllers/lua/generated/output_lookup_generated.cpp";
|
||||||
|
}
|
||||||
|
|
||||||
private static String @NotNull [] getStrings(Object value) {
|
private static String @NotNull [] getStrings(Object value) {
|
||||||
String[] output;
|
String[] output;
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
|
|
|
@ -84,6 +84,52 @@ public class LiveDataProcessorTest {
|
||||||
"lua_torqueReductionState = bits, U32, 32, [3:3]\n" +
|
"lua_torqueReductionState = bits, U32, 32, [3:3]\n" +
|
||||||
"; total TS size = 36\n", liveDataProcessor.getOutputsSectionFileName());
|
"; total TS size = 36\n", liveDataProcessor.getOutputsSectionFileName());
|
||||||
|
|
||||||
|
captor.assertOutput("#if !EFI_UNIT_TEST\n" +
|
||||||
|
"// generated by GetOutputValueConsumer.java\n" +
|
||||||
|
"#include \"pch.h\"\n" +
|
||||||
|
"#include \"board_lookup.h\"\n" +
|
||||||
|
"#include \"value_lookup.h\"\n" +
|
||||||
|
"float getOutputValueByName(const char *name) {\n" +
|
||||||
|
"\tint hash = djb2lowerCase(name);\n" +
|
||||||
|
"\tswitch(hash) {\n" +
|
||||||
|
"// tempC\n" +
|
||||||
|
"\t\tcase 275471198:\n" +
|
||||||
|
"\t\t\treturn engine->wbo1.tempC;\n" +
|
||||||
|
"// bitName1\n" +
|
||||||
|
"\t\tcase -1776438954:\n" +
|
||||||
|
"\t\t\treturn engine->wbo1.bitName1;\n" +
|
||||||
|
"// bitName2\n" +
|
||||||
|
"\t\tcase -1776438953:\n" +
|
||||||
|
"\t\t\treturn engine->wbo1.bitName2;\n" +
|
||||||
|
"// esr\n" +
|
||||||
|
"\t\tcase 193490895:\n" +
|
||||||
|
"\t\t\treturn engine->wbo1.esr;\n" +
|
||||||
|
"// oootempC\n" +
|
||||||
|
"\t\tcase 1477961803:\n" +
|
||||||
|
"\t\t\treturn engine->outputChannels.oootempC;\n" +
|
||||||
|
"// oooesr\n" +
|
||||||
|
"\t\tcase 316857724:\n" +
|
||||||
|
"\t\t\treturn engine->outputChannels.oooesr;\n" +
|
||||||
|
"// lua.fuelMult\n" +
|
||||||
|
"\t\tcase -1390672637:\n" +
|
||||||
|
"\t\t\treturn engine->outputChannels.lua.fuelMult;\n" +
|
||||||
|
"// lua.clutchUpState\n" +
|
||||||
|
"\t\tcase -427776066:\n" +
|
||||||
|
"\t\t\treturn engine->outputChannels.lua.clutchUpState;\n" +
|
||||||
|
"// lua.brakePedalState\n" +
|
||||||
|
"\t\tcase -1296201087:\n" +
|
||||||
|
"\t\t\treturn engine->outputChannels.lua.brakePedalState;\n" +
|
||||||
|
"// lua.disableDecelerationFuelCutOff\n" +
|
||||||
|
"\t\tcase 1680936043:\n" +
|
||||||
|
"\t\t\treturn engine->outputChannels.lua.disableDecelerationFuelCutOff;\n" +
|
||||||
|
"// lua.torqueReductionState\n" +
|
||||||
|
"\t\tcase -1605036797:\n" +
|
||||||
|
"\t\t\treturn engine->outputChannels.lua.torqueReductionState;\n" +
|
||||||
|
"\t}\n" +
|
||||||
|
"\treturn EFI_ERROR_CODE;\n" +
|
||||||
|
"}\n" +
|
||||||
|
"#endif\n", liveDataProcessor.getOutputLookupFileName());
|
||||||
|
|
||||||
captor.assertOutput("entry = wb1tempC, \"wb1WBO: Temperature\", int, \"%d\"\n" +
|
captor.assertOutput("entry = wb1tempC, \"wb1WBO: Temperature\", int, \"%d\"\n" +
|
||||||
"entry = wb1bitName1, \"wb1bitName1\", int, \"%d\"\n" +
|
"entry = wb1bitName1, \"wb1bitName1\", int, \"%d\"\n" +
|
||||||
"entry = wb1bitName2, \"wb1bitName2\", int, \"%d\"\n" +
|
"entry = wb1bitName2, \"wb1bitName2\", int, \"%d\"\n" +
|
||||||
|
|
Loading…
Reference in New Issue