2001-11-07 Dietmar Maurer <dietmar@ximian.com>
[mono.git] / mono / tests / jit-long.cs
1 public class TestJit {
2
3         public static long test_call (long a, long b) {
4                 return a+b;
5         }
6
7         public static int test_alu ()
8         {
9                 long a = 9, b = 6;
10                 
11                 if ((a + b) != 15)
12                         return 1;
13                 
14                 if ((a - b) != 3)
15                         return 1;
16
17                 if ((a & 8) != 8)
18                         return 1;
19
20                 if ((a | 2) != 11)
21                         return 1;
22
23                 if ((a * b) != 54)
24                         return 1;
25                 
26                 if ((a / 4) != 2)
27                         return 1;
28                 
29                 if ((a % 4) != 1)
30                         return 1;
31
32                 if (-a != -9)
33                         return 1;
34
35                 b = -1;
36                 if (~b != 0)
37                         return 1;
38
39                 return 0;
40         }
41         
42         public static int test_branch ()
43         {
44                 long a = 5, b = 5, t;
45                 
46                 if (a == b) t = 1; else t = 0;
47                 if (t != 1) return 1;
48
49                 if (a != b) t = 0; else t = 1;
50                 if (t != 1) return 1;
51
52                 if (a >= b) t = 1; else t = 0;
53                 if (t != 1) return 1;
54
55                 if (a > b) t = 0; else t = 1;
56                 if (t != 1) return 1;
57
58                 if (a <= b) t = 1; else t = 0;
59                 if (t != 1) return 1;
60
61                 if (a < b) t = 0; else t = 1;
62                 if (t != 1) return 1;
63
64                 return 0;
65         }
66
67         public static int Main() {
68                 int num = 1;
69
70                 if (test_call (3, 5) != 8)
71                         return num;
72                 num++;
73
74                 if (test_branch () != 0)
75                         return num;
76                 num++;
77                 
78                 if (test_alu () != 0)
79                         return num;
80                 num++;
81                 
82                 return 0;
83         }
84 }
85