From 09e2788b81fc5aa0739111f833de223cb2a850bd Mon Sep 17 00:00:00 2001 From: 3djc Date: Mon, 29 Jul 2024 02:40:30 +0200 Subject: [PATCH] chore: add legacy_names to gtest (#5335) --- radio/src/tests/lua.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/radio/src/tests/lua.cpp b/radio/src/tests/lua.cpp index adfeeee24..605dd806d 100644 --- a/radio/src/tests/lua.cpp +++ b/radio/src/tests/lua.cpp @@ -191,4 +191,28 @@ TEST(Lua, Switches) luaExecStr("if MIXSRC_SB == nil then error('failed') end"); } +TEST(Lua, testLegacyNames) +{ + MODEL_RESET(); +#if defined(SURFACE_RADIO) + for (uint8_t i = 0; i < 2; i ++) + anaSetFiltered(i, -1024); + luaExecStr("value = getValue('thr')"); + luaExecStr("if value ~= -1024 then error('th not defined in Legacy') end"); + luaExecStr("value = getValue('ste')"); + luaExecStr("if value ~= -1024 then error('st not defined in Legacy') end"); +#else + for (uint8_t i = 0; i < 4; i ++) + anaSetFiltered(i, -1024); + luaExecStr("value = getValue('thr')"); + luaExecStr("if value ~= -1024 then error('thr not defined in Legacy') end"); + luaExecStr("value = getValue('ail')"); + luaExecStr("if value ~= -1024 then error('ail not defined in Legacy') end"); + luaExecStr("value = getValue('rud')"); + luaExecStr("if value ~= -1024 then error('rud not defined in Legacy') end"); + luaExecStr("value = getValue('ele')"); + luaExecStr("if value ~= -1024 then error('ele not defined in Legacy') end"); +#endif +} + #endif // #if defined(LUA)