refactoring

This commit is contained in:
rusefillc 2022-04-17 14:48:00 -04:00
parent e6095e1e56
commit f3897cda58
12 changed files with 48 additions and 64 deletions

View File

@ -223,9 +223,9 @@ public class ConfigDefinition {
* we have '-readfile OUTPUTS_SECTION' in one of .sh files in order to template rusefi.input * we have '-readfile OUTPUTS_SECTION' in one of .sh files in order to template rusefi.input
* Same with '-readfile DATALOG_SECTION' * Same with '-readfile DATALOG_SECTION'
*/ */
state.destinations.add(new OutputsSectionConsumer(tsOutputsDestination + File.separator + "generated/output_channels.ini", state)); state.destinations.add(new OutputsSectionConsumer(tsOutputsDestination + File.separator + "generated/output_channels.ini"));
state.destinations.add(new DataLogConsumer(tsOutputsDestination + File.separator + "generated/data_logs.ini")); state.destinations.add(new DataLogConsumer(tsOutputsDestination + File.separator + "generated/data_logs.ini"));
state.destinations.add(new GaugeConsumer(tsOutputsDestination + File.separator + "generated/gauges.ini", state)); state.destinations.add(new GaugeConsumer(tsOutputsDestination + File.separator + "generated/gauges.ini"));
} }
if (tsInputFileFolder != null) { if (tsInputFileFolder != null) {
state.destinations.add(new TSProjectConsumer(tsInputFileFolder, state)); state.destinations.add(new TSProjectConsumer(tsInputFileFolder, state));

View File

@ -7,7 +7,6 @@ import com.rusefi.VariableRegistry;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.io.CharArrayWriter;
import java.io.FileWriter; import java.io.FileWriter;
import java.io.IOException; import java.io.IOException;
import java.util.TreeSet; import java.util.TreeSet;
@ -18,7 +17,7 @@ import static org.abego.treelayout.internal.util.java.lang.string.StringUtil.quo
public class DataLogConsumer implements ConfigurationConsumer { public class DataLogConsumer implements ConfigurationConsumer {
public static final String UNUSED = "unused"; public static final String UNUSED = "unused";
private final String fileName; private final String fileName;
private final CharArrayWriter tsWriter = new CharArrayWriter(); private final StringBuilder tsWriter = new StringBuilder();
private final TreeSet<String> comments = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); private final TreeSet<String> comments = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
public DataLogConsumer(String fileName) { public DataLogConsumer(String fileName) {
@ -38,10 +37,10 @@ public class DataLogConsumer implements ConfigurationConsumer {
writeStringToFile(fileName, tsWriter); writeStringToFile(fileName, tsWriter);
} }
private void writeStringToFile(@Nullable String fileName, CharArrayWriter writer) throws IOException { private void writeStringToFile(@Nullable String fileName, StringBuilder writer) throws IOException {
if (fileName != null) { if (fileName != null) {
FileWriter fw = new FileWriter(fileName); FileWriter fw = new FileWriter(fileName);
fw.write(writer.toCharArray()); fw.write(writer.toString());
fw.close(); fw.close();
} }
} }
@ -87,7 +86,7 @@ public class DataLogConsumer implements ConfigurationConsumer {
return comment; return comment;
} }
public CharArrayWriter getTsWriter() { public String getContent() {
return tsWriter; return tsWriter.toString();
} }
} }

View File

@ -37,7 +37,7 @@ public class FileJavaFieldsConsumer extends JavaFieldsConsumer {
@Override @Override
public void endFile() throws IOException { public void endFile() throws IOException {
javaFields.write(state.variableRegistry.getJavaConstants()); javaFields.write(state.variableRegistry.getJavaConstants());
javaFields.write(getJavaFieldsWriter()); javaFields.write(getContent());
allFields.append("\t};" + EOL); allFields.append("\t};" + EOL);
javaFields.write(allFields.toString()); javaFields.write(allFields.toString());

View File

@ -12,19 +12,17 @@ import static org.abego.treelayout.internal.util.java.lang.string.StringUtil.quo
public class GaugeConsumer implements ConfigurationConsumer { public class GaugeConsumer implements ConfigurationConsumer {
private final String fileName; private final String fileName;
private final ReaderState state; private final StringBuilder charArrayWriter = new StringBuilder();
private final CharArrayWriter charArrayWriter = new CharArrayWriter();
public GaugeConsumer(String fileName, ReaderState state) { public GaugeConsumer(String fileName) {
this.fileName = fileName; this.fileName = fileName;
this.state = state;
} }
@Override @Override
public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException { public void handleEndStruct(ReaderState readerState, ConfigStructure structure) throws IOException {
if (state.stack.isEmpty()) { if (readerState.stack.isEmpty()) {
PerFieldWithStructuresIterator iterator = new PerFieldWithStructuresIterator(state, structure.tsFields, "", PerFieldWithStructuresIterator iterator = new PerFieldWithStructuresIterator(readerState, structure.tsFields, "",
(state, configField, prefix) -> handle(configField, prefix)); (state, configField, prefix) -> handle(readerState, configField, prefix));
iterator.loop(); iterator.loop();
String content = iterator.getContent(); String content = iterator.getContent();
charArrayWriter.append(content); charArrayWriter.append(content);
@ -32,13 +30,13 @@ public class GaugeConsumer implements ConfigurationConsumer {
if (fileName != null) { if (fileName != null) {
FileWriter fw = new FileWriter(fileName); FileWriter fw = new FileWriter(fileName);
fw.write(charArrayWriter.toCharArray()); fw.write(charArrayWriter.toString());
fw.close(); fw.close();
} }
} }
private String handle(ConfigField configField, String prefix) { private String handle(ReaderState readerState, ConfigField configField, String prefix) {
String comment = getComment("", configField, state.variableRegistry); String comment = getComment("", configField, readerState.variableRegistry);
comment = ConfigField.unquote(comment); comment = ConfigField.unquote(comment);
if (!prefix.isEmpty()) { if (!prefix.isEmpty()) {
comment = prefix + " " + comment; comment = prefix + " " + comment;
@ -60,7 +58,7 @@ public class GaugeConsumer implements ConfigurationConsumer {
"\n"; "\n";
} }
public CharArrayWriter getTsWriter() { public String getContent() {
return charArrayWriter; return charArrayWriter.toString();
} }
} }

View File

@ -3,7 +3,6 @@ package com.rusefi.output;
import com.opensr5.ini.IniFileModel; import com.opensr5.ini.IniFileModel;
import com.rusefi.*; import com.rusefi.*;
import java.io.CharArrayWriter;
import java.io.IOException; import java.io.IOException;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -14,7 +13,7 @@ public abstract class JavaFieldsConsumer implements ConfigurationConsumer {
// todo: why is this field 'static'? // todo: why is this field 'static'?
protected static final Set<String> javaEnums = new HashSet<>(); protected static final Set<String> javaEnums = new HashSet<>();
private final CharArrayWriter javaFieldsWriter = new CharArrayWriter(); private final StringBuilder content = new StringBuilder();
protected final StringBuffer allFields = new StringBuffer("\tpublic static final Field[] VALUES = {" + EOL); protected final StringBuffer allFields = new StringBuffer("\tpublic static final Field[] VALUES = {" + EOL);
protected final ReaderState state; protected final ReaderState state;
@ -22,15 +21,15 @@ public abstract class JavaFieldsConsumer implements ConfigurationConsumer {
this.state = state; this.state = state;
} }
public String getJavaFieldsWriter() { public String getContent() {
return javaFieldsWriter.toString(); return content.toString();
} }
private void writeJavaFieldName(String nameWithPrefix, int tsPosition, double scale) throws IOException { private void writeJavaFieldName(String nameWithPrefix, int tsPosition, double scale) throws IOException {
javaFieldsWriter.write("\tpublic static final Field "); content.append("\tpublic static final Field ");
allFields.append("\t" + nameWithPrefix.toUpperCase() + "," + EOL); allFields.append("\t" + nameWithPrefix.toUpperCase() + "," + EOL);
javaFieldsWriter.write(nameWithPrefix.toUpperCase()); content.append(nameWithPrefix.toUpperCase());
javaFieldsWriter.write(" = Field.create(\"" + nameWithPrefix.toUpperCase() + "\", " content.append(" = Field.create(\"" + nameWithPrefix.toUpperCase() + "\", "
+ tsPosition + ", "); + tsPosition + ", ");
} }
@ -73,20 +72,20 @@ public abstract class JavaFieldsConsumer implements ConfigurationConsumer {
if (configField.isBit()) { if (configField.isBit()) {
writeJavaFieldName(nameWithPrefix, tsPosition, 1); writeJavaFieldName(nameWithPrefix, tsPosition, 1);
javaFieldsWriter.append("FieldType.BIT, " + bitIndex + ");" + EOL); content.append("FieldType.BIT, " + bitIndex + ");" + EOL);
tsPosition += configField.getSize(next); tsPosition += configField.getSize(next);
return tsPosition; return tsPosition;
} }
if (TypesHelper.isFloat(configField.getType())) { if (TypesHelper.isFloat(configField.getType())) {
writeJavaFieldName(nameWithPrefix, tsPosition, configField.autoscaleSpecNumber()); writeJavaFieldName(nameWithPrefix, tsPosition, configField.autoscaleSpecNumber());
javaFieldsWriter.write("FieldType.FLOAT);" + EOL); content.append("FieldType.FLOAT);" + EOL);
} else { } else {
String enumOptions = state.variableRegistry.get(configField.getType() + VariableRegistry.ENUM_SUFFIX); String enumOptions = state.variableRegistry.get(configField.getType() + VariableRegistry.ENUM_SUFFIX);
if (enumOptions != null && !javaEnums.contains(configField.getType())) { if (enumOptions != null && !javaEnums.contains(configField.getType())) {
javaEnums.add(configField.getType()); javaEnums.add(configField.getType());
javaFieldsWriter.write("\tpublic static final String[] " + configField.getType() + " = {" + enumOptions + "};" + EOL); content.append("\tpublic static final String[] " + configField.getType() + " = {" + enumOptions + "};" + EOL);
} }
@ -95,14 +94,14 @@ public abstract class JavaFieldsConsumer implements ConfigurationConsumer {
String custom = state.tsCustomLine.get(configField.getType()); String custom = state.tsCustomLine.get(configField.getType());
String[] tokens = custom.split(","); String[] tokens = custom.split(",");
String stringSize = tokens[3].trim(); String stringSize = tokens[3].trim();
javaFieldsWriter.write(stringSize + ", FieldType.STRING"); content.append(stringSize + ", FieldType.STRING");
} else { } else {
javaFieldsWriter.write(getJavaType(configField.getElementSize())); content.append(getJavaType(configField.getElementSize()));
} }
if (enumOptions != null) { if (enumOptions != null) {
javaFieldsWriter.write(", " + configField.getType()); content.append(", " + configField.getType());
} }
javaFieldsWriter.write(")" + ".setScale(" + configField.autoscaleSpecNumber() + ")" + content.append(")" + ".setScale(" + configField.autoscaleSpecNumber() + ")" +
";" + EOL); ";" + EOL);
} }

View File

@ -10,12 +10,10 @@ import java.io.*;
public class OutputsSectionConsumer implements ConfigurationConsumer { public class OutputsSectionConsumer implements ConfigurationConsumer {
private final String tsOutputsSectionFileName; private final String tsOutputsSectionFileName;
private final TsOutput tsOutput; private final TsOutput tsOutput;
private final ReaderState state;
public OutputsSectionConsumer(String tsOutputsSectionFileName, ReaderState state) { public OutputsSectionConsumer(String tsOutputsSectionFileName) {
this.tsOutputsSectionFileName = tsOutputsSectionFileName; this.tsOutputsSectionFileName = tsOutputsSectionFileName;
tsOutput = new TsOutput(state, false); tsOutput = new TsOutput(false);
this.state = state;
} }
public String getContent() { public String getContent() {
@ -28,7 +26,7 @@ public class OutputsSectionConsumer implements ConfigurationConsumer {
tsOutput.run(readerState, structure, 0); tsOutput.run(readerState, structure, 0);
if (state.stack.isEmpty()) { if (readerState.stack.isEmpty()) {
if (tsOutputsSectionFileName != null) { if (tsOutputsSectionFileName != null) {
FileWriter fos = new FileWriter(tsOutputsSectionFileName); FileWriter fos = new FileWriter(tsOutputsSectionFileName);
fos.write(tsOutput.getContent()); fos.write(tsOutput.getContent());

View File

@ -7,7 +7,6 @@ import com.rusefi.util.SystemOut;
import java.io.*; import java.io.*;
import static com.rusefi.ToolUtil.EOL;
import static com.rusefi.util.IoUtils.CHARSET; import static com.rusefi.util.IoUtils.CHARSET;
/** /**
@ -28,7 +27,7 @@ public class TSProjectConsumer implements ConfigurationConsumer {
public TSProjectConsumer(String tsPath, ReaderState state) { public TSProjectConsumer(String tsPath, ReaderState state) {
this.tsPath = tsPath; this.tsPath = tsPath;
tsOutput = new TsOutput(state, true); tsOutput = new TsOutput(true);
this.state = state; this.state = state;
} }

View File

@ -6,7 +6,6 @@ import com.rusefi.ReaderState;
import com.rusefi.TypesHelper; import com.rusefi.TypesHelper;
import java.io.IOException; import java.io.IOException;
import java.util.List;
import static com.rusefi.ToolUtil.EOL; import static com.rusefi.ToolUtil.EOL;
@ -17,12 +16,10 @@ import static com.rusefi.ToolUtil.EOL;
@SuppressWarnings({"StringConcatenationInsideStringBufferAppend", "DanglingJavadoc"}) @SuppressWarnings({"StringConcatenationInsideStringBufferAppend", "DanglingJavadoc"})
public class TsOutput { public class TsOutput {
private final StringBuilder settingContextHelp = new StringBuilder(); private final StringBuilder settingContextHelp = new StringBuilder();
private final ReaderState state;
private final boolean isConstantsSection; private final boolean isConstantsSection;
private final StringBuilder tsHeader = new StringBuilder(); private final StringBuilder tsHeader = new StringBuilder();
public TsOutput(ReaderState state, boolean longForm) { public TsOutput(boolean longForm) {
this.state = state;
this.isConstantsSection = longForm; this.isConstantsSection = longForm;
} }
@ -128,7 +125,7 @@ public class TsOutput {
private String handleTsInfo(String tsInfo, int multiplierIndex) { private String handleTsInfo(String tsInfo, int multiplierIndex) {
try { try {
String[] fields = tsInfo.split("\\,"); String[] fields = tsInfo.split(",");
if (fields.length > multiplierIndex) { if (fields.length > multiplierIndex) {
/** /**
* Evaluate static math on .ini layer to simplify rusEFI java and rusEFI PHP project consumers * Evaluate static math on .ini layer to simplify rusEFI java and rusEFI PHP project consumers

View File

@ -4,11 +4,7 @@ import com.rusefi.ReaderState;
import com.rusefi.output.JavaFieldsConsumer; import com.rusefi.output.JavaFieldsConsumer;
import org.junit.Test; import org.junit.Test;
import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader;
import java.util.Arrays;
import java.util.Collections;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@ -58,6 +54,6 @@ public class ConfigFieldParserIssue1057Test {
"\tpublic static final Field UNUSEDBIT_1_30 = Field.create(\"UNUSEDBIT_1_30\", 0, FieldType.BIT, 30);\n" + "\tpublic static final Field UNUSEDBIT_1_30 = Field.create(\"UNUSEDBIT_1_30\", 0, FieldType.BIT, 30);\n" +
"\tpublic static final Field UNUSEDBIT_1_31 = Field.create(\"UNUSEDBIT_1_31\", 0, FieldType.BIT, 31);\n" + "\tpublic static final Field UNUSEDBIT_1_31 = Field.create(\"UNUSEDBIT_1_31\", 0, FieldType.BIT, 31);\n" +
"\tpublic static final Field FIELDNAME = Field.create(\"FIELDNAME\", 4, FieldType.INT).setScale(1.0);\n", "\tpublic static final Field FIELDNAME = Field.create(\"FIELDNAME\", 4, FieldType.INT).setScale(1.0);\n",
javaFieldsConsumer.getJavaFieldsWriter()); javaFieldsConsumer.getContent());
} }
} }

View File

@ -185,7 +185,7 @@ public class ConfigFieldParserTest {
assertEquals("\tpublic static final Field VAR = Field.create(\"VAR\", 0, 120, FieldType.STRING).setScale(1.0);\n" + assertEquals("\tpublic static final Field VAR = Field.create(\"VAR\", 0, 120, FieldType.STRING).setScale(1.0);\n" +
"\tpublic static final Field PERIODMS = Field.create(\"PERIODMS\", 120, FieldType.INT16).setScale(1.0);\n" + "\tpublic static final Field PERIODMS = Field.create(\"PERIODMS\", 120, FieldType.INT16).setScale(1.0);\n" +
"\tpublic static final Field ALIGNMENTFILL_AT_122 = Field.create(\"ALIGNMENTFILL_AT_122\", 122, FieldType.INT8).setScale(1.0);\n", "\tpublic static final Field ALIGNMENTFILL_AT_122 = Field.create(\"ALIGNMENTFILL_AT_122\", 122, FieldType.INT8).setScale(1.0);\n",
javaFieldsConsumer.getJavaFieldsWriter()); javaFieldsConsumer.getContent());
} }
@Test @Test
@ -266,7 +266,7 @@ public class ConfigFieldParserTest {
"\tpublic static final Field ETB2_PERIODMS = Field.create(\"ETB2_PERIODMS\", 18, FieldType.INT16).setScale(1.0);\n" + "\tpublic static final Field ETB2_PERIODMS = Field.create(\"ETB2_PERIODMS\", 18, FieldType.INT16).setScale(1.0);\n" +
"\tpublic static final Field ETB2_MINVALUE = Field.create(\"ETB2_MINVALUE\", 20, FieldType.INT16).setScale(1.0);\n" + "\tpublic static final Field ETB2_MINVALUE = Field.create(\"ETB2_MINVALUE\", 20, FieldType.INT16).setScale(1.0);\n" +
"\tpublic static final Field ETB2_ALIGNMENTFILL_AT_6 = Field.create(\"ETB2_ALIGNMENTFILL_AT_6\", 22, FieldType.INT8).setScale(1.0);\n", "\tpublic static final Field ETB2_ALIGNMENTFILL_AT_6 = Field.create(\"ETB2_ALIGNMENTFILL_AT_6\", 22, FieldType.INT8).setScale(1.0);\n",
javaFieldsConsumer.getJavaFieldsWriter()); javaFieldsConsumer.getContent());
} }
} }
@ -282,7 +282,7 @@ public class ConfigFieldParserTest {
JavaFieldsConsumer javaFieldsConsumer = new TestJavaFieldsConsumer(state); JavaFieldsConsumer javaFieldsConsumer = new TestJavaFieldsConsumer(state);
state.readBufferedReader(test, consumer, javaFieldsConsumer); state.readBufferedReader(test, consumer, javaFieldsConsumer);
assertEquals("\tpublic static final Field FIELD1 = Field.create(\"FIELD1\", 0, FieldType.INT).setScale(0.01);\n", assertEquals("\tpublic static final Field FIELD1 = Field.create(\"FIELD1\", 0, FieldType.INT).setScale(0.01);\n",
javaFieldsConsumer.getJavaFieldsWriter()); javaFieldsConsumer.getContent());
assertEquals("// start of pid_s\n" + assertEquals("// start of pid_s\n" +
"struct pid_s {\n" + "struct pid_s {\n" +
"\t/**\n" + "\t/**\n" +

View File

@ -20,7 +20,7 @@ public class OutputsTest {
"end_struct\n"; "end_struct\n";
ReaderState state = new ReaderState(); ReaderState state = new ReaderState();
OutputsSectionConsumer tsProjectConsumer = new OutputsSectionConsumer(null, state); OutputsSectionConsumer tsProjectConsumer = new OutputsSectionConsumer(null);
state.readBufferedReader(test, tsProjectConsumer); state.readBufferedReader(test, tsProjectConsumer);
@ -73,7 +73,7 @@ public class OutputsTest {
"end_struct\n"; "end_struct\n";
ReaderState state = new ReaderState(); ReaderState state = new ReaderState();
OutputsSectionConsumer tsProjectConsumer = new OutputsSectionConsumer(null, state); OutputsSectionConsumer tsProjectConsumer = new OutputsSectionConsumer(null);
state.readBufferedReader(test, (tsProjectConsumer)); state.readBufferedReader(test, (tsProjectConsumer));
} }
@ -107,7 +107,7 @@ public class OutputsTest {
"entry = afr_typet, \"afr_typet\", int, \"%d\"\n" + "entry = afr_typet, \"afr_typet\", int, \"%d\"\n" +
"entry = vehicleSpeedKph, \"vehicleSpeedKph\", int, \"%d\"\n" + "entry = vehicleSpeedKph, \"vehicleSpeedKph\", int, \"%d\"\n" +
"entry = isForcedInduction, \"Does the vehicle have a turbo or supercharger?\", int, \"%d\"\n" + "entry = isForcedInduction, \"Does the vehicle have a turbo or supercharger?\", int, \"%d\"\n" +
"entry = enableFan1WithAc, \"+Turn on this fan when AC is on.\", int, \"%d\"\n", new String(dataLogConsumer.getTsWriter().toCharArray())); "entry = enableFan1WithAc, \"+Turn on this fan when AC is on.\", int, \"%d\"\n", dataLogConsumer.getContent());
} }
@ -280,7 +280,6 @@ public class OutputsTest {
"\t\treturn config->enableFan1WithAc;\n" + "\t\treturn config->enableFan1WithAc;\n" +
"\treturn EFI_ERROR_CODE;\n" + "\treturn EFI_ERROR_CODE;\n" +
"}\n", getConfigValueConsumer.getGetterForUnitTest()); "}\n", getConfigValueConsumer.getGetterForUnitTest());
} }
@Test @Test
@ -296,20 +295,20 @@ public class OutputsTest {
ReaderState state = new ReaderState(); ReaderState state = new ReaderState();
DataLogConsumer dataLogConsumer = new DataLogConsumer(null); DataLogConsumer dataLogConsumer = new DataLogConsumer(null);
GaugeConsumer gaugeConsumer = new GaugeConsumer(null, state); GaugeConsumer gaugeConsumer = new GaugeConsumer(null);
state.readBufferedReader(test, dataLogConsumer, gaugeConsumer); state.readBufferedReader(test, dataLogConsumer, gaugeConsumer);
assertEquals( assertEquals(
"entry = alternatorStatus_iTerm, \"alternatorStatus_iTerm\", float, \"%.3f\"\n" + "entry = alternatorStatus_iTerm, \"alternatorStatus_iTerm\", float, \"%.3f\"\n" +
"entry = alternatorStatus_dTerm, \"alternatorStatus_dTerm\", float, \"%.3f\"\n" + "entry = alternatorStatus_dTerm, \"alternatorStatus_dTerm\", float, \"%.3f\"\n" +
"entry = idleStatus_iTerm, \"idleStatus_iTerm\", float, \"%.3f\"\n" + "entry = idleStatus_iTerm, \"idleStatus_iTerm\", float, \"%.3f\"\n" +
"entry = idleStatus_dTerm, \"idleStatus_dTerm\", float, \"%.3f\"\n", "entry = idleStatus_dTerm, \"idleStatus_dTerm\", float, \"%.3f\"\n",
new String(dataLogConsumer.getTsWriter().toCharArray())); dataLogConsumer.getContent());
assertEquals("alternatorStatus_iTermGauge = alternatorStatus_iTerm,\"alternatorStatus_ iTerm\", \"v\", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 4,4\n" + assertEquals("alternatorStatus_iTermGauge = alternatorStatus_iTerm,\"alternatorStatus_ iTerm\", \"v\", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 4,4\n" +
"alternatorStatus_dTermGauge = alternatorStatus_dTerm,\"alternatorStatus_ dTerm\", \"v\", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 4,4\n" + "alternatorStatus_dTermGauge = alternatorStatus_dTerm,\"alternatorStatus_ dTerm\", \"v\", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 4,4\n" +
"idleStatus_iTermGauge = idleStatus_iTerm,\"idleStatus_ iTerm\", \"v\", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 4,4\n" + "idleStatus_iTermGauge = idleStatus_iTerm,\"idleStatus_ iTerm\", \"v\", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 4,4\n" +
"idleStatus_dTermGauge = idleStatus_dTerm,\"idleStatus_ dTerm\", \"v\", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 4,4\n", "idleStatus_dTermGauge = idleStatus_dTerm,\"idleStatus_ dTerm\", \"v\", -10000.0,10000.0, -10000.0,10000.0, -10000.0,10000.0, 4,4\n",
new String(gaugeConsumer.getTsWriter().toCharArray())); gaugeConsumer.getContent());
} }
} }

View File

@ -6,7 +6,6 @@ import com.rusefi.output.JavaFieldsConsumer;
import com.rusefi.output.TSProjectConsumer; import com.rusefi.output.TSProjectConsumer;
import org.junit.Test; import org.junit.Test;
import java.io.CharArrayWriter;
import java.io.IOException; import java.io.IOException;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
@ -65,7 +64,7 @@ public class TSProjectConsumerTest {
assertEquals("\tpublic static final Field PERIODMS2 = Field.create(\"PERIODMS2\", 0, FieldType.INT16).setScale(1.0);\n" + assertEquals("\tpublic static final Field PERIODMS2 = Field.create(\"PERIODMS2\", 0, FieldType.INT16).setScale(1.0);\n" +
"\tpublic static final Field AFRTABLE = Field.create(\"AFRTABLE\", 2, FieldType.INT).setScale(1.0);\n" + "\tpublic static final Field AFRTABLE = Field.create(\"AFRTABLE\", 2, FieldType.INT).setScale(1.0);\n" +
"\tpublic static final Field PERIODMS = Field.create(\"PERIODMS\", 18, FieldType.INT16).setScale(1.0);\n", "\tpublic static final Field PERIODMS = Field.create(\"PERIODMS\", 18, FieldType.INT16).setScale(1.0);\n",
javaFieldsConsumer.getJavaFieldsWriter()); javaFieldsConsumer.getContent());
assertEquals("// start of pid_s\n" + assertEquals("// start of pid_s\n" +