only: testBoardConfigWithCustomType

This commit is contained in:
Andrey 2024-06-25 19:11:38 -04:00
parent 07507a0cbd
commit f5afb97b1b
1 changed files with 20 additions and 1 deletions

View File

@ -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());
}}