MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / TEST

Function TEST

source/test/lua_test.cpp:9–24  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7using namespace Star;
8
9TEST(LuaTest, BasicGetSet) {
10 auto luaEngine = LuaEngine::create();
11 LuaContext luaContext = luaEngine->createContext();
12 luaContext.load(R"SCRIPT(
13 data1 = 1.0
14 data2 = 3.0 > 2.0
15 data3 = "hello"
16 )SCRIPT");
17
18 luaContext.set("data4", 4.0);
19
20 EXPECT_EQ(luaContext.get<double>("data1"), 1.0);
21 EXPECT_EQ(luaContext.get<bool>("data2"), true);
22 EXPECT_EQ(luaContext.get<String>("data3"), "hello");
23 EXPECT_EQ(luaContext.get<double>("data4"), 4.0);
24}
25
26TEST(LuaTest, TableReferences) {
27 auto luaEngine = LuaEngine::create();

Callers

nothing calls this directly

Calls 15

roundTripEqualFunction · 0.85
TestUserData1Class · 0.85
StringClass · 0.85
luaTieFunction · 0.85
luaTupleReturnFunction · 0.85
StarExceptionClass · 0.85
toStringFunction · 0.85
createFunctionMethod · 0.80
createThreadMethod · 0.80
pushFunctionMethod · 0.80
resumeMethod · 0.80
createUserDataMethod · 0.80

Tested by

no test coverage detected