only:BOARD_CONFIG_FROM_FILE test

This commit is contained in:
rusefillc 2024-06-18 20:04:41 -04:00
parent e0d1c78090
commit d9d17cc1b1
3 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,5 @@
package com.rusefi.tools.tune;
public class BoardConfigStrategy {
public static final String BOARD_CONFIG_FROM_FILE = "BOARD_CONFIG_FROM_FILE";
}

View File

@ -0,0 +1,29 @@
package com.rusefi.test;
import com.rusefi.ReaderStateImpl;
import com.rusefi.output.JavaFieldsConsumer;
import com.rusefi.tools.tune.BoardConfigStrategy;
import org.junit.jupiter.api.Test;
import static com.rusefi.AssertCompatibility.assertEquals;
public class BoardConfigTest {
@Test
public void testBoardConfig() {
ReaderStateImpl state = new ReaderStateImpl();
JavaFieldsConsumer javaFieldsConsumer = new TestJavaFieldsConsumer(state);
state.getVariableRegistry().register(BoardConfigStrategy.BOARD_CONFIG_FROM_FILE, "int fieldName2;\n");
String inputString = "struct pid_s\n" +
"int fieldName;\n" +
"@@" + BoardConfigStrategy.BOARD_CONFIG_FROM_FILE + "@@\n" +
"end_struct\n";
state.readBufferedReader(inputString, javaFieldsConsumer);
assertEquals("\tpublic static final Field FIELDNAME = Field.create(\"FIELDNAME\", 0, FieldType.INT).setScale(1.0).setBaseOffset(0);\n" +
"\tpublic static final Field FIELDNAME2 = Field.create(\"FIELDNAME2\", 4, FieldType.INT).setScale(1.0).setBaseOffset(0);\n",
javaFieldsConsumer.getContent());
}
}

View File

@ -26,7 +26,7 @@ public class MetaHelper {
List<String> options = Files.readAllLines(Paths.get(RootHolder.ROOT + "../" + ConfigDefinition.CONFIG_PATH));
// add default (empty) board config
options.add(ConfigDefinition.READFILE_OPTION);
options.add("BOARD_CONFIG_FROM_FILE");
options.add(BoardConfigStrategy.BOARD_CONFIG_FROM_FILE);
options.add("tunerstudio/empty_board_options.ini");
String[] totalArgs = options.toArray(new String[0]);