mirror of https://github.com/rusefi/rusefi.git
parent
a85cebf2cc
commit
0df3dbb06b
|
@ -65,14 +65,18 @@ public class OutputsTest {
|
|||
"\t\tfloat pTerm;;\"\", 1, 0, -50000, 50000, 2\n" +
|
||||
"\t\tint16_t autoscale dTerm;;\"\", 0.01, 0, -327, 327, 2\n" +
|
||||
"\tend_struct\n" +
|
||||
"\tpid_status_s[2 iterate] vvtStatus\n" +
|
||||
"\tpid_status_s wastegateDcStatus\n" +
|
||||
"\n" +
|
||||
"\tpid_status_s[2 iterate] vvtStatus\n" +
|
||||
"end_struct\n";
|
||||
ReaderStateImpl state = new ReaderStateImpl();
|
||||
DataLogConsumer dataLogConsumer = new DataLogConsumer(null);
|
||||
state.readBufferedReader(test, dataLogConsumer);
|
||||
assertEquals(
|
||||
"entry = vvtStatus1_pTerm, \"vvtStatus1_pTerm\", float, \"%.3f\"\n" +
|
||||
"entry = vvtStatus1_dTerm, \"vvtStatus1_dTerm\", float, \"%.3f\"\n" +
|
||||
"entry = vvtStatus2_pTerm, \"vvtStatus2_pTerm\", float, \"%.3f\"\n" +
|
||||
"entry = vvtStatus2_dTerm, \"vvtStatus2_dTerm\", float, \"%.3f\"\n" +
|
||||
"entry = wastegateDcStatus_pTerm, \"wastegateDcStatus_pTerm\", float, \"%.3f\"\n" +
|
||||
"entry = wastegateDcStatus_dTerm, \"wastegateDcStatus_dTerm\", float, \"%.3f\"\n",
|
||||
dataLogConsumer.getContent());
|
||||
|
|
|
@ -35,8 +35,19 @@ public class DataLogConsumer implements ConfigurationConsumer {
|
|||
@Override
|
||||
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
|
||||
if (readerState.isStackEmpty()) {
|
||||
PerFieldWithStructuresIterator.Strategy strategy = new PerFieldWithStructuresIterator.Strategy() {
|
||||
@Override
|
||||
public String process(ReaderState state, ConfigField configField, String prefix) {
|
||||
return handle(configField, prefix);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean skip(ConfigField cf) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
PerFieldWithStructuresIterator iterator = new PerFieldWithStructuresIterator(readerState, structure.getTsFields(), "",
|
||||
(configField, prefix, prefix2) -> handle(prefix, prefix2));
|
||||
strategy);
|
||||
iterator.loop();
|
||||
String content = iterator.getContent();
|
||||
tsWriter.append(content);
|
||||
|
|
Loading…
Reference in New Issue