GCC Code Coverage Report


Directory: ./
File: unit_tests/tests/lua/test_lua_honda.cpp
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 100.0% 18 0 18
Functions: 100.0% 9 0 9
Branches: 42.9% 9 0 21
Decisions: -% 0 - 0

Line Branch Decision Exec Source
1 #include "pch.h"
2 #include "rusefi_lua.h"
3 #include "lua_lib.h"
4
5 4 TEST(LuaHonda, idleRpm1) {
6 #define real380Packet_1 "\ndata = { 0x00, 0x00, 0x08, 0x4A, 0x00, 0x00, 0x00, 0x1D}\n "
7 1 const char* script = TWO_BYTES_MSB real380Packet_1 R"(
8 function testFunc()
9 rpm = getTwoBytesMSB(data, 2, 1)
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), 2122);
15 1 }
16
17 4 TEST(LuaHonda, idleRpm2) {
18 #define real380Packet_2 "\ndata = { 0x0C, 0x01, 0x07, 0xE1, 0x80, 0x00, 0x00, 0x18}\n "
19 1 const char* script = TWO_BYTES_MSB real380Packet_2 R"(
20 function testFunc()
21 rpm = getTwoBytesMSB(data, 2, 1)
22 return rpm
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(script).value_or(0), 2017);
27 1 }
28
29 4 TEST(LuaHonda, wheelSpeed) {
30 #define real309Packet "\ndata = { 0x06, 0x7C, 0x0A, 0x09, 0x05, 0xCC, 0x00, 0x9A}\n "
31 1 const char* script = TWO_BYTES_LSB real309Packet R"(
32 function testFunc()
33 speedKph = getTwoBytesLSB(data, 1, 0.01)
34 return speedKph
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(script).value_or(0), 26.84);
39 1 }
40