1 using System;
2 
3 public class TestJit {
4 
test_short()5 	public static int test_short ()
6 	{
7 		int max = 32767;
8 		int min = -32768;
9 
10 		int t1 = 0xffeedd;
11 		short s1 = (short)t1;
12 		int t2 = s1;
13 
14 		if ((uint)t2 != 0xffffeedd)
15 			return 1;
16 
17 		Console.WriteLine (t2.ToString ("X"));
18 
19 		if (Int16.Parse((min).ToString()) != -32768)
20 			return 1;
21 
22 		if (Int16.Parse((max).ToString()) != 32767)
23 			return 1;
24 
25 		return 0;
26 	}
27 
test_call(int a, int b)28 	public static int test_call (int a, int b) {
29 		return a+b;
30 	}
31 
test_shift()32 	public static int test_shift ()
33 	{
34 		int a = 9, b = 1;
35 
36 		if ((a << 1) != 18)
37 			return 1;
38 
39 		if ((a << b) != 18)
40 			return 1;
41 
42 		if ((a >> 1) != 4)
43 			return 1;
44 
45 		if ((a >> b) != 4)
46 			return 1;
47 
48 		a = -9;
49 		if ((a >> b) != -5)
50 			return 1;
51 
52 		return 0;
53 	}
54 
test_alu()55 	public static int test_alu ()
56 	{
57 		int a = 9, b = 6;
58 
59 		if ((a + b) != 15)
60 			return 1;
61 
62 		if ((a - b) != 3)
63 			return 1;
64 
65 		if ((a & 8) != 8)
66 			return 1;
67 
68 		if ((a | 2) != 11)
69 			return 1;
70 
71 		if ((a * b) != 54)
72 			return 1;
73 
74 		if ((a / 4) != 2)
75 			return 1;
76 
77 		if ((a % 4) != 1)
78 			return 1;
79 
80 		if (-a != -9)
81 			return 1;
82 
83 		b = -1;
84 		if (~b != 0)
85 			return 1;
86 
87 		return 0;
88 	}
89 
test_branch()90 	public static int test_branch ()
91 	{
92 		int a = 5, b = 5, t;
93 
94 		if (a == b) t = 1; else t = 0;
95 		if (t != 1) return 1;
96 
97 		if (a != b) t = 0; else t = 1;
98 		if (t != 1) return 1;
99 
100 		if (a >= b) t = 1; else t = 0;
101 		if (t != 1) return 1;
102 
103 		if (a > b) t = 0; else t = 1;
104 		if (t != 1) return 1;
105 
106 		if (a <= b) t = 1; else t = 0;
107 		if (t != 1) return 1;
108 
109 		if (a < b) t = 0; else t = 1;
110 		if (t != 1) return 1;
111 
112 		return 0;
113 	}
114 
Main()115 	public static int Main() {
116 		int num = 0;
117 
118 		num++;
119 		if (test_short () != 0)
120 			return num;
121 
122 		num++;
123 		if (test_call (3, 5) != 8)
124 			return num;
125 		num++;
126 
127 		if (test_branch () != 0)
128 			return num;
129 		num++;
130 
131 		if (test_alu () != 0)
132 			return num;
133 		num++;
134 
135 		if (test_shift () != 0)
136 			return num;
137 		num++;
138 
139 		return 0;
140 	}
141 }
142 
143