only: reducing magic numbers in unit tests
This commit is contained in:
parent
b335244601
commit
928f6f2866
|
@ -22,7 +22,7 @@ void setGy6139qmbDefaultEngineConfiguration() {
|
|||
engineConfiguration->cranking.rpm = 1100;
|
||||
setTargetRpmCurve(2000);
|
||||
engineConfiguration->analogInputDividerCoefficient = 1;
|
||||
engineConfiguration->globalTriggerAngleOffset = 45;
|
||||
engineConfiguration->globalTriggerAngleOffset = Gy6139_globalTriggerAngleOffset;
|
||||
engineConfiguration->displacement = 0.072; // 72cc
|
||||
engineConfiguration->cylindersCount = 1;
|
||||
setCrankOperationMode();
|
||||
|
|
|
@ -9,5 +9,8 @@
|
|||
#pragma once
|
||||
#include "engine_configuration.h"
|
||||
|
||||
// used by unit tests
|
||||
#define Gy6139_globalTriggerAngleOffset 45
|
||||
|
||||
void setGy6139qmbDefaultEngineConfiguration();
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ void setDefaultCranking() {
|
|||
engineConfiguration->cranking.baseFuel = 27;
|
||||
|
||||
// Ignition
|
||||
engineConfiguration->ignitionDwellForCrankingMs = 6;
|
||||
engineConfiguration->ignitionDwellForCrankingMs = DEFAULT_CRANKING_DWELL_MS;
|
||||
engineConfiguration->crankingTimingAngle = 6;
|
||||
|
||||
// IAC
|
||||
|
|
|
@ -11,6 +11,8 @@ void setGDIFueling();
|
|||
void setGdiWallWetting();
|
||||
void setInline4();
|
||||
|
||||
#define DEFAULT_CRANKING_DWELL_MS 6
|
||||
|
||||
void setPPSInputs(adc_channel_e pps1, adc_channel_e pps2);
|
||||
void setPPSCalibration(float primaryUp, float primaryDown, float secondaryUp, float secondaryDown);
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include "pch.h"
|
||||
#include "spark_logic.h"
|
||||
#include "GY6_139QMB.h"
|
||||
#include "defaults.h"
|
||||
|
||||
TEST(issues, issueOneCylinderSpecialCase968) {
|
||||
EngineTestHelper eth(engine_type_e::GY6_139QMB);
|
||||
|
@ -21,15 +23,16 @@ TEST(issues, issueOneCylinderSpecialCase968) {
|
|||
ASSERT_EQ( 0, engine->executor.size()) << "start";
|
||||
|
||||
eth.fireTriggerEvents2(/* count */ 2, 50 /* ms */);
|
||||
ASSERT_EQ( 0, Sensor::getOrZero(SensorType::Rpm)) << "RPM";
|
||||
eth.assertRpm(0);
|
||||
ASSERT_EQ( 0, engine->executor.size()) << "first revolution(s)";
|
||||
|
||||
eth.fireTriggerEvents2(/* count */ 1, 50 /* ms */);
|
||||
ASSERT_EQ(600, Sensor::getOrZero(SensorType::Rpm)) << "RPM";
|
||||
eth.assertRpm(600, "RPM");
|
||||
ASSERT_EQ(engine->triggerCentral.currentEngineDecodedPhase, 90 + Gy6139_globalTriggerAngleOffset);
|
||||
|
||||
ASSERT_EQ( 2, engine->executor.size()) << "first revolution(s)";
|
||||
eth.assertEvent5("spark up#0", 0, (void*)turnSparkPinHigh, -45167);
|
||||
eth.assertEvent5("spark down#0", 1, (void*)fireSparkAndPrepareNextSchedule, -39167);
|
||||
eth.assertEvent5("spark down#0", 1, (void*)fireSparkAndPrepareNextSchedule, -45167 + 1000 * DEFAULT_CRANKING_DWELL_MS);
|
||||
|
||||
|
||||
eth.fireTriggerEvents2(/* count */ 1, 50 /* ms */);
|
||||
|
|
|
@ -23,7 +23,7 @@ TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
|
|||
|
||||
|
||||
eth.fireRise(/* delayMs */ 200);
|
||||
ASSERT_EQ( 300, Sensor::getOrZero(SensorType::Rpm)) << "RPM#2";
|
||||
eth.assertRpm(300, "RPM#2");
|
||||
// two simultaneous injections
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "plain#2";
|
||||
|
||||
|
|
Loading…
Reference in New Issue