From 7e40edbebc21ae7846df7705c56d23cc3b8c1b0b Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sun, 24 Apr 2022 23:44:49 -0400 Subject: [PATCH] 2 byte pin index #4097 wow that's bad again --- .../rusefi/test/ConfigFieldParserTest.java | 40 +++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/java_tools/configuration_definition/src/test/java/com/rusefi/test/ConfigFieldParserTest.java b/java_tools/configuration_definition/src/test/java/com/rusefi/test/ConfigFieldParserTest.java index 4e7fad1951..86dd36db21 100644 --- a/java_tools/configuration_definition/src/test/java/com/rusefi/test/ConfigFieldParserTest.java +++ b/java_tools/configuration_definition/src/test/java/com/rusefi/test/ConfigFieldParserTest.java @@ -8,6 +8,7 @@ import com.rusefi.output.BaseCHeaderConsumer; import com.rusefi.output.ConfigStructure; import com.rusefi.output.JavaFieldsConsumer; import com.rusefi.output.TSProjectConsumer; +import org.junit.Ignore; import org.junit.Test; import java.io.IOException; @@ -525,6 +526,45 @@ public class ConfigFieldParserTest { consumer.getContent()); } + @Test + public void justTwoBytes() throws IOException { + String test = + "struct_no_prefix pid_s\n" + + "\tint8_t byte1\n" + + "\tint8_t byte2\n" + + "end_struct\n" + + ""; + BaseCHeaderConsumer consumer = new BaseCHeaderConsumer(); + ReaderState state = new ReaderState(); + state.readBufferedReader(test, consumer); + assertEquals("// start of pid_s\n" + + "struct pid_s {\n" + + "\t/**\n" + + "\t * offset 0\n" + + "\t */\n" + + "\tint8_t byte1 = (int8_t)0;\n" + + "\t/**\n" + + "\t * need 4 byte alignment\n" + + "\tunits\n" + + "\t * offset 1\n" + + "\t */\n" + + "\tuint8_t alignmentFill_at_1[3];\n" + + "\t/**\n" + + "\t * offset 4\n" + + "\t */\n" + + "\tint8_t byte2 = (int8_t)0;\n" + + "\t/**\n" + + "\t * need 4 byte alignment\n" + + "\tunits\n" + + "\t * offset 5\n" + + "\t */\n" + + "\tuint8_t alignmentFill_at_5[3];\n" + + "};\n" + + "static_assert(sizeof(pid_s) == 8);\n" + + "\n", + consumer.getContent()); + } + @Test public void testParseLine() { ReaderState state = new ReaderState();