reducing global variables in tests

This commit is contained in:
rusefi 2019-01-10 23:24:36 -05:00
parent 1defa2551e
commit e7ee023d2d
5 changed files with 5 additions and 9 deletions

View File

@ -23,6 +23,9 @@ extern engine_configuration_s activeConfiguration;
EngineTestHelper::EngineTestHelper(engine_type_e engineType) : engine (&persistentConfig) {
unitTestWarningCounter = 0;
// todo: make this not a global variable, we need currentTimeProvider interface on engine
timeNowUs = 0;
testMafValue = 0;
memset(&activeConfiguration, 0, sizeof(activeConfiguration));

View File

@ -70,7 +70,6 @@ GTEST_API_ int main(int argc, char **argv) {
/**
* Larger-scale engine control
*/
testMissedSpark299();
testSparkReverseOrderBug319();
testFuelSchedulerBug299smallAndLarge();
testFuelSchedulerBug299smallAndMedium();

View File

@ -301,7 +301,6 @@ extern EnginePins enginePins;
void testRpmCalculator(void) {
printf("*************************************************** testRpmCalculator\r\n");
timeNowUs = 0;
EngineTestHelper eth(FORD_INLINE_6_1995);
EXPAND_EngineTestHelper;
@ -320,7 +319,7 @@ void testRpmCalculator(void) {
setFlatInjectorLag(0 PASS_CONFIG_PARAMETER_SUFFIX);
engine->updateSlowSensors(PASS_ENGINE_PARAMETER_SIGNATURE);
timeNowUs = 0;
assertEquals(0, engine->rpmCalculator.getRpm(PASS_ENGINE_PARAMETER_SIGNATURE));
// triggerIndexByAngle update is now fixed! prepareOutputSignals() wasn't reliably called
@ -1170,11 +1169,8 @@ void testSparkReverseOrderBug319(void) {
eth.applyTriggerShape();
eth.engine.periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
timeNowUs = 0;
setWholeTimingTable(0);
eth.fireRise(20);
eth.fireFall(20);
@ -1251,7 +1247,7 @@ void testSparkReverseOrderBug319(void) {
assertEqualsM("out-of-order #8", 0, enginePins.coils[3].outOfOrder);
}
void testMissedSpark299(void) {
TEST(big, testMissedSpark299) {
printf("*************************************************** testMissedSpark299\r\n");
EngineTestHelper eth(TEST_ENGINE);

View File

@ -15,7 +15,6 @@ void testFuelSchedulerBug299smallAndMedium(void);
void testFuelSchedulerBug299smallAndLarge(void);
void testDifferentInjectionModes(void);
void testSparkReverseOrderBug319(void);
void testMissedSpark299(void);
void testRpmCalculator(void);
void testStartupFuelPumping(void);
void test1995FordInline6TriggerDecoder(void);

View File

@ -172,7 +172,6 @@ static void testNoiselessDecoderProcedure(EngineTestHelper &eth, int errorTolera
void testNoiselessDecoder(void) {
printf("====================================================================================== testNoiselessDecoder\r\n");
timeNowUs = 0;
EngineTestHelper eth(TEST_ENGINE);
EXPAND_EngineTestHelper