This commit is contained in:
Andrey 2021-12-24 16:56:17 -05:00
parent 1bcc0c9c92
commit f1705e83a9
1 changed files with 23 additions and 0 deletions

View File

@ -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);
}