1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-17 05:15:18 +03:00
This commit is contained in:
bsongis 2014-07-21 19:15:24 +02:00
parent 3680149b52
commit 9b53f69038
6 changed files with 66 additions and 17 deletions

63
radio/src/tests/lua.cpp Executable file
View file

@ -0,0 +1,63 @@
/*
* Authors (alphabetical order)
* - Andre Bernet <bernet.andre@gmail.com>
* - Andreas Weitl
* - Bertrand Songis <bsongis@gmail.com>
* - Bryan J. Rentoul (Gruvin) <gruvin@gmail.com>
* - Cameron Weeks <th9xer@gmail.com>
* - Erez Raviv
* - Gabriel Birkus
* - Jean-Pierre Parisy
* - Karl Szmutny
* - Michael Blandford
* - Michal Hlavinka
* - Pat Mackenzie
* - Philip Moss
* - Rob Thomson
* - Romolo Manfredini <romolo.manfredini@gmail.com>
* - Thomas Husterer
*
* opentx is based on code named
* gruvin9x by Bryan J. Rentoul: http://code.google.com/p/gruvin9x/,
* er9x by Erez Raviv: http://code.google.com/p/er9x/,
* and the original (and ongoing) project by
* Thomas Husterer, th9x: http://code.google.com/p/th9x/
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
*/
#include <math.h>
#include <gtest/gtest.h>
#if defined(LUA)
#define SWAP_DEFINED
#include "opentx.h"
#include <lua.h>
#include <lauxlib.h>
#include <lualib.h>
void luaExecStr(const char * str)
{
extern lua_State * L;
luaL_dostring(L, str);
}
TEST(Lua, testSetModelId)
{
luaExecStr("info = model.getInfo()");
luaExecStr("info.id = 2");
luaExecStr("model.setInfo(info)");
EXPECT_EQ(g_model.header.modelId, 2);
}
#endif