MCPcopy Create free account
hub / github.com/anjo76/angelscript / TestExecuteScript

Function TestExecuteScript

sdk/tests/test_feature/source/testexecutescript.cpp:24–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22static asIScriptEngine *engine;
23
24bool TestExecuteScript()
25{
26 bool fail = false;
27 COutStream out;
28
29 engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
30 engine->SetMessageCallback(asMETHOD(COutStream,Callback), &out, asCALL_THISCALL);
31
32 RegisterStdString(engine);
33 engine->RegisterGlobalFunction("void assert(bool)", asFUNCTION(Assert), asCALL_GENERIC);
34
35 CScriptBuilder builder;
36
37 int r = builder.StartNewModule(engine, 0);
38 if( r >= 0 )
39 r = builder.AddSectionFromFile("scripts/TestExecuteScript.as");
40 if( r >= 0 )
41 r = builder.BuildModule();
42 if( r >= 0 )
43 {
44 fail = ExecuteScript();
45 }
46
47 // Create a second engine before releasing the first
48 asIScriptEngine *en2 = asCreateScriptEngine(ANGELSCRIPT_VERSION);
49
50 engine->Release();
51 engine = NULL;
52
53 // Release the second engine after the first
54 en2->Release();
55
56 return fail;
57}
58
59
60static bool ExecuteScript()

Callers 1

allTestsFunction · 0.85

Calls 8

RegisterStdStringFunction · 0.85
SetMessageCallbackMethod · 0.80
StartNewModuleMethod · 0.80
AddSectionFromFileMethod · 0.80
BuildModuleMethod · 0.80
ExecuteScriptFunction · 0.70
ReleaseMethod · 0.45

Tested by

no test coverage detected