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