Line | Branch | Decision | Exec | Source |
---|---|---|---|---|
1 | #include "pch.h" | |||
2 | #include "rusefi_lua.h" | |||
3 | #include "lua_lib.h" | |||
4 | ||||
5 | 4 | TEST(canam, ecu102_1) { | ||
6 | 1 | const char* realdata = VAG_CHECKSUM R"( | ||
7 | ||||
8 | function testFunc() | |||
9 | data = { 0x16, 0xca, 0x0d, 0x70, 0x4d, 0xad, 0x04, 0x45 } | |||
10 | return xorChecksum(data, 8) | |||
11 | end | |||
12 | )"; | |||
13 | ||||
14 |
3/7✓ Branch 3 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 time.
✗ Branch 15 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
|
1 | EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(realdata).value_or(0), 0x45); | |
15 | 1 | } | ||
16 | ||||
17 | 4 | TEST(canam, bytes) { | ||
18 | 1 | const char* realdata = TWO_BYTES_MSB R"( | ||
19 | ||||
20 | function testFunc() | |||
21 | data = {0x00, 0x00, 0x00, 0x00, 0x01, 0xc7, 0x00, 0xc6} | |||
22 | return getTwoBytesMSB(data, 4, 1) | |||
23 | end | |||
24 | )"; | |||
25 | ||||
26 |
3/7✓ Branch 3 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 time.
✗ Branch 15 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
|
1 | EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(realdata).value_or(0), 455); | |
27 | 1 | } | ||
28 | ||||
29 | 4 | TEST(canam, bytes2) { | ||
30 | 1 | const char* realdata = TWO_BYTES_MSB R"( | ||
31 | ||||
32 | function testFunc() | |||
33 | data = {0x00, 0x00, 0x04, 0xa2, 0x02, 0x6c, 0x00, 0x00} | |||
34 | return getTwoBytesMSB(data, 2, 1) | |||
35 | end | |||
36 | )"; | |||
37 | ||||
38 |
3/7✓ Branch 3 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 time.
✗ Branch 15 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
|
1 | EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(realdata).value_or(0), 1186); | |
39 | 1 | } | ||
40 | ||||
41 | 4 | TEST(canam, ecu102_4) { | ||
42 | 1 | const char* realdata = VAG_CHECKSUM R"( | ||
43 | ||||
44 | function testFunc() | |||
45 | data = {0x00, 0x00, 0x0e, 0x6a, 0x53, 0xac, 0x06, 0} | |||
46 | return xorChecksum(data, 8) | |||
47 | end | |||
48 | )"; | |||
49 | ||||
50 |
3/7✓ Branch 3 taken 1 time.
✓ Branch 7 taken 1 time.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 time.
✗ Branch 15 not taken.
✗ Branch 20 not taken.
✗ Branch 23 not taken.
|
1 | EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(realdata).value_or(0), 0x9d); | |
51 | 1 | } | ||
52 |