tests: moving away from global timeNowUs

This commit is contained in:
rusefi 2019-01-19 20:34:28 -05:00
parent beb84cfff9
commit ba3ebfb477
3 changed files with 4 additions and 9 deletions

View File

@ -7,8 +7,6 @@
#include "engine_math.h" #include "engine_math.h"
#include "engine_test_helper.h" #include "engine_test_helper.h"
extern int timeNowUs;
TEST(sensors, testFasterEngineSpinningUp) { TEST(sensors, testFasterEngineSpinningUp) {
printf("*************************************************** testFasterEngineSpinningUp\r\n"); printf("*************************************************** testFasterEngineSpinningUp\r\n");
@ -81,7 +79,7 @@ TEST(sensors, testFasterEngineSpinningUp) {
eth.fireFall(60); eth.fireFall(60);
eth.clearQueue(); eth.clearQueue();
timeStartUs = timeNowUs; timeStartUs = eth.getTimeNowUs();
eth.fireTriggerEventsWithDuration(60); eth.fireTriggerEventsWithDuration(60);
// check if the mode is now changed to 'running' at higher RPM // check if the mode is now changed to 'running' at higher RPM

View File

@ -9,8 +9,6 @@
#include "event_queue.h" #include "event_queue.h"
#include "tps.h" #include "tps.h"
extern int timeNowUs;
TEST(fuelCut, coasting) { TEST(fuelCut, coasting) {
printf("*************************************************** testCoastingFuelCut\r\n"); printf("*************************************************** testCoastingFuelCut\r\n");

View File

@ -31,7 +31,6 @@
#include "spark_logic.h" #include "spark_logic.h"
#include "trigger_universal.h" #include "trigger_universal.h"
extern int timeNowUs;
extern float mockMapValue; extern float mockMapValue;
extern float testMafValue; extern float testMafValue;
extern WarningCodeState unitTestWarningCodeState; extern WarningCodeState unitTestWarningCodeState;
@ -1032,11 +1031,11 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
// assertInjectorDownEvent("L04@8", 8, MS2US(50.0), 0); // assertInjectorDownEvent("L04@8", 8, MS2US(50.0), 0);
engine->executor.executeAll(timeNowUs + 1); engine->executor.executeAll(eth.getTimeNowUs() + 1);
// injector goes high... // injector goes high...
ASSERT_FALSE(enginePins.injectors[0].currentLogicValue) << "injector@1"; ASSERT_FALSE(enginePins.injectors[0].currentLogicValue) << "injector@1";
engine->executor.executeAll(timeNowUs + MS2US(17.5) + 1); engine->executor.executeAll(eth.getTimeNowUs() + MS2US(17.5) + 1);
// injector does not go low too soon, that's a feature :) // injector does not go low too soon, that's a feature :)
ASSERT_TRUE(enginePins.injectors[0].currentLogicValue) << "injector@2"; ASSERT_TRUE(enginePins.injectors[0].currentLogicValue) << "injector@2";
@ -1052,7 +1051,7 @@ TEST(big, testFuelSchedulerBug299smallAndLarge) {
//todo assertInjectorDownEvent("L015@5", 5, MS2US(30), 0); //todo assertInjectorDownEvent("L015@5", 5, MS2US(30), 0);
engine->executor.executeAll(timeNowUs + MS2US(10) + 1); engine->executor.executeAll(eth.getTimeNowUs() + MS2US(10) + 1);
// end of combined injection // end of combined injection
ASSERT_FALSE(enginePins.injectors[0].currentLogicValue) << "injector@3"; ASSERT_FALSE(enginePins.injectors[0].currentLogicValue) << "injector@3";