TS Burned All Data engine stop #2839

is this a case of poor API?
This commit is contained in:
rusefillc 2021-06-21 02:09:17 -04:00
parent d632b8825f
commit 102ac146db
2 changed files with 19 additions and 2 deletions

View File

@ -1,5 +1,6 @@
package com.rusefi.f4discovery;
import com.devexperts.logging.Logging;
import com.rusefi.RusefiTestBase;
import com.rusefi.Timeouts;
import com.rusefi.config.generated.Fields;
@ -8,6 +9,7 @@ import com.rusefi.core.SensorCentral;
import com.rusefi.functional_tests.EcuTestHelper;
import org.junit.Test;
import static com.devexperts.logging.Logging.getLogging;
import static com.rusefi.IoUtil.getDisableCommand;
import static com.rusefi.IoUtil.getEnableCommand;
import static com.rusefi.binaryprotocol.BinaryProtocol.sleep;
@ -20,6 +22,8 @@ import static com.rusefi.config.generated.Fields.*;
*/
public class PwmHardwareTest extends RusefiTestBase {
private static final Logging log = getLogging(PwmHardwareTest.class);
@Override
protected boolean needsHardwareTriggerInput() {
// This test uses hardware trigger input!
@ -38,10 +42,15 @@ public class PwmHardwareTest extends RusefiTestBase {
nextChart();
nextChart();
int triggerErrors = (int) SensorCentral.getInstance().getValueSource(Sensor.totalTriggerErrorCounter).getValue();
for (int i = 0; i < 7; i++)
log.info("triggerErrors " + triggerErrors);
for (int i = 0; i < 7; i++) {
ecu.sendCommand(CMD_BURNCONFIG);
sleep(500);
}
int totalTriggerErrorsNow = (int) SensorCentral.getInstance().getValueSource(Sensor.totalTriggerErrorCounter).getValue();
EcuTestHelper.assertEquals("totalTriggerErrorCounter", totalTriggerErrorsNow, triggerErrors);
log.info("totalTriggerErrorsNow " + totalTriggerErrorsNow);
EcuTestHelper.assertTotallyEquals("totalTriggerErrorCounter", totalTriggerErrorsNow, triggerErrors);
}
@Test

View File

@ -66,6 +66,14 @@ public class EcuTestHelper {
EcuTestHelper.assertEquals("", expected, actual);
}
public static void assertTotallyEquals(String msg, double expected, double actual) {
assertEquals(msg, expected, actual, 0);
}
/**
* WARNING this is a LOOSE equals
* @see #assertTotallyEquals
*/
public static void assertEquals(String msg, double expected, double actual) {
EcuTestHelper.assertEquals(msg, expected, actual, EngineReport.RATIO);
}