Added new tests for Loop Statements
[mono.git] / mcs / btests / LogicalOperators.vb
1 ' Logical Operators\r
2 \r
3 Imports System\r
4 \r
5 Module M\r
6 \r
7     Sub Main()\r
8         Console.WriteLine(f())\r
9     End Sub\r
10 \r
11     Function f1() As Boolean\r
12         Console.WriteLine("Function f1() is called")\r
13         Return True\r
14     End Function\r
15 \r
16     Function f2() As Boolean\r
17         Console.WriteLine("Function f2() is called")\r
18         Return False\r
19     End Function\r
20 \r
21     Function f() As Integer\r
22         Dim arr(35) As Boolean\r
23 \r
24         Dim a1, a2, a3, a4 As Boolean\r
25         a1 = True : a2 = True : a3 = False : a4 = False\r
26 \r
27         If a1 And a2 Then arr(0) = True\r
28         If a1 And a3 Then arr(1) = False Else arr(1) = True\r
29         If a3 And a1 Then arr(2) = False Else arr(2) = True\r
30         If a4 And a3 Then arr(3) = False Else arr(3) = True\r
31         If f1() And (a1 = True) Then arr(4) = True\r
32         If f2() And f1() Then arr(5) = False Else arr(5) = True\r
33 \r
34         If a1 Or a2 Then arr(6) = True\r
35         If a1 Or a3 Then arr(7) = True\r
36         If a3 Or a1 Then arr(8) = True\r
37         If a4 Or a3 Then arr(9) = False Else arr(9) = True\r
38         If f1() Or (a1 = True) Then arr(10) = True\r
39         If f2() Or f1() Then arr(11) = True\r
40 \r
41         If a1 Xor a2 Then arr(12) = False Else arr(12) = True\r
42         If a1 Xor a3 Then arr(13) = True\r
43         If a3 Xor a1 Then arr(14) = True\r
44         If a4 Xor a3 Then arr(15) = False Else arr(15) = True\r
45         If f1() Xor (a1 = True) Then arr(16) = False Else arr(16) = True\r
46         If f2() Xor f1() Then arr(17) = True\r
47 \r
48         If f1() AndAlso f2() Then arr(18) = False Else arr(18) = True\r
49         If f2() AndAlso f1() Then arr(19) = False Else arr(19) = True\r
50         If f1() AndAlso (a1 = True) Then arr(20) = True\r
51 \r
52         If f1() OrElse f2() Then arr(21) = True\r
53         If f2() OrElse f1() Then arr(22) = True\r
54         If (a1 = False) OrElse f2() Then arr(23) = False Else arr(23) = True\r
55 \r
56         Dim b1 As Long = 2\r
57         Dim b2 As Byte = 5\r
58         \r
59         If (b1 And System.Int64.MaxValue) = b1 Then arr(24) = True\r
60         If (b1 And 0) = 0 Then arr(25) = True\r
61         If (b1 Or System.Int64.MaxValue) = System.Int64.MaxValue Then arr(26) = True\r
62         If (b1 Or 0) = b1 Then arr(27) = True\r
63         If (b1 Xor System.Int64.MaxValue) = (System.Int64.MaxValue - b1) Then arr(28) = True\r
64         If (b1 Xor 0) = b1 Then arr(29) = True\r
65 \r
66         If (b2 And System.Byte.MaxValue) = b2 Then arr(30) = True\r
67         If (b2 And 0) = 0 Then arr(31) = True\r
68         If (b2 Or System.Byte.MaxValue) = System.Byte.MaxValue Then arr(32) = True\r
69         If (b2 Or 0) = b2 Then arr(33) = True\r
70         If (b2 Xor System.Byte.MaxValue) = (System.Byte.MaxValue - b2) Then arr(34) = True\r
71         If (b2 Xor 0) = b2 Then arr(35) = True\r
72 \r
73         'Dim i As Integer\r
74         'For i = 0 To arr.GetUpperBound(0)\r
75         'Console.WriteLine("{0}: {1}", i, arr(i))\r
76         'Next\r
77 \r
78         Dim bval As Boolean\r
79         For Each bval In arr\r
80             If Not bval Then\r
81                 Return 1\r
82             End If\r
83         Next\r
84 \r
85         Return 0\r
86 \r
87     End Function\r
88 \r
89 End Module\r