Line | Branch | Decision | Exec | Source |
---|---|---|---|---|
1 | /* | |||
2 | * @file test_rpm_multiplier.cpp | |||
3 | * | |||
4 | * Four different cases of operation_mode_e and getRpmMultiplier | |||
5 | * | |||
6 | * @date Jun 26, 2021 | |||
7 | * @author Andrey Belomutskiy, (c) 2012-2021 | |||
8 | */ | |||
9 | ||||
10 | #include "pch.h" | |||
11 | ||||
12 | 3 | static void runRpmTest(bool isTwoStroke, bool isCam, int expected) { | ||
13 |
1/1✓ Branch 2 taken 3 times.
|
3 | EngineTestHelper eth(engine_type_e::TEST_ENGINE); | |
14 | 3 | engineConfiguration->twoStroke = isTwoStroke; | ||
15 | 3 | engineConfiguration->skippedWheelOnCam = isCam; | ||
16 |
1/1✓ Branch 1 taken 3 times.
|
3 | eth.setTriggerType(trigger_type_e::TT_HALF_MOON); | |
17 | ||||
18 |
1/1✓ Branch 1 taken 3 times.
|
3 | eth.smartFireTriggerEvents2(/*count*/200, /*delay*/ 40); | |
19 |
4/9✓ Branch 3 taken 3 times.
✓ Branch 6 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 3 times.
✗ Branch 14 not taken.
✗ Branch 19 not taken.
✗ Branch 22 not taken.
✓ Branch 29 taken 3 times.
✗ Branch 30 not taken.
|
3 | ASSERT_EQ(expected, Sensor::getOrZero(SensorType::Rpm)); | |
20 | 3 | } | ||
21 | ||||
22 | // todo: google test profiles one day? | |||
23 | ||||
24 | 4 | TEST(engine, testRpmOfCamSensor) { | ||
25 | 1 | runRpmTest(false, true, 1500); | ||
26 | 1 | } | ||
27 | ||||
28 | 4 | TEST(engine, testRpmOfTwoStroke) { | ||
29 | 1 | runRpmTest(true, false, 750); | ||
30 | 1 | } | ||
31 | ||||
32 | 4 | TEST(engine, testRpmOfCrankOnly) { | ||
33 | 1 | runRpmTest(false, false, 750); | ||
34 | 1 | } | ||
35 | ||||
36 |