tests: reducing code duplication
This commit is contained in:
parent
ba3ebfb477
commit
082e7d268d
|
@ -97,6 +97,9 @@ class Engine;
|
|||
Engine *engine = ð.engine; \
|
||||
EXPAND_Engine
|
||||
|
||||
#define WITH_ENGINE_TEST_HELPER(x) EngineTestHelper eth(x); \
|
||||
EXPAND_EngineTestHelper;
|
||||
|
||||
#define CONFIG(x) engineConfiguration->x
|
||||
// todo: fix this! this does not work because of 'prepareVoidConfiguration(&activeConfiguration);'
|
||||
//#define CONFIGB(x) engine->engineConfigurationPtr->bc.x
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
TEST(big, testAccelEnrichment) {
|
||||
printf("====================================================================================== testAccelEnrichment\r\n");
|
||||
|
||||
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
||||
|
||||
engine->rpmCalculator.setRpmValue(600 PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
|
||||
TEST(misc, testIgnitionPlanning) {
|
||||
printf("*************************************************** testIgnitionPlanning\r\n");
|
||||
EngineTestHelper eth(FORD_ESCORT_GT);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_ESCORT_GT);
|
||||
|
||||
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
assertEqualsM("testIgnitionPlanning_AFR", 13.5, eth.engine.engineState.targetAFR);
|
||||
|
@ -28,8 +27,7 @@ TEST(misc, testIgnitionPlanning) {
|
|||
TEST(misc, testEngineMath) {
|
||||
printf("*************************************************** testEngineMath\r\n");
|
||||
|
||||
EngineTestHelper eth(FORD_ESCORT_GT);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_ESCORT_GT);
|
||||
|
||||
engineConfiguration->operationMode = FOUR_STROKE_CAM_SENSOR;
|
||||
|
||||
|
@ -88,8 +86,7 @@ TEST(misc, testIgnitionMapGenerator) {
|
|||
TEST(misc, testMafLookup) {
|
||||
printf("*************************************************** testMafLookup\r\n");
|
||||
|
||||
EngineTestHelper eth(FORD_ESCORT_GT);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_ESCORT_GT);
|
||||
|
||||
setBosch0280218037(config);
|
||||
engine->preCalculate(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
TEST(sensors, testFasterEngineSpinningUp) {
|
||||
printf("*************************************************** testFasterEngineSpinningUp\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
EXPAND_EngineTestHelper
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
// turn on FasterEngineSpinUp mode
|
||||
engineConfiguration->bc.isFasterEngineSpinUpEnabled = true;
|
||||
eth.firePrimaryTriggerRise();
|
||||
|
|
|
@ -20,8 +20,7 @@ extern float testMafValue;
|
|||
|
||||
TEST(misc, testMafFuelMath) {
|
||||
printf("====================================================================================== testMafFuelMath\r\n");
|
||||
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
||||
|
||||
engineConfiguration->fuelAlgorithm = LM_REAL_MAF;
|
||||
engineConfiguration->injector.flow = 200;
|
||||
|
@ -36,8 +35,7 @@ TEST(misc, testFuelMap) {
|
|||
printf("====================================================================================== testFuelMap\r\n");
|
||||
|
||||
printf("Setting up FORD_ASPIRE_1996\r\n");
|
||||
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
||||
|
||||
printf("Filling fuel map\r\n");
|
||||
for (int k = 0; k < FUEL_LOAD_COUNT; k++) {
|
||||
|
@ -164,8 +162,7 @@ static void confgiureFordAspireTriggerShape(TriggerShape * s) {
|
|||
TEST(misc, testAngleResolver) {
|
||||
printf("*************************************************** testAngleResolver\r\n");
|
||||
|
||||
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
||||
|
||||
engineConfiguration->globalTriggerAngleOffset = 175;
|
||||
|
||||
|
|
|
@ -95,8 +95,7 @@ static void testExpression2(float selfValue, const char *line, float expected) {
|
|||
ASSERT_TRUE(element != NULL) << "Not NULL expected";
|
||||
LECalculator c;
|
||||
|
||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
|
||||
|
||||
assertEqualsM(line, expected, c.getValue2(selfValue, element PASS_ENGINE_PARAMETER_SUFFIX));
|
||||
}
|
||||
|
@ -110,8 +109,7 @@ TEST(misc, testLogicExpressions) {
|
|||
|
||||
testParsing();
|
||||
|
||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
|
||||
|
||||
LECalculator c;
|
||||
|
||||
|
|
|
@ -14,8 +14,7 @@
|
|||
|
||||
TEST(maf2map, util) {
|
||||
|
||||
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
||||
|
||||
engineConfiguration->fuelAlgorithm = LM_REAL_MAF;
|
||||
|
||||
|
@ -26,6 +25,6 @@ TEST(maf2map, util) {
|
|||
|
||||
TEST(maf2map, integrated) {
|
||||
|
||||
EngineTestHelper eth(MIATA_NA6_VAF);
|
||||
WITH_ENGINE_TEST_HELPER(MIATA_NA6_VAF);
|
||||
|
||||
}
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
static ThermistorConf tc;
|
||||
|
||||
TEST(sensors, mapDecoding) {
|
||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
|
||||
|
||||
air_pressure_sensor_config_s s;
|
||||
s.type = MT_DENSO183;
|
||||
|
@ -30,8 +29,7 @@ TEST(sensors, mapDecoding) {
|
|||
TEST(sensors, tps) {
|
||||
print("************************************************** testTps\r\n");
|
||||
|
||||
EngineTestHelper eth(DODGE_RAM);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(DODGE_RAM);
|
||||
|
||||
engineConfiguration->tpsMax = 193;
|
||||
engineConfiguration->tpsMin = 43;
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
|
||||
TEST(big, testSpeedDensity) {
|
||||
printf("*************************************************** testSpeedDensity\r\n");
|
||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
|
||||
|
||||
engineConfiguration->trigger.customTotalToothCount = 8;
|
||||
eth.applyTriggerShape();
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
|
||||
printf("*************************************************** testPlainCrankingWithoutAdvancedFeatures\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
EXPAND_EngineTestHelper
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
|
||||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
||||
ASSERT_EQ( 0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE)) << "RPM=0";
|
||||
|
@ -34,8 +33,7 @@ TEST(engine, testPlainCrankingWithoutAdvancedFeatures) {
|
|||
TEST(engine, testStartOfCrankingPrimingPulse) {
|
||||
printf("*************************************************** testStartOfCrankingPrimingPulse\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
EXPAND_EngineTestHelper
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
|
||||
engineConfiguration->startOfCrankingPrimingPulse = 4;
|
||||
|
||||
|
|
|
@ -46,8 +46,7 @@ void sendOutConfirmation(char *value, int i) {
|
|||
}
|
||||
|
||||
static int getTriggerZeroEventIndex(engine_type_e engineType) {
|
||||
EngineTestHelper eth(engineType);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(engineType);
|
||||
|
||||
initDataStructures(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
|
@ -61,8 +60,7 @@ static void testDodgeNeonDecoder(void) {
|
|||
|
||||
ASSERT_EQ( 8, getTriggerZeroEventIndex(DODGE_NEON_1995)) << "DODGE_NEON_1995: trigger zero index";
|
||||
|
||||
EngineTestHelper eth(DODGE_NEON_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(DODGE_NEON_1995);
|
||||
|
||||
TriggerShape * shape = ð.engine.triggerCentral.triggerShape;
|
||||
ASSERT_EQ(8, shape->getTriggerShapeSynchPointIndex());
|
||||
|
@ -114,8 +112,7 @@ static void assertTriggerPosition(event_trigger_position_s *position, int eventI
|
|||
TEST(misc, testSomethingWeird) {
|
||||
printf("*************************************************** testSomethingWeird\r\n");
|
||||
|
||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
|
||||
|
||||
TriggerState state_;
|
||||
TriggerState *sta = &state_;
|
||||
|
@ -154,8 +151,7 @@ TEST(misc, test1995FordInline6TriggerDecoder) {
|
|||
|
||||
ASSERT_EQ( 0, getTriggerZeroEventIndex(FORD_INLINE_6_1995)) << "triggerIndex ";
|
||||
|
||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
|
||||
|
||||
TriggerShape * shape = &engine->triggerCentral.triggerShape;
|
||||
|
||||
|
@ -197,8 +193,7 @@ TEST(misc, testFordAspire) {
|
|||
|
||||
ASSERT_EQ( 4, getTriggerZeroEventIndex(FORD_ASPIRE_1996)) << "getTriggerZeroEventIndex";
|
||||
|
||||
EngineTestHelper eth(FORD_ASPIRE_1996);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_ASPIRE_1996);
|
||||
|
||||
ASSERT_EQ( 4, TRIGGER_SHAPE(getTriggerShapeSynchPointIndex())) << "getTriggerShapeSynchPointIndex";
|
||||
|
||||
|
@ -220,8 +215,7 @@ TEST(misc, testFordAspire) {
|
|||
static void testTriggerDecoder2(const char *msg, engine_type_e type, int synchPointIndex, float channel1duty, float channel2duty) {
|
||||
printf("====================================================================================== testTriggerDecoder2 msg=%s\r\n", msg);
|
||||
|
||||
EngineTestHelper eth(type);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(type);
|
||||
|
||||
TriggerShape *t = &ENGINE(triggerCentral.triggerShape);
|
||||
|
||||
|
@ -242,8 +236,7 @@ static void testTriggerDecoder3(const char *msg, engine_type_e type, int synchPo
|
|||
|
||||
TEST(misc, testStartupFuelPumping) {
|
||||
printf("*************************************************** testStartupFuelPumping\r\n");
|
||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
|
||||
|
||||
StartupFuelPumping sf;
|
||||
|
||||
|
@ -295,8 +288,7 @@ extern EnginePins enginePins;
|
|||
TEST(misc, testRpmCalculator) {
|
||||
printf("*************************************************** testRpmCalculator\r\n");
|
||||
|
||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(FORD_INLINE_6_1995);
|
||||
IgnitionEventList *ilist = &engine->ignitionEvents;
|
||||
ASSERT_EQ( 0, ilist->isReady) << "size #1";
|
||||
|
||||
|
@ -507,8 +499,7 @@ TEST(misc, testTriggerDecoder) {
|
|||
|
||||
testTriggerDecoder2("testMitsu", MITSU_4G93, 0, 0.3553, 0.3752);
|
||||
{
|
||||
EngineTestHelper eth(MITSU_4G93);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(MITSU_4G93);
|
||||
|
||||
|
||||
// TriggerShape *t = ð.engine.triggerShape;
|
||||
|
@ -551,8 +542,7 @@ TEST(misc, testTriggerDecoder) {
|
|||
{
|
||||
printTriggerDebug = true;
|
||||
|
||||
EngineTestHelper eth(DODGE_NEON_2003_CAM);
|
||||
EXPAND_EngineTestHelper;
|
||||
WITH_ENGINE_TEST_HELPER(DODGE_NEON_2003_CAM);
|
||||
|
||||
printf("!!!!!!!!!!!!!!!!!! Now trying with only rising edges !!!!!!!!!!!!!!!!!\r\n");
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
|
@ -704,8 +694,7 @@ static void assertInjectors(const char *msg, int value0, int value1) {
|
|||
TEST(big, testFuelSchedulerBug299smallAndMedium) {
|
||||
printf("*************************************************** testFuelSchedulerBug299 small to medium\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
EXPAND_EngineTestHelper
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
setTestBug299(ð);
|
||||
|
||||
FuelSchedule * t;
|
||||
|
@ -956,8 +945,7 @@ static void setInjectionMode(int value DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
TEST(big, testDifferentInjectionModes) {
|
||||
printf("*************************************************** testDifferentInjectionModes\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
EXPAND_EngineTestHelper
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
setTestBug299(ð);
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#0";
|
||||
|
||||
|
@ -988,8 +976,7 @@ TEST(big, testDifferentInjectionModes) {
|
|||
TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
||||
printf("*************************************************** testFuelSchedulerBug299 small to large\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
EXPAND_EngineTestHelper
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
setTestBug299(ð);
|
||||
ASSERT_EQ( 4, engine->executor.size()) << "Lqs#0";
|
||||
|
||||
|
@ -1101,8 +1088,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
TEST(big, testSparkReverseOrderBug319) {
|
||||
printf("*************************************************** testSparkReverseOrderBug319 small to medium\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
EXPAND_EngineTestHelper
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = false;
|
||||
engineConfiguration->isInjectionEnabled = false;
|
||||
|
@ -1208,8 +1194,7 @@ TEST(big, testSparkReverseOrderBug319) {
|
|||
TEST(big, testMissedSpark299) {
|
||||
printf("*************************************************** testMissedSpark299\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
EXPAND_EngineTestHelper
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = false;
|
||||
setupSimpleTestEngineWithMafAndTT_ONE_trigger(ð);
|
||||
|
|
|
@ -170,8 +170,7 @@ static void testNoiselessDecoderProcedure(EngineTestHelper ð, int errorTolera
|
|||
TEST(big, testNoiselessDecoder) {
|
||||
printf("====================================================================================== testNoiselessDecoder\r\n");
|
||||
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
EXPAND_EngineTestHelper
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
|
||||
engineConfiguration->ignitionMode = IM_WASTED_SPARK;
|
||||
engineConfiguration->useOnlyRisingEdgeForTrigger = true;
|
||||
|
|
Loading…
Reference in New Issue