mirror of https://github.com/rusefi/rusefi.git
only: reducing junit4
This commit is contained in:
parent
845327dd3c
commit
749d553410
|
@ -6,10 +6,11 @@ import com.rusefi.tools.tune.TuneCanTool;
|
||||||
import com.rusefi.tools.tune.TuneTools;
|
import com.rusefi.tools.tune.TuneTools;
|
||||||
import com.rusefi.tune.xml.Msq;
|
import com.rusefi.tune.xml.Msq;
|
||||||
import com.rusefi.tune.xml.Page;
|
import com.rusefi.tune.xml.Page;
|
||||||
import org.junit.Assert;
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.*;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
import static org.junit.jupiter.api.Assertions.assertFalse;
|
||||||
|
|
||||||
public class LoadOlderTuneTest {
|
public class LoadOlderTuneTest {
|
||||||
@Test
|
@Test
|
||||||
|
@ -128,10 +129,10 @@ public class LoadOlderTuneTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testLegacyCustomEnumOrdinal() {
|
public void testLegacyCustomEnumOrdinal() {
|
||||||
assertThrows(IllegalStateException.class, () -> {
|
Assertions.assertThrows(IllegalStateException.class, () -> {
|
||||||
String tsCustomLine = "bits, U08, @OFFSET@, [0:1], \"Single Coil\", \"Individual Coils\", \"Wasted Spark\", \"Two Distributors\"";
|
String tsCustomLine = "bits, U08, @OFFSET@, [0:1], \"Single Coil\", \"Individual Coils\", \"Wasted Spark\", \"Two Distributors\"";
|
||||||
|
|
||||||
Assert.assertEquals(0, TuneTools.resolveEnumByName(tsCustomLine, "One coil"));
|
assertEquals(0, TuneTools.resolveEnumByName(tsCustomLine, "One coil"));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +140,7 @@ public class LoadOlderTuneTest {
|
||||||
public void testCustomEnumOrdinal() {
|
public void testCustomEnumOrdinal() {
|
||||||
String tsCustomLine = "bits, U08, @OFFSET@, [0:1], \"Single Coil\", \"Individual Coils\", \"Wasted Spark\", \"Two Distributors\"";
|
String tsCustomLine = "bits, U08, @OFFSET@, [0:1], \"Single Coil\", \"Individual Coils\", \"Wasted Spark\", \"Two Distributors\"";
|
||||||
|
|
||||||
Assert.assertEquals(0, TuneTools.resolveEnumByName(tsCustomLine, "Single coil"));
|
assertEquals(0, TuneTools.resolveEnumByName(tsCustomLine, "Single coil"));
|
||||||
Assert.assertEquals(3, TuneTools.resolveEnumByName(tsCustomLine, "Two Distributors"));
|
assertEquals(3, TuneTools.resolveEnumByName(tsCustomLine, "Two Distributors"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,14 +2,13 @@ package com.rusefi.tune;
|
||||||
|
|
||||||
import com.opensr5.ini.IniFileModel;
|
import com.opensr5.ini.IniFileModel;
|
||||||
import com.rusefi.tools.tune.WriteSimulatorConfiguration;
|
import com.rusefi.tools.tune.WriteSimulatorConfiguration;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import static org.junit.Assert.assertNotNull;
|
|
||||||
|
|
||||||
public class ReadCurrentIniTest {
|
public class ReadCurrentIniTest {
|
||||||
@Test
|
@Test
|
||||||
public void test() {
|
public void test() {
|
||||||
IniFileModel ini = new IniFileModel().readIniFile("../" + WriteSimulatorConfiguration.INI_FILE_FOR_SIMULATOR);
|
IniFileModel ini = new IniFileModel().readIniFile("../" + WriteSimulatorConfiguration.INI_FILE_FOR_SIMULATOR);
|
||||||
assertNotNull(ini);
|
Assertions.assertNotNull(ini);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,13 +2,14 @@ package com.rusefi.tune;
|
||||||
|
|
||||||
import com.rusefi.tools.tune.TS2C;
|
import com.rusefi.tools.tune.TS2C;
|
||||||
import com.rusefi.tools.tune.TableData;
|
import com.rusefi.tools.tune.TableData;
|
||||||
|
import org.junit.jupiter.api.Assertions;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.Reader;
|
import java.io.Reader;
|
||||||
import java.io.StringReader;
|
import java.io.StringReader;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||||
|
|
||||||
public class TableDataTest {
|
public class TableDataTest {
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -11,7 +11,6 @@ import com.rusefi.tools.tune.TS2C;
|
||||||
import com.rusefi.tools.tune.TuneCanTool;
|
import com.rusefi.tools.tune.TuneCanTool;
|
||||||
import com.rusefi.tune.xml.Constant;
|
import com.rusefi.tune.xml.Constant;
|
||||||
import com.rusefi.tune.xml.Msq;
|
import com.rusefi.tune.xml.Msq;
|
||||||
import org.junit.Assert;
|
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -32,9 +31,9 @@ public class TuneReadWriteTest {
|
||||||
@Test
|
@Test
|
||||||
public void testIniReader() throws IOException {
|
public void testIniReader() throws IOException {
|
||||||
assertTrue(model.getTables().contains("fueltable"));
|
assertTrue(model.getTables().contains("fueltable"));
|
||||||
Assert.assertEquals(21, model.getTables().size());
|
assertEquals(21, model.getTables().size());
|
||||||
Assert.assertEquals("fuelRpmBins", model.getXBin("FUELTable"));
|
assertEquals("fuelRpmBins", model.getXBin("FUELTable"));
|
||||||
Assert.assertEquals("fuelLoadBins", model.getYBin("fuelTable"));
|
assertEquals("fuelLoadBins", model.getYBin("fuelTable"));
|
||||||
|
|
||||||
String tableName = "ignitionIatCorrTable";
|
String tableName = "ignitionIatCorrTable";
|
||||||
String xRpmBinsName = model.getXBin(tableName);
|
String xRpmBinsName = model.getXBin(tableName);
|
||||||
|
@ -44,10 +43,10 @@ public class TuneReadWriteTest {
|
||||||
|
|
||||||
CurveData xRpmCurve = CurveData.valueOf(TUNE_NAME, xRpmBinsName, model);
|
CurveData xRpmCurve = CurveData.valueOf(TUNE_NAME, xRpmBinsName, model);
|
||||||
|
|
||||||
Assert.assertEquals("static const float hardCodedignitionIatCorrRpmBins[16] = " +
|
assertEquals("static const float hardCodedignitionIatCorrRpmBins[16] = " +
|
||||||
"{880.0, 1260.0, 1640.0, 2020.0, 2400.0, 2780.0, 3000.0, 3380.0, 3760.0, 4140.0, 4520.0, 5000.0, 5700.0, 6500.0, 7200.0, 8000.0};\n", xRpmCurve.getCsourceCode());
|
"{880.0, 1260.0, 1640.0, 2020.0, 2400.0, 2780.0, 3000.0, 3380.0, 3760.0, 4140.0, 4520.0, 5000.0, 5700.0, 6500.0, 7200.0, 8000.0};\n", xRpmCurve.getCsourceCode());
|
||||||
|
|
||||||
Assert.assertEquals("static void cannedignitionIatCorrRpmBins() {\n" +
|
assertEquals("static void cannedignitionIatCorrRpmBins() {\n" +
|
||||||
"\tstatic const float hardCodedignitionIatCorrRpmBins[16] = {880.0, 1260.0, 1640.0, 2020.0, 2400.0, 2780.0, 3000.0, 3380.0, 3760.0, 4140.0, 4520.0, 5000.0, 5700.0, 6500.0, 7200.0, 8000.0};\n" +
|
"\tstatic const float hardCodedignitionIatCorrRpmBins[16] = {880.0, 1260.0, 1640.0, 2020.0, 2400.0, 2780.0, 3000.0, 3380.0, 3760.0, 4140.0, 4520.0, 5000.0, 5700.0, 6500.0, 7200.0, 8000.0};\n" +
|
||||||
"\tcopyArray(config->ignitionIatCorrRpmBins, hardCodedignitionIatCorrRpmBins);\n" +
|
"\tcopyArray(config->ignitionIatCorrRpmBins, hardCodedignitionIatCorrRpmBins);\n" +
|
||||||
"}\n" +
|
"}\n" +
|
||||||
|
@ -147,7 +146,7 @@ public class TuneReadWriteTest {
|
||||||
|
|
||||||
Constant flow = tsTune.findPage().findParameter("injector_flow");
|
Constant flow = tsTune.findPage().findParameter("injector_flow");
|
||||||
assertNotNull(flow);
|
assertNotNull(flow);
|
||||||
Assert.assertEquals("2", flow.getDigits());
|
assertEquals("2", flow.getDigits());
|
||||||
|
|
||||||
ConfigurationImage tsBinaryData = tsTune.asImage(model, LEGACY_TOTAL_CONFIG_SIZE);
|
ConfigurationImage tsBinaryData = tsTune.asImage(model, LEGACY_TOTAL_CONFIG_SIZE);
|
||||||
|
|
||||||
|
@ -171,11 +170,11 @@ public class TuneReadWriteTest {
|
||||||
|
|
||||||
Constant batteryCorrection = tuneFromBinary.findPage().findParameter("injector_battLagCorrBins");
|
Constant batteryCorrection = tuneFromBinary.findPage().findParameter("injector_battLagCorrBins");
|
||||||
assertNotNull(batteryCorrection);
|
assertNotNull(batteryCorrection);
|
||||||
Assert.assertEquals("2", batteryCorrection.getDigits());
|
assertEquals("2", batteryCorrection.getDigits());
|
||||||
|
|
||||||
Constant flow = tuneFromBinary.findPage().findParameter("injector_flow");
|
Constant flow = tuneFromBinary.findPage().findParameter("injector_flow");
|
||||||
assertNotNull(flow);
|
assertNotNull(flow);
|
||||||
Assert.assertEquals("2", flow.getDigits());
|
assertEquals("2", flow.getDigits());
|
||||||
|
|
||||||
Constant nonEmptyFormula = tuneFromBinary.findPage().findParameter("fsioFormulas1");
|
Constant nonEmptyFormula = tuneFromBinary.findPage().findParameter("fsioFormulas1");
|
||||||
assertNotNull(nonEmptyFormula);
|
assertNotNull(nonEmptyFormula);
|
||||||
|
@ -188,7 +187,7 @@ public class TuneReadWriteTest {
|
||||||
|
|
||||||
Constant enumField = tuneFromBinary.findPage().findParameter("acRelayPin");
|
Constant enumField = tuneFromBinary.findPage().findParameter("acRelayPin");
|
||||||
// quotes are expected
|
// quotes are expected
|
||||||
Assert.assertEquals("\"NONE\"", enumField.getValue());
|
assertEquals("\"NONE\"", enumField.getValue());
|
||||||
|
|
||||||
// and now reading that XML back
|
// and now reading that XML back
|
||||||
Msq tuneFromFile = Msq.readTune(fileName);
|
Msq tuneFromFile = Msq.readTune(fileName);
|
||||||
|
|
Loading…
Reference in New Issue