From f5afb97b1bb72628f762c2c6bf158213408115c0 Mon Sep 17 00:00:00 2001 From: Andrey Date: Tue, 25 Jun 2024 19:11:38 -0400 Subject: [PATCH] only: testBoardConfigWithCustomType --- .../java/com/rusefi/test/BoardConfigTest.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/java_tools/configuration_definition/src/test/java/com/rusefi/test/BoardConfigTest.java b/java_tools/configuration_definition/src/test/java/com/rusefi/test/BoardConfigTest.java index ccc4cc28c7..f2a5fb27ea 100644 --- a/java_tools/configuration_definition/src/test/java/com/rusefi/test/BoardConfigTest.java +++ b/java_tools/configuration_definition/src/test/java/com/rusefi/test/BoardConfigTest.java @@ -30,4 +30,23 @@ public class BoardConfigTest { "\tpublic static final Field FIELDNAME2 = Field.create(\"FIELDNAME2\", 4, FieldType.INT).setScale(1.0).setBaseOffset(0);\n", javaFieldsConsumer.getContent()); } -} + + @Test + public void testBoardConfigWithCustomType() { + ReaderStateImpl state = new ReaderStateImpl(); + JavaFieldsConsumer javaFieldsConsumer = new TestJavaFieldsConsumer(state); + + state.getVariableRegistry().register(BoardConfigStrategy.BOARD_CONFIG_FROM_FILE, "custom string_here_t 64 string, ASCII, @OFFSET@, 64\n" + + "string_here_t fieldName2;\n"); + + String inputString = "struct parent\n" + + "@@" + BoardConfigStrategy.BOARD_CONFIG_FROM_FILE + "@@\n" + + "int fieldName;\n" + + "end_struct\n"; + + state.readBufferedReader(inputString, javaFieldsConsumer); + + assertEquals("\tpublic static final Field FIELDNAME2 = Field.create(\"FIELDNAME2\", 0, 64, FieldType.STRING).setScale(1.0).setBaseOffset(0);\n" + + "\tpublic static final Field FIELDNAME = Field.create(\"FIELDNAME\", 64, FieldType.INT).setScale(1.0).setBaseOffset(0);\n", + javaFieldsConsumer.getContent()); + }}