TODO: We have to move either forward or backwards with newparse #4441

This commit is contained in:
rusefillc 2022-08-14 18:20:49 -04:00
parent 1946218699
commit 4c93418599
4 changed files with 17 additions and 43 deletions

View File

@ -14,6 +14,7 @@ public class TsWriter {
private static final Pattern OPTIONAL_LINE = Pattern.compile("@@if_([a-zA-Z0-9_]+)");
// TODO: We have to move either forward or backwards with newparse #4441
public void writeTunerstudio(ParseState parser, String inputFile, String outputFile) throws IOException {
PrintStream ps = new PrintStreamAlwaysUnix(new FileOutputStream(outputFile));
writeTunerstudio(parser, inputFile, ps);

View File

@ -5,6 +5,7 @@ import com.rusefi.ReaderState;
import java.io.*;
/**
* TODO: We have to move either forward or backwards with newparse #4441
* [OutputChannels]
*/
public class OutputsSectionConsumer implements ConfigurationConsumer {

View File

@ -2,11 +2,15 @@ package com.rusefi.test;
import com.rusefi.BitState;
import com.rusefi.ReaderState;
import com.rusefi.output.*;
import com.rusefi.output.DataLogConsumer;
import com.rusefi.output.GaugeConsumer;
import com.rusefi.output.GetOutputValueConsumer;
import com.rusefi.output.OutputsSectionConsumer;
import org.junit.Test;
import java.io.IOException;
import static com.rusefi.test.newParse.NewParseHelper.parseToOutputChannels;
import static org.junit.Assert.assertEquals;
public class OutputsTest {
@ -23,48 +27,14 @@ public class OutputsTest {
"float tCharge;speed density\n" +
"end_struct\n";
OutputsSectionConsumer tsProjectConsumer = new OutputsSectionConsumer(null);
state.readBufferedReader(test, tsProjectConsumer);
assertEquals("afr_type = scalar, F32, 0, \"ms\", 1, 0\n" +
"afr_typet = scalar, U08, 4, \"ms\", 1, 0\n" +
"isForcedInduction = bits, U32, 8, [0:0]\n" +
"enableFan1WithAc = bits, U32, 8, [1:1]\n" +
"unusedBit_5_2 = bits, U32, 8, [2:2]\n" +
"unusedBit_5_3 = bits, U32, 8, [3:3]\n" +
"unusedBit_5_4 = bits, U32, 8, [4:4]\n" +
"unusedBit_5_5 = bits, U32, 8, [5:5]\n" +
"unusedBit_5_6 = bits, U32, 8, [6:6]\n" +
"unusedBit_5_7 = bits, U32, 8, [7:7]\n" +
"unusedBit_5_8 = bits, U32, 8, [8:8]\n" +
"unusedBit_5_9 = bits, U32, 8, [9:9]\n" +
"unusedBit_5_10 = bits, U32, 8, [10:10]\n" +
"unusedBit_5_11 = bits, U32, 8, [11:11]\n" +
"unusedBit_5_12 = bits, U32, 8, [12:12]\n" +
"unusedBit_5_13 = bits, U32, 8, [13:13]\n" +
"unusedBit_5_14 = bits, U32, 8, [14:14]\n" +
"unusedBit_5_15 = bits, U32, 8, [15:15]\n" +
"unusedBit_5_16 = bits, U32, 8, [16:16]\n" +
"unusedBit_5_17 = bits, U32, 8, [17:17]\n" +
"unusedBit_5_18 = bits, U32, 8, [18:18]\n" +
"unusedBit_5_19 = bits, U32, 8, [19:19]\n" +
"unusedBit_5_20 = bits, U32, 8, [20:20]\n" +
"unusedBit_5_21 = bits, U32, 8, [21:21]\n" +
"unusedBit_5_22 = bits, U32, 8, [22:22]\n" +
"unusedBit_5_23 = bits, U32, 8, [23:23]\n" +
"unusedBit_5_24 = bits, U32, 8, [24:24]\n" +
"unusedBit_5_25 = bits, U32, 8, [25:25]\n" +
"unusedBit_5_26 = bits, U32, 8, [26:26]\n" +
"unusedBit_5_27 = bits, U32, 8, [27:27]\n" +
"unusedBit_5_28 = bits, U32, 8, [28:28]\n" +
"unusedBit_5_29 = bits, U32, 8, [29:29]\n" +
"unusedBit_5_30 = bits, U32, 8, [30:30]\n" +
"unusedBit_5_31 = bits, U32, 8, [31:31]\n" +
"m_requested_pump = scalar, F32, 12, \"\", 1, 0\n" +
"tCharge = scalar, F32, 16, \"\", 1, 0\n" +
"; total TS size = 20\n", tsProjectConsumer.getContent());
String expected = "root_afr_type = scalar, F32, 0, \"ms\", 1, 0\n" +
"root_afr_typet = scalar, U08, 4, \"ms\", 1, 0\n" +
"root_isForcedInduction = bits, U32, 8, [0:0]\n" +
"root_enableFan1WithAc = bits, U32, 8, [1:1]\n" +
"root_m_requested_pump = scalar, F32, 12, \"\", 1, 0\n" +
"root_tCharge = scalar, F32, 16, \"\", 1, 0\n" +
"; total TS size = 20\n";
assertEquals(expected, parseToOutputChannels(test));
}
@Test(expected = BitState.TooManyBitsInARow.class)

View File

@ -17,6 +17,7 @@ public class NewParseHelper {
return parseState;
}
// TODO: We have to move either forward or backwards with newparse #4441
public static String parseToTs(String input) throws IOException {
ParseState state = parse(input);
@ -46,6 +47,7 @@ public class NewParseHelper {
return baos.toString(utf8);
}
// TODO: We have to move either forward or backwards with newparse #4441
public static String parseToC(String input) throws IOException {
ParseState state = parse(input);