Programmatically remove EnginePtr/inject, EXPAND_Engine, and WITH_ENGINE_TEST_HELPER* (#3560)

* Programmatically remove EnginePtr/inject, EXPAND_Engine, and WITH_ENGINE_TEST_HELPER*

for i in ": public EnginePtr " ", public EnginePtr" "EXPAND_Engine;" "EXPAND_Engine"; do
    git grep -l "$i" | xargs sed -i "s/$i//g"
done

git grep -l "inject" | xargs sed -i "/inject[(][)]/d"

for i in WITH_ENGINE_TEST_HELPER_SENS WITH_ENGINE_TEST_HELPER_BOARD_CALLBACK WITH_ENGINE_TEST_HELPER; do
    git grep -l "$i" | xargs sed -i "s/$i/EngineTestHelper eth/g"
done

git checkout firmware/controllers/core/engine_ptr.h
git checkout unit_tests/global.h

* Review fixups.
This commit is contained in:
Scott Smith 2021-11-16 13:52:11 -08:00 committed by GitHub
parent 17d4646dce
commit cc95bd6c8e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
108 changed files with 212 additions and 333 deletions

View File

@ -12,7 +12,7 @@
struct IPwm;
class BoostController : public ClosedLoopController<float, percent_t>, public EnginePtr {
class BoostController : public ClosedLoopController<float, percent_t> {
public:
void init(IPwm* pmw, const ValueProvider3D* openLoopMap, const ValueProvider3D* closedLoopTargetMap, pid_s* pidParams);
void update();

View File

@ -956,7 +956,6 @@ void doInitElectronicThrottle() {
auto pid = getEtbPidForFunction(func);
anyEtbConfigured |= controller->init(func, motor, pid, &pedal2tpsMap, shouldInitThrottles);
engine->etbControllers[i]->inject();
}
}

View File

@ -43,7 +43,7 @@ struct pid_s;
class ValueProvider3D;
struct pid_state_s;
class IEtbController : public ClosedLoopController<percent_t, percent_t>, public EnginePtr {
class IEtbController : public ClosedLoopController<percent_t, percent_t> {
public:
// Initialize the throttle.
// returns true if the throttle was initialized, false otherwise.

View File

@ -42,7 +42,6 @@ void initGpPwm() {
tables[i]->init(cfg.table, cfg.loadBins, cfg.rpmBins);
// Finally configure the channel
channels[i].inject();
channels[i].init(usePwm, &outputs[i], &pins[i], tables[i], &cfg);
}
}

View File

@ -9,7 +9,7 @@ class OutputPin;
struct IPwm;
class ValueProvider3D;
class GppwmChannel : public EnginePtr {
class GppwmChannel {
public:
void init(bool usePwm, IPwm* pwm, OutputPin* outputPin, const ValueProvider3D* table, const gppwm_channel* config);
float update();

View File

@ -566,9 +566,7 @@ void startIdleBench(void) {
#endif /* EFI_UNIT_TEST */
void startIdleThread() {
idleControllerInstance.inject();
idleControllerInstance.init(&CONFIG(idleTimingPid));
industrialWithOverrideIdlePid.inject();
ENGINE(idleController) = &idleControllerInstance;

View File

@ -31,7 +31,7 @@ struct IIdleController {
virtual float getCrankingTaperFraction() const = 0;
};
class IdleController : public IIdleController, public EnginePtr {
class IdleController : public IIdleController {
public:
void init(pid_s* idlePidConfig);

View File

@ -140,7 +140,6 @@ void initAuxPid() {
config->vvtTable2RpmBins);
for (int i = 0;i < CAM_INPUTS_COUNT;i++) {
instances[i].inject();
int camIndex = i % CAMS_PER_BANK;
int bankIndex = i / CAMS_PER_BANK;

View File

@ -19,7 +19,7 @@ void initAuxPid();
void startVvtControlPins();
void stopVvtControlPins();
class VvtController : public PeriodicTimerController, public ClosedLoopController<angle_t, percent_t>, public EnginePtr {
class VvtController : public PeriodicTimerController, public ClosedLoopController<angle_t, percent_t> {
public:
void init(int index, int bankIndex, int camIndex, const ValueProvider3D* targetMap);

View File

@ -11,7 +11,7 @@ struct AirmassModelBase {
virtual AirmassResult getAirmass(int rpm) = 0;
};
class AirmassVeModelBase : public AirmassModelBase, public EnginePtr {
class AirmassVeModelBase : public AirmassModelBase {
public:
explicit AirmassVeModelBase(const ValueProvider3D& veTable);

View File

@ -146,7 +146,6 @@ int getDynoviewPower() {
void updateDynoView() {
if (isBrainPinValid(CONFIG(vehicleSpeedSensorInputPin)) &&
(!CONFIG(enableCanVss))) {
dynoInstance.inject();
dynoInstance.update(ICU);
}
}

View File

@ -19,7 +19,7 @@ typedef enum{
CAN,
}vssSrc;
class DynoView : public EnginePtr {
class DynoView {
public:
// Update the state of the launch control system
void update(vssSrc src);

View File

@ -130,7 +130,6 @@ static void initVvtShape(int camIndex, TriggerState &initState) {
void Engine::initializeTriggerWaveform() {
static TriggerState initState;
initState.inject();
// Re-read config in case it's changed
primaryTriggerConfiguration.update();
@ -463,23 +462,13 @@ void Engine::OnTriggerSyncronization(bool wasSynchronized) {
#endif
void Engine::injectEngineReferences() {
triggerCentral.inject();
primaryTriggerConfiguration.inject();
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
vvtTriggerConfiguration[camIndex].inject();
}
limpManager.inject();
knockController.inject();
primaryTriggerConfiguration.update();
for (int camIndex = 0;camIndex < CAMS_PER_BANK;camIndex++) {
vvtTriggerConfiguration[camIndex].update();
}
triggerCentral.init();
}
void Engine::setConfig() {
inject();
efi::clear(config);
injectEngineReferences();

View File

@ -87,7 +87,7 @@ protected:
#define DEFAULT_MOCK_SPEED -1
class Engine final : public TriggerStateListener, public EnginePtr {
class Engine final : public TriggerStateListener {
public:
Engine();
AcState acState;

View File

@ -19,7 +19,7 @@
class Engine;
class InjectionEvent : public EnginePtr {
class InjectionEvent {
public:
InjectionEvent();
@ -92,7 +92,7 @@ public:
#define MAX_OUTPUTS_FOR_IGNITION 2
class IgnitionEvent : public EnginePtr {
class IgnitionEvent {
public:
IgnitionEvent();
IgnitionOutputPin *outputs[MAX_OUTPUTS_FOR_IGNITION];
@ -139,7 +139,7 @@ public:
bool isReady = false;
};
class AuxActor : public EnginePtr {
class AuxActor {
public:
int phaseIndex;
int valveIndex;

View File

@ -9,7 +9,7 @@ struct IFuelComputer {
};
// This contains the math of the fuel model, but doesn't actually read any configuration
class FuelComputerBase : public IFuelComputer, public EnginePtr {
class FuelComputerBase : public IFuelComputer {
public:
mass_t getCycleFuel(mass_t airmass, int rpm, float load) const override;

View File

@ -27,7 +27,7 @@ private:
float m_massFlowRate = 0;
};
class InjectorModel : public InjectorModelBase, public EnginePtr {
class InjectorModel : public InjectorModelBase {
public:
void postState(float deadtime) const override;
floatms_t getDeadtime() const override;

View File

@ -305,12 +305,7 @@ static InjectorModel injectorModel;
* is to prepare the fuel map data structure for 3d interpolation
*/
void initFuelMap() {
sdAirmass.inject();
mafAirmass.inject();
alphaNAirmass.inject();
fuelComputer.inject();
injectorModel.inject();
ENGINE(fuelComputer) = &fuelComputer;
ENGINE(injectorModel) = &injectorModel;

View File

@ -155,7 +155,6 @@ bool SoftSparkLimiter::shouldSkip() {
}
void initLaunchControl() {
engine->launchController.inject();
}
#endif /* EFI_LAUNCH_CONTROL */

View File

@ -12,7 +12,7 @@
void initLaunchControl();
class LaunchControlBase : public EnginePtr {
class LaunchControlBase {
public:
// Update the state of the launch control system
void update();

View File

@ -85,5 +85,4 @@ void ButtonShiftController::update() {
void initButtonShift() {
buttonShiftController.init();
engine->gearController = &buttonShiftController;
buttonShiftController.inject();
}

View File

@ -71,7 +71,6 @@ void initAuxValves() {
actor->valveIndex = valveIndex;
actor->extra = phaseIndex * 360 + valveIndex * 180;
actor->inject();
scheduleOpen(actor);
}
}

View File

@ -96,7 +96,6 @@ bool FuelSchedule::addFuelEventsForCylinder(int i ) {
bool isSimultanious = mode == IM_SIMULTANEOUS;
InjectionEvent *ev = &elements[i];
ev->inject();
ev->ownIndex = i;
ev->outputs[0] = output;

View File

@ -11,7 +11,7 @@
int getCylinderKnockBank(uint8_t cylinderIndex);
class KnockController : public EnginePtr {
class KnockController {
public:
// onKnockSenseCompleted is the callback from the knock sense driver to report a sensed knock level
bool onKnockSenseCompleted(uint8_t cylinderIndex, float dbv, efitick_t lastKnockTime);

View File

@ -99,7 +99,6 @@ void InjectorOutputPin::open(efitick_t nowNt) {
#if EFI_TOOTH_LOGGER
LogTriggerInjectorState(nowNt, true);
#endif // EFI_TOOTH_LOGGER
this->inject();
setHigh();
}
}
@ -441,7 +440,6 @@ static bool isPrimeInjectionPulseSkipped() {
* See testStartOfCrankingPrimingPulse()
*/
void startPrimeInjectionPulse() {
engine->primeInjEvent.inject();
// First, we need a protection against 'fake' ignition switch on and off (i.e. no engine started), to avoid repeated prime pulses.
// So we check and update the ignition switch counter in non-volatile backup-RAM

View File

@ -275,9 +275,6 @@ void mapAveragingTriggerCallback(
scheduling_s *starTimer = &startTimers[i][structIndex];
scheduling_s *endTimer = &endTimers[i][structIndex];
mapAveragingPin.inject();
starTimer->inject();
endTimer->inject();
// at the moment we schedule based on time prediction based on current RPM and angle
// we are loosing precision in case of changing RPM - the further away is the event the worse is precision

View File

@ -364,7 +364,6 @@ float getCrankshaftAngleNt(efitick_t timeNt) {
}
void initRpmCalculator() {
ENGINE(rpmCalculator).inject();
#if ! HW_CHECK_MODE
if (hasFirmwareError()) {

View File

@ -42,7 +42,7 @@ typedef enum {
RUNNING,
} spinning_state_e;
class RpmCalculator : public StoredValueSensor, public EnginePtr {
class RpmCalculator : public StoredValueSensor {
public:
#if !EFI_PROD_CODE
int mockRpm;

View File

@ -251,7 +251,6 @@ static void startDwellByTurningSparkPinHigh(IgnitionEvent *event, IgnitionOutput
}
}
output->inject();
output->setHigh();
}
@ -273,7 +272,6 @@ void turnSparkPinHigh(IgnitionEvent *event) {
if (CONFIG(enableTrailingSparks)) {
IgnitionOutputPin *output = &enginePins.trailingCoils[event->cylinderNumber];
output->inject();
// Trailing sparks are enabled - schedule an event for the corresponding trailing coil
scheduleByAngle(
&event->trailingSparkCharge, nowNt, ENGINE(engineState.trailingSparkAngle),

View File

@ -3,7 +3,6 @@
#include "gear_controller.h"
void GearControllerBase::init() {
transmissionController.inject();
transmissionController.init();
}

View File

@ -7,7 +7,7 @@
#include "globalaccess.h"
#include "simple_tcu.h"
class GearControllerBase : public EnginePtr {
class GearControllerBase {
public:
virtual void update();
gear_e getDesiredGear() const;

View File

@ -23,7 +23,7 @@ private:
bool m_value = true;
};
class LimpManager : public EnginePtr {
class LimpManager {
public:
// This is called from periodicFastCallback to update internal state
void updateState(int rpm, efitick_t nowNt);

View File

@ -5,7 +5,7 @@
#include "pch.h"
#include "sensor_converter_func.h"
class TurbochargerSpeedConverter : public SensorConverter, public EnginePtr {
class TurbochargerSpeedConverter : public SensorConverter {
public:
SensorResult convert(float frequency) const override {
auto hz = frequency * engineConfiguration->turboSpeedSensorMultiplier;

View File

@ -1,7 +1,7 @@
#include "pch.h"
#include "sensor_converter_func.h"
class VehicleSpeedConverter : public SensorConverter, public EnginePtr {
class VehicleSpeedConverter : public SensorConverter {
public:
SensorResult convert(float frequency) const override {
auto speed = frequency * engineConfiguration->vehicleSpeedCoef;

View File

@ -2,7 +2,7 @@
#include "tcu.h"
class SimpleTransmissionController: public TransmissionControllerBase, public EnginePtr {
class SimpleTransmissionController: public TransmissionControllerBase {
public:
void update(gear_e);
void init();

View File

@ -89,7 +89,7 @@ private:
/**
* OutputPin which is reported on Engine Sniffer
*/
class NamedOutputPin : public virtual OutputPin, public EnginePtr {
class NamedOutputPin : public virtual OutputPin {
public:
NamedOutputPin();
explicit NamedOutputPin(const char *name);
@ -155,7 +155,7 @@ public:
RegisteredNamedOutputPin(const char *name, short pinOffset, short pinModeOffset);
};
class EnginePins : public EnginePtr {
class EnginePins {
public:
EnginePins();
void startPins();

View File

@ -39,7 +39,7 @@ private:
* This structure holds information about an event scheduled in the future: when to execute what callback with what parameters
*/
#pragma pack(push, 4)
struct scheduling_s : public EnginePtr {
struct scheduling_s {
#if EFI_SIGNAL_EXECUTOR_SLEEP
virtual_timer_t timer;
#endif /* EFI_SIGNAL_EXECUTOR_SLEEP */

View File

@ -51,15 +51,6 @@ TriggerCentral::TriggerCentral() : trigger_central_s(),
noiseFilter.resetAccumSignalData();
}
void TriggerCentral::init() {
triggerState.inject();
for (int bankIndex = 0; bankIndex < BANKS_COUNT; bankIndex++) {
for (int camIndex = 0; camIndex < CAMS_PER_BANK; camIndex++) {
vvtState[bankIndex][camIndex].inject();
}
}
}
void TriggerNoiseFilter::resetAccumSignalData() {
memset(lastSignalTimes, 0xff, sizeof(lastSignalTimes)); // = -1
memset(accumSignalPeriods, 0, sizeof(accumSignalPeriods));

View File

@ -37,10 +37,9 @@ public:
* Probably not: we have an instance of TriggerState which is used for trigger initialization,
* also composition probably better than inheritance here
*/
class TriggerCentral final : public trigger_central_s, public EnginePtr {
class TriggerCentral final : public trigger_central_s {
public:
TriggerCentral();
void init();
void handleShaftSignal(trigger_event_e signal, efitick_t timestamp);
int getHwEventCounter(int index) const;
void resetCounters();

View File

@ -24,7 +24,7 @@ struct TriggerStateListener {
#endif // EFI_SHAFT_POSITION_INPUT
};
class TriggerConfiguration : public EnginePtr {
class TriggerConfiguration {
public:
explicit TriggerConfiguration(const char* printPrefix) : PrintPrefix(printPrefix) {}
void update();
@ -74,7 +74,7 @@ typedef struct {
/**
* @see TriggerWaveform for trigger wheel shape definition
*/
class TriggerState : public trigger_state_s, public EnginePtr {
class TriggerState : public trigger_state_s {
public:
TriggerState();
/**

View File

@ -16,7 +16,7 @@
/**
* @brief rusEfi console sniffer data buffer
*/
class WaveChart : public EnginePtr {
class WaveChart {
public:
WaveChart();
void init();

View File

@ -80,7 +80,7 @@ public:
#define DEFINE_PARAM_SUFFIX(x) , x
#endif
class HIP9011 : public EnginePtr {
class HIP9011 {
public:
explicit HIP9011(Hip9011HardwareInterface *hardware);
int sendCommand(uint8_t cmd);

View File

@ -4,7 +4,7 @@
#include "adc_subscription.h"
#include "function_pointer_sensor.h"
struct GetAfrWrapper : public EnginePtr {
struct GetAfrWrapper {
float getLambda() {
return getAfr() / 14.7f;
}
@ -24,7 +24,6 @@ static AemXSeriesWideband aem2(1, SensorType::Lambda2);
#endif
void initLambda() {
afrWrapper.inject();
#if EFI_CAN_SUPPORT
if (CONFIG(enableAemXSeries)) {

View File

@ -7,7 +7,7 @@
#include "function_pointer_sensor.h"
#include "identity_func.h"
struct GetBaroWrapper : public EnginePtr {
struct GetBaroWrapper {
float getBaro() {
return ::getBaroPressure();
}
@ -111,7 +111,6 @@ void configureMapFunction() {
}
void initMap() {
baroWrapper.inject();
auto mapChannel = engineConfiguration->map.sensor.hwChannel;

View File

@ -9,7 +9,6 @@ static TurbochargerSpeedConverter turbochargerSpeedConverter;
void initTurbochargerSpeedSensor() {
turbochargerSpeedConverter.inject();
auto pin = CONFIG(turboSpeedSensorInputPin);

View File

@ -8,7 +8,6 @@ static FrequencySensor vehicleSpeedSensor(SensorType::VehicleSpeed, MS2NT(500));
static VehicleSpeedConverter vehicleSpeedConverter;
void initVehicleSpeedSensor() {
vehicleSpeedConverter.inject();
auto pin = CONFIG(vehicleSpeedSensorInputPin);

View File

@ -27,7 +27,7 @@ struct pid_s;
/**
* default basic implementation also known as PidParallelController
*/
class Pid : public pid_state_s, public EnginePtr {
class Pid : public pid_state_s {
public:
Pid();
explicit Pid(pid_s *parameters);

View File

@ -86,11 +86,9 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType, configuration_callb
memset(&activeConfiguration, 0, sizeof(activeConfiguration));
enginePins.inject();
enginePins.reset();
enginePins.unregisterPins();
waveChart.inject();
waveChart.init();
setCurveValue(config->cltFuelCorrBins, config->cltFuelCorr, CLT_CURVE_SIZE, -40, 1.5);

View File

@ -28,7 +28,7 @@ static void doRevolution(EngineTestHelper& eth, int periodMs) {
// https://github.com/rusefi/rusefi/issues/1592
TEST(fuelControl, transitionIssue1592) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
ENGINE(tdcMarkEnabled) = false;
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth, IM_SEQUENTIAL);

View File

@ -9,7 +9,7 @@
TEST(scheduler, dwellIssue796) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth, IM_SEQUENTIAL);
eth.fireTriggerEvents2(4 /* count */ , 600 /* ms */);

View File

@ -13,7 +13,7 @@
using ::testing::_;
TEST(fuelCut, coasting) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
EXPECT_CALL(eth.mockAirmass, getAirmass(_))
.WillRepeatedly(Return(AirmassResult{0.1008f, 50.0f}));

View File

@ -14,10 +14,9 @@ public:
};
TEST(FuelComputer, getCycleFuel) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
MockFuelComputer dut;
dut.inject();
EXPECT_CALL(dut, getTargetLambdaLoadAxis(FloatEq(0.8f)))
.WillOnce(Return(0.8f));
@ -41,11 +40,10 @@ TEST(FuelComputer, LambdaLookup) {
}
TEST(FuelComputer, FlexFuel) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
MockVp3d lambdaTable;
FuelComputer dut(lambdaTable);
dut.inject();
// easier values for testing
engineConfiguration->stoichRatioPrimary = 15;

View File

@ -16,7 +16,7 @@ using ::testing::FloatNear;
TEST(misc, testFuelMap) {
printf("Setting up FORD_ASPIRE_1996\r\n");
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
EngineTestHelper eth(FORD_ASPIRE_1996);
for (int i = 0; i < VBAT_INJECTOR_CURVE_SIZE; i++) {
CONFIG(injector.battLagCorrBins[i]) = i;
@ -133,7 +133,7 @@ static void configureFordAspireTriggerWaveform(TriggerWaveform * s) {
TEST(misc, testAngleResolver) {
printf("*************************************************** testAngleResolver\r\n");
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
EngineTestHelper eth(FORD_ASPIRE_1996);
engineConfiguration->globalTriggerAngleOffset = 175;

View File

@ -9,7 +9,7 @@ using ::testing::InSequence;
using ::testing::_;
TEST(FuelMath, getStandardAirCharge) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Miata 1839cc 4cyl
CONFIG(specs.displacement) = 1.839f;
@ -36,7 +36,7 @@ TEST(FuelMath, getStandardAirCharge) {
}
TEST(AirmassModes, AlphaNNormal) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// 4 cylinder 4 liter = easy math
engineConfiguration->specs.displacement = 4.0f;
engineConfiguration->specs.cylindersCount = 4;
@ -47,7 +47,6 @@ TEST(AirmassModes, AlphaNNormal) {
.WillOnce(Return(35.0f));
AlphaNAirmass dut(veTable);
dut.inject();
Sensor::setMockValue(SensorType::Tps1, 0.71f);
@ -60,13 +59,12 @@ TEST(AirmassModes, AlphaNNormal) {
}
TEST(AirmassModes, AlphaNFailedTps) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Shouldn't get called
StrictMock<MockVp3d> veTable;
AlphaNAirmass dut(veTable);
dut.inject();
// explicitly reset the sensor
Sensor::resetMockValue(SensorType::Tps1);
@ -78,7 +76,7 @@ TEST(AirmassModes, AlphaNFailedTps) {
}
TEST(AirmassModes, MafNormal) {
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
EngineTestHelper eth(FORD_ASPIRE_1996);
engineConfiguration->fuelAlgorithm = LM_REAL_MAF;
engineConfiguration->injector.flow = 200;
@ -88,7 +86,6 @@ TEST(AirmassModes, MafNormal) {
.WillOnce(Return(75.0f));
MafAirmass dut(veTable);
dut.inject();
auto airmass = dut.getAirmassImpl(200, 6000);
@ -120,9 +117,8 @@ TEST(AirmassModes, VeOverride) {
}
};
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
DummyAirmassModel dut(veTable);
dut.inject();
// Use default mode - will call with 10
dut.getAirmass(0);
@ -138,7 +134,7 @@ TEST(AirmassModes, VeOverride) {
void setInjectionMode(int value);
TEST(FuelMath, testDifferentInjectionModes) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth);
EXPECT_CALL(eth.mockAirmass, getAirmass(_))
@ -163,7 +159,7 @@ TEST(FuelMath, testDifferentInjectionModes) {
}
TEST(FuelMath, deadtime) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth);

View File

@ -10,7 +10,7 @@
#include "pch.h"
TEST(fuel, testWallWettingEnrichmentMath) {
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
EngineTestHelper eth(FORD_ASPIRE_1996);
engineConfiguration->wwaeTau = 1.0f;
engineConfiguration->wwaeBeta = 0.40f;
@ -26,7 +26,7 @@ TEST(fuel, testWallWettingEnrichmentMath) {
TEST(fuel, testWallWettingEnrichmentScheduling) {
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
EngineTestHelper eth(FORD_ASPIRE_1996);
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->useOnlyRisingEdgeForTrigger = true;

View File

@ -11,7 +11,7 @@
using ::testing::_;
TEST(ignition, twoCoils) {
WITH_ENGINE_TEST_HELPER(FRANKENSO_BMW_M73_F);
EngineTestHelper eth(FRANKENSO_BMW_M73_F);
// first one to fire uses first coil
ASSERT_EQ(ENGINE(ignitionPin[ID2INDEX(1)]), 0);
@ -38,7 +38,7 @@ TEST(ignition, twoCoils) {
}
TEST(ignition, trailingSpark) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
/**
// TODO #3220: this feature makes this test sad, eventually remove this line (and the ability to disable it altogether)

View File

@ -59,9 +59,8 @@ TEST(InjectorModel, getInjectionDurationNonlinear) {
}
TEST(InjectorModel, nonlinearPolynomial) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
InjectorModel dut;
dut.inject();
CONFIG(applyNonlinearBelowPulse) = MS2US(10);
@ -80,7 +79,7 @@ TEST(InjectorModel, nonlinearPolynomial) {
}
TEST(InjectorModel, Deadtime) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Some test data in the injector correction table
for (size_t i = 0; i < efi::size(engineConfiguration->injector.battLagCorr); i++) {
@ -89,7 +88,6 @@ TEST(InjectorModel, Deadtime) {
}
InjectorModel dut;
dut.inject();
Sensor::setMockValue(SensorType::BatteryVoltage, 3);
EXPECT_EQ(dut.getDeadtime(), 6);
@ -121,8 +119,7 @@ TEST_P(FlowRateFixture, FlowRateRatio) {
StrictMock<TesterGetFlowRate> dut;
EXPECT_CALL(dut, getInjectorFlowRatio()).WillOnce(Return(flowRatio));
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
dut.inject();
EngineTestHelper eth(TEST_ENGINE);
engineConfiguration->injector.flow = 500;
// 500 cc/min = 6g/s
@ -141,8 +138,7 @@ TEST_P(FlowRateFixture, PressureRatio) {
StrictMock<TesterGetRailPressure> dut;
EXPECT_CALL(dut, getAbsoluteRailPressure()).WillOnce(Return(400 * pressureRatio + fakeMap));
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
dut.inject();
EngineTestHelper eth(TEST_ENGINE);
// Use injector compensation
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
@ -160,8 +156,7 @@ TEST_P(FlowRateFixture, PressureRatio) {
TEST(InjectorModel, NegativePressureDelta) {
StrictMock<TesterGetRailPressure> dut;
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
dut.inject();
EngineTestHelper eth(TEST_ENGINE);
// Use injector compensation
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
@ -180,8 +175,7 @@ TEST(InjectorModel, NegativePressureDelta) {
TEST(InjectorModel, VariableInjectorFlowModeNone) {
StrictMock<TesterGetRailPressure> dut;
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
dut.inject();
EngineTestHelper eth(TEST_ENGINE);
engineConfiguration->injectorCompensationMode = ICM_None;
@ -192,8 +186,7 @@ TEST(InjectorModel, VariableInjectorFlowModeNone) {
TEST(InjectorModel, RailPressureFixed) {
InjectorModel dut;
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
dut.inject();
EngineTestHelper eth(TEST_ENGINE);
// Reference pressure is 350kpa
engineConfiguration->fuelReferencePressure = 350;
@ -206,8 +199,7 @@ TEST(InjectorModel, RailPressureFixed) {
TEST(InjectorModel, RailPressureSensed) {
InjectorModel dut;
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
dut.inject();
EngineTestHelper eth(TEST_ENGINE);
// Reference pressure is 350kpa
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
@ -224,8 +216,7 @@ TEST(InjectorModel, RailPressureSensed) {
TEST(InjectorModel, FailedPressureSensor) {
InjectorModel dut;
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
dut.inject();
EngineTestHelper eth(TEST_ENGINE);
// Reference pressure is 350kpa
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;
@ -243,8 +234,7 @@ TEST(InjectorModel, FailedPressureSensor) {
TEST(InjectorModel, MissingPressureSensor) {
InjectorModel dut;
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
dut.inject();
EngineTestHelper eth(TEST_ENGINE);
// Reference pressure is 350kpa
engineConfiguration->injectorCompensationMode = ICM_SensedRailPressure;

View File

@ -9,7 +9,7 @@
#include "advance_map.h"
TEST(Multispark, DefaultConfiguration) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
EXPECT_EQ(0, getMultiSparkCount(0 ));
EXPECT_EQ(0, getMultiSparkCount(100 ));
@ -37,7 +37,7 @@ static void multisparkCfg() {
}
TEST(Multispark, EnabledNoMaxRpm) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
multisparkCfg();
@ -62,7 +62,7 @@ TEST(Multispark, EnabledNoMaxRpm) {
}
TEST(Multispark, RpmLimit) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
multisparkCfg();

View File

@ -7,7 +7,7 @@
#include "spark_logic.h"
TEST(issues, issueOneCylinderSpecialCase968) {
WITH_ENGINE_TEST_HELPER(GY6_139QMB);
EngineTestHelper eth(GY6_139QMB);
ENGINE(tdcMarkEnabled) = false;
// set injection_mode 1
engineConfiguration->injectionMode = IM_SEQUENTIAL;

View File

@ -8,7 +8,7 @@
#include "pch.h"
TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
ENGINE(tdcMarkEnabled) = false;
engineConfiguration->cranking.baseFuel = 12;
@ -33,7 +33,7 @@ TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
TEST(engine, testStartOfCrankingPrimingPulse) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
engineConfiguration->startOfCrankingPrimingPulse = 4;

View File

@ -45,7 +45,7 @@ end
)";
TEST(LuaHooks, Table3d) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
setTable(config->scriptTable2, (uint8_t)33);
EXPECT_EQ(testLuaReturnsNumber(tableTest), 33);

View File

@ -19,7 +19,7 @@ end
)";
TEST(LuaHooks, TestCurve) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
strcpy(engineConfiguration->scriptCurveName[3], "hello");
setLinearCurve(engineConfiguration->scriptCurve4, 500, 600, 1);

View File

@ -22,7 +22,7 @@ TEST(testCJ125, testInitialState) {
ASSERT_FALSE(cj.isWorkingState());
ASSERT_EQ(cj.heaterDuty, 0);
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
EngineTestHelper eth(FORD_ASPIRE_1996);
cj.StartHeaterControl();
ASSERT_EQ(cj.heaterDuty, CJ125_HEATER_IDLE_RATE);
@ -49,7 +49,7 @@ TEST(testCJ125, testFailedIdentify) {
TestSpi mock;
cj.spi = &mock;
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
EngineTestHelper eth(FORD_ASPIRE_1996);
cj.cjIdentify();
ASSERT_EQ(cj.errorCode, CJ125_ERROR_WRONG_IDENT);

View File

@ -51,7 +51,7 @@ public:
*/
TEST_F(FrequencySensorTest, testValidWithPwm) {
ASSERT_TRUE(dut.Register());
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Should be invalid - not set yet
{

View File

@ -24,7 +24,7 @@ static void postToFuncSensor(Sensor* s, float value) {
}
TEST(SensorInit, Tps) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
CONFIG(tpsMin) = 200; // 1 volt
CONFIG(tpsMax) = 800; // 4 volts
@ -50,7 +50,7 @@ TEST(SensorInit, Tps) {
}
TEST(SensorInit, TpsValuesTooClose) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Should fail, 0.49 volts apart
CONFIG(tpsMin) = 200; // 1.00 volt
@ -97,7 +97,7 @@ TEST(SensorInit, TpsValuesTooClose) {
}
TEST(SensorInit, Pedal) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
CONFIG(throttlePedalPositionAdcChannel) = EFI_ADC_0;
CONFIG(throttlePedalUpVoltage) = 1;
@ -124,7 +124,7 @@ TEST(SensorInit, Pedal) {
}
TEST(SensorInit, DriverIntentNoPedal) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// We have no pedal - so we should get the TPS
CONFIG(throttlePedalPositionAdcChannel) = EFI_ADC_NONE;
@ -144,7 +144,7 @@ TEST(SensorInit, DriverIntentNoPedal) {
TEST(SensorInit, DriverIntentWithPedal) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// We have a pedal, so we should get it
CONFIG(throttlePedalPositionAdcChannel) = EFI_ADC_0;
@ -163,7 +163,7 @@ TEST(SensorInit, DriverIntentWithPedal) {
}
TEST(SensorInit, OilPressure) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
CONFIG(oilPressure.hwChannel) = EFI_ADC_0;
CONFIG(oilPressure.v1) = 1;
@ -188,7 +188,7 @@ TEST(SensorInit, OilPressure) {
}
TEST(SensorInit, Clt) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// 2003 neon sensor
CONFIG(clt.config) = {0, 30, 100, 32500, 7550, 700, 2700};
@ -210,7 +210,7 @@ TEST(SensorInit, Clt) {
}
TEST(SensorInit, Lambda) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
initLambda();
@ -219,7 +219,7 @@ TEST(SensorInit, Lambda) {
}
TEST(SensorInit, Map) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
initMap();

View File

@ -13,7 +13,6 @@ public:
}
void SetUp() override {
dut.inject();
}
void SetCoef(float new_coef) {

View File

@ -13,7 +13,6 @@ public:
}
void SetUp() override {
dut.inject();
}
void SetCoef(float new_coef) {

View File

@ -15,7 +15,7 @@
TEST(fuel, testTpsAccelEnrichmentMath) {
printf("====================================================================================== testAccelEnrichment\r\n");
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
EngineTestHelper eth(FORD_ASPIRE_1996);
engine->rpmCalculator.setRpmValue(600);
engine->periodicFastCallback();
@ -40,7 +40,7 @@ TEST(fuel, testTpsAccelEnrichmentMath) {
}
TEST(fuel, testTpsAccelEnrichmentScheduling) {
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
EngineTestHelper eth(FORD_ASPIRE_1996);
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
@ -91,7 +91,7 @@ static void doFractionalTpsIteration(int period, int divisor, int numCycles, std
TEST(fuel, testAccelEnrichmentFractionalTps) {
printf("====================================================================================== testAccelEnrichmentFractionalTps\r\n");
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
EngineTestHelper eth(FORD_ASPIRE_1996);
// setup
engineConfiguration->tpsAccelEnrichmentThreshold = 5;

View File

@ -12,7 +12,7 @@
TEST(misc, testAuxValves) {
Sensor::setMockValue(SensorType::DriverThrottleIntent, 0);
WITH_ENGINE_TEST_HELPER(NISSAN_PRIMERA);
EngineTestHelper eth(NISSAN_PRIMERA);
engine->needTdcCallback = false;

View File

@ -12,11 +12,10 @@ TEST(BoostControl, Setpoint) {
EXPECT_CALL(targetMap, getValue(_, _))
.WillRepeatedly([](float xRpm, float tps) { return tps * 2; });
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
engineConfiguration->boostType = CLOSED_LOOP;
BoostController bc;
bc.inject();
// Should return unexpected without a pedal map cfg'd
EXPECT_EQ(bc.getSetpoint(), unexpected);
@ -33,10 +32,9 @@ TEST(BoostControl, Setpoint) {
}
TEST(BoostControl, ObservePlant) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
BoostController bc;
bc.inject();
Sensor::resetMockValue(SensorType::Map);
// Check that invalid MAP returns unexpected
@ -55,10 +53,9 @@ TEST(BoostControl, OpenLoop) {
EXPECT_CALL(openMap, getValue(_, _))
.WillRepeatedly([](float xRpm, float tps) { return tps * 2; });
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
BoostController bc;
bc.inject();
// Without table set, should return unexpected
EXPECT_EQ(bc.getOpenLoop(0), unexpected);
@ -71,10 +68,9 @@ TEST(BoostControl, OpenLoop) {
}
TEST(BoostControl, ClosedLoop) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
BoostController bc;
bc.inject();
pid_s pidCfg = {
1, 0, 0, // P controller, easier to test
@ -111,12 +107,11 @@ TEST(BoostControl, ClosedLoop) {
}
TEST(BoostControl, SetOutput) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
StrictMock<MockPwm> pwm;
StrictMock<MockEtb> etb;
BoostController bc;
bc.inject();
// ETB wastegate position & PWM should both be set
EXPECT_CALL(etb, setWastegatePosition(25.0f));

View File

@ -13,7 +13,7 @@ TEST(misc, changeEngineType) {
/**
* this configuration has triggerInputDebugPins defined
*/
WITH_ENGINE_TEST_HELPER (FORD_ASPIRE_1996);
EngineTestHelper eth (FORD_ASPIRE_1996);
brain_pin_e brainPin = engineConfiguration->triggerInputDebugPins[0];
ASSERT_TRUE(brainPin != GPIO_UNASSIGNED);

View File

@ -17,10 +17,9 @@ void printResults(DynoView *dut) {
TEST(DynoView, VSS_T1) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
DynoView dut;
dut.inject();
// Test Speed threshold
engineConfiguration->vehicleWeight = 900;
@ -37,10 +36,9 @@ TEST(DynoView, VSS_T1) {
}
TEST(DynoView, algo) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
DynoView dut;
dut.inject();
// Test Speed threshold
engineConfiguration->vehicleWeight = 900;
@ -62,10 +60,9 @@ TEST(DynoView, algo) {
}
TEST(DynoView, VSS_fast) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
DynoView dut;
dut.inject();
// Test Speed threshold
engineConfiguration->vehicleWeight = 900; //kg
@ -86,10 +83,9 @@ TEST(DynoView, VSS_fast) {
TEST(DynoView, VSS_Torque) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
DynoView dut;
dut.inject();
// Test Speed threshold
engineConfiguration->vehicleWeight = 900; //kg

View File

@ -22,7 +22,7 @@ TEST(misc, structSize) {
TEST(misc, testIgnitionPlanning) {
printf("*************************************************** testIgnitionPlanning\r\n");
WITH_ENGINE_TEST_HELPER(FORD_ESCORT_GT);
EngineTestHelper eth(FORD_ESCORT_GT);
eth.engine.periodicFastCallback();
assertEqualsM("testIgnitionPlanning_AFR", 13.5, eth.engine.engineState.targetAFR);
@ -33,7 +33,7 @@ TEST(misc, testIgnitionPlanning) {
TEST(misc, testEngineMath) {
printf("*************************************************** testEngineMath\r\n");
WITH_ENGINE_TEST_HELPER(FORD_ESCORT_GT);
EngineTestHelper eth(FORD_ESCORT_GT);
engineConfiguration->ambiguousOperationMode = FOUR_STROKE_CAM_SENSOR;

View File

@ -20,7 +20,7 @@ using ::testing::StrictMock;
TEST(etb, initializationNoPedal) {
StrictMock<MockEtb> mocks[ETB_COUNT];
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
for (int i = 0; i < ETB_COUNT; i++) {
engine->etbControllers[i] = &mocks[i];
@ -36,7 +36,7 @@ TEST(etb, initializationNoPedal) {
TEST(etb, initializationMissingThrottle) {
StrictMock<MockEtb> mocks[ETB_COUNT];
WITH_ENGINE_TEST_HELPER_BOARD_CALLBACK(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
engineConfiguration->etbFunctions[0] = ETB_None;
engineConfiguration->etbFunctions[1] = ETB_None;
});
@ -59,7 +59,7 @@ TEST(etb, initializationMissingThrottle) {
TEST(etb, initializationSingleThrottle) {
StrictMock<MockEtb> mocks[ETB_COUNT];
WITH_ENGINE_TEST_HELPER_BOARD_CALLBACK(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
engineConfiguration->etbFunctions[0] = ETB_Throttle1;
engineConfiguration->etbFunctions[1] = ETB_None;
});
@ -84,7 +84,7 @@ TEST(etb, initializationSingleThrottle) {
TEST(etb, initializationSingleThrottleInSecondSlot) {
StrictMock<MockEtb> mocks[ETB_COUNT];
WITH_ENGINE_TEST_HELPER_BOARD_CALLBACK(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
engineConfiguration->etbFunctions[0] = ETB_None;
engineConfiguration->etbFunctions[1] = ETB_Throttle1;
});
@ -109,7 +109,7 @@ TEST(etb, initializationSingleThrottleInSecondSlot) {
TEST(etb, initializationDualThrottle) {
StrictMock<MockEtb> mocks[ETB_COUNT];
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
for (int i = 0; i < ETB_COUNT; i++) {
engine->etbControllers[i] = &mocks[i];
@ -137,7 +137,7 @@ TEST(etb, initializationDualThrottle) {
TEST(etb, initializationWastegate) {
StrictMock<MockEtb> mocks[ETB_COUNT];
WITH_ENGINE_TEST_HELPER_BOARD_CALLBACK(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
EngineTestHelper eth(TEST_ENGINE, [](engine_configuration_s* engineConfiguration) {
engineConfiguration->etbFunctions[0] = ETB_Wastegate;
engineConfiguration->etbFunctions[1] = ETB_None;
});
@ -217,7 +217,7 @@ TEST(etb, initializationNoThrottles) {
// This tests the case where you don't want an ETB, and expect everything to go fine
EtbController duts[2];
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
for (int i = 0; i < ETB_COUNT; i++) {
engine->etbControllers[i] = &duts[i];
@ -240,7 +240,7 @@ TEST(etb, initializationNoThrottles) {
TEST(etb, idlePlumbing) {
StrictMock<MockEtb> mocks[ETB_COUNT];
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
engineConfiguration->useETBforIdleControl = true;
Sensor::setMockValue(SensorType::AcceleratorPedal, 50.0f, true);
@ -255,13 +255,12 @@ TEST(etb, idlePlumbing) {
}
TEST(etb, testSetpointOnlyPedal) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Don't use ETB for idle, we aren't testing that yet - just pedal table for now
engineConfiguration->useETBforIdleControl = false;
EtbController etb;
etb.inject();
// Mock pedal map that's just passthru pedal -> target
StrictMock<MockVp3d> pedalMap;
@ -325,7 +324,7 @@ TEST(etb, testSetpointOnlyPedal) {
}
TEST(etb, setpointIdle) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Use ETB for idle, but don't give it any range (yet)
engineConfiguration->useETBforIdleControl = true;
@ -337,7 +336,6 @@ TEST(etb, setpointIdle) {
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
EtbController etb;
etb.inject();
// Mock pedal map that's just passthru pedal -> target
StrictMock<MockVp3d> pedalMap;
@ -383,7 +381,7 @@ TEST(etb, setpointIdle) {
}
TEST(etb, setpointRevLimit) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Configure 5000 limit start, with 750 rpm taper
engineConfiguration->etbRevLimitStart = 5000;
@ -395,7 +393,6 @@ TEST(etb, setpointRevLimit) {
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
EtbController etb;
etb.inject();
// Mock pedal map to just return 80%
StrictMock<MockVp3d> pedalMap;
@ -517,7 +514,7 @@ TEST(etb, etbTpsSensor) {
}
TEST(etb, setOutputInvalid) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Redundant TPS & accelerator pedal required for init
Sensor::setMockValue(SensorType::Tps1Primary, 0);
@ -527,7 +524,6 @@ TEST(etb, setOutputInvalid) {
StrictMock<MockMotor> motor;
EtbController etb;
etb.inject();
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
// Should be disabled in case of unexpected
@ -537,7 +533,7 @@ TEST(etb, setOutputInvalid) {
}
TEST(etb, setOutputValid) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
StrictMock<MockMotor> motor;
// Must have TPS & PPS initialized for ETB setup
@ -546,7 +542,6 @@ TEST(etb, setOutputValid) {
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
EtbController etb;
etb.inject();
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
// Should be enabled and value set
@ -558,7 +553,7 @@ TEST(etb, setOutputValid) {
}
TEST(etb, setOutputValid2) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
StrictMock<MockMotor> motor;
// Must have TPS & PPS initialized for ETB setup
@ -567,7 +562,6 @@ TEST(etb, setOutputValid2) {
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
EtbController etb;
etb.inject();
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
// Should be enabled and value set
@ -579,7 +573,7 @@ TEST(etb, setOutputValid2) {
}
TEST(etb, setOutputOutOfRangeHigh) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
StrictMock<MockMotor> motor;
// Must have TPS & PPS initialized for ETB setup
@ -588,7 +582,6 @@ TEST(etb, setOutputOutOfRangeHigh) {
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
EtbController etb;
etb.inject();
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
// Should be enabled and value set
@ -600,7 +593,7 @@ TEST(etb, setOutputOutOfRangeHigh) {
}
TEST(etb, setOutputOutOfRangeLow) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
StrictMock<MockMotor> motor;
// Must have TPS & PPS initialized for ETB setup
@ -609,7 +602,6 @@ TEST(etb, setOutputOutOfRangeLow) {
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
EtbController etb;
etb.inject();
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
// Should be enabled and value set
@ -621,7 +613,7 @@ TEST(etb, setOutputOutOfRangeLow) {
}
TEST(etb, setOutputPauseControl) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
StrictMock<MockMotor> motor;
// Must have TPS & PPS initialized for ETB setup
@ -630,7 +622,6 @@ TEST(etb, setOutputPauseControl) {
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
EtbController etb;
etb.inject();
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
// Pause control - should get no output
@ -643,7 +634,7 @@ TEST(etb, setOutputPauseControl) {
}
TEST(etb, setOutputLimpHome) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
StrictMock<MockMotor> motor;
// Must have TPS & PPS initialized for ETB setup
@ -652,7 +643,6 @@ TEST(etb, setOutputLimpHome) {
Sensor::setMockValue(SensorType::AcceleratorPedal, 0.0f, true);
EtbController etb;
etb.inject();
etb.init(ETB_Throttle1, &motor, nullptr, nullptr, true);
// Should be disabled when in ETB limp mode
@ -694,7 +684,7 @@ TEST(etb, closedLoopPid) {
}
TEST(etb, openLoopThrottle) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Redundant TPS & accelerator pedal required for init
Sensor::setMockValue(SensorType::Tps1Primary, 0);
@ -702,7 +692,6 @@ TEST(etb, openLoopThrottle) {
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
EtbController etb;
etb.inject();
etb.init(ETB_Throttle1, nullptr, nullptr, nullptr, true);
// Map [0, 100] -> [-50, 50]
@ -717,7 +706,7 @@ TEST(etb, openLoopThrottle) {
}
TEST(etb, openLoopNonThrottle) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Redundant TPS & accelerator pedal required for init
Sensor::setMockValue(SensorType::Tps1Primary, 0);
@ -725,7 +714,6 @@ TEST(etb, openLoopNonThrottle) {
Sensor::setMockValue(SensorType::AcceleratorPedal, 0, true);
EtbController etb;
etb.inject();
etb.init(ETB_Wastegate, nullptr, nullptr, nullptr, false);
// Map [0, 100] -> [-50, 50]

View File

@ -3,7 +3,7 @@
#include "fan_control.h"
TEST(FanControl, fan1) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
engineConfiguration->fanOnTemperature = 90;
engineConfiguration->fanOffTemperature = 80;

View File

@ -1,7 +1,7 @@
#include "pch.h"
TEST(gpio, testPinInitNonInverted) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
OutputPin dut;
@ -17,7 +17,7 @@ TEST(gpio, testPinInitNonInverted) {
}
TEST(gpio, testPinInitInverted) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
OutputPin dut;

View File

@ -74,9 +74,8 @@ TEST(GpPwm, OutputOnOff) {
}
TEST(GpPwm, GetOutput) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
GppwmChannel ch;
ch.inject();
gppwm_channel cfg;
cfg.loadAxis = GPPWM_Tps;

View File

@ -1,7 +1,7 @@
#include "pch.h"
TEST(hardware, reinit) {
WITH_ENGINE_TEST_HELPER(FRANKENSO_MIATA_NA6_MAP);
EngineTestHelper eth(FRANKENSO_MIATA_NA6_MAP);
ButtonDebounce::stopConfigurationList();
ButtonDebounce::startConfigurationList();

View File

@ -19,9 +19,8 @@ using ::testing::_;
using ICP = IIdleController::Phase;
TEST(idle_v2, timingPid) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
IdleController dut;
dut.inject();
engineConfiguration->useIdleTimingPidControl = true;
@ -55,9 +54,8 @@ TEST(idle_v2, timingPid) {
}
TEST(idle_v2, testTargetRpm) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
IdleController dut;
dut.inject();
for (size_t i = 0; i < efi::size(engineConfiguration->cltIdleRpmBins); i++) {
CONFIG(cltIdleRpmBins)[i] = i * 10;
@ -69,9 +67,8 @@ TEST(idle_v2, testTargetRpm) {
}
TEST(idle_v2, testDeterminePhase) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
IdleController dut;
dut.inject();
// TPS threshold 5% for easy test
CONFIG(idlePidDeactivationTpsThreshold) = 5;
@ -115,9 +112,8 @@ TEST(idle_v2, testDeterminePhase) {
}
TEST(idle_v2, crankingOpenLoop) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
IdleController dut;
dut.inject();
engineConfiguration->crankingIACposition = 50;
@ -141,9 +137,8 @@ TEST(idle_v2, crankingOpenLoop) {
}
TEST(idle_v2, runningOpenLoopBasic) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
IdleController dut;
dut.inject();
engineConfiguration->manIdlePosition = 50;
@ -157,9 +152,8 @@ TEST(idle_v2, runningOpenLoopBasic) {
}
TEST(idle_v2, runningFanAcBump) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
IdleController dut;
dut.inject();
engineConfiguration->manIdlePosition = 50;
engineConfiguration->acIdleExtraOffset = 9;
@ -196,9 +190,8 @@ TEST(idle_v2, runningFanAcBump) {
}
TEST(idle_v2, runningOpenLoopTpsTaper) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
IdleController dut;
dut.inject();
// Zero out base tempco table
setArrayValues(config->cltIdleCorr, 0.0f);
@ -224,9 +217,8 @@ struct MockOpenLoopIdler : public IdleController {
};
TEST(idle_v2, testOpenLoopCranking) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
StrictMock<MockOpenLoopIdler> dut;
dut.inject();
CONFIG(overrideCrankingIacSetting) = true;
@ -237,9 +229,8 @@ TEST(idle_v2, testOpenLoopCranking) {
}
TEST(idle_v2, openLoopRunningTaper) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
StrictMock<MockOpenLoopIdler> dut;
dut.inject();
EXPECT_CALL(dut, getRunningOpenLoop(30, SensorResult(0))).WillRepeatedly(Return(25));
EXPECT_CALL(dut, getCrankingOpenLoop(30)).WillRepeatedly(Return(75));
@ -262,9 +253,8 @@ TEST(idle_v2, openLoopRunningTaper) {
}
TEST(idle_v2, getCrankingTaperFraction) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
StrictMock<MockOpenLoopIdler> dut;
dut.inject();
CONFIG(afterCrankingIACtaperDuration) = 500;
@ -291,9 +281,8 @@ TEST(idle_v2, getCrankingTaperFraction) {
}
TEST(idle_v2, openLoopCoastingTable) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
IdleController dut;
dut.inject();
// enable & configure feature
CONFIG(useIacTableForCoasting) = true;
@ -309,9 +298,8 @@ TEST(idle_v2, openLoopCoastingTable) {
extern int timeNowUs;
TEST(idle_v2, closedLoopBasic) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
IdleController dut;
dut.inject();
// Not testing PID here, so we can set very simple PID gains
CONFIG(idleRpmPid).pFactor = 0.5; // 0.5 output per 1 RPM error = 50% per 100 rpm
@ -337,9 +325,8 @@ TEST(idle_v2, closedLoopBasic) {
}
TEST(idle_v2, closedLoopDeadzone) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
IdleController dut;
dut.inject();
// Not testing PID here, so we can set very simple PID gains
CONFIG(idleRpmPid).pFactor = 0.5; // 0.5 output per 1 RPM error = 50% per 100 rpm
@ -373,9 +360,8 @@ struct IntegrationIdleMock : public IdleController {
};
TEST(idle_v2, IntegrationManual) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
StrictMock<IntegrationIdleMock> dut;
dut.inject();
SensorResult expectedTps = 1;
float expectedClt = 37;
@ -406,9 +392,8 @@ TEST(idle_v2, IntegrationManual) {
}
TEST(idle_v2, IntegrationAutomatic) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
StrictMock<IntegrationIdleMock> dut;
dut.inject();
CONFIG(idleMode) = IM_AUTO;
@ -444,9 +429,8 @@ TEST(idle_v2, IntegrationAutomatic) {
}
TEST(idle_v2, IntegrationClamping) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
StrictMock<IntegrationIdleMock> dut;
dut.inject();
CONFIG(idleMode) = IM_AUTO;

View File

@ -3,7 +3,7 @@
#include "knock_logic.h"
TEST(Knock, Retards) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Knock threshold of 20dBv
ENGINE(engineState).knockThreshold = 20;
@ -13,7 +13,6 @@ TEST(Knock, Retards) {
CONFIG(knockRetardMaximum) = 8;
KnockController dut;
dut.inject();
// No retard unless we knock
ASSERT_FLOAT_EQ(dut.getKnockRetard(), 0);
@ -40,10 +39,9 @@ TEST(Knock, Retards) {
}
TEST(Knock, Reapply) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
KnockController dut;
dut.inject();
// Knock threshold of 20dBv
ENGINE(engineState).knockThreshold = 20;

View File

@ -3,10 +3,9 @@
#include "launch_control.h"
TEST(LaunchControl, TpsCondition) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
LaunchControlBase dut;
dut.inject();
engineConfiguration->launchTpsTreshold = 10;
@ -25,10 +24,9 @@ TEST(LaunchControl, TpsCondition) {
TEST(LaunchControl, VSSCondition) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
LaunchControlBase dut;
dut.inject();
// Test Speed threshold
engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH;
@ -43,10 +41,9 @@ TEST(LaunchControl, VSSCondition) {
}
TEST(LaunchControl, RPMCondition) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
LaunchControlBase dut;
dut.inject();
engineConfiguration->launchRpm = 3000;
@ -56,10 +53,9 @@ TEST(LaunchControl, RPMCondition) {
}
TEST(LaunchControl, SwitchInputCondition) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
LaunchControlBase dut;
dut.inject();
//activation based on VSS
engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH;
@ -99,10 +95,9 @@ TEST(LaunchControl, SwitchInputCondition) {
}
TEST(LaunchControl, CombinedCondition) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
LaunchControlBase dut;
dut.inject();
//check VSS normal usage
engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH;
@ -143,7 +138,7 @@ static void setDefaultLaunchParameters() {
}
TEST(LaunchControl, CompleteRun) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
initLaunchControl();

View File

@ -21,12 +21,11 @@ TEST(limp, testFatalError) {
}
TEST(limp, revLimit) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
engineConfiguration->rpmHardLimit = 2500;
LimpManager dut;
dut.inject();
// Under rev limit, inj/ign allowed
dut.updateState(2000, 0);
@ -45,13 +44,12 @@ TEST(limp, revLimit) {
}
TEST(limp, boostCut) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Cut above 100kPa
engineConfiguration->boostCutPressure = 100;
LimpManager dut;
dut.inject();
// Below threshold, injection allowed
Sensor::setMockValue(SensorType::Map, 80);
@ -78,11 +76,10 @@ TEST(limp, boostCut) {
extern int timeNowUs;
TEST(limp, oilPressureFailureCase) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
engineConfiguration->minOilPressureAfterStart = 200;
LimpManager dut;
dut.inject();
// Low oil pressure!
Sensor::setMockValue(SensorType::OilPressure, 50);
@ -112,11 +109,10 @@ TEST(limp, oilPressureFailureCase) {
}
TEST(limp, oilPressureSuccessCase) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
engineConfiguration->minOilPressureAfterStart = 200;
LimpManager dut;
dut.inject();
// Low oil pressure!
Sensor::setMockValue(SensorType::OilPressure, 50);

View File

@ -114,13 +114,13 @@ static void testExpression2(float selfValue, const char *line, float expected, E
ASSERT_TRUE(element != NULL) << "Not NULL expected";
LECalculator c;
EXPAND_Engine;
ASSERT_NEAR(expected, c.evaluate("test", selfValue, element), EPS4D) << line;
}
static void testExpression2(float selfValue, const char *line, float expected, const std::unordered_map<SensorType, float>& sensorVals = {}) {
WITH_ENGINE_TEST_HELPER_SENS(FORD_INLINE_6_1995, sensorVals);
EngineTestHelper eth(FORD_INLINE_6_1995, sensorVals);
testExpression2(selfValue, line, expected, engine);
}
@ -129,7 +129,7 @@ static void testExpression(const char *line, float expectedValue, const std::uno
}
TEST(fsio, testHysteresisSelf) {
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
EngineTestHelper eth(FORD_INLINE_6_1995);
LEElement thepool[TEST_POOL_SIZE];
LEElementPool pool(thepool, TEST_POOL_SIZE);
@ -234,7 +234,7 @@ TEST(fsio, testLogicExpressions) {
testExpression("fan NOT coolant 90 > AND fan coolant 85 > AND OR", 1, sensorVals);
{
WITH_ENGINE_TEST_HELPER_SENS(FORD_INLINE_6_1995, sensorVals);
EngineTestHelper eth(FORD_INLINE_6_1995, sensorVals);
LEElement thepool[TEST_POOL_SIZE];
LEElementPool pool(thepool, TEST_POOL_SIZE);
LEElement * element = pool.parseExpression("fan NOT coolant 90 > AND fan coolant 85 > AND OR");
@ -248,7 +248,7 @@ TEST(fsio, testLogicExpressions) {
}
{
WITH_ENGINE_TEST_HELPER_SENS(FORD_INLINE_6_1995, sensorVals);
EngineTestHelper eth(FORD_INLINE_6_1995, sensorVals);
engine->fsioState.mockRpm = 900;
engine->fsioState.mockCrankingRpm = 200;
testExpression2(0, "rpm", 900, engine);
@ -260,7 +260,7 @@ TEST(fsio, testLogicExpressions) {
TEST(fsio, fuelPump) {
// this will init fuel pump fsio logic
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Mock a fuel pump pin
CONFIG(fuelPumpPin) = GPIOA_0;

View File

@ -8,14 +8,14 @@
#include "pch.h"
TEST(sensors, vrThreshold) {
WITH_ENGINE_TEST_HELPER(HELLEN_128_MERCEDES_4_CYL);
EngineTestHelper eth(HELLEN_128_MERCEDES_4_CYL);
auto& cfg = CONFIG(vrThreshold)[0];
ASSERT_FLOAT_EQ(0.8 * PACK_PERCENT_BYTE_MULT, cfg.values[2]);
}
TEST(sensors, mapDecoding) {
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
EngineTestHelper eth(FORD_INLINE_6_1995);
air_pressure_sensor_config_s s;
s.type = MT_DENSO183;

View File

@ -9,7 +9,7 @@
TEST(start, startStop) {
std::unordered_map<SensorType, float> sensorVals = {{ SensorType::AcceleratorPedal, 0 }};
WITH_ENGINE_TEST_HELPER_SENS(PROTEUS_BMW_M73, sensorVals);
EngineTestHelper eth(PROTEUS_BMW_M73, sensorVals);
eth.moveTimeForwardAndInvokeEventsSec(1); // '0' time has special meaning for implementation so let's move forward
// this is a pull-up, so 'true' on start-up

View File

@ -77,7 +77,7 @@ TEST(ClosedLoopFuel, CellSelection) {
}
TEST(ClosedLoopFuel, afrLimits) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
engineConfiguration->stft.minAfr = 100; // 10.0 AFR
engineConfiguration->stft.maxAfr = 180; // 18.0 AFR

View File

@ -5,7 +5,7 @@ extern float getTachDuty(void);
TEST(tachometer, testPulsePerRev) {
// This engine has a tach pin set - we need that
WITH_ENGINE_TEST_HELPER(FRANKENSO_MAZDA_MIATA_2003);
EngineTestHelper eth(FRANKENSO_MAZDA_MIATA_2003);
// We don't actually care about ign/inj at all, just tach
engineConfiguration->isInjectionEnabled = false;

View File

@ -68,7 +68,7 @@ TEST(binary, testWriteCrc) {
}
TEST(TunerstudioCommands, writeChunkEngineConfig) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
MockTsChannel channel;
uint8_t* configBytes = reinterpret_cast<uint8_t*>(config);
@ -90,7 +90,7 @@ TEST(TunerstudioCommands, writeChunkEngineConfig) {
}
TEST(TunerstudioCommands, writeChunkOutsideEngineConfig) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
MockTsChannel channel;
uint8_t* configBytes = reinterpret_cast<uint8_t*>(config);

View File

@ -6,7 +6,7 @@ using ::testing::StrictMock;
using ::testing::Return;
TEST(Vvt, setpoint) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// Set up a mock target map
StrictMock<MockVp3d> targetMap;
@ -18,7 +18,6 @@ TEST(Vvt, setpoint) {
engine->rpmCalculator.mockRpm = 4321;
VvtController dut;
dut.inject();
dut.init(0, 0, 0, &targetMap);
// Test dut
@ -26,12 +25,11 @@ TEST(Vvt, setpoint) {
}
TEST(Vvt, observePlant) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
engine->triggerCentral.vvtPosition[0][0] = 23;
VvtController dut;
dut.inject();
dut.init(0, 0, 0, nullptr);
EXPECT_EQ(23, dut.observePlant().value_or(0));

View File

@ -9,7 +9,7 @@
TEST(sensors, test2jz) {
WITH_ENGINE_TEST_HELPER(TOYOTA_2JZ_GTE_VVTi);
EngineTestHelper eth(TOYOTA_2JZ_GTE_VVTi);
// this crank trigger would be easier to test, crank shape is less important for this test

View File

@ -13,7 +13,7 @@ extern WarningCodeState unitTestWarningCodeState;
extern WaveChart waveChart;
TEST(trigger, testNoStartUpWarningsNoSyncronizationTrigger) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// one tooth does not need synchronization it just counts tooth
eth.setTriggerType(TT_ONE);
ASSERT_EQ( 0, GET_RPM()) << "testNoStartUpWarnings RPM";
@ -24,7 +24,7 @@ TEST(trigger, testNoStartUpWarningsNoSyncronizationTrigger) {
}
TEST(trigger, testNoStartUpWarnings) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// for this test we need a trigger with isSynchronizationNeeded=true
engineConfiguration->trigger.customTotalToothCount = 3;
engineConfiguration->trigger.customSkippedToothCount = 1;
@ -59,7 +59,7 @@ TEST(trigger, testNoStartUpWarnings) {
}
TEST(trigger, testNoisyInput) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
ASSERT_EQ( 0, GET_RPM()) << "testNoisyInput RPM";
@ -81,7 +81,7 @@ TEST(trigger, testNoisyInput) {
TEST(trigger, testCamInput) {
// setting some weird engine
WITH_ENGINE_TEST_HELPER(FORD_ESCORT_GT);
EngineTestHelper eth(FORD_ESCORT_GT);
// changing to 'ONE TOOTH' trigger on CRANK with CAM/VVT
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
@ -122,7 +122,7 @@ TEST(trigger, testCamInput) {
}
TEST(trigger, testNB2CamInput) {
WITH_ENGINE_TEST_HELPER(FRANKENSO_MAZDA_MIATA_2003);
EngineTestHelper eth(FRANKENSO_MAZDA_MIATA_2003);
// this crank trigger would be easier to test, crank shape is less important for this test
eth.setTriggerType(TT_ONE);

View File

@ -7,7 +7,7 @@
#include "pch.h"
TEST(cranking, testFasterEngineSpinningUp) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
ENGINE(tdcMarkEnabled) = false;
// turn on FasterEngineSpinUp mode
engineConfiguration->isFasterEngineSpinUpEnabled = true;
@ -97,7 +97,7 @@ TEST(cranking, testFasterEngineSpinningUp) {
}
static void doTestFasterEngineSpinningUp60_2(int startUpDelayMs, int rpm1, int expectedRpm) {
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
// turn on FasterEngineSpinUp mode
engineConfiguration->isFasterEngineSpinUpEnabled = true;

View File

@ -9,13 +9,12 @@ using ::testing::InSequence;
TEST(injectionScheduling, NormalDutyCycle) {
StrictMock<MockExecutor> mockExec;
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
EngineTestHelper eth(TEST_ENGINE);
engine->executor.setMockExecutor(&mockExec);
efitick_t nowNt = 1000000;
InjectionEvent event;
event.inject();
InjectorOutputPin pin;
pin.injectorIndex = 0;
event.outputs[0] = &pin;

View File

@ -4,7 +4,7 @@
#include "trigger_emulator_algo.h"
TEST(miata, miata_na_tdc) {
WITH_ENGINE_TEST_HELPER(FRANKENSO_MIATA_NA6_MAP);
EngineTestHelper eth(FRANKENSO_MIATA_NA6_MAP);
#define TEST_REVOLUTIONS 6

View File

@ -22,7 +22,7 @@ public:
static void func(TriggerCallback *callback) {
int formIndex = callback->toothIndex % callback->form->getSize();
Engine *engine = callback->engine;
EXPAND_Engine;
int value = callback->form->wave->getChannelState(0, formIndex);
efitick_t nowNt = getTimeNowNt();
@ -72,7 +72,7 @@ TEST(nissan, vq_vvt) {
// hold a reference to the heap allocated scheduling events until the test is done
std::vector<std::shared_ptr<TriggerCallback>> ptrs;
WITH_ENGINE_TEST_HELPER (HELLEN_121_NISSAN_6_CYL);
EngineTestHelper eth (HELLEN_121_NISSAN_6_CYL);
engineConfiguration->isIgnitionEnabled = false;
engineConfiguration->isInjectionEnabled = false;

View File

@ -8,7 +8,7 @@
#include "pch.h"
TEST(subaru, overrideGap) {
WITH_ENGINE_TEST_HELPER(FRANKENSO_MIATA_NA6_MAP);
EngineTestHelper eth(FRANKENSO_MIATA_NA6_MAP);
CONFIG(overrideTriggerGaps) = true;
CONFIG(gapTrackingLengthOverride) = 2;

View File

@ -7,7 +7,7 @@
TEST(trigger, testQuadCam) {
// setting some weird engine
WITH_ENGINE_TEST_HELPER(FORD_ESCORT_GT);
EngineTestHelper eth(FORD_ESCORT_GT);
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);

View File

@ -15,7 +15,7 @@ TEST(cranking, realCrankingFromFile) {
int indeces[2] = {1, 0}; // this logic data file has first trigger channel in second column and second trigger channel in first column
reader.open("tests/trigger/resources/cranking_na_3.csv", indeces);
WITH_ENGINE_TEST_HELPER (FRANKENSO_MIATA_NA6_MAP);
EngineTestHelper eth (FRANKENSO_MIATA_NA6_MAP);
ssize_t read;

View File

@ -28,14 +28,14 @@ static void fireTriggerEvent(EngineTestHelper*eth, double timestampS, trigger_wh
}
Engine *engine = &eth->engine;
EXPAND_Engine;
timeNowUs = 1'000'000 * timestampS;
printf("MIATANA: posting time=%d event=%d\n", timeNowUs, event);
hwHandleShaftSignal((int)channel, !isFall, getTimeNowNt());
}
TEST(cranking, hardcodedRealCranking) {
WITH_ENGINE_TEST_HELPER(FRANKENSO_MIATA_NA6_VAF);
EngineTestHelper eth(FRANKENSO_MIATA_NA6_VAF);
#define EVENT(timestamp, channel, value) { fireTriggerEvent(&eth, timestamp, channel, value); }
@ -171,7 +171,7 @@ TEST(cranking, naCrankFromFile) {
int indeces[2] = {1, 0};
reader.open("tests/trigger/resources/cranking_na_4.csv", indeces);
WITH_ENGINE_TEST_HELPER(FRANKENSO_MIATA_NA6_VAF);
EngineTestHelper eth(FRANKENSO_MIATA_NA6_VAF);
while (reader.haveMore()) {
reader.processLine(&eth);

View File

@ -13,7 +13,7 @@ TEST(realCrankingVQ40, normalCranking) {
int indeces[] = {0};
reader.open("tests/trigger/resources/nissan_vq40_cranking-1.csv", indeces);
WITH_ENGINE_TEST_HELPER (HELLEN_121_NISSAN_6_CYL);
EngineTestHelper eth (HELLEN_121_NISSAN_6_CYL);
bool hasSeenFirstVvt = false;

Some files were not shown because too many files have changed in this diff Show More