mirror of https://github.com/rusefi/rusefi-1.git
reducing global variables in tests
This commit is contained in:
parent
1defa2551e
commit
e7ee023d2d
|
@ -23,6 +23,9 @@ extern engine_configuration_s activeConfiguration;
|
||||||
EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persistentConfig) {
|
EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persistentConfig) {
|
||||||
unitTestWarningCounter = 0;
|
unitTestWarningCounter = 0;
|
||||||
|
|
||||||
|
// todo: make this not a global variable, we need currentTimeProvider interface on engine
|
||||||
|
timeNowUs = 0;
|
||||||
|
|
||||||
testMafValue = 0;
|
testMafValue = 0;
|
||||||
memset(&activeConfiguration, 0, sizeof(activeConfiguration));
|
memset(&activeConfiguration, 0, sizeof(activeConfiguration));
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,6 @@ GTEST_API_ int main(int argc, char **argv) {
|
||||||
/**
|
/**
|
||||||
* Larger-scale engine control
|
* Larger-scale engine control
|
||||||
*/
|
*/
|
||||||
testMissedSpark299();
|
|
||||||
testSparkReverseOrderBug319();
|
testSparkReverseOrderBug319();
|
||||||
testFuelSchedulerBug299smallAndLarge();
|
testFuelSchedulerBug299smallAndLarge();
|
||||||
testFuelSchedulerBug299smallAndMedium();
|
testFuelSchedulerBug299smallAndMedium();
|
||||||
|
|
|
@ -301,7 +301,6 @@ extern EnginePins enginePins;
|
||||||
|
|
||||||
void testRpmCalculator(void) {
|
void testRpmCalculator(void) {
|
||||||
printf("*************************************************** testRpmCalculator\r\n");
|
printf("*************************************************** testRpmCalculator\r\n");
|
||||||
timeNowUs = 0;
|
|
||||||
|
|
||||||
EngineTestHelper eth(FORD_INLINE_6_1995);
|
EngineTestHelper eth(FORD_INLINE_6_1995);
|
||||||
EXPAND_EngineTestHelper;
|
EXPAND_EngineTestHelper;
|
||||||
|
@ -320,7 +319,7 @@ void testRpmCalculator(void) {
|
||||||
setFlatInjectorLag(0 PASS_CONFIG_PARAMETER_SUFFIX);
|
setFlatInjectorLag(0 PASS_CONFIG_PARAMETER_SUFFIX);
|
||||||
|
|
||||||
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
|
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
timeNowUs = 0;
|
|
||||||
assertEquals(0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
assertEquals(0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
|
||||||
|
|
||||||
// triggerIndexByAngle update is now fixed! prepareOutputSignals() wasn't reliably called
|
// triggerIndexByAngle update is now fixed! prepareOutputSignals() wasn't reliably called
|
||||||
|
@ -1170,11 +1169,8 @@ void testSparkReverseOrderBug319(void) {
|
||||||
eth.applyTriggerShape();
|
eth.applyTriggerShape();
|
||||||
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||||
|
|
||||||
|
|
||||||
timeNowUs = 0;
|
|
||||||
setWholeTimingTable(0);
|
setWholeTimingTable(0);
|
||||||
|
|
||||||
|
|
||||||
eth.fireRise(20);
|
eth.fireRise(20);
|
||||||
eth.fireFall(20);
|
eth.fireFall(20);
|
||||||
|
|
||||||
|
@ -1251,7 +1247,7 @@ void testSparkReverseOrderBug319(void) {
|
||||||
assertEqualsM("out-of-order #8", 0, enginePins.coils[3].outOfOrder);
|
assertEqualsM("out-of-order #8", 0, enginePins.coils[3].outOfOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void testMissedSpark299(void) {
|
TEST(big, testMissedSpark299) {
|
||||||
printf("*************************************************** testMissedSpark299\r\n");
|
printf("*************************************************** testMissedSpark299\r\n");
|
||||||
|
|
||||||
EngineTestHelper eth(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
|
|
|
@ -15,7 +15,6 @@ void testFuelSchedulerBug299smallAndMedium(void);
|
||||||
void testFuelSchedulerBug299smallAndLarge(void);
|
void testFuelSchedulerBug299smallAndLarge(void);
|
||||||
void testDifferentInjectionModes(void);
|
void testDifferentInjectionModes(void);
|
||||||
void testSparkReverseOrderBug319(void);
|
void testSparkReverseOrderBug319(void);
|
||||||
void testMissedSpark299(void);
|
|
||||||
void testRpmCalculator(void);
|
void testRpmCalculator(void);
|
||||||
void testStartupFuelPumping(void);
|
void testStartupFuelPumping(void);
|
||||||
void test1995FordInline6TriggerDecoder(void);
|
void test1995FordInline6TriggerDecoder(void);
|
||||||
|
|
|
@ -172,7 +172,6 @@ static void testNoiselessDecoderProcedure(EngineTestHelper ð, int errorTolera
|
||||||
|
|
||||||
void testNoiselessDecoder(void) {
|
void testNoiselessDecoder(void) {
|
||||||
printf("====================================================================================== testNoiselessDecoder\r\n");
|
printf("====================================================================================== testNoiselessDecoder\r\n");
|
||||||
timeNowUs = 0;
|
|
||||||
|
|
||||||
EngineTestHelper eth(TEST_ENGINE);
|
EngineTestHelper eth(TEST_ENGINE);
|
||||||
EXPAND_EngineTestHelper
|
EXPAND_EngineTestHelper
|
||||||
|
|
Loading…
Reference in New Issue