GCC Code Coverage Report


Directory: ./
File: unit_tests/tests/lua/test_lua_nissan.cpp
Date: 2025-10-03 00:57:22
Coverage Exec Excl Total
Lines: 100.0% 12 0 12
Functions: 100.0% 6 0 6
Branches: 42.9% 6 0 14
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(LuaNissan, wheelSpeed) {
6 #define realWheelPacket "\ndata = { 0x19, 0x6c, 0x19, 0x68, 0x0e, 0xb0, 0x37, 0x81}\n "
7 1 const char* script = TWO_BYTES_MSB realWheelPacket R"(
8 function testFunc()
9 engineTorque = getTwoBytesMSB(data, 0, 0.005)
10 return engineTorque
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), 32.54);
15 1 }
16
17 4 TEST(LuaNissan, rpm) {
18 #define realRpmPacket "\ndata = { 0x63, 0x00, 0x00, 0x1B, 0x01, 0xCC, 0x00, 0x70}\n "
19 1 const char* script = TWO_BYTES_LSB realRpmPacket R"(
20 function testFunc()
21 engineTorque = getTwoBytesLSB(data, 3, 3.15)
22 return engineTorque
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), 891.45);
27 1 }
28