only:honda

This commit is contained in:
Andrey 2023-04-22 11:29:15 -04:00
parent e43c6b0d06
commit d7b9961c4b
2 changed files with 40 additions and 0 deletions

View File

@ -0,0 +1,39 @@
#include "pch.h"
#include "rusefi_lua.h"
#include "lua_lib.h"
TEST(LuaHonda, idleRpm1) {
#define real380Packet_1 "\ndata = { 0x00, 0x00, 0x08, 0x4A, 0x00, 0x00, 0x00, 0x1D}\n "
const char* script = TWO_BYTES_MSB real380Packet_1 R"(
function testFunc()
rpm = getTwoBytesMSB(data, 2, 1)
return rpm
end
)";
EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(script).value_or(0), 2122);
}
TEST(LuaHonda, idleRpm2) {
#define real380Packet_2 "\ndata = { 0x0C, 0x01, 0x07, 0xE1, 0x80, 0x00, 0x00, 0x18}\n "
const char* script = TWO_BYTES_MSB real380Packet_2 R"(
function testFunc()
rpm = getTwoBytesMSB(data, 2, 1)
return rpm
end
)";
EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(script).value_or(0), 2017);
}
TEST(LuaHonda, wheelSpeed) {
#define real309Packet "\ndata = { 0x06, 0x7C, 0x0A, 0x09, 0x05, 0xCC, 0x00, 0x9A}\n "
const char* script = TWO_BYTES_LSB real309Packet R"(
function testFunc()
speedKph = getTwoBytesLSB(data, 1, 0.01)
return speedKph
end
)";
EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(script).value_or(0), 26.84);
}

View File

@ -40,6 +40,7 @@ TESTS_SRC_CPP = \
tests/lua/test_lua_e65.cpp \
tests/lua/test_lua_ford.cpp \
tests/lua/test_lua_vag.cpp \
tests/lua/test_lua_honda.cpp \
tests/lua/test_lua_nissan.cpp \
tests/lua/test_lua_with_engine.cpp \
tests/lua/test_lua_hooks.cpp \