refactoring: moving field
This commit is contained in:
parent
d51511a15e
commit
feb386a54b
|
@ -12,8 +12,8 @@
|
|||
using ::testing::_;
|
||||
|
||||
// Define some helpers for not-cut and cut
|
||||
#define EXPECT_NORMAL() EXPECT_FLOAT_EQ(normalInjDuration, engine->injectionDuration)
|
||||
#define EXPECT_CUT() EXPECT_FLOAT_EQ(0, engine->injectionDuration)
|
||||
#define EXPECT_NORMAL() EXPECT_FLOAT_EQ(normalInjDuration, engine->engineState.injectionDuration)
|
||||
#define EXPECT_CUT() EXPECT_FLOAT_EQ(0, engine->engineState.injectionDuration)
|
||||
|
||||
TEST(fuelCut, coasting) {
|
||||
EngineTestHelper eth(TEST_ENGINE);
|
||||
|
|
|
@ -174,19 +174,19 @@ TEST(FuelMath, testDifferentInjectionModes) {
|
|||
|
||||
setInjectionMode((int)IM_BATCH);
|
||||
engine->periodicFastCallback();
|
||||
EXPECT_FLOAT_EQ( 20, engine->injectionDuration) << "injection while batch";
|
||||
EXPECT_FLOAT_EQ( 20, engine->engineState.injectionDuration) << "injection while batch";
|
||||
|
||||
setInjectionMode((int)IM_SIMULTANEOUS);
|
||||
engine->periodicFastCallback();
|
||||
EXPECT_FLOAT_EQ( 10, engine->injectionDuration) << "injection while simultaneous";
|
||||
EXPECT_FLOAT_EQ( 10, engine->engineState.injectionDuration) << "injection while simultaneous";
|
||||
|
||||
setInjectionMode((int)IM_SEQUENTIAL);
|
||||
engine->periodicFastCallback();
|
||||
EXPECT_FLOAT_EQ( 40, engine->injectionDuration) << "injection while IM_SEQUENTIAL";
|
||||
EXPECT_FLOAT_EQ( 40, engine->engineState.injectionDuration) << "injection while IM_SEQUENTIAL";
|
||||
|
||||
setInjectionMode((int)IM_SINGLE_POINT);
|
||||
engine->periodicFastCallback();
|
||||
EXPECT_FLOAT_EQ( 40, engine->injectionDuration) << "injection while IM_SINGLE_POINT";
|
||||
EXPECT_FLOAT_EQ( 40, engine->engineState.injectionDuration) << "injection while IM_SINGLE_POINT";
|
||||
EXPECT_EQ( 0, eth.recentWarnings()->getCount()) << "warningCounter#testDifferentInjectionModes";
|
||||
}
|
||||
|
||||
|
@ -200,14 +200,14 @@ TEST(FuelMath, deadtime) {
|
|||
|
||||
// First test with no deadtime
|
||||
engine->periodicFastCallback();
|
||||
EXPECT_FLOAT_EQ( 20, engine->injectionDuration);
|
||||
EXPECT_FLOAT_EQ( 20, engine->engineState.injectionDuration);
|
||||
|
||||
// Now add some deadtime
|
||||
setArrayValues(engineConfiguration->injector.battLagCorr, 2.0f);
|
||||
|
||||
// Should have deadtime now!
|
||||
engine->periodicFastCallback();
|
||||
EXPECT_FLOAT_EQ( 20 + 2, engine->injectionDuration);
|
||||
EXPECT_FLOAT_EQ( 20 + 2, engine->engineState.injectionDuration);
|
||||
}
|
||||
|
||||
TEST(FuelMath, CylinderFuelTrim) {
|
||||
|
|
|
@ -307,7 +307,7 @@ TEST(misc, testRpmCalculator) {
|
|||
|
||||
ASSERT_NEAR(engine->engineState.timingAdvance[0], 707, 0.1f);
|
||||
|
||||
assertEqualsM("fuel #1", 4.5450, engine->injectionDuration);
|
||||
assertEqualsM("fuel #1", 4.5450, engine->engineState.injectionDuration);
|
||||
InjectionEvent *ie0 = &engine->injectionEvents.elements[0];
|
||||
assertEqualsM("injection angle", 499.095, ie0->injectionStartAngle);
|
||||
|
||||
|
@ -315,7 +315,7 @@ TEST(misc, testRpmCalculator) {
|
|||
ASSERT_EQ(1500, Sensor::getOrZero(SensorType::Rpm));
|
||||
|
||||
assertEqualsM("dwell", 4.5, engine->engineState.dwellAngle);
|
||||
assertEqualsM("fuel #2", 4.5450, engine->injectionDuration);
|
||||
assertEqualsM("fuel #2", 4.5450, engine->engineState.injectionDuration);
|
||||
assertEqualsM("one degree", 111.1111, engine->rpmCalculator.oneDegreeUs);
|
||||
ASSERT_EQ( 1, ilist->isReady) << "size #2";
|
||||
ASSERT_EQ( 0, ilist->elements[0].dwellPosition.triggerEventIndex) << "dwell @ index";
|
||||
|
@ -365,7 +365,7 @@ TEST(misc, testRpmCalculator) {
|
|||
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);
|
||||
assertEqualsM("fuel #3", 4.5450, eth.engine.engineState.injectionDuration);
|
||||
ASSERT_EQ(1500, Sensor::getOrZero(SensorType::Rpm));
|
||||
|
||||
|
||||
|
@ -616,7 +616,7 @@ static void setTestBug299(EngineTestHelper *eth) {
|
|||
|
||||
ASSERT_EQ( 3000, round(Sensor::getOrZero(SensorType::Rpm))) << "setTestBug299: RPM";
|
||||
|
||||
assertEqualsM("fuel#1", 1.5, engine->injectionDuration);
|
||||
assertEqualsM("fuel#1", 1.5, engine->engineState.injectionDuration);
|
||||
assertEqualsM("duty for maf=0", 7.5, getInjectorDutyCycle(round(Sensor::getOrZero(SensorType::Rpm))));
|
||||
}
|
||||
|
||||
|
@ -646,7 +646,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
|||
|
||||
engine->periodicFastCallback();
|
||||
|
||||
engine->injectionDuration = 12.5f;
|
||||
engine->engineState.injectionDuration = 12.5f;
|
||||
// Injection duration of 12.5ms
|
||||
MockInjectorModel2 im;
|
||||
EXPECT_CALL(im, getInjectionDuration(_)).WillRepeatedly(Return(12.5f));
|
||||
|
@ -806,7 +806,7 @@ void doTestFuelSchedulerBug299smallAndMedium(int startUpDelayMs) {
|
|||
assertInjectionEvent("#2#", &t->elements[2], 0, 1, 135 + 540);
|
||||
assertInjectionEvent("#3#", &t->elements[3], 1, 0, 135);
|
||||
|
||||
engine->injectionDuration = 17.5;
|
||||
engine->engineState.injectionDuration = 17.5;
|
||||
// Injection duration of 17.5ms
|
||||
MockInjectorModel2 im2;
|
||||
EXPECT_CALL(im2, getInjectionDuration(_)).WillRepeatedly(Return(17.5f));
|
||||
|
@ -944,7 +944,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
|
||||
engine->periodicFastCallback();
|
||||
|
||||
engine->injectionDuration = 17.5f;
|
||||
engine->engineState.injectionDuration = 17.5f;
|
||||
// Injection duration of 17.5ms
|
||||
MockInjectorModel2 im;
|
||||
EXPECT_CALL(im, getInjectionDuration(_)).WillRepeatedly(Return(17.5f));
|
||||
|
@ -1012,7 +1012,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
|
|||
engine->periodicFastCallback();
|
||||
|
||||
// Injection duration of 2ms
|
||||
engine->injectionDuration = 2.0f;
|
||||
engine->engineState.injectionDuration = 2.0f;
|
||||
MockInjectorModel2 im2;
|
||||
EXPECT_CALL(im2, getInjectionDuration(_)).WillRepeatedly(Return(2.0f));
|
||||
engine->module<InjectorModel>().set(&im2);
|
||||
|
|
Loading…
Reference in New Issue