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

Function Test2

sdk/tests/test_feature/source/test_scriptstring.cpp:861–900  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

859}
860
861bool Test2()
862{
863 bool fail = false;
864
865 int r;
866 COutStream out;
867 asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION);
868 engine->SetMessageCallback(asMETHOD(COutStream,Callback), &out, asCALL_THISCALL);
869 RegisterScriptString(engine);
870 r = engine->RegisterGlobalFunction("void assert(bool)", asFUNCTION(Assert), asCALL_GENERIC); assert( r >= 0 );
871
872 const char *string =
873 "class Jerome \n"
874 "{ \n"
875 " string a; \n"
876 " string b; \n"
877 " double c; \n"
878 " Jerome(string A,string B,double C) \n"
879 " { \n"
880 " a = A; \n"
881 " b = B; \n"
882 " c = C; \n"
883 " assert( a == 'Hello' ); \n"
884 " assert( b == 'Hi' ); \n"
885 " assert( c == 1.23456 ); \n"
886 " } \n"
887 "} \n"
888 "Jerome cc('Hello','Hi',1.23456); \n";
889 asIScriptModule *mod = engine->GetModule("test", asGM_ALWAYS_CREATE);
890 mod->AddScriptSection("test", string);
891 r = mod->Build();
892 if( r < 0 )
893 {
894 TEST_FAILED;
895 }
896
897 engine->Release();
898
899 return fail;
900}
901
902//========================================================================
903

Callers 1

TestFunction · 0.70

Calls 7

SetMessageCallbackMethod · 0.80
AddScriptSectionMethod · 0.80
RegisterScriptStringFunction · 0.70
GetModuleMethod · 0.45
BuildMethod · 0.45
ReleaseMethod · 0.45

Tested by

no test coverage detected