MCPcopy Create free account
hub / github.com/PolygonTek/BlueshiftEngine / TestCompile

Function TestCompile

Source/TestBase/TestLua.cpp:311–324  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

309}
310
311static void TestCompile(LuaCpp::State &lua) {
312 std::string byteCode;
313 bool success = lua.Compile("test_compile", R"(
314 function sum3(x, y, z)
315 return x + y + z
316 end
317 print("This is compiled code")
318 )", byteCode);
319 if (success) {
320 lua.RunBuffer("test_compile", byteCode.data(), byteCode.size(), "sandbox");
321 int s = lua["sandbox"]["sum3"](1, 2, 3);
322 assert(s == 6);
323 }
324}
325
326void TestLua() {
327 LuaCpp::State lua(true);

Callers 1

TestLuaFunction · 0.85

Calls 4

CompileMethod · 0.80
RunBufferMethod · 0.80
dataMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected