Bench Test IAC Valve fails #3534

This commit is contained in:
rusefillc 2021-11-11 20:37:12 -05:00
parent 8d154b94df
commit c2c335ea6d
3 changed files with 10 additions and 3 deletions

Binary file not shown.

View File

@ -17,9 +17,16 @@ public class EnumsReader {
* core implementation sorts by name, we need special considerations to sort by value
*/
@NotNull
static List<Value> getSortedByOrder(VariableRegistry registry, Map<String, Value> brain_pin_e) {
static List<Value> getSortedByOrder(VariableRegistry registry, Map<String, Value> enumValues) {
Set<Integer> ids = new TreeSet<>();
for (Value value : enumValues.values()) {
boolean isUniqueId = ids.add(value.getIntValueMaybeResolve(registry));
if (!isUniqueId)
throw new IllegalArgumentException("Ordinal duplication? " + value);
}
Set<Value> byOrdinal = new TreeSet<>(Comparator.comparingInt(value -> value.getIntValueMaybeResolve(registry)));
byOrdinal.addAll(brain_pin_e.values());
byOrdinal.addAll(enumValues.values());
return new ArrayList<>(byOrdinal);
}

View File

@ -50,7 +50,7 @@ public class ToJavaEnum {
for (Value value : sorted) {
int numericValue = value.getIntValueMaybeResolve(registry);
if (index != numericValue && !value.getName().startsWith("Force_4_bytes_size"))
throw new IllegalStateException(numericValue + " instead of " + index + " in " + value);
throw new IllegalStateException("Got explicit ordinal " + numericValue + " instead of ordinal " + index + " in " + value);
sb.append("\t" + value.getName() + ",\n");
index++;
}