3 import flash.display.MovieClip
4 public class Main extends flash.display.MovieClip {
7 function assert(b:Boolean) {
9 trace("ok "+count+"/"+num);
11 trace("error "+count+"/"+num);
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
26 /* test unary minus */
29 /* test tenary operator */
30 assert((true?1:2) == 1);
31 true?assert(1):assert(0);
32 false?assert(0):assert(1);
34 /* test other operators */
35 trace("[arithmetric]");
46 /* test strict equals/unequals */
47 trace("[strict equals]");
53 /* test bit operations */
54 trace("[bit operations]");
55 assert(!(0xaaaaaa & 0x555555))
56 assert((0xaa | 0x55) == 0xff);
57 assert((0xff ^ 0x55) == 0xaa);
58 assert((1 & ~1) == 0);
61 assert((1|2|4|8|16|32|64|128) == 0xff);
63 /* test shift operations */
64 trace("[shift operations]");
65 assert((0xff<<8)==0xff00);
66 assert((0xff>>4)==0x0f);
74 assert(String(v)=="undefined");
76 assert(String(v)=="undefined");
80 assert( (1,2,3,4) == 4);