migrating to googletest
This commit is contained in:
parent
473f67e907
commit
38ed23c43f
|
@ -122,7 +122,7 @@ void EngineTestHelper::fireTriggerEvents2(int count, int durationMs) {
|
|||
|
||||
void EngineTestHelper::clearQueue() {
|
||||
engine.executor.executeAll(99999999); // this is needed to clear 'isScheduled' flag
|
||||
assertEqualsM("queue size/0", 0, engine.executor.size());
|
||||
ASSERT_EQ( 0, engine.executor.size()) << "queue size/0";
|
||||
engine.iHead = NULL; // let's drop whatever was scheduled just to start from a clean state
|
||||
}
|
||||
|
||||
|
|
|
@ -41,17 +41,17 @@ static void newTestToComfirmInterpolation() {
|
|||
|
||||
// let's start by testing corners
|
||||
ASSERT_EQ(3, getValue(/*rpm*/200, 2));
|
||||
assertEqualsM("low rpm high load", 4, getValue(/*rpm*/200, 3));
|
||||
ASSERT_EQ( 4, getValue(/*rpm*/200, 3)) << "low rpm high load";
|
||||
|
||||
ASSERT_EQ(10, getValue(/*rpm*/300, 2));
|
||||
ASSERT_EQ(200, getValue(/*rpm*/300, 3));
|
||||
|
||||
// now testing middles of cell sides
|
||||
assertEqualsM("low rpm middle", 3.5, getValue(/*rpm*/200, 2.5));
|
||||
assertEqualsM("high rpm ", 105, getValue(/*rpm*/300, 2.5));
|
||||
ASSERT_EQ( 105, getValue(/*rpm*/300, 2.5)) << "high rpm ";
|
||||
|
||||
assertEqualsM("low load middle", 6.5, getValue(/*rpm*/250, 2));
|
||||
assertEqualsM(" ", 102, getValue(/*rpm*/250, 3));
|
||||
ASSERT_EQ( 102, getValue(/*rpm*/250, 3)) << " ";
|
||||
|
||||
// slowly go from middle side towards center
|
||||
assertEqualsM("middle @ 2.1 ",16.05, getValue(/*rpm*/250, 2.1));
|
||||
|
@ -71,8 +71,8 @@ static void newTestToComfirmInterpolation() {
|
|||
assertEqualsM("-820 @ 2.3 ",2.3, getValue(/*rpm*/-820, 2.3));
|
||||
|
||||
// Y above the range
|
||||
assertEqualsM("310 @ 12.1 ", 330, getValue(/*rpm*/310, 12.1));
|
||||
assertEqualsM("320 @ 12.3 ", 360, getValue(/*rpm*/320, 12.3));
|
||||
ASSERT_EQ( 330, getValue(/*rpm*/310, 12.1)) << "310 @ 12.1 ";
|
||||
ASSERT_EQ( 360, getValue(/*rpm*/320, 12.3)) << "320 @ 12.3 ";
|
||||
|
||||
// Y below the range
|
||||
assertEqualsM("310 @ -12.1 ", 3.1, getValue(/*rpm*/310, -12.1));
|
||||
|
|
|
@ -23,18 +23,18 @@ TEST(big, testAccelEnrichment) {
|
|||
engine->tpsAccelEnrichment.setLength(4);
|
||||
|
||||
engine->tpsAccelEnrichment.onNewValue(0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("maxDelta", 0, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 0, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE)) << "maxDelta";
|
||||
engine->tpsAccelEnrichment.onNewValue(10 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("maxDelta#1", 40, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 40, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE)) << "maxDelta#1";
|
||||
engine->tpsAccelEnrichment.onNewValue(30 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("maxDelta#2", 80, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 80, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE)) << "maxDelta#2";
|
||||
|
||||
engine->tpsAccelEnrichment.onNewValue(0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("maxDelta#3", 80, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 80, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE)) << "maxDelta#3";
|
||||
engine->tpsAccelEnrichment.onNewValue(0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("maxDelta#4", 80, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 80, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE)) << "maxDelta#4";
|
||||
engine->tpsAccelEnrichment.onNewValue(0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("maxDelta#5", 0, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 0, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE)) << "maxDelta#5";
|
||||
engine->tpsAccelEnrichment.onNewValue(0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("maxDelta", 0, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 0, engine->tpsAccelEnrichment.getMaxDelta(PASS_ENGINE_PARAMETER_SIGNATURE)) << "maxDelta";
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@ TEST(misc, testEngineMath) {
|
|||
|
||||
engineConfiguration->operationMode = FOUR_STROKE_CAM_SENSOR;
|
||||
|
||||
assertEqualsM("600 RPM", 50, getOneDegreeTimeMs(600) * 180);
|
||||
assertEqualsM("6000 RPM", 5, getOneDegreeTimeMs(6000) * 180);
|
||||
ASSERT_NEAR( 50, getOneDegreeTimeMs(600) * 180, EPS4D) << "600 RPM";
|
||||
ASSERT_EQ( 5, getOneDegreeTimeMs(6000) * 180) << "6000 RPM";
|
||||
|
||||
ASSERT_FLOAT_EQ(312.5, getTCharge(1000, 0, 300, 350 PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
ASSERT_FLOAT_EQ(313.5833, getTCharge(1000, 50, 300, 350 PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
@ -67,10 +67,10 @@ TEST(misc, testIgnitionMapGenerator) {
|
|||
float rpmBin[16];
|
||||
setRpmBin(rpmBin, 16, 800, 7000);
|
||||
ASSERT_EQ(650, rpmBin[0]);
|
||||
assertEqualsM("@1", 800, rpmBin[1]);
|
||||
assertEqualsM("@2", 1100, rpmBin[2]);
|
||||
assertEqualsM("rpm@3", 1400, rpmBin[3]);
|
||||
assertEqualsM("rpm@14", 4700, rpmBin[14]);
|
||||
ASSERT_EQ( 800, rpmBin[1]) << "@1";
|
||||
ASSERT_EQ( 1100, rpmBin[2]) << "@2";
|
||||
ASSERT_EQ( 1400, rpmBin[3]) << "rpm@3";
|
||||
ASSERT_EQ( 4700, rpmBin[14]) << "rpm@14";
|
||||
ASSERT_EQ(7000, rpmBin[15]);
|
||||
|
||||
|
||||
|
@ -98,7 +98,7 @@ TEST(misc, testMafLookup) {
|
|||
assertEqualsM("@1", -33.7875, engine->mafDecodingLookup[1]);
|
||||
assertEqualsM("@2", -33.0750, engine->mafDecodingLookup[2]);
|
||||
assertEqualsM("@200", 313.8826, engine->mafDecodingLookup[200]);
|
||||
assertEqualsM("@255", 738, engine->mafDecodingLookup[255]);
|
||||
ASSERT_EQ( 738, engine->mafDecodingLookup[255]) << "@255";
|
||||
}
|
||||
|
||||
float mockMapValue = 0;
|
||||
|
|
|
@ -30,7 +30,7 @@ TEST(sensors, testFasterEngineSpinningUp) {
|
|||
// check if the engine has the right state
|
||||
ASSERT_EQ(STOPPED, engine->rpmCalculator.getState());
|
||||
// check RPM
|
||||
assertEqualsM("RPM=0", 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM=0";
|
||||
// the queue should be empty, no trigger events yet
|
||||
ASSERT_EQ(0, engine->executor.size()) << "plain#1";
|
||||
|
||||
|
@ -43,7 +43,7 @@ TEST(sensors, testFasterEngineSpinningUp) {
|
|||
// check if the mode is changed
|
||||
ASSERT_EQ(SPINNING_UP, engine->rpmCalculator.getState());
|
||||
// due to isFasterEngineSpinUp=true, we should have already detected RPM!
|
||||
assertEqualsM("spinning-RPM#1", 300, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 300, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "spinning-RPM#1";
|
||||
// two simultaneous injections
|
||||
ASSERT_EQ(4, engine->executor.size()) << "plain#2";
|
||||
// test if they are simultaneous
|
||||
|
@ -65,13 +65,13 @@ TEST(sensors, testFasterEngineSpinningUp) {
|
|||
// check if the mode is changed when fully synched
|
||||
ASSERT_EQ(CRANKING, engine->rpmCalculator.getState());
|
||||
// check RPM
|
||||
assertEqualsM("RPM#2", 300, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 300, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#2";
|
||||
// test if they are simultaneous in cranking mode too
|
||||
ASSERT_EQ(IM_SIMULTANEOUS, engine->getCurrentInjectionMode(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
// test if ignition mode is restored to ind.coils
|
||||
ASSERT_EQ(IM_INDIVIDUAL_COILS, getIgnitionMode(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
// two simultaneous injections
|
||||
assertEqualsM("plain#2", 4, engine->executor.size());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "plain#2";
|
||||
// check real events
|
||||
eth.assertEvent5(&engine->executor, "inj start#2", 0, (void*)startSimultaniousInjection, eth.getTimeNowUs(), 97975);
|
||||
eth.assertEvent5(&engine->executor, "inj end#2", 1, (void*)endSimultaniousInjection, eth.getTimeNowUs(), 100000);
|
||||
|
@ -86,11 +86,11 @@ TEST(sensors, testFasterEngineSpinningUp) {
|
|||
// check if the mode is now changed to 'running' at higher RPM
|
||||
ASSERT_EQ(RUNNING, engine->rpmCalculator.getState());
|
||||
// check RPM
|
||||
assertEqualsM("RPM#3", 1000, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 1000, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#3";
|
||||
// check if the injection mode is back to sequential now
|
||||
ASSERT_EQ(IM_SEQUENTIAL, engine->getCurrentInjectionMode(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
// 4 sequential injections for the full cycle
|
||||
assertEqualsM("plain#3", 8, engine->executor.size());
|
||||
ASSERT_EQ( 8, engine->executor.size()) << "plain#3";
|
||||
|
||||
// check real events for sequential injection
|
||||
// Note: See addFuelEvents() fix inside setRpmValue()!
|
||||
|
|
|
@ -50,7 +50,7 @@ TEST(misc, testFuelMap) {
|
|||
for (int i = 0; i < FUEL_RPM_COUNT; i++)
|
||||
eth.engine.config->fuelRpmBins[i] = i;
|
||||
|
||||
assertEqualsM("base fuel table", 1005, getBaseTableFuel(5, 5));
|
||||
ASSERT_EQ( 1005, getBaseTableFuel(5, 5)) << "base fuel table";
|
||||
|
||||
printf("*************************************************** initThermistors\r\n");
|
||||
|
||||
|
@ -90,12 +90,12 @@ TEST(misc, testFuelMap) {
|
|||
float iat = getIntakeAirTemperature(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
ASSERT_FALSE(cisnan(iat));
|
||||
float iatCorrection = getIatFuelCorrection(-KELV PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("IAT", 2, iatCorrection);
|
||||
ASSERT_EQ( 2, iatCorrection) << "IAT";
|
||||
engine->sensors.clt = getCoolantTemperature(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
float cltCorrection = getCltFuelCorrection(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("CLT", 1, cltCorrection);
|
||||
ASSERT_EQ( 1, cltCorrection) << "CLT";
|
||||
float injectorLag = getInjectorLag(getVBatt(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("injectorLag", 0, injectorLag);
|
||||
ASSERT_EQ( 0, injectorLag) << "injectorLag";
|
||||
|
||||
testMafValue = 5;
|
||||
|
||||
|
@ -103,7 +103,7 @@ TEST(misc, testFuelMap) {
|
|||
printf("*************************************************** getRunningFuel 2\r\n");
|
||||
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
baseFuel = getBaseTableFuel(5, getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
assertEqualsM("v1", 30150, getRunningFuel(baseFuel PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
ASSERT_EQ( 30150, getRunningFuel(baseFuel PASS_ENGINE_PARAMETER_SUFFIX)) << "v1";
|
||||
|
||||
testMafValue = 0;
|
||||
|
||||
|
@ -111,7 +111,7 @@ TEST(misc, testFuelMap) {
|
|||
|
||||
printf("*************************************************** getStartingFuel\r\n");
|
||||
// NAN in case we have issues with the CLT sensor
|
||||
assertEqualsM("getStartingFuel nan", 4, getCrankingFuel3(NAN, 0 PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
ASSERT_EQ( 4, getCrankingFuel3(NAN, 0 PASS_ENGINE_PARAMETER_SUFFIX)) << "getStartingFuel nan";
|
||||
assertEqualsM("getStartingFuel#1", 17.8, getCrankingFuel3(0, 4 PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
assertEqualsM("getStartingFuel#2", 8.4480, getCrankingFuel3(8, 15 PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
assertEqualsM("getStartingFuel#3", 6.48, getCrankingFuel3(70, 0 PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
@ -135,30 +135,30 @@ static void confgiureFordAspireTriggerShape(TriggerShape * s) {
|
|||
s->addEvent720(720, T_PRIMARY, TV_FALL);
|
||||
|
||||
ASSERT_FLOAT_EQ(53.747 / 720, s->wave.getSwitchTime(0));
|
||||
assertEqualsM("@0", 1, s->wave.getChannelState(1, 0));
|
||||
assertEqualsM("@0", 1, s->wave.getChannelState(1, 0));
|
||||
ASSERT_EQ( 1, s->wave.getChannelState(1, 0)) << "@0";
|
||||
ASSERT_EQ( 1, s->wave.getChannelState(1, 0)) << "@0";
|
||||
|
||||
assertEqualsM("@1", 0, s->wave.getChannelState(0, 1));
|
||||
assertEqualsM("@1", 0, s->wave.getChannelState(1, 1));
|
||||
ASSERT_EQ( 0, s->wave.getChannelState(0, 1)) << "@1";
|
||||
ASSERT_EQ( 0, s->wave.getChannelState(1, 1)) << "@1";
|
||||
|
||||
assertEqualsM("@2", 0, s->wave.getChannelState(0, 2));
|
||||
assertEqualsM("@2", 1, s->wave.getChannelState(1, 2));
|
||||
ASSERT_EQ( 0, s->wave.getChannelState(0, 2)) << "@2";
|
||||
ASSERT_EQ( 1, s->wave.getChannelState(1, 2)) << "@2";
|
||||
|
||||
assertEqualsM("@3", 0, s->wave.getChannelState(0, 3));
|
||||
assertEqualsM("@3", 0, s->wave.getChannelState(1, 3));
|
||||
ASSERT_EQ( 0, s->wave.getChannelState(0, 3)) << "@3";
|
||||
ASSERT_EQ( 0, s->wave.getChannelState(1, 3)) << "@3";
|
||||
|
||||
assertEqualsM("@4", 1, s->wave.getChannelState(0, 4));
|
||||
assertEqualsM("@5", 1, s->wave.getChannelState(1, 5));
|
||||
assertEqualsM("@8", 0, s->wave.getChannelState(1, 8));
|
||||
ASSERT_EQ( 1, s->wave.getChannelState(0, 4)) << "@4";
|
||||
ASSERT_EQ( 1, s->wave.getChannelState(1, 5)) << "@5";
|
||||
ASSERT_EQ( 0, s->wave.getChannelState(1, 8)) << "@8";
|
||||
ASSERT_FLOAT_EQ(121.90 / 720, s->wave.getSwitchTime(1));
|
||||
ASSERT_FLOAT_EQ(657.03 / 720, s->wave.getSwitchTime(8));
|
||||
|
||||
assertEqualsM("expecting 0", 0, s->wave.findAngleMatch(53.747 / 720.0, s->getSize()));
|
||||
ASSERT_EQ( 0, s->wave.findAngleMatch(53.747 / 720.0, s->getSize())) << "expecting 0";
|
||||
assertEqualsM("expecting not found", -1, s->wave.findAngleMatch(53 / 720.0, s->getSize()));
|
||||
ASSERT_EQ(7, s->wave.findAngleMatch(588.045 / 720.0, s->getSize()));
|
||||
|
||||
assertEqualsM("expecting 0", 0, s->wave.findInsertionAngle(23.747 / 720.0, s->getSize()));
|
||||
assertEqualsM("expecting 1", 1, s->wave.findInsertionAngle(63.747 / 720.0, s->getSize()));
|
||||
ASSERT_EQ( 0, s->wave.findInsertionAngle(23.747 / 720.0, s->getSize())) << "expecting 0";
|
||||
ASSERT_EQ( 1, s->wave.findInsertionAngle(63.747 / 720.0, s->getSize())) << "expecting 1";
|
||||
}
|
||||
|
||||
TEST(misc, testAngleResolver) {
|
||||
|
@ -179,23 +179,23 @@ TEST(misc, testAngleResolver) {
|
|||
|
||||
ASSERT_EQ(4, ts->getTriggerShapeSynchPointIndex());
|
||||
|
||||
assertEqualsM("shape size", 10, ts->getSize());
|
||||
ASSERT_EQ( 10, ts->getSize()) << "shape size";
|
||||
|
||||
event_trigger_position_s injectionStart;
|
||||
|
||||
printf("*************************************************** testAngleResolver 0\r\n");
|
||||
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, -122, engineConfiguration->globalTriggerAngleOffset));
|
||||
assertEqualsM("eventIndex@0", 2, injectionStart.eventIndex);
|
||||
ASSERT_EQ( 2, injectionStart.eventIndex) << "eventIndex@0";
|
||||
ASSERT_NEAR(0.24, injectionStart.angleOffset, EPS5D);
|
||||
|
||||
printf("*************************************************** testAngleResolver 0.1\r\n");
|
||||
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, -80, engineConfiguration->globalTriggerAngleOffset));
|
||||
assertEqualsM("eventIndex@0", 2, injectionStart.eventIndex);
|
||||
ASSERT_EQ( 2, injectionStart.eventIndex) << "eventIndex@0";
|
||||
ASSERT_FLOAT_EQ(42.24, injectionStart.angleOffset);
|
||||
|
||||
printf("*************************************************** testAngleResolver 0.2\r\n");
|
||||
TRIGGER_SHAPE(findTriggerPosition(&injectionStart, -54, engineConfiguration->globalTriggerAngleOffset));
|
||||
assertEqualsM("eventIndex@0", 2, injectionStart.eventIndex);
|
||||
ASSERT_EQ( 2, injectionStart.eventIndex) << "eventIndex@0";
|
||||
ASSERT_FLOAT_EQ(68.2400, injectionStart.angleOffset);
|
||||
|
||||
printf("*************************************************** testAngleResolver 0.3\r\n");
|
||||
|
|
|
@ -21,10 +21,10 @@ TEST(idle, pid) {
|
|||
|
||||
Pid pid(&pidS);
|
||||
|
||||
assertEqualsM("getValue#90", 90, pid.getValue(14, 12, 0.1));
|
||||
ASSERT_EQ( 90, pid.getValue(14, 12, 0.1)) << "getValue#90";
|
||||
|
||||
|
||||
assertEqualsM("getValue#10", 10, pid.getValue(14, 16, 0.1));
|
||||
ASSERT_EQ( 10, pid.getValue(14, 16, 0.1)) << "getValue#10";
|
||||
ASSERT_EQ(10, pid.getValue(14, 16, 1));
|
||||
|
||||
pid.updateFactors(29, 0, 0);
|
||||
|
@ -49,16 +49,16 @@ TEST(idle, pid) {
|
|||
|
||||
pid.reset();
|
||||
|
||||
assertEqualsM("target=50, input=0", 50, pid.getValue(/*target*/50, /*input*/0));
|
||||
assertEqualsM("target=50, input=0 iTerm", 0, pid.iTerm);
|
||||
ASSERT_EQ( 50, pid.getValue(/*target*/50, /*input*/0)) << "target=50, input=0";
|
||||
ASSERT_EQ( 0, pid.iTerm) << "target=50, input=0 iTerm";
|
||||
|
||||
assertEqualsM("target=50, input=70", 0, pid.getValue(/*target*/50, /*input*/70));
|
||||
assertEqualsM("target=50, input=70 iTerm", 0, pid.iTerm);
|
||||
ASSERT_EQ( 0, pid.getValue(/*target*/50, /*input*/70)) << "target=50, input=70";
|
||||
ASSERT_EQ( 0, pid.iTerm) << "target=50, input=70 iTerm";
|
||||
|
||||
assertEqualsM("target=50, input=70 #2", 0, pid.getValue(/*target*/50, /*input*/70));
|
||||
assertEqualsM("target=50, input=70 iTerm #2", 0, pid.iTerm);
|
||||
ASSERT_EQ( 0, pid.getValue(/*target*/50, /*input*/70)) << "target=50, input=70 #2";
|
||||
ASSERT_EQ( 0, pid.iTerm) << "target=50, input=70 iTerm #2";
|
||||
|
||||
assertEqualsM("target=50, input=50", 0, pid.getValue(/*target*/50, /*input*/50));
|
||||
assertEqualsM("target=50, input=50 iTerm", 0, pid.iTerm);
|
||||
ASSERT_EQ( 0, pid.getValue(/*target*/50, /*input*/50)) << "target=50, input=50";
|
||||
ASSERT_EQ( 0, pid.iTerm) << "target=50, input=50 iTerm";
|
||||
|
||||
}
|
||||
|
|
|
@ -193,7 +193,7 @@ TEST(misc, testLogicExpressions) {
|
|||
LEElement * element = pool.parseExpression("fan NOT coolant 90 > AND fan coolant 85 > AND OR");
|
||||
assertTrueM("Not NULL expected", element != NULL);
|
||||
LECalculator c;
|
||||
assertEqualsM("that expression", 1, c.getValue2(0, element PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
ASSERT_EQ( 1, c.getValue2(0, element PASS_ENGINE_PARAMETER_SUFFIX)) << "that expression";
|
||||
|
||||
ASSERT_EQ(12, c.currentCalculationLogPosition);
|
||||
ASSERT_EQ(102, c.calcLogAction[0]);
|
||||
|
|
|
@ -47,7 +47,7 @@ static void testPidAutoZigZagStable() {
|
|||
at.SetLookbackSec(5);
|
||||
at.SetControlType(PID_AutoTune::ZIEGLER_NICHOLS_PI);
|
||||
at.sampleTime = 0; // not used in math only used to filter values out
|
||||
assertEqualsM("nLookBack", 20, at.nLookBack);
|
||||
ASSERT_EQ( 20, at.nLookBack) << "nLookBack";
|
||||
|
||||
|
||||
at.outputStart = 50;
|
||||
|
@ -60,7 +60,7 @@ static void testPidAutoZigZagStable() {
|
|||
at.Runtime(&logging);
|
||||
// assertEqualsLM("min@1", 0, at.absMin);
|
||||
// assertEqualsLM("max@1", 10, at.absMax);
|
||||
assertEqualsM("peakCount", 0, at.peakCount);
|
||||
ASSERT_EQ( 0, at.peakCount) << "peakCount";
|
||||
int startMockMs = mockTimeMs;
|
||||
|
||||
for (; mockTimeMs <= 10 + startMockMs; mockTimeMs++) {
|
||||
|
@ -71,29 +71,29 @@ static void testPidAutoZigZagStable() {
|
|||
}
|
||||
// assertEqualsLM("min@11", 0, at.absMin);
|
||||
// assertEqualsLM("max@11", 100, at.absMax);
|
||||
assertEqualsM("peakCount", 0, at.peakCount);
|
||||
ASSERT_EQ( 0, at.peakCount) << "peakCount";
|
||||
|
||||
for (; mockTimeMs <= 21; mockTimeMs++) {
|
||||
at.input = zigZagValue(mockTimeMs);
|
||||
bool result = at.Runtime(&logging);
|
||||
assertFalseM("should be false#2", result);
|
||||
}
|
||||
assertEqualsM("peakCount@21", 0, at.peakCount);
|
||||
ASSERT_EQ( 0, at.peakCount) << "peakCount@21";
|
||||
|
||||
for (; mockTimeMs <= 41; mockTimeMs++) {
|
||||
at.input = zigZagValue(mockTimeMs);
|
||||
bool result = at.Runtime(&logging);
|
||||
assertFalseM("should be false#2_2", result);
|
||||
}
|
||||
assertEqualsM("peakCount@41", 2, at.peakCount);
|
||||
// assertEqualsM("Pu@41", 1, cisnan(at.Pu));
|
||||
ASSERT_EQ( 2, at.peakCount) << "peakCount@41";
|
||||
// ASSERT_EQ( 1, cisnan(at.Pu)) << "Pu@41";
|
||||
|
||||
for (; mockTimeMs <= 60; mockTimeMs++) {
|
||||
at.input = zigZagValue(mockTimeMs);
|
||||
bool result = at.Runtime(&logging);
|
||||
assertFalseM("should be false#4", result);
|
||||
}
|
||||
assertEqualsM("peakCount@60", 4, at.peakCount);
|
||||
ASSERT_EQ( 4, at.peakCount) << "peakCount@60";
|
||||
//assertEqualsM("Pu@60", 0.02, at.Pu);
|
||||
|
||||
// zigZagOffset = 10;
|
||||
|
@ -107,11 +107,11 @@ static void testPidAutoZigZagStable() {
|
|||
|
||||
at.input = zigZagValue(mockTimeMs);
|
||||
bool result = at.Runtime(&logging);
|
||||
assertEqualsM("should be true", 1, result);
|
||||
ASSERT_EQ( 1, result) << "should be true";
|
||||
|
||||
assertEqualsM("testPidAutoZigZagStable::output", 0.0, at.output);
|
||||
|
||||
assertEqualsM("peakCount@80", 5, at.peakCount);
|
||||
ASSERT_EQ( 5, at.peakCount) << "peakCount@80";
|
||||
assertEqualsM("ki", 27.7798, at.GetKi());
|
||||
assertEqualsM("kd", 0.0, at.GetKd());
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ static void testApplyPinState(PwmConfig *state, int stateIndex) {
|
|||
static void assertNextEvent(const char *msg, int expectedPinState, TestExecutor *executor) {
|
||||
printf("PWM_test: Asserting event [%s]\r\n", msg);
|
||||
// only one action expected in queue
|
||||
assertEqualsM("PWM_test: schedulingQueue size", 1, executor->size());
|
||||
ASSERT_EQ( 1, executor->size()) << "PWM_test: schedulingQueue size";
|
||||
|
||||
// move time to next event timestamp
|
||||
timeNowUs = expectedTimeOfNextEvent;
|
||||
|
@ -36,7 +36,7 @@ static void assertNextEvent(const char *msg, int expectedPinState, TestExecutor
|
|||
assertEqualsM5(msg, " pin state", expectedPinState, pinValue, 0);
|
||||
|
||||
// assert that we have one new action in queue
|
||||
assertEqualsM("PWM_test: queue.size", 1, executor->size());
|
||||
ASSERT_EQ( 1, executor->size()) << "PWM_test: queue.size";
|
||||
}
|
||||
|
||||
static void test100dutyCycle() {
|
||||
|
@ -85,7 +85,7 @@ static void testSwitchToNanPeriod() {
|
|||
assertEqualsM2("1@1000/70", expectedTimeOfNextEvent, executor.getForUnitTest(0)->momentX, 0);
|
||||
|
||||
assertNextEvent("exec@70", LOW_VALUE, &executor);
|
||||
assertEqualsM("time1", 600, timeNowUs);
|
||||
ASSERT_EQ( 600, timeNowUs) << "time1";
|
||||
|
||||
expectedTimeOfNextEvent += 400;
|
||||
assertNextEvent("exec2@70", HIGH_VALUE, &executor);
|
||||
|
@ -125,7 +125,7 @@ TEST(misc, testPwmGenerator) {
|
|||
assertEqualsM2("1@1000/80", expectedTimeOfNextEvent, executor.getForUnitTest(0)->momentX, 0);
|
||||
|
||||
assertNextEvent("exec@0", LOW_VALUE, &executor);
|
||||
assertEqualsM("time1", 800, timeNowUs);
|
||||
ASSERT_EQ( 800, timeNowUs) << "time1";
|
||||
|
||||
expectedTimeOfNextEvent += 200;
|
||||
assertEqualsM2("2@1000/80", expectedTimeOfNextEvent, executor.getForUnitTest(0)->momentX, 0);
|
||||
|
@ -135,18 +135,18 @@ TEST(misc, testPwmGenerator) {
|
|||
assertEqualsM2("2@1000/0", expectedTimeOfNextEvent, executor.getForUnitTest(0)->momentX, 0);
|
||||
|
||||
assertNextEvent("exec@1", LOW_VALUE, &executor);
|
||||
assertEqualsM("time2", 1000, timeNowUs);
|
||||
ASSERT_EQ( 1000, timeNowUs) << "time2";
|
||||
|
||||
expectedTimeOfNextEvent += 1000;
|
||||
assertEqualsM2("3@1000/0", expectedTimeOfNextEvent, executor.getForUnitTest(0)->momentX, 0);
|
||||
|
||||
assertNextEvent("exec@2", LOW_VALUE /* pin value */, &executor);
|
||||
assertEqualsM("time3", 2000, timeNowUs);
|
||||
ASSERT_EQ( 2000, timeNowUs) << "time3";
|
||||
expectedTimeOfNextEvent += 1000;
|
||||
assertEqualsM2("4@1000/0", expectedTimeOfNextEvent, executor.getForUnitTest(0)->momentX, 0);
|
||||
|
||||
assertNextEvent("exec@3", LOW_VALUE /* pin value */, &executor);
|
||||
assertEqualsM("time4", 3000, timeNowUs);
|
||||
ASSERT_EQ( 3000, timeNowUs) << "time4";
|
||||
expectedTimeOfNextEvent += 1000;
|
||||
assertEqualsM2("5@1000/0", expectedTimeOfNextEvent, executor.getForUnitTest(0)->momentX, 0);
|
||||
|
||||
|
@ -156,7 +156,7 @@ TEST(misc, testPwmGenerator) {
|
|||
|
||||
assertNextEvent("exec@5", LOW_VALUE /* pin value */, &executor);
|
||||
expectedTimeOfNextEvent += 1000;
|
||||
assertEqualsM("time4", 5000, timeNowUs);
|
||||
ASSERT_EQ( 5000, timeNowUs) << "time4";
|
||||
assertEqualsM2("7@1000/0", expectedTimeOfNextEvent, executor.getForUnitTest(0)->momentX, 0);
|
||||
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ TEST(sensors, mapDecoding) {
|
|||
ASSERT_FLOAT_EQ(31.244, decodePressure(1, &s PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
||||
s.type = MT_MPX4250;
|
||||
assertEqualsM("MPX_4250 0 volts", 8, decodePressure(0, &s PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
ASSERT_EQ( 8, decodePressure(0, &s PASS_ENGINE_PARAMETER_SUFFIX)) << "MPX_4250 0 volts";
|
||||
ASSERT_FLOAT_EQ(58.4, decodePressure(1, &s PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
}
|
||||
|
||||
|
|
|
@ -51,15 +51,15 @@ static void testSignalExecutor2(void) {
|
|||
eq.insertTask(&p1.s, 0, (schfunc_t) complexCallback, &p1);
|
||||
eq.insertTask(&p2.s, 0, (schfunc_t) complexCallback, &p2);
|
||||
eq.executeAll(complexTestNow);
|
||||
assertEqualsM("callbackCounter #1", 2, callbackCounter);
|
||||
ASSERT_EQ( 2, callbackCounter) << "callbackCounter #1";
|
||||
ASSERT_EQ(2, eq.size());
|
||||
|
||||
eq.executeAll(complexTestNow = 2);
|
||||
assertEqualsM("callbackCounter #2", 3, callbackCounter);
|
||||
ASSERT_EQ( 3, callbackCounter) << "callbackCounter #2";
|
||||
ASSERT_EQ(2, eq.size());
|
||||
|
||||
eq.executeAll(complexTestNow = 3);
|
||||
assertEqualsM("callbackCounter #3", 4, callbackCounter);
|
||||
ASSERT_EQ( 4, callbackCounter) << "callbackCounter #3";
|
||||
ASSERT_EQ(2, eq.size());
|
||||
|
||||
}
|
||||
|
@ -115,10 +115,10 @@ TEST(misc, testSignalExecutor) {
|
|||
|
||||
callbackCounter = 0;
|
||||
eq.executeAll(10);
|
||||
assertEqualsM("callbackCounter/2", 2, callbackCounter);
|
||||
ASSERT_EQ( 2, callbackCounter) << "callbackCounter/2";
|
||||
callbackCounter = 0;
|
||||
eq.executeAll(11);
|
||||
assertEqualsM("callbackCounter/1#1", 1, callbackCounter);
|
||||
ASSERT_EQ( 1, callbackCounter) << "callbackCounter/1#1";
|
||||
eq.executeAll(100);
|
||||
ASSERT_EQ(0, eq.size());
|
||||
|
||||
|
@ -127,7 +127,7 @@ TEST(misc, testSignalExecutor) {
|
|||
eq.insertTask(&s3, 10, callback, NULL);
|
||||
callbackCounter = 0;
|
||||
eq.executeAll(10);
|
||||
assertEqualsM("callbackCounter/1#2", 1, callbackCounter);
|
||||
ASSERT_EQ( 1, callbackCounter) << "callbackCounter/1#2";
|
||||
callbackCounter = 0;
|
||||
eq.executeAll(11);
|
||||
ASSERT_EQ(1, callbackCounter);
|
||||
|
@ -139,7 +139,7 @@ TEST(misc, testSignalExecutor) {
|
|||
ASSERT_EQ(10, eq.getNextEventTime(0));
|
||||
|
||||
eq.executeAll(1);
|
||||
assertEqualsM("callbacks not expected", 0, callbackCounter);
|
||||
ASSERT_EQ( 0, callbackCounter) << "callbacks not expected";
|
||||
|
||||
eq.executeAll(11);
|
||||
ASSERT_EQ(1, callbackCounter);
|
||||
|
|
|
@ -18,7 +18,7 @@ TEST(big, testSpeedDensity) {
|
|||
eth.applyTriggerShape();
|
||||
|
||||
eth.fireTriggerEvents(36);
|
||||
assertEqualsM("RPM", 1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 1500, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM";
|
||||
|
||||
// 427 cubic inches, that's a LOT of engine
|
||||
engineConfiguration->specs.displacement = 6.99728;
|
||||
|
|
|
@ -14,17 +14,17 @@ TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
|
|||
EXPAND_EngineTestHelper
|
||||
|
||||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
||||
assertEqualsM("RPM=0", 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM=0";
|
||||
|
||||
eth.fireTriggerEventsWithDuration(/* durationMs */ 200);
|
||||
// still no RPM since need to cycles measure cycle duration
|
||||
assertEqualsM("start-RPM#1", 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "start-RPM#1";
|
||||
|
||||
|
||||
eth.fireRise(/* delayMs */ 200);
|
||||
assertEqualsM("RPM#2", 300, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 300, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#2";
|
||||
// two simultaneous injections
|
||||
assertEqualsM("plain#2", 4, engine->executor.size());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "plain#2";
|
||||
|
||||
eth.assertEvent5(&engine->executor, "sim start", 0, (void*)startSimultaniousInjection, eth.getTimeNowUs(), 97975);
|
||||
eth.assertEvent5(&engine->executor, "sim end", 1, (void*)endSimultaniousInjection, eth.getTimeNowUs(), 100000);
|
||||
|
@ -40,10 +40,10 @@ TEST(engine, testStartOfCrankingPrimingPulse) {
|
|||
engineConfiguration->startOfCrankingPrimingPulse = 4;
|
||||
|
||||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
||||
assertEqualsM("RPM=0", 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM=0";
|
||||
|
||||
// this -70 value comes from CLT error handling code
|
||||
assertEqualsM("CLT#1", 70, engine->sensors.clt);
|
||||
ASSERT_NEAR( 70, engine->sensors.clt, EPS4D) << "CLT#1";
|
||||
|
||||
// we need below freezing temperature to get prime fuel
|
||||
// todo: less cruel CLT value assignment which would survive 'updateSlowSensors'
|
||||
|
@ -53,6 +53,6 @@ TEST(engine, testStartOfCrankingPrimingPulse) {
|
|||
startPrimeInjectionPulse(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
|
||||
assertEqualsM("prime fuel", 1, engine->executor.size());
|
||||
ASSERT_EQ( 1, engine->executor.size()) << "prime fuel";
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ static void testDodgeNeonDecoder(void) {
|
|||
printf("*************************************************** testDodgeNeonDecoder95\r\n");
|
||||
initTriggerDecoder();
|
||||
|
||||
assertEqualsM("DODGE_NEON_1995: trigger zero index", 8, getTriggerZeroEventIndex(DODGE_NEON_1995));
|
||||
ASSERT_EQ( 8, getTriggerZeroEventIndex(DODGE_NEON_1995)) << "DODGE_NEON_1995: trigger zero index";
|
||||
|
||||
EngineTestHelper eth(DODGE_NEON_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
|
@ -99,10 +99,10 @@ static void testDodgeNeonDecoder(void) {
|
|||
// printf("3rd camshaft revolution\r\n");
|
||||
// r = 2 * 720;
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 60);
|
||||
// assertEqualsM("current index", 3, state.current_index);
|
||||
// ASSERT_EQ( 3, state.current_index) << "current index";
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 210);
|
||||
// ASSERT_TRUE(state.shaft_is_synchronized);
|
||||
// assertEqualsM("current index", 0, state.current_index);
|
||||
// ASSERT_EQ( 0, state.current_index) << "current index";
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_RISING, r + 420);
|
||||
// processTriggerEvent(&state, shape, &ec->triggerConfig, SHAFT_PRIMARY_FALLING, r + 630);
|
||||
}
|
||||
|
@ -153,17 +153,17 @@ TEST(misc, test1995FordInline6TriggerDecoder) {
|
|||
|
||||
printf("*************************************************** test1995FordInline6TriggerDecoder\r\n");
|
||||
|
||||
assertEqualsM("triggerIndex ", 0, getTriggerZeroEventIndex(FORD_INLINE_6_1995));
|
||||
ASSERT_EQ( 0, getTriggerZeroEventIndex(FORD_INLINE_6_1995)) << "triggerIndex ";
|
||||
|
||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
|
||||
TriggerShape * shape = &engine->triggerCentral.triggerShape;
|
||||
|
||||
assertEqualsM("triggerShapeSynchPointIndex", 0, shape->getTriggerShapeSynchPointIndex());
|
||||
ASSERT_EQ( 0, shape->getTriggerShapeSynchPointIndex()) << "triggerShapeSynchPointIndex";
|
||||
|
||||
event_trigger_position_s position;
|
||||
assertEqualsM("globalTriggerAngleOffset", 0, engineConfiguration->globalTriggerAngleOffset);
|
||||
ASSERT_EQ( 0, engineConfiguration->globalTriggerAngleOffset) << "globalTriggerAngleOffset";
|
||||
TRIGGER_SHAPE(findTriggerPosition(&position, 0, engineConfiguration->globalTriggerAngleOffset));
|
||||
assertTriggerPosition(&position, 0, 0);
|
||||
|
||||
|
@ -182,11 +182,11 @@ TEST(misc, test1995FordInline6TriggerDecoder) {
|
|||
eth.fireTriggerEvents(48);
|
||||
|
||||
IgnitionEventList *ecl = &engine->ignitionEvents;
|
||||
assertEqualsM("ford inline ignition events size", 1, ecl->isReady);
|
||||
assertEqualsM("event index", 0, ecl->elements[0].dwellPosition.eventIndex);
|
||||
ASSERT_EQ( 1, ecl->isReady) << "ford inline ignition events size";
|
||||
ASSERT_EQ( 0, ecl->elements[0].dwellPosition.eventIndex) << "event index";
|
||||
assertEqualsM("angle offset#1", 7.8621, ecl->elements[0].dwellPosition.angleOffset);
|
||||
|
||||
assertEqualsM("event index", 10, ecl->elements[5].dwellPosition.eventIndex);
|
||||
ASSERT_EQ( 10, ecl->elements[5].dwellPosition.eventIndex) << "event index";
|
||||
assertEqualsM("angle offset#2", 7.8621, ecl->elements[5].dwellPosition.angleOffset);
|
||||
|
||||
|
||||
|
@ -196,12 +196,12 @@ TEST(misc, test1995FordInline6TriggerDecoder) {
|
|||
TEST(misc, testFordAspire) {
|
||||
printf("*************************************************** testFordAspire\r\n");
|
||||
|
||||
assertEqualsM("getTriggerZeroEventIndex", 4, getTriggerZeroEventIndex(FORD_ASPIRE_1996));
|
||||
ASSERT_EQ( 4, getTriggerZeroEventIndex(FORD_ASPIRE_1996)) << "getTriggerZeroEventIndex";
|
||||
|
||||
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||
EXPAND_EngineTestHelper;
|
||||
|
||||
assertEqualsM("getTriggerShapeSynchPointIndex", 4, TRIGGER_SHAPE(getTriggerShapeSynchPointIndex()));
|
||||
ASSERT_EQ( 4, TRIGGER_SHAPE(getTriggerShapeSynchPointIndex())) << "getTriggerShapeSynchPointIndex";
|
||||
|
||||
ASSERT_EQ(800, config->fuelRpmBins[0]);
|
||||
ASSERT_EQ(7000, config->fuelRpmBins[15]);
|
||||
|
@ -212,7 +212,7 @@ TEST(misc, testFordAspire) {
|
|||
engine->rpmCalculator.setRpmValue(200 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("cranking dwell", 54.166670, getSparkDwell(200 PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
engine->rpmCalculator.setRpmValue(2000 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("running dwell", 4, getSparkDwell(2000 PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
ASSERT_EQ( 4, getSparkDwell(2000 PASS_ENGINE_PARAMETER_SUFFIX)) << "running dwell";
|
||||
|
||||
engine->rpmCalculator.setRpmValue(6000 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("higher rpm dwell", 3.25, getSparkDwell(6000 PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
@ -255,31 +255,31 @@ TEST(misc, testStartupFuelPumping) {
|
|||
|
||||
setMockTpsPosition(6);
|
||||
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("pc#1", 1, sf.pumpsCounter);
|
||||
ASSERT_EQ( 1, sf.pumpsCounter) << "pc#1";
|
||||
|
||||
setMockTpsPosition(3);
|
||||
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("pumpsCounter#2", 1, sf.pumpsCounter);
|
||||
ASSERT_EQ( 1, sf.pumpsCounter) << "pumpsCounter#2";
|
||||
|
||||
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("pc#3", 1, sf.pumpsCounter);
|
||||
ASSERT_EQ( 1, sf.pumpsCounter) << "pc#3";
|
||||
|
||||
engine->rpmCalculator.mockRpm = 10;
|
||||
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("pc#4", 0, sf.pumpsCounter);
|
||||
ASSERT_EQ( 0, sf.pumpsCounter) << "pc#4";
|
||||
|
||||
setMockTpsPosition(7);
|
||||
engine->rpmCalculator.mockRpm = 0;
|
||||
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("pc#5", 1, sf.pumpsCounter);
|
||||
ASSERT_EQ( 1, sf.pumpsCounter) << "pc#5";
|
||||
|
||||
setMockTpsPosition(3);
|
||||
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("pc#6", 1, sf.pumpsCounter);
|
||||
ASSERT_EQ( 1, sf.pumpsCounter) << "pc#6";
|
||||
|
||||
setMockTpsPosition(7);
|
||||
sf.update(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("pc#7", 2, sf.pumpsCounter);
|
||||
ASSERT_EQ( 2, sf.pumpsCounter) << "pc#7";
|
||||
}
|
||||
|
||||
static void assertREquals(void *expected, void *actual) {
|
||||
|
@ -299,9 +299,9 @@ TEST(misc, testRpmCalculator) {
|
|||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
IgnitionEventList *ilist = &engine->ignitionEvents;
|
||||
assertEqualsM("size #1", 0, ilist->isReady);
|
||||
ASSERT_EQ( 0, ilist->isReady) << "size #1";
|
||||
|
||||
assertEqualsM("engineCycle", 720, engine->engineCycle);
|
||||
ASSERT_EQ( 720, engine->engineCycle) << "engineCycle";
|
||||
|
||||
efiAssertVoid(CUSTOM_ERR_6670, engineConfiguration!=NULL, "null config in engine");
|
||||
|
||||
|
@ -323,8 +323,8 @@ TEST(misc, testRpmCalculator) {
|
|||
|
||||
eth.fireTriggerEvents(/* count */ 48);
|
||||
|
||||
assertEqualsM("RPM", 1500, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
assertEqualsM("index #1", 15, engine->triggerCentral.triggerState.getCurrentIndex());
|
||||
ASSERT_EQ( 1500, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM";
|
||||
ASSERT_EQ( 15, engine->triggerCentral.triggerState.getCurrentIndex()) << "index #1";
|
||||
|
||||
|
||||
eth.clearQueue();
|
||||
|
@ -336,7 +336,7 @@ TEST(misc, testRpmCalculator) {
|
|||
eth.moveTimeForwardUs(MS2US(5)); // 5ms
|
||||
|
||||
int start = eth.getTimeNowUs();
|
||||
assertEqualsM("start value", 485000, start);
|
||||
ASSERT_EQ( 485000, start) << "start value";
|
||||
|
||||
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
|
@ -350,12 +350,12 @@ TEST(misc, testRpmCalculator) {
|
|||
assertEqualsM("dwell", 4.5, engine->engineState.dwellAngle);
|
||||
assertEqualsM("fuel #2", 4.5450, engine->injectionDuration);
|
||||
assertEqualsM("one degree", 111.1111, engine->rpmCalculator.oneDegreeUs);
|
||||
assertEqualsM("size #2", 1, ilist->isReady);
|
||||
assertEqualsM("dwell angle", 0, ilist->elements[0].dwellPosition.eventAngle);
|
||||
ASSERT_EQ( 1, ilist->isReady) << "size #2";
|
||||
ASSERT_EQ( 0, ilist->elements[0].dwellPosition.eventAngle) << "dwell angle";
|
||||
assertEqualsM("dwell offset", 8.5, ilist->elements[0].dwellPosition.angleOffset);
|
||||
|
||||
assertEqualsM("index #2", 0, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("queue size/2", 2, engine->executor.size());
|
||||
ASSERT_EQ( 0, eth.engine.triggerCentral.triggerState.getCurrentIndex()) << "index #2";
|
||||
ASSERT_EQ( 2, engine->executor.size()) << "queue size/2";
|
||||
{
|
||||
scheduling_s *ev0 = engine->executor.getForUnitTest(0);
|
||||
|
||||
|
@ -375,8 +375,8 @@ TEST(misc, testRpmCalculator) {
|
|||
eth.fireFall(5);
|
||||
eth.fireRise(5);
|
||||
eth.fireFall(5);
|
||||
assertEqualsM("index #3", 3, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("queue size 3", 4, engine->executor.size());
|
||||
ASSERT_EQ( 3, eth.engine.triggerCentral.triggerState.getCurrentIndex()) << "index #3";
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "queue size 3";
|
||||
assertEqualsM("ev 3", start + 13333 - 1515, engine->executor.getForUnitTest(0)->momentX);
|
||||
assertEqualsM2("ev 5", start + 14277, engine->executor.getForUnitTest(1)->momentX, 2);
|
||||
assertEqualsM("3/3", start + 14777, engine->executor.getForUnitTest(2)->momentX);
|
||||
|
@ -387,15 +387,15 @@ TEST(misc, testRpmCalculator) {
|
|||
|
||||
|
||||
eth.fireFall(5);
|
||||
assertEqualsM("queue size 4.1", 0, engine->executor.size());
|
||||
ASSERT_EQ( 0, engine->executor.size()) << "queue size 4.1";
|
||||
|
||||
|
||||
eth.fireRise(5);
|
||||
assertEqualsM("queue size 4.2", 4, engine->executor.size());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "queue size 4.2";
|
||||
|
||||
|
||||
eth.fireRise(5);
|
||||
assertEqualsM("queue size 4.3", 4, engine->executor.size());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "queue size 4.3";
|
||||
|
||||
assertEqualsM("dwell", 4.5, eth.engine.engineState.dwellAngle);
|
||||
assertEqualsM("fuel #3", 4.5450, eth.engine.injectionDuration);
|
||||
|
@ -404,29 +404,29 @@ TEST(misc, testRpmCalculator) {
|
|||
eth.assertInjectorUpEvent("ev 0/2", 0, -4849, 2);
|
||||
|
||||
|
||||
assertEqualsM("index #4", 6, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||
assertEqualsM("queue size 4", 4, engine->executor.size());
|
||||
ASSERT_EQ( 6, eth.engine.triggerCentral.triggerState.getCurrentIndex()) << "index #4";
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "queue size 4";
|
||||
engine->executor.clear();
|
||||
|
||||
eth.fireFall(5);
|
||||
assertEqualsM("queue size 5", 2, engine->executor.size());
|
||||
ASSERT_EQ( 2, engine->executor.size()) << "queue size 5";
|
||||
// todo: assert queue elements
|
||||
engine->executor.clear();
|
||||
|
||||
|
||||
eth.fireRise(5);
|
||||
assertEqualsM("queue size 6", 2, engine->executor.size());
|
||||
ASSERT_EQ( 2, engine->executor.size()) << "queue size 6";
|
||||
assertEqualsM("6/0", start + 40944, engine->executor.getForUnitTest(0)->momentX);
|
||||
assertEqualsM("6/1", start + 41444, engine->executor.getForUnitTest(1)->momentX);
|
||||
engine->executor.clear();
|
||||
|
||||
eth.fireFall(5);
|
||||
assertEqualsM("queue size 7", 0, engine->executor.size());
|
||||
ASSERT_EQ( 0, engine->executor.size()) << "queue size 7";
|
||||
engine->executor.clear();
|
||||
|
||||
eth.moveTimeForwardUs(5000); // 5ms
|
||||
eth.firePrimaryTriggerRise();
|
||||
assertEqualsM("queue size 8", 4, engine->executor.size());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "queue size 8";
|
||||
// todo: assert queue elements completely
|
||||
assertEqualsM("8/0", start + 53333 - 1515, engine->executor.getForUnitTest(0)->momentX);
|
||||
assertEqualsM2("8/1", start + 54277, engine->executor.getForUnitTest(1)->momentX, 0);
|
||||
|
@ -435,12 +435,12 @@ TEST(misc, testRpmCalculator) {
|
|||
|
||||
|
||||
eth.fireFall(5);
|
||||
assertEqualsM("queue size 9", 0, engine->executor.size());
|
||||
ASSERT_EQ( 0, engine->executor.size()) << "queue size 9";
|
||||
engine->executor.clear();
|
||||
|
||||
|
||||
eth.fireRise(5);
|
||||
assertEqualsM("queue size 10", 0, engine->executor.size());
|
||||
ASSERT_EQ( 0, engine->executor.size()) << "queue size 10";
|
||||
engine->executor.clear();
|
||||
}
|
||||
|
||||
|
@ -514,13 +514,13 @@ TEST(misc, testTriggerDecoder) {
|
|||
|
||||
// TriggerShape *t = ð.engine.triggerShape;
|
||||
// ASSERT_EQ(1, t->eventAngles[1]);
|
||||
// assertEqualsM("index at 0", 0, t->triggerIndexByAngle[56]);
|
||||
// assertEqualsM("index at 1", 1, t->triggerIndexByAngle[57]);
|
||||
// ASSERT_EQ( 0, t->triggerIndexByAngle[56]) << "index at 0";
|
||||
// ASSERT_EQ( 1, t->triggerIndexByAngle[57]) << "index at 1";
|
||||
//
|
||||
// ASSERT_EQ(270, t->eventAngles[5]);
|
||||
// assertEqualsM("index at 269", 4, t->triggerIndexByAngle[269]);
|
||||
// assertEqualsM("index at 270", 5, t->triggerIndexByAngle[270]);
|
||||
// assertEqualsM("index at 271", 5, t->triggerIndexByAngle[271]);
|
||||
// ASSERT_EQ( 4, t->triggerIndexByAngle[269]) << "index at 269";
|
||||
// ASSERT_EQ( 5, t->triggerIndexByAngle[270]) << "index at 270";
|
||||
// ASSERT_EQ( 5, t->triggerIndexByAngle[271]) << "index at 271";
|
||||
//
|
||||
// ASSERT_EQ(306, t->eventAngles[6]);
|
||||
// ASSERT_EQ(5, t->triggerIndexByAngle[305]);
|
||||
|
@ -528,8 +528,8 @@ TEST(misc, testTriggerDecoder) {
|
|||
// ASSERT_EQ(6, t->triggerIndexByAngle[307]);
|
||||
//
|
||||
// ASSERT_EQ(666, t->eventAngles[11]);
|
||||
// assertEqualsM("index for 665", 10, t->triggerIndexByAngle[665]);
|
||||
// assertEqualsM("index for 668", 11, t->triggerIndexByAngle[668]);
|
||||
// ASSERT_EQ( 10, t->triggerIndexByAngle[665]) << "index for 665";
|
||||
// ASSERT_EQ( 11, t->triggerIndexByAngle[668]) << "index for 668";
|
||||
|
||||
|
||||
eth.persistentConfig.engineConfiguration.useOnlyRisingEdgeForTrigger = false;
|
||||
|
@ -605,12 +605,12 @@ void setupSimpleTestEngineWithMafAndTT_ONE_trigger(EngineTestHelper *eth, inject
|
|||
// this is needed to update injectorLag
|
||||
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
assertEqualsM("CLT", 70, engine->sensors.clt);
|
||||
assertEqualsM("trigger #1", 0, readIfTriggerConfigChangedForUnitTest());
|
||||
ASSERT_NEAR( 70, engine->sensors.clt, EPS4D) << "CLT";
|
||||
ASSERT_EQ( 0, readIfTriggerConfigChangedForUnitTest()) << "trigger #1";
|
||||
|
||||
engineConfiguration->trigger.type = TT_ONE;
|
||||
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("trigger #2", 1, readIfTriggerConfigChangedForUnitTest());
|
||||
ASSERT_EQ( 1, readIfTriggerConfigChangedForUnitTest()) << "trigger #2";
|
||||
|
||||
eth->applyTriggerShape();
|
||||
|
||||
|
@ -623,8 +623,8 @@ static void setTestBug299(EngineTestHelper *eth) {
|
|||
|
||||
|
||||
assertRpm("RPM=0", 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
assertEqualsM("setTestBug299 EL", 0, getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
assertEqualsM("setTestBug299 IAT", 30, engine->sensors.iat);
|
||||
ASSERT_EQ( 0, getEngineLoadT(PASS_ENGINE_PARAMETER_SIGNATURE)) << "setTestBug299 EL";
|
||||
ASSERT_NEAR( 30, engine->sensors.iat, EPS4D) << "setTestBug299 IAT";
|
||||
eth->fireTriggerEventsWithDuration(20);
|
||||
// still no RPM since need to cycles measure cycle duration
|
||||
assertRpm("setTestBug299: RPM#1", 0 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
|
@ -641,13 +641,13 @@ static void setTestBug299(EngineTestHelper *eth) {
|
|||
// time...|0.......|10......|20......|30......|40
|
||||
// inj #0 |.......#|........|.......#|........|
|
||||
// inj #1 |........|.......#|........|.......#|
|
||||
assertEqualsM("qs#00", 4, engine->executor.size());
|
||||
assertEqualsM("rev cnt#3", 3, engine->rpmCalculator.getRevolutionCounter());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#00";
|
||||
ASSERT_EQ( 3, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#3";
|
||||
eth->assertInjectorUpEvent("setTestBug299: 1@0", 0, MS2US(8.5), 0);
|
||||
eth->assertInjectorDownEvent("@1", 1, MS2US(10), 0);
|
||||
eth->assertInjectorUpEvent("1@2", 2, MS2US(18.5), 1);
|
||||
eth->assertInjectorDownEvent("1@3", 3, MS2US(20), 1);
|
||||
assertEqualsM("exec#0", 0, eth->executeActions());
|
||||
ASSERT_EQ( 0, eth->executeActions()) << "exec#0";
|
||||
|
||||
FuelSchedule * t = &ENGINE(injectionEvents);
|
||||
|
||||
|
@ -664,8 +664,8 @@ static void setTestBug299(EngineTestHelper *eth) {
|
|||
// time...|-20.....|-10.....|0.......|10......|20
|
||||
// inj #0 |.......#|........|.......#|........|
|
||||
// inj #1 |........|.......#|........|.......#|
|
||||
assertEqualsM("qs#0", 8, engine->executor.size());
|
||||
assertEqualsM("rev cnt#3", 3, engine->rpmCalculator.getRevolutionCounter());
|
||||
ASSERT_EQ( 8, engine->executor.size()) << "qs#0";
|
||||
ASSERT_EQ( 3, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#3";
|
||||
eth->assertInjectorUpEvent("02@0", 0, MS2US(-11.5), 0);
|
||||
eth->assertInjectorDownEvent("@1", 1, MS2US(-10), 0);
|
||||
eth->assertInjectorUpEvent("@2", 2, MS2US(-1.5), 1);
|
||||
|
@ -674,7 +674,7 @@ static void setTestBug299(EngineTestHelper *eth) {
|
|||
eth->assertInjectorDownEvent("@5", 5, MS2US(10), 0);
|
||||
eth->assertInjectorUpEvent("02@6", 6, MS2US(18.5), 1);
|
||||
eth->assertInjectorDownEvent("@7", 7, MS2US(20), 1);
|
||||
assertEqualsM("exec#1", 4, eth->executeActions());
|
||||
ASSERT_EQ( 4, eth->executeActions()) << "exec#1";
|
||||
|
||||
|
||||
/**
|
||||
|
@ -685,10 +685,10 @@ static void setTestBug299(EngineTestHelper *eth) {
|
|||
eth->assertInjectorDownEvent("22@1", 1, MS2US(-10), 0);
|
||||
eth->assertInjectorUpEvent("22@2", 2, MS2US(-1.5), 1);
|
||||
eth->assertInjectorDownEvent("22@3", 3, MS2US(0), 1);
|
||||
assertEqualsM("exec#20", 4, eth->executeActions());
|
||||
ASSERT_EQ( 4, eth->executeActions()) << "exec#20";
|
||||
|
||||
eth->firePrimaryTriggerRise();
|
||||
assertEqualsM("qs#0-2", 4, engine->executor.size());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#0-2";
|
||||
// fuel schedule - short pulses. and more realistic schedule this time
|
||||
// time...|-20.....|-10.....|0.......|10......|20
|
||||
// inj #0 |.......#|........|.......#|........|
|
||||
|
@ -697,7 +697,7 @@ static void setTestBug299(EngineTestHelper *eth) {
|
|||
eth->assertInjectorDownEvent("@1", 1, MS2US(10), 0);
|
||||
eth->assertInjectorUpEvent("@2", 2, MS2US(18.5), 1);
|
||||
eth->assertInjectorDownEvent("2@3", 3, MS2US(20), 1);
|
||||
assertEqualsM("exec#2", 0, eth->executeActions());
|
||||
ASSERT_EQ( 0, eth->executeActions()) << "exec#2";
|
||||
|
||||
|
||||
eth->moveTimeForwardUs(MS2US(20));
|
||||
|
@ -707,29 +707,29 @@ static void setTestBug299(EngineTestHelper *eth) {
|
|||
// time...|-20.....|-10.....|0.......|10......|20
|
||||
// inj #0 |.......#|........|........|........|
|
||||
// inj #1 |........|.......#|........|........|
|
||||
assertEqualsM("qs#0-2", 4, engine->executor.size());
|
||||
assertEqualsM("rev cnt#4", 4, engine->rpmCalculator.getRevolutionCounter());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#0-2";
|
||||
ASSERT_EQ( 4, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#4";
|
||||
eth->assertInjectorUpEvent("0@0", 0, MS2US(8.5), 0);
|
||||
eth->assertInjectorDownEvent("0@1", 1, MS2US(10), 0);
|
||||
eth->assertInjectorUpEvent("0@2", 2, MS2US(18.5), 1);
|
||||
eth->assertInjectorDownEvent("0@3", 3, MS2US(20), 1);
|
||||
assertEqualsM("exec#3", 0, eth->executeActions());
|
||||
ASSERT_EQ( 0, eth->executeActions()) << "exec#3";
|
||||
|
||||
|
||||
assertEqualsM("iatC", 1, engine->engineState.iatFuelCorrection);
|
||||
assertEqualsM("cltC", 1, engine->engineState.cltFuelCorrection);
|
||||
assertEqualsM("lag", 0, engine->engineState.injectorLag);
|
||||
ASSERT_EQ( 1, engine->engineState.iatFuelCorrection) << "iatC";
|
||||
ASSERT_EQ( 1, engine->engineState.cltFuelCorrection) << "cltC";
|
||||
ASSERT_EQ( 0, engine->engineState.injectorLag) << "lag";
|
||||
|
||||
testMafValue = 0;
|
||||
assertEqualsM("maf", 0, getMaf(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 0, getMaf(PASS_ENGINE_PARAMETER_SIGNATURE)) << "maf";
|
||||
|
||||
assertEqualsM("setTestBug299: RPM", 3000, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 3000, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "setTestBug299: RPM";
|
||||
|
||||
assertEqualsM("fuel#1", 1.5, engine->injectionDuration);
|
||||
assertEqualsM("duty for maf=0", 7.5, getInjectorDutyCycle(engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
||||
testMafValue = 3;
|
||||
assertEqualsM("maf", 3, getMaf(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 3, getMaf(PASS_ENGINE_PARAMETER_SIGNATURE)) << "maf";
|
||||
}
|
||||
|
||||
static void assertInjectors(const char *msg, int value0, int value1) {
|
||||
|
@ -758,19 +758,19 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
assertEqualsM("fuel#2", 12.5, engine->injectionDuration);
|
||||
assertEqualsM("duty for maf=3", 62.5, getInjectorDutyCycle(eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
||||
assertEqualsM("qs#1", 4, engine->executor.size());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#1";
|
||||
eth.moveTimeForwardUs(MS2US(20));
|
||||
assertEqualsM("exec#2#0", 4, eth.executeActions());
|
||||
assertEqualsM("qs#1#2", 0, engine->executor.size());
|
||||
ASSERT_EQ( 4, eth.executeActions()) << "exec#2#0";
|
||||
ASSERT_EQ( 0, engine->executor.size()) << "qs#1#2";
|
||||
|
||||
|
||||
assertEqualsM("rev cnt#4#0", 4, engine->rpmCalculator.getRevolutionCounter());
|
||||
ASSERT_EQ( 4, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#4#0";
|
||||
eth.firePrimaryTriggerRise();
|
||||
assertEqualsM("rev cnt#4#1", 5, engine->rpmCalculator.getRevolutionCounter());
|
||||
ASSERT_EQ( 5, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#4#1";
|
||||
// time...|0.......|10......|20......|30......|40......|50......|60......|
|
||||
// inj #0 |########|##...###|########|.....###|########|........|........|
|
||||
// inj #1 |.....###|########|....####|########|........|........|........|
|
||||
assertEqualsM("qs#4", 6, engine->executor.size());
|
||||
ASSERT_EQ( 6, engine->executor.size()) << "qs#4";
|
||||
//todo assertInjectorUpEvent("04@0", 0, MS2US(0), 0);
|
||||
// assertInjectorUpEvent("04@1", 1, MS2US(7.5), 1);
|
||||
// assertInjectorDownEvent("04@2", 2, MS2US(12.5), 0);
|
||||
|
@ -784,17 +784,17 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
|
||||
// {
|
||||
// scheduling_s *ev = engine->executor.getForUnitTest(9);
|
||||
// assertEqualsM("rev cnt#4#2", 5, engine->rpmCalculator.getRevolutionCounter());
|
||||
// ASSERT_EQ( 5, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#4#2";
|
||||
// assertTrueM("down 50", ev == &engineConfiguration->fuelActuators[2].signalPair[1].signalTimerDown);
|
||||
// }
|
||||
|
||||
|
||||
assertEqualsM("exec#4", 0, eth.executeActions());
|
||||
ASSERT_EQ( 0, eth.executeActions()) << "exec#4";
|
||||
|
||||
|
||||
eth.fireFall(20);
|
||||
assertEqualsM("qs#2#1", 8, engine->executor.size());
|
||||
assertEqualsM("rev cnt#5", 5, engine->rpmCalculator.getRevolutionCounter());
|
||||
ASSERT_EQ( 8, engine->executor.size()) << "qs#2#1";
|
||||
ASSERT_EQ( 5, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt#5";
|
||||
// using old fuel schedule - but already wider pulses
|
||||
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
|
||||
// inj #0 |........|.....###|########|.....###|########|........|........|
|
||||
|
@ -809,7 +809,7 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
// assertInjectorUpEvent("5@6", 6, MS2US(17.5), 0);
|
||||
// assertInjectorDownEvent("5@7", 7, MS2US(20.0), 1);
|
||||
// assertInjectorDownEvent("5@8", 8, MS2US(30.0), 0);
|
||||
assertEqualsM("exec#5", 3, eth.executeActions());
|
||||
ASSERT_EQ( 3, eth.executeActions()) << "exec#5";
|
||||
|
||||
/**
|
||||
* one more revolution
|
||||
|
@ -825,7 +825,7 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
assertInjectionEvent("inj#3", &t->elements[3], 1, 0, 333, false);
|
||||
|
||||
eth.moveTimeForwardUs(MS2US(20));
|
||||
assertEqualsM("qs#02", 5, engine->executor.size());
|
||||
ASSERT_EQ( 5, engine->executor.size()) << "qs#02";
|
||||
// assertInjectorUpEvent("6@0", 0, MS2US(-12.5), 1);
|
||||
// assertInjectorDownEvent("6@1", 1, MS2US(-10.0), 0);
|
||||
// assertInjectorUpEvent("6@2", 2, MS2US(-2.5), 0);
|
||||
|
@ -833,13 +833,13 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
// assertInjectorDownEvent("6@4", 4, MS2US(10.0), 0);
|
||||
|
||||
// so placing this 'executeAll' changes much?
|
||||
assertEqualsM("exec#07", 5, eth.executeActions());
|
||||
assertEqualsM("qs#07", 0, engine->executor.size());
|
||||
ASSERT_EQ( 5, eth.executeActions()) << "exec#07";
|
||||
ASSERT_EQ( 0, engine->executor.size()) << "qs#07";
|
||||
// assertInjectorDownEvent("26@0", 0, MS2US(10.0), 0);
|
||||
|
||||
eth.firePrimaryTriggerRise();
|
||||
assertEqualsM("qs#2#2", 4, engine->executor.size());
|
||||
assertEqualsM("rev cnt6", 6, engine->rpmCalculator.getRevolutionCounter());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#2#2";
|
||||
ASSERT_EQ( 6, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt6";
|
||||
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
|
||||
// inj #0 |########|.....###|########|....####|........|........|........|
|
||||
// inj #1 |.....###|########|.....###|########|........|........|........|
|
||||
|
@ -847,7 +847,7 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
// assertInjectorUpEvent("06@6", 6, MS2US(37.5), 0);
|
||||
// assertInjectorDownEvent("06@7", 7, MS2US(40.0), 1);
|
||||
|
||||
assertEqualsM("exec#7", 0, eth.executeActions());
|
||||
ASSERT_EQ( 0, eth.executeActions()) << "exec#7";
|
||||
|
||||
assertInjectors("#1_ij_", 0, 0);
|
||||
|
||||
|
@ -856,7 +856,7 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
// time...|-20.....|-10.....|0.......|10......|20......|30......|40......|
|
||||
// inj #0 |########|.......#|........|........|........|........|........|
|
||||
// inj #1 |....####|########|........|........|........|........|........|
|
||||
assertEqualsM("qs#022", 4, engine->executor.size());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#022";
|
||||
// assertInjectorUpEvent("7@0", 0, MS2US(-12.5), 1);
|
||||
// assertInjectorDownEvent("7@1", 1, MS2US(-10.0), 0);
|
||||
// assertInjectorUpEvent("7@2", 2, MS2US(-2.5), 0);
|
||||
|
@ -867,9 +867,9 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
//// assertInjectorDownEvent("7@7", 7, MS2US(20), 1);
|
||||
// // todo index 8
|
||||
|
||||
assertEqualsM("executed #06", 3, eth.executeActions());
|
||||
ASSERT_EQ( 3, eth.executeActions()) << "executed #06";
|
||||
assertInjectors("#4", 1, 0);
|
||||
assertEqualsM("qs#06", 1, engine->executor.size());
|
||||
ASSERT_EQ( 1, engine->executor.size()) << "qs#06";
|
||||
eth.assertInjectorDownEvent("17@0", 0, MS2US(10), 0);
|
||||
// assertInjectorDownEvent("17@1", 1, MS2US(10.0), 0);
|
||||
// assertInjectorUpEvent("17@2", 2, MS2US(17.5), 0);
|
||||
|
@ -878,18 +878,18 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
|
||||
eth.firePrimaryTriggerFall();
|
||||
|
||||
assertEqualsM("qs#3", 5, engine->executor.size());
|
||||
assertEqualsM("rev cnt6", 6, engine->rpmCalculator.getRevolutionCounter());
|
||||
assertEqualsM("executed #6", 0, eth.executeActions());
|
||||
ASSERT_EQ( 5, engine->executor.size()) << "qs#3";
|
||||
ASSERT_EQ( 6, engine->rpmCalculator.getRevolutionCounter()) << "rev cnt6";
|
||||
ASSERT_EQ( 0, eth.executeActions()) << "executed #6";
|
||||
|
||||
|
||||
eth.moveTimeForwardUs(MS2US(20));
|
||||
assertEqualsM("executed #06", 4, eth.executeActions());
|
||||
assertEqualsM("qs#06", 1, engine->executor.size());
|
||||
ASSERT_EQ( 4, eth.executeActions()) << "executed #06";
|
||||
ASSERT_EQ( 1, engine->executor.size()) << "qs#06";
|
||||
assertInjectors("inj#2", 1, 0);
|
||||
|
||||
eth.firePrimaryTriggerRise();
|
||||
assertEqualsM("Queue.size#03", 5, engine->executor.size());
|
||||
ASSERT_EQ( 5, engine->executor.size()) << "Queue.size#03";
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
eth.assertInjectorUpEvent("07@0", 0, MS2US(7.5), 1);
|
||||
eth.assertInjectorDownEvent("07@1", 1, MS2US(10), 0);
|
||||
|
@ -901,9 +901,9 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
// assertInjectorDownEvent("07@7", 7, MS2US(40), 1);
|
||||
// assertInjectorDownEvent("07@8", 8, MS2US(50), 0);
|
||||
|
||||
assertEqualsM("executeAll#3", 0, eth.executeActions());
|
||||
ASSERT_EQ( 0, eth.executeActions()) << "executeAll#3";
|
||||
eth.moveTimeForwardUs(MS2US(20));
|
||||
assertEqualsM("executeAll#4", 4, eth.executeActions());
|
||||
ASSERT_EQ( 4, eth.executeActions()) << "executeAll#4";
|
||||
|
||||
t = &ENGINE(injectionEvents);
|
||||
|
||||
|
@ -925,9 +925,9 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
|
||||
assertEqualsM("inj#0", 1, enginePins.injectors[0].currentLogicValue);
|
||||
ASSERT_EQ( 1, enginePins.injectors[0].currentLogicValue) << "inj#0";
|
||||
|
||||
assertEqualsM("Queue.size#04", 1, engine->executor.size());
|
||||
ASSERT_EQ( 1, engine->executor.size()) << "Queue.size#04";
|
||||
eth.assertInjectorDownEvent("08@0", 0, MS2US(10), 0);
|
||||
// assertInjectorDownEvent("08@1", 1, MS2US(10), 0);
|
||||
// assertInjectorUpEvent("08@2", 2, MS2US(17.5), 0);
|
||||
|
@ -942,7 +942,7 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
|
||||
|
||||
eth.fireRise(20);
|
||||
assertEqualsM("Queue.size#05", 7, engine->executor.size());
|
||||
ASSERT_EQ( 7, engine->executor.size()) << "Queue.size#05";
|
||||
eth.executeActions();
|
||||
|
||||
|
||||
|
@ -963,7 +963,7 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
assertInjectionEvent("#30", &t->elements[3], 1, 0, 45, false);
|
||||
|
||||
// todo: what's what? a mix of new something and old something?
|
||||
assertEqualsM("qs#5", 4, engine->executor.size());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "qs#5";
|
||||
// assertInjectorDownEvent("8@0", 0, MS2US(5.0), 1);
|
||||
// assertInjectorUpEvent("8@1", 1, MS2US(7.5), 1);
|
||||
// assertInjectorDownEvent("8@2", 2, MS2US(15.0), 0);
|
||||
|
@ -979,7 +979,7 @@ TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
|||
|
||||
mockMapValue = 0;
|
||||
testMafValue = 0;
|
||||
assertEqualsM("warningCounter#testFuelSchedulerBug299smallAndMedium", 2, unitTestWarningCodeState.recentWarnings.getCount());
|
||||
ASSERT_EQ( 2, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testFuelSchedulerBug299smallAndMedium";
|
||||
ASSERT_EQ(CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0));
|
||||
ASSERT_EQ(CUSTOM_OBD_SKIPPED_FUEL, unitTestWarningCodeState.recentWarnings.get(1));
|
||||
}
|
||||
|
@ -995,7 +995,7 @@ TEST(big, testDifferentInjectionModes) {
|
|||
EngineTestHelper eth(TEST_ENGINE);
|
||||
EXPAND_EngineTestHelper
|
||||
setTestBug299(ð);
|
||||
assertEqualsM("Lqs#0", 4, engine->executor.size());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#0";
|
||||
|
||||
// set fuel map values - extract method?
|
||||
int engineLoadIndex = findIndex(config->fuelLoadBins, FUEL_LOAD_COUNT, testMafValue);
|
||||
|
@ -1005,20 +1005,20 @@ TEST(big, testDifferentInjectionModes) {
|
|||
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("injectionMode IM_BATCH", (int)IM_BATCH, (int)engineConfiguration->injectionMode);
|
||||
assertEqualsM("injection while batch", 20, engine->injectionDuration);
|
||||
ASSERT_EQ( 20, engine->injectionDuration) << "injection while batch";
|
||||
|
||||
setInjectionMode((int)IM_SIMULTANEOUS PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("injection while simultaneous", 10, engine->injectionDuration);
|
||||
ASSERT_EQ( 10, engine->injectionDuration) << "injection while simultaneous";
|
||||
|
||||
setInjectionMode((int)IM_SEQUENTIAL PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("injection while IM_SEQUENTIAL", 40, engine->injectionDuration);
|
||||
ASSERT_EQ( 40, engine->injectionDuration) << "injection while IM_SEQUENTIAL";
|
||||
|
||||
setInjectionMode((int)IM_SINGLE_POINT PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("injection while IM_SINGLE_POINT", 40, engine->injectionDuration);
|
||||
assertEqualsM("warningCounter#testDifferentInjectionModes", 1, unitTestWarningCodeState.recentWarnings.getCount());
|
||||
ASSERT_EQ( 40, engine->injectionDuration) << "injection while IM_SINGLE_POINT";
|
||||
ASSERT_EQ( 1, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testDifferentInjectionModes";
|
||||
}
|
||||
|
||||
TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
||||
|
@ -1027,7 +1027,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
EngineTestHelper eth(TEST_ENGINE);
|
||||
EXPAND_EngineTestHelper
|
||||
setTestBug299(ð);
|
||||
assertEqualsM("Lqs#0", 4, engine->executor.size());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#0";
|
||||
|
||||
// set fuel map values - extract method?
|
||||
int engineLoadIndex = findIndex(config->fuelLoadBins, FUEL_LOAD_COUNT, testMafValue);
|
||||
|
@ -1040,7 +1040,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
assertEqualsM("Lduty for maf=3", 87.5, getInjectorDutyCycle(engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
|
||||
|
||||
assertEqualsM("Lqs#1", 4, engine->executor.size());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#1";
|
||||
eth.moveTimeForwardUs(MS2US(20));
|
||||
eth.executeActions();
|
||||
|
||||
|
@ -1052,7 +1052,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
// time...|0.......|10......|20......|30......|40......|50......|60......|
|
||||
// inj #0 |########|########|########|.....###|########|........|........|
|
||||
// inj #1 |..######|########|....####|########|........|........|........|
|
||||
assertEqualsM("Lqs#4", 6, engine->executor.size());
|
||||
ASSERT_EQ( 6, engine->executor.size()) << "Lqs#4";
|
||||
eth.assertInjectorUpEvent("L04@0", 0, MS2US(8.5), 0);
|
||||
eth.assertInjectorUpEvent("L04@1", 1, MS2US(12.5), 0);
|
||||
// special overlapping injection is merged with one of the scheduled injections
|
||||
|
@ -1078,7 +1078,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
|
||||
eth.fireFall(20);
|
||||
|
||||
assertEqualsM("Lqs#04", 6, engine->executor.size());
|
||||
ASSERT_EQ( 6, engine->executor.size()) << "Lqs#04";
|
||||
eth.assertInjectorUpEvent("L015@0", 0, MS2US(-1.5), 1);
|
||||
eth.assertInjectorUpEvent("L015@1", 1, MS2US(2.5), 1);
|
||||
eth.assertInjectorDownEvent("L015@2", 2, MS2US(6), 0);
|
||||
|
@ -1094,19 +1094,19 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
|
||||
eth.moveTimeForwardUs(MS2US(20));
|
||||
eth.executeActions();
|
||||
assertEqualsM("Lqs#04", 0, engine->executor.size());
|
||||
ASSERT_EQ( 0, engine->executor.size()) << "Lqs#04";
|
||||
|
||||
setArrayValues(fuelMap.pointers[engineLoadIndex], FUEL_RPM_COUNT, 4);
|
||||
setArrayValues(fuelMap.pointers[engineLoadIndex + 1], FUEL_RPM_COUNT, 4);
|
||||
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("Lfuel#4", 2, engine->injectionDuration);
|
||||
assertEqualsM("Lduty for maf=3", 10, getInjectorDutyCycle(eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
ASSERT_EQ( 2, engine->injectionDuration) << "Lfuel#4";
|
||||
ASSERT_EQ( 10, getInjectorDutyCycle(eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE) PASS_ENGINE_PARAMETER_SUFFIX)) << "Lduty for maf=3";
|
||||
|
||||
|
||||
eth.firePrimaryTriggerRise();
|
||||
|
||||
//todoassertEqualsM("Lqs#05", 5, engine->executor.size());
|
||||
//todoASSERT_EQ( 5, engine->executor.size()) << "Lqs#05";
|
||||
//todo assertInjectorUpEvent("L016@0", 0, MS2US(8), 0);
|
||||
//todo assertInjectorDownEvent("L016@1", 1, MS2US(10), 0);
|
||||
//todo assertInjectorDownEvent("L016@2", 2, MS2US(10), 0);
|
||||
|
@ -1121,7 +1121,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
eth.executeActions();
|
||||
eth.firePrimaryTriggerRise();
|
||||
|
||||
assertEqualsM("Lqs#5", 4, engine->executor.size());
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#5";
|
||||
eth.assertInjectorUpEvent("L05@0", 0, MS2US(8), 0);
|
||||
eth.assertInjectorDownEvent("L05@1", 1, MS2US(10), 0);
|
||||
eth.assertInjectorUpEvent("L05@2", 2, MS2US(18), 1);
|
||||
|
@ -1129,7 +1129,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
|
||||
eth.moveTimeForwardUs(MS2US(20));
|
||||
eth.executeActions();
|
||||
assertEqualsM("warningCounter#testFuelSchedulerBug299smallAndLarge", 2, unitTestWarningCodeState.recentWarnings.getCount());
|
||||
ASSERT_EQ( 2, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testFuelSchedulerBug299smallAndLarge";
|
||||
ASSERT_EQ(CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0));
|
||||
ASSERT_EQ(CUSTOM_OBD_SKIPPED_FUEL, unitTestWarningCodeState.recentWarnings.get(1));
|
||||
}
|
||||
|
@ -1150,7 +1150,7 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
// this is needed to update injectorLag
|
||||
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
assertEqualsM("CLT", 70, engine->sensors.clt);
|
||||
ASSERT_NEAR( 70, engine->sensors.clt, EPS4D) << "CLT";
|
||||
|
||||
engineConfiguration->trigger.type = TT_ONE;
|
||||
incrementGlobalConfigurationVersion(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
@ -1168,10 +1168,10 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
eth.fireRise(20);
|
||||
eth.fireFall(20);
|
||||
|
||||
assertEqualsM("testSparkReverseOrderBug319: RPM", 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "testSparkReverseOrderBug319: RPM";
|
||||
|
||||
|
||||
assertEqualsM("testSparkReverseOrderBug319: queue size", 7, engine->executor.size());
|
||||
ASSERT_EQ( 7, engine->executor.size()) << "testSparkReverseOrderBug319: queue size";
|
||||
eth.executeActions();
|
||||
printf("***************************************************\r\n");
|
||||
|
||||
|
@ -1185,13 +1185,13 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
eth.fireFall(0.1); // executing new signal too early
|
||||
eth.executeActions();
|
||||
|
||||
assertEqualsM("out-of-order #1", 1, enginePins.coils[3].outOfOrder);
|
||||
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #1";
|
||||
|
||||
|
||||
eth.moveTimeForwardUs(MS2US(200)); // moving time forward to execute all pending actions
|
||||
eth.executeActions();
|
||||
|
||||
assertEqualsM("out-of-order #2", 0, enginePins.coils[3].outOfOrder);
|
||||
ASSERT_EQ( 0, enginePins.coils[3].outOfOrder) << "out-of-order #2";
|
||||
|
||||
printf("*************************************************** now let's have a good engine cycle and confirm things work\r\n");
|
||||
|
||||
|
@ -1199,43 +1199,43 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
eth.fireRise(20);
|
||||
eth.executeActions();
|
||||
|
||||
assertEqualsM("RPM#2", 545, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 545, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#2";
|
||||
|
||||
assertEqualsM("out-of-order #3", 0, enginePins.coils[3].outOfOrder);
|
||||
ASSERT_EQ( 0, enginePins.coils[3].outOfOrder) << "out-of-order #3";
|
||||
|
||||
|
||||
eth.fireFall(20);
|
||||
eth.executeActions();
|
||||
assertEqualsM("out-of-order #4", 1, enginePins.coils[3].outOfOrder);
|
||||
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #4";
|
||||
|
||||
printf("*************************************************** (rpm is back) now let's have a good engine cycle and confirm things work\r\n");
|
||||
|
||||
eth.fireRise(20);
|
||||
eth.executeActions();
|
||||
|
||||
assertEqualsM("RPM#3", 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#3";
|
||||
|
||||
assertEqualsM("out-of-order #5 on c4", 1, enginePins.coils[3].outOfOrder);
|
||||
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #5 on c4";
|
||||
|
||||
|
||||
eth.fireFall(20);
|
||||
eth.executeActions();
|
||||
assertEqualsM("out-of-order #6 on c4", 1, enginePins.coils[3].outOfOrder);
|
||||
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #6 on c4";
|
||||
|
||||
printf("*************************************************** (rpm is back 2) now let's have a good engine cycle and confirm things work\r\n");
|
||||
|
||||
eth.fireRise(20);
|
||||
eth.executeActions();
|
||||
|
||||
assertEqualsM("RPM#4", 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 3000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM#4";
|
||||
|
||||
assertEqualsM("out-of-order #7", 1, enginePins.coils[3].outOfOrder);
|
||||
ASSERT_EQ( 1, enginePins.coils[3].outOfOrder) << "out-of-order #7";
|
||||
|
||||
|
||||
eth.fireFall(20);
|
||||
eth.executeActions();
|
||||
assertEqualsM("out-of-order #8", 0, enginePins.coils[3].outOfOrder);
|
||||
assertEqualsM("warningCounter#SparkReverseOrderBug319", 3, unitTestWarningCodeState.recentWarnings.getCount());
|
||||
ASSERT_EQ( 0, enginePins.coils[3].outOfOrder) << "out-of-order #8";
|
||||
ASSERT_EQ( 3, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#SparkReverseOrderBug319";
|
||||
ASSERT_EQ(CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0));
|
||||
ASSERT_EQ(CUSTOM_DWELL_TOO_LONG, unitTestWarningCodeState.recentWarnings.get(1));
|
||||
ASSERT_EQ(CUSTOM_OUT_OF_ORDER_COIL, unitTestWarningCodeState.recentWarnings.get(2));
|
||||
|
@ -1252,27 +1252,27 @@ TEST(big, testMissedSpark299) {
|
|||
engineConfiguration->isIgnitionEnabled = true;
|
||||
engineConfiguration->isInjectionEnabled = false;
|
||||
|
||||
assertEqualsM("warningCounter#0", 0, unitTestWarningCodeState.recentWarnings.getCount());
|
||||
ASSERT_EQ( 0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#0";
|
||||
|
||||
|
||||
eth.fireRise(20);
|
||||
eth.executeActions();
|
||||
assertEqualsM("ci#0", 0, eth.engine.triggerCentral.triggerState.currentCycle.current_index);
|
||||
ASSERT_EQ( 0, eth.engine.triggerCentral.triggerState.currentCycle.current_index) << "ci#0";
|
||||
|
||||
|
||||
eth.fireFall(20);
|
||||
eth.executeActions();
|
||||
assertEqualsM("ci#1", 1, eth.engine.triggerCentral.triggerState.currentCycle.current_index);
|
||||
ASSERT_EQ( 1, eth.engine.triggerCentral.triggerState.currentCycle.current_index) << "ci#1";
|
||||
|
||||
|
||||
eth.fireRise(20);
|
||||
eth.executeActions();
|
||||
assertEqualsM("ci#2", 0, eth.engine.triggerCentral.triggerState.currentCycle.current_index);
|
||||
ASSERT_EQ( 0, eth.engine.triggerCentral.triggerState.currentCycle.current_index) << "ci#2";
|
||||
|
||||
|
||||
eth.fireFall(20);
|
||||
eth.executeActions();
|
||||
assertEqualsM("ci#3", 1, eth.engine.triggerCentral.triggerState.currentCycle.current_index);
|
||||
ASSERT_EQ( 1, eth.engine.triggerCentral.triggerState.currentCycle.current_index) << "ci#3";
|
||||
|
||||
|
||||
eth.fireRise(20);
|
||||
|
@ -1281,7 +1281,7 @@ TEST(big, testMissedSpark299) {
|
|||
|
||||
eth.fireFall(20);
|
||||
eth.executeActions();
|
||||
assertEqualsM("ci#5", 1, eth.engine.triggerCentral.triggerState.currentCycle.current_index);
|
||||
ASSERT_EQ( 1, eth.engine.triggerCentral.triggerState.currentCycle.current_index) << "ci#5";
|
||||
|
||||
|
||||
printf("*************************************************** testMissedSpark299 start\r\n");
|
||||
|
@ -1322,6 +1322,6 @@ TEST(big, testMissedSpark299) {
|
|||
eth.fireFall(20);
|
||||
eth.executeActions();
|
||||
|
||||
assertEqualsM("warningCounter#1", 1, unitTestWarningCodeState.recentWarnings.getCount());
|
||||
ASSERT_EQ( 1, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#1";
|
||||
assertEqualsM("warningCounter code", CUSTOM_SYNC_COUNT_MISMATCH, unitTestWarningCodeState.recentWarnings.get(0));
|
||||
}
|
||||
|
|
|
@ -102,11 +102,11 @@ static void testNoiselessDecoderProcedure(EngineTestHelper ð, int errorTolera
|
|||
fireNoisyCycle60_2(ð, 2, 1000, -1, 0, 0, 0);
|
||||
|
||||
// should be no errors anyway
|
||||
assertEqualsM("testNoiselessDecoderProcedure totalTriggerErrorCounter", 0, engine->triggerCentral.triggerState.totalTriggerErrorCounter);
|
||||
ASSERT_EQ( 0, engine->triggerCentral.triggerState.totalTriggerErrorCounter) << "testNoiselessDecoderProcedure totalTriggerErrorCounter";
|
||||
// check if we're imitating the 60-2 signal correctly
|
||||
assertEqualsM("index #1", 0, eth.engine.triggerCentral.triggerState.getCurrentIndex());
|
||||
ASSERT_EQ( 0, eth.engine.triggerCentral.triggerState.getCurrentIndex()) << "index #1";
|
||||
// check rpm (60secs / (1000us * 60teeth)) = 1000rpm
|
||||
assertEqualsM("testNoiselessDecoder RPM", 1000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 1000, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "testNoiselessDecoder RPM";
|
||||
|
||||
// add noise1 - 1 spike in the middle of the 2nd rising pulse
|
||||
fireNoisyCycle60_2(ð, 2, 1000, 2, 10, 500, 1);
|
||||
|
@ -163,7 +163,7 @@ static void testNoiselessDecoderProcedure(EngineTestHelper ð, int errorTolera
|
|||
// alas, this is a hard case even for noiseless decoder, and it fails...
|
||||
// but still we're close to 33% signal-noise ratio threshold - not bad!
|
||||
// so here's an error anyway!
|
||||
assertEqualsM("testNoiselessDecoder noise#7_fail_test", 1, engine->triggerCentral.triggerState.totalTriggerErrorCounter);
|
||||
ASSERT_EQ( 1, engine->triggerCentral.triggerState.totalTriggerErrorCounter) << "testNoiselessDecoder noise#7_fail_test";
|
||||
|
||||
}
|
||||
|
||||
|
@ -183,7 +183,7 @@ TEST(big, testNoiselessDecoder) {
|
|||
eth.applyTriggerShape();
|
||||
|
||||
ASSERT_EQ(0, engine->triggerCentral.triggerState.totalTriggerErrorCounter);
|
||||
assertEqualsM("testNoiselessDecoder RPM", 0, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||
ASSERT_EQ( 0, eth.engine.rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "testNoiselessDecoder RPM";
|
||||
|
||||
//printTriggerDebug = true;
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ TEST(util, crc) {
|
|||
|
||||
const char * A = "A";
|
||||
|
||||
assertEqualsM("crc8", 168, calc_crc((const crc_t *) A, 1));
|
||||
ASSERT_EQ( 168, calc_crc((const crc_t *) A, 1)) << "crc8";
|
||||
uint32_t c = crc32(A, 1);
|
||||
printf("crc32(A)=%x\r\n", c);
|
||||
assertEqualsM("crc32 1", 0xd3d99e8b, c);
|
||||
|
@ -94,7 +94,7 @@ TEST(util, cyclicBuffer) {
|
|||
|
||||
ASSERT_EQ(4, sb.maxValue(3));
|
||||
ASSERT_EQ(4, sb.maxValue(113));
|
||||
assertEqualsM("minValue(3)", 2, sb.minValue(3));
|
||||
ASSERT_EQ( 2, sb.minValue(3)) << "minValue(3)";
|
||||
ASSERT_EQ(1, sb.minValue(113));
|
||||
}
|
||||
|
||||
|
@ -202,7 +202,7 @@ TEST(misc, testMalfunctionCentral) {
|
|||
addError(code);
|
||||
|
||||
getErrorCodes(&localCopy);
|
||||
assertEqualsM("count #1", 1, localCopy.count);
|
||||
ASSERT_EQ( 1, localCopy.count) << "count #1";
|
||||
ASSERT_EQ(code, localCopy.error_codes[0]);
|
||||
|
||||
// let's remove value which is not in the collection
|
||||
|
@ -263,46 +263,46 @@ TEST(misc, testGpsParser) {
|
|||
// we need to pass a mutable string, not a constant because the parser would be modifying the string
|
||||
strcpy(nmeaMessage, "$GPRMC,173843,A,3349.896,N,11808.521,W,000.0,360.0,230108,013.4,E*69");
|
||||
gps_location(&GPSdata, nmeaMessage);
|
||||
assertEqualsM("1 valid", 4, GPSdata.quality);
|
||||
ASSERT_EQ( 4, GPSdata.quality) << "1 valid";
|
||||
assertEqualsM("1 latitude", 3349.896, GPSdata.latitude);
|
||||
assertEqualsM("1 longitude", 11808.521, GPSdata.longitude);
|
||||
assertEqualsM("1 speed", 0, GPSdata.speed);
|
||||
// assertEqualsM("1 altitude", 0, GPSdata.altitude); // GPRMC not overwrite altitude
|
||||
assertEqualsM("1 course", 360, GPSdata.course);
|
||||
ASSERT_EQ( 0, GPSdata.speed) << "1 speed";
|
||||
// ASSERT_EQ( 0, GPSdata.altitude) << "1 altitude"; // GPRMC not overwrite altitude
|
||||
ASSERT_EQ( 360, GPSdata.course) << "1 course";
|
||||
|
||||
strcpy(nmeaMessage, "$GPGGA,111609.14,5001.27,N,3613.06,E,3,08,0.0,10.2,M,0.0,M,0.0,0000*70");
|
||||
gps_location(&GPSdata, nmeaMessage);
|
||||
assertEqualsM("2 valid", 3, GPSdata.quality); // see field details
|
||||
ASSERT_EQ( 3, GPSdata.quality) << "2 valid"; // see field details
|
||||
assertEqualsM("2 latitude", 50.0212, GPSdata.latitude);
|
||||
assertEqualsM("2 longitude", 36.2177, GPSdata.longitude);
|
||||
assertEqualsM("2 speed", 0, GPSdata.speed);
|
||||
ASSERT_EQ( 0, GPSdata.speed) << "2 speed";
|
||||
assertEqualsM("2 altitude", 10.2, GPSdata.altitude);
|
||||
// assertEqualsM("2 course", 0, GPSdata.course); // GPGGA not overwrite course
|
||||
// ASSERT_EQ( 0, GPSdata.course) << "2 course"; // GPGGA not overwrite course
|
||||
|
||||
strcpy(nmeaMessage, "$GPRMC,111609.14,A,5001.27,N,3613.06,E,11.2,0.0,261206,0.0,E*50");
|
||||
gps_location(&GPSdata, nmeaMessage);
|
||||
assertEqualsM("3 valid", 4, GPSdata.quality);
|
||||
ASSERT_EQ( 4, GPSdata.quality) << "3 valid";
|
||||
assertEqualsM("3 latitude", 5001.27, GPSdata.latitude);
|
||||
assertEqualsM("3 longitude", 3613.06, GPSdata.longitude);
|
||||
assertEqualsM("3 speed", 11.2, GPSdata.speed);
|
||||
// assertEqualsM("3 altitude", 0, GPSdata.altitude); // GPRMC not overwrite altitude
|
||||
assertEqualsM("3 course", 0, GPSdata.course);
|
||||
assertEqualsM("3 GPS yy", 2006, GPSdata.GPStm.tm_year + 1900);
|
||||
assertEqualsM("3 GPS mm", 12, GPSdata.GPStm.tm_mon);
|
||||
assertEqualsM("3 GPS yy", 26, GPSdata.GPStm.tm_mday);
|
||||
assertEqualsM("3 GPS hh", 11, GPSdata.GPStm.tm_hour);
|
||||
assertEqualsM("3 GPS mm", 16, GPSdata.GPStm.tm_min);
|
||||
assertEqualsM("3 GPS ss", 9, GPSdata.GPStm.tm_sec);
|
||||
// ASSERT_EQ( 0, GPSdata.altitude) << "3 altitude"; // GPRMC not overwrite altitude
|
||||
ASSERT_EQ( 0, GPSdata.course) << "3 course";
|
||||
ASSERT_EQ( 2006, GPSdata.GPStm.tm_year + 1900) << "3 GPS yy";
|
||||
ASSERT_EQ( 12, GPSdata.GPStm.tm_mon) << "3 GPS mm";
|
||||
ASSERT_EQ( 26, GPSdata.GPStm.tm_mday) << "3 GPS yy";
|
||||
ASSERT_EQ( 11, GPSdata.GPStm.tm_hour) << "3 GPS hh";
|
||||
ASSERT_EQ( 16, GPSdata.GPStm.tm_min) << "3 GPS mm";
|
||||
ASSERT_EQ( 9, GPSdata.GPStm.tm_sec) << "3 GPS ss";
|
||||
|
||||
// check again first one
|
||||
// we need to pass a mutable string, not a constant because the parser would be modifying the string
|
||||
strcpy(nmeaMessage, "$GPRMC,173843,A,3349.896,N,11808.521,W,000.0,360.0,230108,013.4,E*69");
|
||||
gps_location(&GPSdata, nmeaMessage);
|
||||
assertEqualsM("4 valid", 4, GPSdata.quality);
|
||||
ASSERT_EQ( 4, GPSdata.quality) << "4 valid";
|
||||
assertEqualsM("4 latitude", 3349.896, GPSdata.latitude);
|
||||
assertEqualsM("4 longitude", 11808.521, GPSdata.longitude);
|
||||
assertEqualsM("4 speed", 0, GPSdata.speed);
|
||||
assertEqualsM("4 course", 360, GPSdata.course);
|
||||
ASSERT_EQ( 0, GPSdata.speed) << "4 speed";
|
||||
ASSERT_EQ( 360, GPSdata.course) << "4 course";
|
||||
}
|
||||
|
||||
// this buffer is needed because on Unix you would not be able to change static char constants
|
||||
|
|
Loading…
Reference in New Issue