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
25 /* test unary minus */
28 /* test tenary operator */
29 assert((true?1:2) == 1);
30 true?assert(1):assert(0);
31 false?assert(0):assert(1);
33 /* test other operators */
34 trace("[arithmetric]");
45 /* test strict equals/unequals */
46 trace("[strict equals]");
52 /* test bit operations */
53 trace("[bit operations]");
54 assert(!(0xaaaaaaaa & 0x55555555))
55 assert((0xaa | 0x55) == 0xff);
56 assert((0xff ^ 0x55) == 0xaa);
57 assert((1 & ~1) == 0);
60 /* test shift operations */
61 trace("[shift operations]");
62 assert((0xff<<8)==0xff00);
63 assert((0xff>>4)==0x0f);
70 assert(typeof(3)=="number" &&
71 typeof("")=="string" &&
72 typeof(this)=="object" &&
73 typeof(undefined)=="undefined" &&
74 typeof(null)=="object" &&
75 typeof(assert)=="function" &&
76 typeof(Main)=="object");
81 assert(String(v)=="undefined");
84 assert( (1,2,3,4) == 4);