only:kia CAN

This commit is contained in:
Andrey 2023-07-07 21:12:41 -04:00
parent 0e0a38acaa
commit fec4ffa6cb
2 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,31 @@
#include "pch.h"
#include "rusefi_lua.h"
#include "lua_lib.h"
TEST(LuaKia, idleRpm1) {
#define real316Packet_1 "\ndata = { 0x05, 0x1B, 0x7A, 0x0F, 0x1B, 0x2C, 0x00, 0x7F}\n "
const char* script = TWO_BYTES_LSB real316Packet_1 R"(
function testFunc()
rpm = getTwoBytesLSB(data, 2, 0.25)
return rpm
end
)";
EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(script).value_or(0), 990.5);
}
TEST(LuaKia, packRpm) {
EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(
TWO_BYTES_MSB ARRAY_EQUALS SET_TWO_BYTES PRINT_ARRAY R"(
rpm = 990
function testFunc()
canEngine = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }
setTwoBytes(canEngine, 2, 4 * rpm)
print(arrayToString(canEngine))
expected = { 0x00, 0x00, 0x78, 0x0F, 0x00, 0x00, 0x00, 0x00 }
return equals(canEngine, expected)
end
)"
).value_or(0), 0);
}

View File

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