Line | Branch | Decision | Exec | Source |
---|---|---|---|---|
1 | /* | |||
2 | * @file test_ion.cpp | |||
3 | * | |||
4 | * @date Jan 4, 2019 | |||
5 | * @author Andrey Belomutskiy, (c) 2012-2020 | |||
6 | */ | |||
7 | ||||
8 | #include "gtest/gtest.h" | |||
9 | #include "cdm_ion_sense.h" | |||
10 | ||||
11 | 4 | TEST(ion, signalCounter) { | ||
12 |
1/1✓ Branch 2 taken 1 time.
|
1 | CdmState state; | |
13 | ||||
14 |
3/7✓ Branch 3 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 time.
✗ Branch 16 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
|
1 | EXPECT_EQ(0, state.getValue(0)); | |
15 | ||||
16 |
1/1✓ Branch 1 taken 1 time.
|
1 | state.onNewSignal(/* currentRevolution= */ 2); | |
17 |
1/1✓ Branch 1 taken 1 time.
|
1 | state.onNewSignal(/* currentRevolution= */ 2); | |
18 |
1/1✓ Branch 1 taken 1 time.
|
1 | state.onNewSignal(/* currentRevolution= */ 2); | |
19 | ||||
20 | // value is still '0' until we signal end of engine cycle | |||
21 |
3/7✓ Branch 3 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 time.
✗ Branch 16 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
|
1 | EXPECT_EQ(0, state.getValue(/* currentRevolution= */2)); | |
22 | ||||
23 | // this invocation would flush current accumulation | |||
24 |
3/7✓ Branch 3 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 time.
✗ Branch 16 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
|
1 | EXPECT_EQ(3, state.getValue(/* currentRevolution= */3)); | |
25 | ||||
26 |
1/1✓ Branch 1 taken 1 time.
|
1 | state.onNewSignal(/* currentRevolution= */3); | |
27 | // returning previous full cycle value | |||
28 |
3/7✓ Branch 3 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 time.
✗ Branch 16 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
|
1 | EXPECT_EQ(3, state.getValue(3)); | |
29 | ||||
30 | ||||
31 |
3/7✓ Branch 3 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 time.
✗ Branch 16 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
|
1 | EXPECT_EQ(1, state.getValue(/* currentRevolution= */4)); | |
32 |
3/7✓ Branch 3 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 12 not taken.
✓ Branch 13 taken 1 time.
✗ Branch 16 not taken.
✗ Branch 21 not taken.
✗ Branch 24 not taken.
|
1 | EXPECT_EQ(0, state.getValue(/* currentRevolution= */5)); | |
33 | 1 | } | ||
34 | ||||
35 |