2004-07-07 Bernie Solomon <bernard@ugsolutions.com>
authorBernie Solomon <bernard@mono-cvs.ximian.com>
Tue, 7 Sep 2004 20:06:52 +0000 (20:06 -0000)
committerBernie Solomon <bernard@mono-cvs.ximian.com>
Tue, 7 Sep 2004 20:06:52 +0000 (20:06 -0000)
* OptionalA.vb: new test for optional args + overloads

svn path=/trunk/mcs/; revision=33534

mcs/btests/ChangeLog
mcs/btests/OptionalA.vb [new file with mode: 0755]

index e50db5509b81b6f6de9bf91669d6519812e26ae9..f773d70df221dbd31b8f4fb2479f8882a73965cd 100644 (file)
@@ -1,3 +1,6 @@
+2004-07-07 Bernie Solomon <bernard@ugsolutions.com>
+       * OptionalA.vb: new test for optional args + overloads
+
 2004-09-03 Sachin Kumar <skumar1@novell.com>
        * ConversionsA.vb:
 
diff --git a/mcs/btests/OptionalA.vb b/mcs/btests/OptionalA.vb
new file mode 100755 (executable)
index 0000000..c183069
--- /dev/null
@@ -0,0 +1,66 @@
+Imports System
+
+Module Test
+    Enum E
+        A
+        B
+    End Enum
+    Function F(Optional i As Integer = 42) As Integer
+        F = i + 1
+    End Function
+    Function F2(ByVal Optional i As Integer = 42) As Integer
+        F2 = i + 1
+    End Function
+    Function G(i As Integer, Optional j As Integer = 42) As Integer
+        G = i + j
+    End Function
+    Function G(e As E) As Integer
+        G = e
+    End Function
+    Function H(i As Integer, Optional j As Integer = 42, Optional k As Integer = 3) As Integer
+        H = i + j + k
+    End Function
+    Function K(ByRef Optional i As Integer = 3) As Integer
+        K = i
+        i = i + 3
+    End Function
+    Sub Main
+        If F() <> 43 Then
+            Throw New Exception("#A1: unexpected return value")
+        End If
+        If F(99) <> 100 Then
+            Throw New Exception("#A2: unexpected return value")
+        End If
+        If F2() <> 43 Then
+            Throw New Exception("#A3: unexpected return value")
+        End If
+        If G(1) <> 43 Then
+            Throw New Exception("#A4: unexpected return value")
+        End If
+        If G(E.A) <> 0 Then
+            Throw New Exception("#A5: unexpected return value")
+        End If
+        If G(1,99) <> 100 Then
+            Throw New Exception("#A6: unexpected return value")
+        End If
+        If G(E.A,99) <> 99 Then
+            Throw New Exception("#A7: unexpected return value")
+        End If
+        If H(1) <> 46 Then
+            Throw New Exception("#A8: unexpected return value")
+        End If
+        If H(1,0) <> 4 Then
+            Throw New Exception("#A9: unexpected return value")
+        End If
+        If H(E.A) <> 45 Then
+            Throw New Exception("#A10: unexpected return value")
+        End If
+        If K() <> 3 Then
+            Throw New Exception("#A11: unexpected return value")
+        End If
+        Dim i As Integer = 9
+        If K(i) <> 9 OrElse i <> 12 Then
+            Throw New Exception("#A12: unexpected return value")
+        End If
+    End Sub
+End Module