mirror of https://github.com/rusefi/rusefi.git
only:Improve toolset for default tune canned tune generation #4871
This commit is contained in:
parent
60ad272548
commit
5713b180a2
|
@ -26,7 +26,6 @@ public class IniFileModel {
|
|||
private String dialogId;
|
||||
private String dialogUiName;
|
||||
private final Map<String, DialogModel> dialogs = new TreeMap<>();
|
||||
private final Map<String, DialogModel.Field> allFields = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
// this is only used while reading model - TODO extract reader
|
||||
private final List<DialogModel.Field> fieldsOfCurrentDialog = new ArrayList<>();
|
||||
public Map<String, IniField> allIniFields = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
@ -247,31 +246,6 @@ public class IniFileModel {
|
|||
allIniFields.put(field.getName(), field);
|
||||
}
|
||||
|
||||
private void handleField(LinkedList<String> list) {
|
||||
list.removeFirst(); // "field"
|
||||
|
||||
String uiFieldName = list.isEmpty() ? "" : list.removeFirst();
|
||||
|
||||
String key = list.isEmpty() ? null : list.removeFirst();
|
||||
|
||||
DialogModel.Field field = new DialogModel.Field(key, uiFieldName);
|
||||
if (key != null) {
|
||||
// UI labels do not have 'key'
|
||||
allFields.put(key, field);
|
||||
}
|
||||
fieldsOfCurrentDialog.add(field);
|
||||
log.debug("IniFileModel: Field label=[" + uiFieldName + "] : key=[" + key + "]");
|
||||
}
|
||||
|
||||
public Map<String, DialogModel.Field> getAllFields() {
|
||||
return allFields;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public DialogModel.Field getField(String key) {
|
||||
return allFields.get(key);
|
||||
}
|
||||
|
||||
private void handleDialog(LinkedList<String> list) {
|
||||
finishDialog();
|
||||
list.removeFirst(); // "dialog"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi.tune;
|
||||
|
||||
import com.opensr5.ini.IniFileModel;
|
||||
import com.rusefi.tune.xml.Constant;
|
||||
import com.rusefi.tune.xml.Msq;
|
||||
import com.rusefi.tune.xml.Page;
|
||||
|
@ -9,6 +10,7 @@ import org.junit.Test;
|
|||
import java.util.Map;
|
||||
|
||||
import static com.rusefi.tune.TuneReadWriteTest.SRC_TEST_RESOURCES;
|
||||
import static com.rusefi.tune.TuneReadWriteTest.TEST_INI;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
|
||||
public class LoadOlderTuneTest {
|
||||
|
@ -20,8 +22,6 @@ public class LoadOlderTuneTest {
|
|||
|
||||
Msq lessOldDefaultTune = Msq.readTune(SRC_TEST_RESOURCES + "simulator_tune-2023-06.xml");
|
||||
|
||||
Map<String, Constant> byName = lessOldDefaultTune.getConstantsAsMap();
|
||||
|
||||
int noLongerPresent = 0;
|
||||
int sameValueCounter = 0;
|
||||
int notSameValueCounter = 0;
|
||||
|
@ -34,7 +34,7 @@ public class LoadOlderTuneTest {
|
|||
noLongerPresent++;
|
||||
System.out.println("No longer present " + name);
|
||||
} else {
|
||||
boolean isSameValue = newerDefault.getValue().equals(customValue.getValue());
|
||||
boolean isSameValue = simplerSpaces(newerDefault.getValue()).equals(simplerSpaces(customValue.getValue()));
|
||||
if (isSameValue) {
|
||||
System.out.println("Still around " + name);
|
||||
sameValueCounter++;
|
||||
|
@ -49,6 +49,13 @@ public class LoadOlderTuneTest {
|
|||
Assert.assertTrue(sameValueCounter > 0);
|
||||
Assert.assertTrue(notSameValueCounter > 0);
|
||||
|
||||
//IniFileModel ini = new IniFileModel().readIniFile(INI_FILE_FOR_SIMULATOR);
|
||||
IniFileModel ini = new IniFileModel().readIniFile(TEST_INI);
|
||||
System.out.printf(ini.toString());
|
||||
}
|
||||
|
||||
private static Object simplerSpaces(String value) {
|
||||
if (value == null)
|
||||
return value;
|
||||
return value.replaceAll("\\s+", " ").trim();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,7 @@ public class TuneReadWriteTest {
|
|||
public static final String SRC_TEST_RESOURCES = "src/test/resources/";
|
||||
private static final String PATH = SRC_TEST_RESOURCES + "frankenso/";
|
||||
static final String TUNE_NAME = PATH + "test-CurrentTune.msq";
|
||||
private static final String TEST_INI = PATH + "test-mainController.ini";
|
||||
static final String TEST_INI = PATH + "test-mainController.ini";
|
||||
private static final String TEST_BINARY_FILE = PATH + "current_configuration.rusefi_binary";
|
||||
private static final int LEGACY_TOTAL_CONFIG_SIZE = 20000;
|
||||
|
||||
|
|
Loading…
Reference in New Issue