only: extracting & fixing test
This commit is contained in:
parent
8f627887b7
commit
fa7d33ac19
|
@ -0,0 +1,48 @@
|
|||
package com.rusefi.test;
|
||||
|
||||
import com.rusefi.ReaderStateImpl;
|
||||
import com.rusefi.output.GetOutputValueConsumer;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class GetOutputValueConsumerTest {
|
||||
@Test
|
||||
public void generateGetOutputs() {
|
||||
String test = "struct_no_prefix ts_outputs_s\n" +
|
||||
"bit issue_294_31,\"si_example\",\"nada_example\"\n" +
|
||||
"bit enableFan1WithAc;+Turn on this fan when AC is on.\n" +
|
||||
"int hwChannel;\n" +
|
||||
"end_struct\n";
|
||||
ReaderStateImpl state = new ReaderStateImpl();
|
||||
|
||||
GetOutputValueConsumer outputValueConsumer = new GetOutputValueConsumer(null);
|
||||
outputValueConsumer.conditional = "EFI_BOOST_CONTROL";
|
||||
state.readBufferedReader(test, (outputValueConsumer));
|
||||
assertEquals(
|
||||
"// generated by GetOutputValueConsumer.java\n" +
|
||||
"#include \"pch.h\"\n" +
|
||||
"#include \"value_lookup.h\"\n" +
|
||||
"float getOutputValueByName(const char *name) {\n" +
|
||||
"\tint hash = djb2lowerCase(name);\n" +
|
||||
"\tswitch(hash) {\n" +
|
||||
"// issue_294_31\n" +
|
||||
"#if EFI_BOOST_CONTROL\n" +
|
||||
"\t\tcase -1571463185:\n" +
|
||||
"\t\t\treturn engine->outputChannels.issue_294_31;\n" +
|
||||
"#endif\n" +
|
||||
"// enableFan1WithAc\n" +
|
||||
"#if EFI_BOOST_CONTROL\n" +
|
||||
"\t\tcase -298185774:\n" +
|
||||
"\t\t\treturn engine->outputChannels.enableFan1WithAc;\n" +
|
||||
"#endif\n" +
|
||||
"// hwChannel\n" +
|
||||
"#if EFI_BOOST_CONTROL\n" +
|
||||
"\t\tcase -709106787:\n" +
|
||||
"\t\t\treturn engine->outputChannels.hwChannel;\n" +
|
||||
"#endif\n" +
|
||||
"\t}\n" +
|
||||
"\treturn EFI_ERROR_CODE;\n" +
|
||||
"}\n", outputValueConsumer.getContent());
|
||||
}
|
||||
}
|
|
@ -137,45 +137,6 @@ public class OutputsTest {
|
|||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void generateGetOutputs() {
|
||||
String test = "struct_no_prefix ts_outputs_s\n" +
|
||||
"bit issue_294_31,\"si_example\",\"nada_example\"\n" +
|
||||
"bit enableFan1WithAc;+Turn on this fan when AC is on.\n" +
|
||||
"int hwChannel;\n" +
|
||||
"end_struct\n";
|
||||
ReaderStateImpl state = new ReaderStateImpl();
|
||||
|
||||
GetOutputValueConsumer outputValueConsumer = new GetOutputValueConsumer(null);
|
||||
outputValueConsumer.conditional = "EFI_BOOST_CONTROL";
|
||||
state.readBufferedReader(test, (outputValueConsumer));
|
||||
assertEquals(
|
||||
"// generated by GetConfigValueConsumer.java\n" +
|
||||
"#include \"pch.h\"\n" +
|
||||
"#include \"value_lookup.h\"\n" +
|
||||
"float getOutputValueByName(const char *name) {\n" +
|
||||
"\tint hash = djb2lowerCase(name);\n" +
|
||||
"\tswitch(hash) {\n" +
|
||||
"// issue_294_31\n" +
|
||||
"#if EFI_BOOST_CONTROL\n" +
|
||||
"\t\tcase -1571463185:\n" +
|
||||
"\t\t\treturn engine->outputChannels.issue_294_31;\n" +
|
||||
"#endif\n" +
|
||||
"// enableFan1WithAc\n" +
|
||||
"#if EFI_BOOST_CONTROL\n" +
|
||||
"\t\tcase -298185774:\n" +
|
||||
"\t\t\treturn engine->outputChannels.enableFan1WithAc;\n" +
|
||||
"#endif\n" +
|
||||
"// hwChannel\n" +
|
||||
"#if EFI_BOOST_CONTROL\n" +
|
||||
"\t\tcase -709106787:\n" +
|
||||
"\t\t\treturn engine->outputChannels.hwChannel;\n" +
|
||||
"#endif\n" +
|
||||
"\t}\n" +
|
||||
"\treturn EFI_ERROR_CODE;\n" +
|
||||
"}\n", outputValueConsumer.getContent());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void sensorStruct() {
|
||||
String test = "struct total\n" +
|
||||
|
|
Loading…
Reference in New Issue