progress
This commit is contained in:
parent
951338d4e2
commit
1b71606174
|
@ -0,0 +1 @@
|
|||
out/
|
|
@ -37,13 +37,13 @@ public class ConfigField {
|
|||
*/
|
||||
public final String name;
|
||||
public final String comment;
|
||||
public final boolean isBit;
|
||||
public final String arraySizeAsText;
|
||||
final boolean isBit;
|
||||
private final String arraySizeAsText;
|
||||
public final String type;
|
||||
public final int arraySize;
|
||||
|
||||
public final String tsInfo;
|
||||
public final int elementSize;
|
||||
private final int elementSize;
|
||||
/**
|
||||
* this property of array expands field into a bunch of variables like field1 field2 field3 etc
|
||||
*/
|
||||
|
@ -106,7 +106,7 @@ public class ConfigField {
|
|||
return field;
|
||||
}
|
||||
|
||||
int getSize(ConfigField next) {
|
||||
public int getSize(ConfigField next) {
|
||||
if (isBit && next.isBit)
|
||||
return 0;
|
||||
if (isBit)
|
||||
|
|
|
@ -12,6 +12,9 @@ import java.util.List;
|
|||
*/
|
||||
public class ConfigStructure {
|
||||
public static final String UINT8_T = "uint8_t";
|
||||
public static final String UINT_16_T = "uint16_t";
|
||||
public static final String INT_16_T = "int16_t";
|
||||
|
||||
public final String name;
|
||||
private final String comment;
|
||||
public final boolean withPrefix;
|
||||
|
|
|
@ -4,6 +4,7 @@ package com.rusefi;
|
|||
* 1/22/15
|
||||
*/
|
||||
public class TypesHelper {
|
||||
|
||||
public static int getElementSize(String type) {
|
||||
if (type == null)
|
||||
throw new NullPointerException("type");
|
||||
|
@ -13,7 +14,7 @@ public class TypesHelper {
|
|||
return ConfigDefinition.tsCustomSize.get(type);
|
||||
if (type.equals(ConfigStructure.UINT8_T))
|
||||
return 1;
|
||||
if (type.equals("int16_t") || type.equals("uint16_t")) {
|
||||
if (type.equals(ConfigStructure.INT_16_T) || type.equals(ConfigStructure.UINT_16_T)) {
|
||||
return 2;
|
||||
}
|
||||
return 4;
|
||||
|
|
|
@ -4,9 +4,7 @@ import com.rusefi.ConfigDefinition;
|
|||
import com.rusefi.ConfigField;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* (c) Andrey Belomutskiy
|
||||
|
@ -21,6 +19,18 @@ public class ConfigDefinitionTest {
|
|||
"\t * vbn\n", ConfigDefinition.packComment("abc\\nvbn", "\t"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testByteArray() {
|
||||
{
|
||||
ConfigField cf = ConfigField.parse("uint8_t[8] field");
|
||||
assertEquals(cf.type, "uint8_t");
|
||||
assertEquals(cf.arraySize, 8);
|
||||
assertEquals(cf.getSize(null), 8);
|
||||
assertFalse("isIterate", cf.isIterate);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testParseLine() {
|
||||
assertNull(ConfigField.parse("int"));
|
||||
|
|
Loading…
Reference in New Issue