Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 00297 00298 00299 00300 00301 00302 00303 00304 00305 00306 00307 00308 00309 00310 00311 00312 00313 00314 00315 00316 00317 00318 00319 00320 00321 00322 00323 00324 00325 00326 00327 00328 00329 00330 00331 00332 00333 00334 00335 00336 00337 00338 00339 00340 00341 00342 00343 00344 00345 00346 00347 00348 00349 00350 00351 00352 00353 00354 00355 00356 00357 00358 00359 00360 00361 00362 00363 00364 00365 00366 00367 00368 00369 00370 00371 00372 00373 00374 00375 00376 00377 00378 00379 00380 00381 00382 00383 00384 00385 00386 00387 00388 00389 00390 00391 00392 00393 00394 00395 00396 00397 00398 00399 00400 00401 00402 00403 00404 00405 00406 00407 00408 00409 00410 00411 00412 00413 00414 00415 00416 00417 00418 00419 00420 00421 00422 00423 00424 00425 00426 00427 00428 00429 00430 00431 00432 00433 00434 00435 00436 00437 00438 00439 00440 00441 00442 00443 00444 00445 00446 00447 00448 00449 00450 00451 00452 00453 00454 00455 00456 00457 00458 00459 00460 00461 00462 00463 00464 00465 00466 00467 00468 00469 00470 00471 00472 00473 00474 00475 00476 00477 00478 00479 00480 00481 00482 00483 00484 00485 00486 00487 00488 00489 00490 |
//============================================================================= // For internal testing. //============================================================================= class TestInfo extends Info; var() bool bTrue1; var() bool bFalse1; var() bool bTrue2; var() bool bFalse2; var bool bBool1; var bool bBool2; var() int xnum; var float ppp; var string sxx; var int MyArray[2]; var vector v1,v2; var string TestRepStr; //var string[32] teststring; const Pie=3.14; const Str="Tim"; const Lotus=vect(1,2,3); //NEW (mdf) -- test consts in properties support const ConstBool = 1; const ConstByte = 222; const ConstFloat = 0.123; const ConstString = "ad rocks!"; const ConstObject = class'Pawn'; var() bool TestBool; var() byte TestByte; var() float TestFloat; var() string TestString; var() class<Actor> TestObject; //OLD var struct STest { var bool b1; var int i; var bool b2; var bool b3; } ST; function TestQ() { local vector v; v.x = 2; v.y = 3; v.z = 4; assert(v==vect(2,3,4)); assert(v.z==4); assert(v.y==3); assert(v.x==2); } static function test() { class'testinfo'.default.v1 = vect(1,2,3); //NEW (mdf) test additional directives support (code ignored unless -debug used with ucc make) #debug log( "log on debug line" ); #debug log( "log after debug line" ); #debugbegin log( "log between debugbegin and debugend #1: " $ default.bHidden ); log( "log between debugbegin and debugend #2: " $ default.bHidden ); #debugend #debugbegin /* log( "log between debugbegin and debugend #1: " $ default.bHidden ); log( "log between debugbegin and debugend #2: " $ default.bHidden ); */ #debugend #debugbegin #if0 // skip directives inside #debugbegin..#debugend #endif0 #debugend #debugbegin #debugbegin //nested #debugbegin..debugend #debugend #debugend #if0 garbage1 garbage2 #endif0 #if0 /* garbage1 garbage2 */ #endif0 #if0 // skip directives inside #if0..#endif0 #debug foo #debugbegin #debugend garbage #endif0 #if0 #if0 //nested #if0..#endif0 garbage #endif0 garbage #endif0 //OLD } event PostBeginPlay() { local object o; local actor TempActor; log("!!BEGIN"); default.v1=vect(5,4,3); assert(default.v1==vect(5,4,3)); test(); assert(default.v1==vect(1,2,3)); assert(IsA('Actor')); assert(IsA('TestInfo')); assert(IsA('Info')); assert(!IsA('LevelInfo')); assert(!IsA('Texture')); //NEW (mdf) -- test consts in properties support assert(TestBool); assert(TestByte == ConstByte); assert(TestFloat == ConstFloat); assert(TestString == ConstString); assert(TestObject == ConstObject); //OLD //o=dynamicloadobject( "UnrealShare.AutoMag.Reload", class'object' ); //assert(o!=None); //assert(o==None); log("!!END"); } function TestStructBools() { assert(ST.b1==false); assert(ST.b2==false); assert(ST.b3==false); ST.b1=true; assert(ST.b1==true); assert(ST.b2==false); assert(ST.b3==false); ST.b2=true; assert(ST.b1==true); assert(ST.b2==true); assert(ST.b3==false); ST.b3=true; assert(ST.b1==true); assert(ST.b2==true); assert(ST.b3==true); ST.b1=false; ST.b2=false; ST.b3=false; } event BeginPlay() { local testobj to; local object oo; to = new class'TestObj'; to = new()class'TestObj'; to = new(self)class'TestObj'; to = new(self,"")class'TestObj'; to = new(self,"",0)class'TestObj'; to.Test(); TestStructBools(); } function TestX( bool bResource ) { local int n; n = int(bResource); MyArray[ int(bResource) ] = 0; MyArray[ int(bResource) ]++; } function bool RecurseTest() { bBool1=true; return false; } function TestLimitor( class c ) { local class<actor> NewClass; NewClass = class<actor>( c ); } static function int OtherStatic( int i ) { assert(i==246); assert(default.xnum==777); return 555; } static function int TestStatic( int i ) { assert(i==123); assert(default.xnum==777); assert(OtherStatic(i*2)==555); return i; } function TestContinueFor() { local int i; log("TestContinue"); for( i=0; i<20; i++ ) { log("iteration "$i); if(i==7||i==9||i==19) continue; log("..."); } log("DoneContinue"); } function TestContinueWhile() { local int i; log("TestContinue"); while( ++i <= 20 ) { log("iteration "$i); if(i==7||i==9) continue; log("..."); } log("DoneContinue"); } function TestContinueDoUntil() { local int i; log("TestContinue"); do { i++; log("iteration "$i); if(i==7||i==9||i>18) continue; log("..."); } until( i>20 ); log("DoneContinue"); } function TestContinueForEach() { local actor a; log("TestContinue"); foreach AllActors( class'Actor', a ) { log("actor "$a); if(light(a)==none) continue; log("..."); } log("DoneContinue"); } function SubTestOptionalOut( optional out int a, optional out int b, optional out int c ) { a *= 2; b = b*2; c += c; } function TestOptionalOut() { local int a,b,c; a=1; b=2; c=3; SubTestOptionalOut(a,b,c); assert(a==2); assert(b==4); assert(c==6); SubTestOptionalOut(a,b); assert(a==4); assert(b==8); assert(c==6); SubTestOptionalOut(,b,c); assert(a==4); assert(b==16); assert(c==12); SubTestOptionalOut(); assert(a==4); assert(b==16); assert(c==12); SubTestOptionalOut(a,b,c); assert(a==8); assert(b==32); assert(c==24); log("TestOptionalOut ok!"); } function TestNullContext( actor a ) { bHidden = a.bHidden; a.bHidden = bHidden; } function TestSwitch() { local string s; local int i; local bool b; s="Tim"; i=2; switch( i ) { case 0: assert(false); break; case 2: b=true; break; default: assert(false); break; } assert(b); switch( s ) { case "": assert(false); break; case "xyzzy": assert(false); break; default: b=false; break; } assert(!b); log("testswitch succeeded"); } event Tick( float DeltaTime ) { local class C; local class<testinfo> TC; local actor a; log("time="$Level.TimeSeconds); TestOptionalOut(); TestNullContext( self ); TestNullContext( None ); TestSwitch(); v1=vect(1,2,3); v2=vect(2,4,6); assert(v1!=v2); assert(!(v1==v2)); assert(v1==vect(1,2,3)); assert(v2==vect(2,4,6)); assert(vect(1,2,5)!=v1); assert(v1*2==v2); assert(v1==v2/2); assert(Pie==3.14); assert(Pie!=2); assert(Str=="Tim"); assert(Str!="Bob"); assert(Lotus==vect(1,2,3)); //NEW (mdf) changed GetPropertyText to return a bool and an out string param assert(CanGetProperty("sxx")); assert(CanGetProperty("ppp")); assert(CanGetProperty("bogus")); assert(CanSetProperty("xnum")); //OLD assert(GetPropertyText("sxx")=="Tim"); assert(GetPropertyText("ppp")!="123"); assert(GetPropertyText("bogus")==""); xnum=345; assert(GetPropertyText("xnum")=="345"); SetPropertyText("xnum","999"); assert(xnum==999); assert(xnum!=666); assert(bTrue1==true); assert(bFalse1==false); assert(bTrue2==true); assert(bFalse2==false); assert(default.bTrue1==true); assert(default.bFalse1==false); assert(default.bTrue2==true); assert(default.bFalse2==false); assert(class'TestInfo'.default.bTrue1==true); assert(class'TestInfo'.default.bFalse1==false); assert(class'TestInfo'.default.bTrue2==true); assert(class'TestInfo'.default.bFalse2==false); TC=Class; assert(TC.default.bTrue1==true); assert(TC.default.bFalse1==false); assert(TC.default.bTrue2==true); assert(TC.default.bFalse2==false); C=Class; assert(class<testinfo>(C).default.bTrue1==true); assert(class<testinfo>(C).default.bFalse1==false); assert(class<testinfo>(C).default.bTrue2==true); assert(class<testinfo>(C).default.bFalse2==false); assert(default.xnum==777); TestStatic(123); TC.static.TestStatic(123); class<testinfo>(C).static.TestStatic(123); bBool2=RecurseTest(); assert(bBool2==false); TestStructBools(); TestQ(); log( "All tests passed" ); } function f(); function temp() { local int i; local playercontroller PlayerOwner; local name LeftList[20]; temp(); } state AA { function f(); } state BB { function f(); } state CCAA extends AA { function f(); } state DDAA extends AA { function f(); } state EEDDAA extends DDAA { function f(); } defaultproperties { bTrue1=true bTrue2=true xnum=777 ppp=3.140000 sxx="Tim" TestBool=true TestByte=222 TestFloat=0.123000 TestString="ad rocks!" TestObject=Class'Engine.Pawn' bHidden=false bAlwaysRelevant=true RemoteRole=ROLE_SimulatedProxy UseReticleOnEvents(0)="UseReticleText" UseReticleOnEvents(1)="UseReticleCorners" UseReticleOnEvents(2)="UseReticleTopBars" ProximityReticleOnEvents(0)="ProximityReticleCorners" ProximityReticleOnEvents(1)="ProximityReticleTopBars" } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |