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

          Line data    Source code
       1             : /**
       2             :  * @file test_one_cylinder_logic.cpp
       3             :  * @author Andrey Belomutskiy, (c) 2012-2020
       4             :  */
       5             : 
       6             : #include "pch.h"
       7             : #include "spark_logic.h"
       8             : #include "GY6_139QMB.h"
       9             : #include "defaults.h"
      10             : 
      11           4 : TEST(issues, issueOneCylinderSpecialCase968) {
      12           1 :         EngineTestHelper eth(engine_type_e::GY6_139QMB);
      13           1 :         angle_t timing = 4;
      14           1 :         engineConfiguration->crankingTimingAngle = timing;
      15           1 :         setTable(config->injectionPhase, -180.0f);
      16           1 :         engineConfiguration->isFasterEngineSpinUpEnabled = false;
      17           1 :         engine->tdcMarkEnabled = false;
      18             :         // set injection_mode 1
      19           1 :         engineConfiguration->injectionMode = IM_SEQUENTIAL;
      20             : 
      21           1 :         setCrankOperationMode();
      22             : 
      23           1 :         eth.setTriggerType(trigger_type_e::TT_HALF_MOON);
      24             : 
      25           1 :         ASSERT_EQ( 0,  engine->executor.size()) << "start";
      26             : 
      27           1 :         eth.fireTriggerEvents2(/* count */ 2, 50 /* ms */);
      28           1 :         eth.assertRpm(0);
      29           1 :         ASSERT_EQ( 0,  engine->executor.size()) << "first revolution(s)";
      30             : 
      31           1 :         eth.fireTriggerEvents2(/* count */ 1, 50 /* ms */);
      32           1 :         eth.assertRpm(600, "RPM");
      33           1 :         ASSERT_EQ(engine->triggerCentral.currentEngineDecodedPhase, 90 + Gy6139_globalTriggerAngleOffset);
      34           1 :         ASSERT_EQ(engine->engineState.timingAdvance[0], timing);
      35             : 
      36           1 :   angle_t expectedAngle = 180 - Gy6139_globalTriggerAngleOffset + timing;
      37           1 :   int expectedDeltaTimeUs = eth.angleToTimeUs(expectedAngle);
      38             : 
      39           1 :         ASSERT_EQ( 2,  engine->executor.size()) << "first revolution(s)";
      40           1 :         eth.assertEvent5("spark up#0", 0, (void*)turnSparkPinHighStartCharging, -expectedDeltaTimeUs - MS2US(DEFAULT_CRANKING_DWELL_MS));
      41           1 :         eth.assertEvent5("spark down#0", 1, (void*)fireSparkAndPrepareNextSchedule, -expectedDeltaTimeUs);
      42             : 
      43             : 
      44           1 :         eth.fireTriggerEvents2(/* count */ 1, 50 /* ms */);
      45           1 :         ASSERT_EQ( 4,  engine->executor.size()) << "first revolution(s)";
      46           1 : }

Generated by: LCOV version 1.14