better test coverage

This commit is contained in:
Andrey 2021-06-24 23:38:16 -04:00
parent a39920b68e
commit 76840d07db
3 changed files with 6 additions and 1 deletions

View File

@ -50,6 +50,9 @@ warningBuffer_t *EngineTestHelper::recentWarnings() {
return &unitTestWarningCodeState.recentWarnings;
}
int EngineTestHelper::getWarningCounter() {
return unitTestWarningCodeState.warningCounter;
}
EngineTestHelper::EngineTestHelper(engine_type_e engineType, configuration_callback_t configurationCallback, const std::unordered_map<SensorType, float>& sensorValues) {
Sensor::setMockValue(SensorType::Clt, 70);

View File

@ -38,6 +38,7 @@ public:
~EngineTestHelper();
warningBuffer_t *recentWarnings();
int getWarningCounter();
void applyTriggerWaveform();
void setTriggerType(trigger_type_e trigger DECLARE_ENGINE_PARAMETER_SUFFIX);

View File

@ -34,7 +34,6 @@ static void fireTriggerEvent(EngineTestHelper*eth, double timestampS, trigger_wh
TEST(cranking, hardcodedRealCranking) {
WITH_ENGINE_TEST_HELPER(MIATA_NA6_VAF);
unitTestWarningCodeState.clear();
#define EVENT(timestamp, channel, value) { fireTriggerEvent(&eth, timestamp, channel, value); }
@ -76,7 +75,9 @@ TEST(cranking, hardcodedRealCranking) {
/* 27 */ EVENT(/* timestamp*/1.511785, T_SECONDARY, /*value*/true);
/* 28 */ EVENT(/* timestamp*/1.5908545, T_SECONDARY, /*value*/false);
/* 31 */ EVENT(/* timestamp*/1.6399845, T_SECONDARY, /*value*/true);
ASSERT_EQ( 1, eth.getWarningCounter()) << "warningCounter#realCranking";
/* 32 */ EVENT(/* timestamp*/1.70975875, T_PRIMARY, /*value*/true);
ASSERT_EQ( 2, eth.getWarningCounter()) << "warningCounter#realCranking";
/* 33 */ EVENT(/* timestamp*/1.7194455, T_SECONDARY, /*value*/false);
/* 36 */ EVENT(/* timestamp*/1.7697125, T_SECONDARY, /*value*/true);
/* 37 */ EVENT(/* timestamp*/1.817179, T_PRIMARY, /*value*/true);