treat glyphs with alpha=0 differently than normal glyphs (remove outlines)
[swftools.git] / lib / as3 / ok / ops.as
1
2 package {
3     import flash.display.MovieClip
4     public class Main extends flash.display.MovieClip {
5         var count:int = 1;
6         var num:int = 30;
7         function assert(b:Boolean) {
8             if(b) {
9                 trace("ok "+count+"/"+num);
10             } else {
11                 trace("error "+count+"/"+num);
12             }
13             count = count + 1
14         }
15         function Main() {
16             /* operations not tested here:
17                * comparison is tested in compare.as
18                * 'as' and 'is' are tested in typecast.as and extends.as
19                * ++ and -- are tested in assignments.as
20                * 'in' is tested by in.as
21                * || and && are tested in boolvalue.as
22                * <op>= is tested in assignments.as
23                * typeof is tested in typeof.as
24             */
25
26             /* test unary minus */
27             assert(-(3) == -3);
28
29             /* test tenary operator */
30             assert((true?1:2) == 1);
31             true?assert(1):assert(0);
32             false?assert(0):assert(1);
33
34             /* test other operators */
35             trace("[arithmetric]");
36             assert(3*3==9);
37             assert(3/3==1);
38             assert(10%4==2);
39             assert(2+3==5);
40             assert(2-3==-1);
41
42             /* test or */
43             var y = 0;
44             var x = y || 1;
45             assert(x);
46             var z = x && 1;
47             assert(z);
48
49             /* test not */
50             trace("[not]");
51             assert(!false);
52             
53             /* test strict equals/unequals */
54             trace("[strict equals]");
55             assert(3===3);
56             assert(3!==4);
57             assert(!(3===4));
58             assert(!(3!==3));
59
60             /* test bit operations */
61             trace("[bit operations]");
62             assert(!(0xaaaaaa & 0x555555))
63             assert((0xaa | 0x55) == 0xff);
64             assert((0xff ^ 0x55) == 0xaa);
65             assert((1 & ~1) == 0);
66             assert((1|~1)==~0);
67             
68             assert((1|2|4|8|16|32|64|128) == 0xff);
69            
70             /* test shift operations */
71             trace("[shift operations]");
72             assert((0xff<<8)==0xff00);
73             assert((0xff>>4)==0x0f);
74             assert((-1>>1)==-1);
75             assert((-1>>1)==-1);
76             assert((-1>>>1)>0);
77  
78             /* test void */
79             trace("[void]");
80             var v = void;
81             assert(String(v)=="undefined");
82             v = void 3;
83             assert(String(v)=="undefined");
84
85             /* test comma */
86             trace("[comma]");
87             assert( (1,2,3,4) == 4);
88             
89             trace("[exit]");
90         }
91     }
92 }
93