From f1705e83a9931f9696602ee27e9b6bd282528c00 Mon Sep 17 00:00:00 2001 From: Andrey Date: Fri, 24 Dec 2021 16:56:17 -0500 Subject: [PATCH] E65 --- unit_tests/tests/lua/test_lua_e65.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 unit_tests/tests/lua/test_lua_e65.cpp diff --git a/unit_tests/tests/lua/test_lua_e65.cpp b/unit_tests/tests/lua/test_lua_e65.cpp new file mode 100644 index 0000000000..f80daae084 --- /dev/null +++ b/unit_tests/tests/lua/test_lua_e65.cpp @@ -0,0 +1,23 @@ +#include "pch.h" +#include "rusefi_lua.h" + +#define TWO_BYTES "( \ + function twoBytes(data, offset, factor) \ + return (data[offset + 1] * 256 + data[offset]) * factor \ + end" + + +TEST(LuaE65, Battery) { + const char* realdata = TWO_BYTES R"( + + function testFunc() + data = {0xdc, 0x03, 0x00, 0x53, 0xFE, 0xD3, 0x04, 0x00} + return twoBytes(data, 1, 0.0147) + end + + )"; + + EXPECT_NEAR_M3(testLuaReturnsNumberOrNil(realdata).value_or(0), 14.5236); + + +}