LCOV - code coverage report
Current view: top level - unit_tests/tests/ignition_injection - test_dwell_corner_case_issue_796.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 12 12 100.0 %
Date: 2024-04-25 02:23:43 Functions: 4 4 100.0 %

          Line data    Source code
       1             : /*
       2             :  * test_dwell_corner_case_issue_796.cpp
       3             :  *
       4             :  *  Created on: Jul 1, 2019
       5             :  * @author Andrey Belomutskiy, (c) 2012-2020
       6             :  */
       7             : 
       8             : #include "pch.h"
       9             : 
      10           4 : TEST(scheduler, dwellIssue796) {
      11             : 
      12           1 :         EngineTestHelper eth(engine_type_e::TEST_ENGINE);
      13           1 :         setupSimpleTestEngineWithMafAndTT_ONE_trigger(&eth, IM_SEQUENTIAL);
      14             : 
      15           1 :         eth.fireTriggerEvents2(4 /* count */ , 600 /* ms */);
      16             : 
      17             :         // check if the mode is changed
      18           1 :         ASSERT_EQ(CRANKING, engine->rpmCalculator.getState());
      19             :         // due to isFasterEngineSpinUp=true, we should have already detected RPM!
      20           1 :         ASSERT_EQ( 100,  round(Sensor::getOrZero(SensorType::Rpm))) << "spinning-RPM#1";
      21           1 :         ASSERT_NEAR(300000.0f, engine->rpmCalculator.oneDegreeUs * 180, 1);
      22             : 
      23             :         // with just a bit much time between events integer RPM goes down one full percent
      24           1 :         eth.smartFireRise(601);
      25           1 :         eth.smartFireFall(600);
      26           1 :         ASSERT_NEAR( 100,  round(Sensor::getOrZero(SensorType::Rpm)), EPS3D) << "spinning-RPM#2";
      27             :         // while integer RPM value is 1% away from rpm=100, below oneDegreeUs is much closer to RPM=100 value
      28           1 :         ASSERT_NEAR(300250, (int)(engine->rpmCalculator.oneDegreeUs * 180), 1);
      29           1 : }

Generated by: LCOV version 1.14