that's how this works now

This commit is contained in:
rusefi 2020-04-12 23:24:14 -04:00
parent 167f484d8f
commit ca93302969
1 changed files with 20 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.StringReader;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections;
import static org.junit.Assert.*; import static org.junit.Assert.*;
@ -51,6 +52,25 @@ public class ConfigFieldParserTest {
assertEquals(16, TypesHelper.getElementSize(state, "pid_s")); assertEquals(16, TypesHelper.getElementSize(state, "pid_s"));
} }
@Test
public void multiplicationInDefine() throws IOException {
String test = "struct pid_s\n" +
"#define ERROR_BUFFER_SIZE 120\n" +
"#define ERROR_BUFFER_COUNT 120\n" +
"#define RESULT 120*@@ERROR_BUFFER_COUNT@@\n" +
"\tint16_t periodMs;PID dTime;\"ms\", 1, 0, 0, 3000, 0\n" +
"end_struct\n" +
"";
VariableRegistry.INSTANCE.clear();
BufferedReader reader = new BufferedReader(new StringReader(test));
new ReaderState().readBufferedReader(reader, Collections.emptyList());
assertEquals("#define ERROR_BUFFER_COUNT 120\n" +
"#define ERROR_BUFFER_SIZE 120\n" +
"#define RESULT 120*@@ERROR_BUFFER_COUNT@@\n", VariableRegistry.INSTANCE.getDefinesSection());
}
@Test @Test
public void useCustomType() throws IOException { public void useCustomType() throws IOException {
ReaderState state = new ReaderState(); ReaderState state = new ReaderState();
@ -72,7 +92,6 @@ public class ConfigFieldParserTest {
} }
@Test @Test
public void testFsioVisible() throws IOException { public void testFsioVisible() throws IOException {
{ {