refactoring
This commit is contained in:
parent
a57d7c48fb
commit
1c48a61339
|
@ -57,6 +57,8 @@ public:
|
|||
gear_e gearSelectorPosition;
|
||||
};
|
||||
|
||||
typedef cyclic_buffer<int, 8> warningBuffer_t;
|
||||
|
||||
class WarningCodeState {
|
||||
public:
|
||||
WarningCodeState();
|
||||
|
@ -67,7 +69,7 @@ public:
|
|||
int lastErrorCode;
|
||||
efitimesec_t timeOfPreviousWarning;
|
||||
// todo: we need a way to post multiple recent warnings into TS
|
||||
cyclic_buffer<int, 8> recentWarnings;
|
||||
warningBuffer_t recentWarnings;
|
||||
};
|
||||
|
||||
class FsioState {
|
||||
|
|
|
@ -46,6 +46,11 @@ EngineTestHelper::EngineTestHelper(engine_type_e engineType, const std::unordere
|
|||
: EngineTestHelper(engineType, &emptyCallbackWithConfiguration, sensorValues) {
|
||||
}
|
||||
|
||||
warningBuffer_t *EngineTestHelper::recentWarnings() {
|
||||
return &unitTestWarningCodeState.recentWarnings;
|
||||
}
|
||||
|
||||
|
||||
EngineTestHelper::EngineTestHelper(engine_type_e engineType, configuration_callback_t configurationCallback, const std::unordered_map<SensorType, float>& sensorValues) {
|
||||
Sensor::setMockValue(SensorType::Clt, 70);
|
||||
Sensor::setMockValue(SensorType::Iat, 30);
|
||||
|
|
|
@ -37,6 +37,8 @@ public:
|
|||
EngineTestHelper(engine_type_e engineType, configuration_callback_t boardCallback, const std::unordered_map<SensorType, float>& sensorValues);
|
||||
~EngineTestHelper();
|
||||
|
||||
warningBuffer_t *recentWarnings();
|
||||
|
||||
void applyTriggerWaveform();
|
||||
void setTriggerType(trigger_type_e trigger DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
/**
|
||||
|
|
|
@ -139,7 +139,6 @@ TEST(AirmassModes, VeOverride) {
|
|||
}
|
||||
|
||||
void setInjectionMode(int value DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
extern WarningCodeState unitTestWarningCodeState;
|
||||
|
||||
TEST(FuelMath, testDifferentInjectionModes) {
|
||||
WITH_ENGINE_TEST_HELPER(TEST_ENGINE);
|
||||
|
@ -163,7 +162,7 @@ TEST(FuelMath, testDifferentInjectionModes) {
|
|||
setInjectionMode((int)IM_SINGLE_POINT PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
engine->periodicFastCallback(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
EXPECT_FLOAT_EQ( 40, engine->injectionDuration) << "injection while IM_SINGLE_POINT";
|
||||
EXPECT_EQ( 0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testDifferentInjectionModes";
|
||||
EXPECT_EQ( 0, eth.recentWarnings()->getCount()) << "warningCounter#testDifferentInjectionModes";
|
||||
}
|
||||
|
||||
TEST(FuelMath, deadtime) {
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
#include "engine_test_helper.h"
|
||||
|
||||
extern WarningCodeState unitTestWarningCodeState;
|
||||
extern float getTachFreq(void);
|
||||
extern float getTachDuty(void);
|
||||
|
||||
|
|
|
@ -7,8 +7,6 @@
|
|||
|
||||
#include "engine_test_helper.h"
|
||||
|
||||
extern WarningCodeState unitTestWarningCodeState;
|
||||
|
||||
static void boardConfigurationForIssue898(engine_configuration_s *engineConfiguration) {
|
||||
setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR);
|
||||
engineConfiguration->trigger.type = TT_TOOTHED_WHEEL_60_2;
|
||||
|
@ -21,7 +19,7 @@ TEST(issues, issue898) {
|
|||
|
||||
ASSERT_EQ(TRUE, engine->triggerCentral.triggerShape.shapeDefinitionError) << "MRE_MIATA_NA6 shapeDefinitionError";
|
||||
|
||||
ASSERT_EQ( 2, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#testFuelSchedulerBug299smallAndMedium";
|
||||
ASSERT_EQ(CUSTOM_ERR_BOTH_FRONTS_REQUIRED, unitTestWarningCodeState.recentWarnings.get(0));
|
||||
ASSERT_EQ(CUSTOM_ERR_TRIGGER_SYNC, unitTestWarningCodeState.recentWarnings.get(1));
|
||||
ASSERT_EQ( 2, eth.recentWarnings()->getCount()) << "warningCounter#testFuelSchedulerBug299smallAndMedium";
|
||||
ASSERT_EQ(CUSTOM_ERR_BOTH_FRONTS_REQUIRED, eth.recentWarnings()->get(0));
|
||||
ASSERT_EQ(CUSTOM_ERR_TRIGGER_SYNC, eth.recentWarnings()->get(1));
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue