| 338 | |
| 339 | |
| 340 | bool Test2() |
| 341 | { |
| 342 | int nRet; |
| 343 | bool fail = false; |
| 344 | COutStream out; |
| 345 | |
| 346 | asIScriptEngine *engine = asCreateScriptEngine(ANGELSCRIPT_VERSION); |
| 347 | engine->SetMessageCallback(asMETHOD(COutStream, Callback), &out, asCALL_THISCALL); |
| 348 | RegisterScriptArray(engine, true); |
| 349 | |
| 350 | nRet = engine->RegisterObjectType("Value", sizeof(Value), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_CLASS_CK); assert( nRet >= 0 ); |
| 351 | |
| 352 | nRet = engine->RegisterObjectType("A", sizeof(A), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_CLASS_CK); assert( nRet >= 0 ); |
| 353 | nRet = engine->RegisterObjectMethod("A", "Value &opIndex(int)", asMETHODPR(A, operator[], (int ), Value &), asCALL_THISCALL); assert( nRet >= 0 ); |
| 354 | nRet = engine->RegisterObjectType("A[]", sizeof(AArray), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_CLASS_CK); assert( nRet >= 0 ); |
| 355 | nRet = engine->RegisterObjectMethod("A[]", "A opIndex( int )", asMETHODPR(AArray, operator[], (int ), A), asCALL_THISCALL); assert( nRet >= 0 ); |
| 356 | nRet = engine->RegisterObjectType("A[][]", sizeof(AArrayArray), asOBJ_VALUE | asOBJ_POD | asOBJ_APP_CLASS_CK); assert( nRet >= 0 ); |
| 357 | nRet = engine->RegisterObjectMethod("A[][]", "A[] opIndex(int)", asMETHODPR(AArrayArray, operator[], (int ), AArray), asCALL_THISCALL); assert( nRet >= 0 ); |
| 358 | |
| 359 | nRet = ExecuteString(engine, "A[][] f;"); assert( nRet >= 0 ); |
| 360 | nRet = ExecuteString(engine, "A[][] f; f[0];"); assert( nRet >= 0 ); |
| 361 | nRet = ExecuteString(engine, "A[][] f; f[0][0];"); assert( nRet >= 0 ); |
| 362 | nRet = ExecuteString(engine, "A[][] f; f[0][0][0];"); assert( nRet >= 0 ); |
| 363 | |
| 364 | engine->Release(); |
| 365 | |
| 366 | return fail; |
| 367 | } |
| 368 | |
| 369 | } // namespace |
| 370 |
no test coverage detected