Migrating mbas test cases from mcs/btests to mcs/mbas/Test folder.
[mono.git] / mcs / mbas / Test / tests / ShiftOperators.vb
1 Imports System\r
2 \r
3 Module M\r
4     Sub main()\r
5         Console.WriteLine(f())\r
6     End Sub\r
7 \r
8     Function f()\r
9         Dim arr(15) As Boolean\r
10 \r
11         ' Left shift operator tests \r
12 \r
13         Dim a1 As Byte = 5\r
14 \r
15         a1 = a1 << 1001\r
16         If a1 = 10 Then arr(0) = True\r
17 \r
18         a1 = Byte.MaxValue\r
19         a1 = a1 << 2001\r
20         If a1 = 254 Then arr(1) = True\r
21 \r
22         a1 = Byte.MinValue\r
23         a1 = a1 << 2002\r
24         If a1 = 0 Then arr(2) = True\r
25 \r
26         Dim b1 As Integer = 5\r
27         Dim b2 As Integer = -5\r
28 \r
29         b1 = b1 << 1001\r
30         If b1 = 2560 Then arr(3) = True\r
31 \r
32         b1 = -5\r
33         b1 = b1 << 1001\r
34         If b1 = -2560 Then arr(4) = True\r
35 \r
36         b1 = Integer.MaxValue\r
37         b1 = b1 << 1001\r
38         If b1 = -512 Then arr(5) = True\r
39 \r
40         b1 = Integer.MinValue\r
41         b1 = b1 << 1001\r
42         If b1 = 0 Then arr(6) = True\r
43 \r
44         b1 = 0\r
45         b1 = b1 << 1001\r
46         If b1 = 0 Then arr(7) = True\r
47 \r
48         ' Right shift operator tests\r
49 \r
50         Dim c1 As Byte = 5\r
51 \r
52         c1 = c1 >> 1001\r
53         If c1 = 2 Then arr(8) = True\r
54 \r
55         c1 = Byte.MaxValue\r
56         c1 = c1 >> 2001\r
57         If c1 = 127 Then arr(9) = True\r
58 \r
59         c1 = Byte.MinValue\r
60         c1 = c1 >> 2002\r
61         If c1 = 0 Then arr(10) = True\r
62 \r
63         Dim d1 As Integer = 5\r
64 \r
65         d1 = d1 >> 1001\r
66         If d1 = 0 Then arr(11) = True\r
67 \r
68         d1 = -5\r
69         d1 = d1 >> 1001\r
70         If d1 = -1 Then arr(12) = True\r
71 \r
72         d1 = Integer.MaxValue\r
73         d1 = d1 >> 1001\r
74         If d1 = 4194303 Then arr(13) = True\r
75 \r
76         d1 = Integer.MinValue\r
77         d1 = d1 >> 1001\r
78         If d1 = -4194304 Then arr(14) = True\r
79 \r
80         d1 = 0\r
81         d1 = d1 >> 1001\r
82         If d1 = 0 Then arr(15) = True\r
83 \r
84         'For i As Integer = 0 To arr.GetUpperBound(0) \r
85         '   Console.WriteLine("{0}: {1}", i, arr(i))\r
86         'Next\r
87 \r
88         For Each bval As Boolean In arr\r
89             If Not bval Then\r
90                 Return 1\r
91             End If\r
92         Next\r
93 \r
94         Return 0\r
95 \r
96     End Function\r
97 End Module