| Line | Branch | Decision | Exec | Source |
|---|---|---|---|---|
| 1 | #include "pch.h" | |||
| 2 | #include "rusefi_lua.h" | |||
| 3 | #include "lua_lib.h" | |||
| 4 | ||||
| 5 | 4 | TEST(LuaKia, idleRpm1) { | ||
| 6 | #define real316Packet_1 "\ndata = { 0x05, 0x1B, 0x7A, 0x0F, 0x1B, 0x2C, 0x00, 0x7F}\n " | |||
| 7 | 1 | const char* script = TWO_BYTES_LSB real316Packet_1 R"( | ||
| 8 | function testFunc() | |||
| 9 | rpm = getTwoBytesLSB(data, 2, 0.25) | |||
| 10 | return rpm | |||
| 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(script).value_or(0), 990.5); | |
| 15 | 1 | } | ||
| 16 | ||||
| 17 | 4 | TEST(LuaKia, packRpm) { | ||
| 18 |
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( | |
| 19 | TWO_BYTES_MSB ARRAY_EQUALS SET_TWO_BYTES_LSB PRINT_ARRAY R"( | |||
| 20 | rpm = 990 | |||
| 21 | function testFunc() | |||
| 22 | canEngine = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 } | |||
| 23 | setTwoBytesLsb(canEngine, 2, 4 * rpm) | |||
| 24 | ||||
| 25 | print(arrayToString(canEngine)) | |||
| 26 | expected = { 0x00, 0x00, 0x78, 0x0F, 0x00, 0x00, 0x00, 0x00 } | |||
| 27 | return equals(canEngine, expected) | |||
| 28 | end | |||
| 29 | )" | |||
| 30 | 1 | ).value_or(0), 0); | ||
| 31 | 1 | } | ||
| 32 | ||||
| 33 | 4 | TEST(LuaKia, calcSumOfNibbles) { | ||
| 34 | #define real81Packet "\npacket = { 0x40, 0x85, 0x5F, 0x00, 0x00, 0x00, 0x00, 0xED}\n " | |||
| 35 | 1 | const char* script = HYUNDAI_SUM_NIBBLES real81Packet R"( | ||
| 36 | function testFunc() | |||
| 37 | return hyundaiSumNibbles(packet, 0xD) | |||
| 38 | end | |||
| 39 | )"; | |||
| 40 |
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(script).value_or(0), 0xE); | |
| 41 | 1 | } | ||
| 42 |