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]");
53 /* test strict equals/unequals */
54 trace("[strict equals]");
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);
68 assert((1|2|4|8|16|32|64|128) == 0xff);
70 /* test shift operations */
71 trace("[shift operations]");
72 assert((0xff<<8)==0xff00);
73 assert((0xff>>4)==0x0f);
81 assert(String(v)=="undefined");
83 assert(String(v)=="undefined");
87 assert( (1,2,3,4) == 4);