## Engine
Class TestInfo

source: C:\XIII\Engine\Classes\TestInfo.uc

    Core.Object
       |
       +--Engine.Actor
          |
          +--Engine.Info
             |
             +--Engine.TestInfo

Direct Known Subclasses:None

class TestInfo
extends Engine.Info

    //=============================================================================
    // For internal testing.
    //=============================================================================

Variables
`int` | `MyArray[2]`
`struct` | `STest`
`string` | `TestRepStr`
`bool` | `bBool1`
`bool` | `bBool2`
`bool` | `bFalse1`
`bool` | `bFalse2`
`bool` | `bTrue1`
`bool` | `bTrue2`
`float` | `ppp`
`string` | `sxx`
`vector` | `v1,v2`
`int` | `xnum`

States
EEDDAA, DDAA, CCAA, BB, AA

Function Summary
`void` | `BeginPlay()`
`int` | `OtherStatic(int i)`
`void` | `PostBeginPlay()`
`bool` | `RecurseTest()`
`void` | `SubTestOptionalOut(optional out, optional out, optional out)`
`void` | `TestContinueDoUntil()`
`void` | `TestContinueFor()`
`void` | `TestContinueForEach()`
`void` | `TestContinueWhile()`
`void` | `TestLimitor(class c)`
`void` | `TestNullContext(Actor a)`
`void` | `TestOptionalOut()`
`void` | `TestQ()`
`int` | `TestStatic(int i)`
`void` | `TestStructBools()`
`void` | `TestSwitch()`
`void` | `TestX(bool bResource)`
`void` | `Tick(float DeltaTime)`
`void` | `f()`
`void` | `temp()`
`void` | `test()`

State EEDDAA Function Summary
`void` | `f()`

State DDAA Function Summary
`void` | `f()`

State CCAA Function Summary
`void` | `f()`

State BB Function Summary
`void` | `f()`

State AA Function Summary
`void` | `f()`

Source Code

    00001	//=============================================================================
    00002	// For internal testing.
    00003	//=============================================================================
    00004	class TestInfo extends Info;
    00005
    00006	var() bool bTrue1;
    00007	var() bool bFalse1;
    00008	var() bool bTrue2;
    00009	var() bool bFalse2;
    00010	var bool bBool1;
    00011	var bool bBool2;
    00012	var() int xnum;
    00013	var float ppp;
    00014	var string sxx;
    00015	var int MyArray[2];
    00016	var vector v1,v2;
    00017	var string TestRepStr;
    00018	//var string[32] teststring;
    00019
    00020	const Pie=3.14;
    00021	const Str="Tim";
    00022	const Lotus=vect(1,2,3);
    00023
    00024	var struct STest
    00025	{
    00026		var bool b1;
    00027		var int i;
    00028		var bool b2;
    00029		var bool b3;
    00030	} ST;
    00031
    00032	function TestQ()
    00033	{
    00034		local vector v;
    00035		v.x = 2;
    00036		v.y = 3;
    00037		v.z = 4;
    00038		assert(v==vect(2,3,4));
    00039		assert(v.z==4);
    00040		assert(v.y==3);
    00041		assert(v.x==2);
    00042	}
    00043
    00044	static function test()
    00045	{
    00046		class'testinfo'.default.v1 = vect(1,2,3);
    00047	}
    00048
    00049	function PostBeginPlay()
    00050	{
    00051		local object o;
    00052		local actor TempActor;
    00053		log("!!BEGIN");
    00054
    00055		default.v1=vect(5,4,3);
    00056		assert(default.v1==vect(5,4,3));
    00057		test();
    00058		assert(default.v1==vect(1,2,3));
    00059
    00060		assert(IsA('Actor'));
    00061		assert(IsA('TestInfo'));
    00062		assert(IsA('Info'));
    00063		assert(!IsA('LevelInfo'));
    00064		assert(!IsA('Texture'));
    00065		//o=dynamicloadobject( "UnrealShare.AutoMag.Reload", class'object' );
    00066		//assert(o!=None);
    00067		//assert(o==None);
    00068		log("!!END");
    00069	}
    00070
    00071	function TestStructBools()
    00072	{
    00073		assert(ST.b1==false);
    00074		assert(ST.b2==false);
    00075		assert(ST.b3==false);
    00076
    00077		ST.b1=true;
    00078		assert(ST.b1==true);
    00079		assert(ST.b2==false);
    00080		assert(ST.b3==false);
    00081
    00082		ST.b2=true;
    00083		assert(ST.b1==true);
    00084		assert(ST.b2==true);
    00085		assert(ST.b3==false);
    00086
    00087		ST.b3=true;
    00088		assert(ST.b1==true);
    00089		assert(ST.b2==true);
    00090		assert(ST.b3==true);
    00091
    00092		ST.b1=false;
    00093		ST.b2=false;
    00094		ST.b3=false;
    00095	}
    00096
    00097	function BeginPlay()
    00098	{
    00099		local testobj to;
    00100		local object oo;
    00101		to = new class'TestObj';
    00102		to = new()class'TestObj';
    00103		to = new(self)class'TestObj';
    00104		to = new(self,"")class'TestObj';
    00105		to = new(self,"",0)class'TestObj';
    00106		to.Test();
    00107		TestStructBools();
    00108	}
    00109
    00110	function TestX( bool bResource )
    00111	{
    00112		local int n;
    00113		n = int(bResource);
    00114		MyArray[ int(bResource) ] = 0;
    00115		MyArray[ int(bResource) ]++;
    00116	}
    00117
    00118	function bool RecurseTest()
    00119	{
    00120		bBool1=true;
    00121		return false;
    00122	}
    00123
    00124	function TestLimitor( class c )
    00125	{
    00126		local class<actor> NewClass;
    00127		NewClass = class<actor>( c );
    00128	}
    00129
    00130	static function int OtherStatic( int i )
    00131	{
    00132		assert(i==246);
    00133		assert(default.xnum==777);
    00134		return 555;
    00135	}
    00136
    00137	static function int TestStatic( int i )
    00138	{
    00139		assert(i==123);
    00140		assert(default.xnum==777);
    00141		assert(OtherStatic(i*2)==555);
    00142		return i;
    00143	}
    00144
    00145	function TestContinueFor()
    00146	{
    00147		local int i;
    00148		log("TestContinue");
    00149		for( i=0; i<20; i++ )
    00150		{
    00151			log("iteration "$i);
    00152			if(i==7||i==9||i==19)
    00153				continue;
    00154			log("...");
    00155		}
    00156		log("DoneContinue");
    00157	}
    00158
    00159	function TestContinueWhile()
    00160	{
    00161		local int i;
    00162		log("TestContinue");
    00163		while( ++i <= 20 )
    00164		{
    00165			log("iteration "$i);
    00166			if(i==7||i==9)
    00167				continue;
    00168			log("...");
    00169		}
    00170		log("DoneContinue");
    00171	}
    00172
    00173	function TestContinueDoUntil()
    00174	{
    00175		local int i;
    00176		log("TestContinue");
    00177		do
    00178		{
    00179			i++;
    00180			log("iteration "$i);
    00181			if(i==7||i==9||i>18)
    00182				continue;
    00183			log("...");
    00184		} until( i>20 );
    00185		log("DoneContinue");
    00186	}
    00187
    00188	function TestContinueForEach()
    00189	{
    00190		local actor a;
    00191		log("TestContinue");
    00192		foreach AllActors( class'Actor', a )
    00193		{
    00194			log("actor "$a);
    00195			if(light(a)==none)
    00196				continue;
    00197			log("...");
    00198		}
    00199		log("DoneContinue");
    00200	}
    00201
    00202
    00203	function SubTestOptionalOut( optional out int a, optional out int b, optional out int c )
    00204	{
    00205		a *= 2;
    00206		b = b*2;
    00207		c += c;
    00208	}
    00209	function TestOptionalOut()
    00210	{
    00211		local int a,b,c;
    00212		a=1; b=2; c=3;
    00213
    00214		SubTestOptionalOut(a,b,c);
    00215		assert(a==2); assert(b==4); assert(c==6);
    00216
    00217		SubTestOptionalOut(a,b);
    00218		assert(a==4); assert(b==8); assert(c==6);
    00219
    00220		SubTestOptionalOut(,b,c);
    00221		assert(a==4); assert(b==16); assert(c==12);
    00222
    00223		SubTestOptionalOut();
    00224		assert(a==4); assert(b==16); assert(c==12);
    00225
    00226		SubTestOptionalOut(a,b,c);
    00227		assert(a==8); assert(b==32); assert(c==24);
    00228
    00229		log("TestOptionalOut ok!");
    00230	}
    00231
    00232	function TestNullContext( actor a )
    00233
{ 00234 bHidden = a.bHidden; 00235 a.bHidden = bHidden; 00236 } 00237 00238 function TestSwitch() 00239 { 00240 local string s; 00241 local int i; 00242 local bool b; 00243 s="Tim"; 00244 i=2; 00245 switch( i ) 00246 { 00247 case 0: 00248 assert(false); 00249 break; 00250 case 2: 00251 b=true; 00252 break; 00253 default: 00254 assert(false); 00255 break; 00256 } 00257 assert(b); 00258 switch( s ) 00259 { 00260 case "": 00261 assert(false); 00262 break; 00263 case "xyzzy": 00264 assert(false); 00265 break; 00266 default: 00267 b=false; 00268 break; 00269 } 00270 assert(!b); 00271 log("testswitch succeeded"); 00272 } 00273 00274 function Tick( float DeltaTime ) 00275 { 00276 local class C; 00277 local class<testinfo> TC; 00278 local actor a; 00279 00280 log("time="$Level.TimeSeconds); 00281 00282 TestOptionalOut(); 00283 TestNullContext( self ); 00284 TestNullContext( None ); 00285 TestSwitch(); 00286 00287 v1=vect(1,2,3); 00288 v2=vect(2,4,6); 00289 assert(v1!=v2); 00290 assert(!(v1==v2)); 00291 assert(v1==vect(1,2,3)); 00292 assert(v2==vect(2,4,6)); 00293 assert(vect(1,2,5)!=v1); 00294 assert(v1*2==v2); 00295 assert(v1==v2/2); 00296 00297 assert(Pie==3.14); 00298 assert(Pie!=2); 00299 assert(Str=="Tim"); 00300 assert(Str!="Bob"); 00301 assert(Lotus==vect(1,2,3)); 00302 00303 assert(GetPropertyText("sxx")=="Tim"); 00304 assert(GetPropertyText("ppp")!="123"); 00305 assert(GetPropertyText("bogus")==""); 00306 xnum=345; 00307 assert(GetPropertyText("xnum")=="345"); 00308 SetPropertyText("xnum","999"); 00309 assert(xnum==999); 00310 assert(xnum!=666); 00311 00312 assert(bTrue1==true); 00313 assert(bFalse1==false); 00314 assert(bTrue2==true); 00315 assert(bFalse2==false); 00316 00317 assert(default.bTrue1==true); 00318 assert(default.bFalse1==false); 00319 assert(default.bTrue2==true); 00320 assert(default.bFalse2==false); 00321 00322 assert(class'TestInfo'.default.bTrue1==true); 00323 assert(class'TestInfo'.default.bFalse1==false); 00324 assert(class'TestInfo'.default.bTrue2==true); 00325 assert(class'TestInfo'.default.bFalse2==false); 00326 00327 TC=Class; 00328 assert(TC.default.bTrue1==true); 00329 assert(TC.default.bFalse1==false); 00330 assert(TC.default.bTrue2==true); 00331 assert(TC.default.bFalse2==false); 00332 00333 C=Class; 00334 assert(class<testinfo>(C).default.bTrue1==true); 00335 assert(class<testinfo>(C).default.bFalse1==false); 00336 assert(class<testinfo>(C).default.bTrue2==true); 00337 assert(class<testinfo>(C).default.bFalse2==false); 00338 00339 assert(default.xnum==777); 00340 TestStatic(123); 00341 TC.static.TestStatic(123); 00342 class<testinfo>(C).static.TestStatic(123); 00343 00344 bBool2=RecurseTest(); 00345 assert(bBool2==false); 00346 00347 TestStructBools(); 00348 TestQ(); 00349 00350 log( "All tests passed" ); 00351 } 00352 00353 function f(); 00354 00355 function temp() 00356 { 00357 local int i; 00358 local playercontroller PlayerOwner; 00359 local name LeftList[20]; 00360 temp(); 00361 } 00362 00363 state AA 00364 { 00365 function f(); 00366 } 00367 state BB 00368 { 00369 function f(); 00370 } 00371 state CCAA extends AA 00372 { 00373 function f(); 00374 } 00375 state DDAA extends AA 00376 { 00377 function f(); 00378 } 00379 state EEDDAA extends DDAA 00380 { 00381 function f(); 00382 } 00383 00384 defaultproperties 00385 { 00386 bTrue1=True 00387 bTrue2=True 00388 xnum=777 00389 ppp=3.140000 00390 sxx="Tim" 00391 bHidden=False 00392 bAlwaysRelevant=True 00393 RemoteRole=ROLE_SimulatedProxy 00394 }

End Source Code