X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=lib%2Fas3%2Fok%2Fops.as;h=87de785d7300045fc114bf3b39bd5821d899fe3a;hb=85df2905e1d050077d079f2f59242aa5e8040eb0;hp=0471d5a027cfd3103e652711028e8b7d25bddd38;hpb=a43e097bc7958c5739ef3e77cdcedd56ddc060b9;p=swftools.git diff --git a/lib/as3/ok/ops.as b/lib/as3/ok/ops.as index 0471d5a..87de785 100644 --- a/lib/as3/ok/ops.as +++ b/lib/as3/ok/ops.as @@ -3,7 +3,7 @@ package { import flash.display.MovieClip public class Main extends flash.display.MovieClip { var count:int = 1; - var num:int = 27; + var num:int = 28; function assert(b:Boolean) { if(b) { trace("ok "+count+"/"+num); @@ -20,6 +20,7 @@ package { * 'in' is tested by in.as * || and && are tested in boolvalue.as * = is tested in assignments.as + * typeof is tested in typeof.as */ /* test unary minus */ @@ -51,11 +52,13 @@ package { /* test bit operations */ trace("[bit operations]"); - assert(!(0xaaaaaaaa & 0x55555555)) + assert(!(0xaaaaaa & 0x555555)) assert((0xaa | 0x55) == 0xff); assert((0xff ^ 0x55) == 0xaa); assert((1 & ~1) == 0); assert((1|~1)==~0); + + assert((1|2|4|8|16|32|64|128) == 0xff); /* test shift operations */ trace("[shift operations]"); @@ -64,24 +67,19 @@ package { assert((-1>>1)==-1); assert((-1>>1)==-1); assert((-1>>>1)>0); - - /* test typeof */ - trace("[typeof]"); - assert(typeof(3)=="number" && - typeof("")=="string" && - typeof(this)=="object" && - typeof(undefined)=="undefined" && - typeof(null)=="object" && - typeof(assert)=="function" && - typeof(Main)=="object"); - + /* test void */ trace("[void]"); var v = void; assert(String(v)=="undefined"); + v = void 3; + assert(String(v)=="undefined"); /* test comma */ + trace("[comma]"); assert( (1,2,3,4) == 4); + + trace("[exit]"); } } }