here.
svn path=/trunk/mcs/; revision=35053
--- /dev/null
+
+Imports System
+
+Module ArithmeticOperators1
+
+ Sub main()
+
+ Dim b1 As Decimal
+ b1 = 34.45
+ b1 = b1 / 0
+ Console.WriteLine(b1)
+
+ End Sub
+
+End Module
\ No newline at end of file
--- /dev/null
+
+Imports System
+
+Module ArithmeticOperators2
+
+ Sub main()
+
+ Dim c1 As Decimal
+ c1 = 12.345
+ c1 = c1 Mod 0
+
+ End Sub
+
+End Module
\ No newline at end of file
--- /dev/null
+
+Imports System
+
+Module ArithmeticOperators3
+
+ Sub main()
+
+ Dim a1 As Decimal
+ a1 = System.Decimal.MaxValue
+ a1 = a1 ^ 2
+ Console.WriteLine(a1)
+
+ End Sub
+
+End Module
\ No newline at end of file
--- /dev/null
+'Unhandled Exception: System.ArrayTypeMismatchException: 'ReDim' can
+' only change the rightmost dimension.
+
+Imports System
+
+Module Array1
+
+ Sub Main()
+ Dim arr As Integer(,) = {{1, 2}, {3, 4}}
+ ReDim Preserve arr(3, 3)
+ arr(2, 2) = 12
+ End Sub
+End Module
+
--- /dev/null
+' System.InvalidCastException: Cast from string to integer not valid
+
+Imports System
+
+Module Array2
+
+ Sub Main()
+ Dim arr As Integer(,) = {{1, "Hello"}, {3, 4}}
+ If arr(0, 0) <> 1 Then
+ Throw New Exception("#A1")
+ End If
+ End Sub
+
+End Module
+
--- /dev/null
+' Unhandled Exception: System.IndexOutOfRangeException: Index was outside
+' the bounds of the array.
+
+Imports System
+
+Module Array3
+
+ Sub Main()
+ Dim arr As Integer(,) = {{1, 2, 3}, {3, 4, 7}}
+ arr(0, 2) = arr(0, 0) * arr(0, 1)
+ arr(1, 2) = arr(1, 0) * arr(1, 1)
+ If arr(0, 2) <> 2 Or arr(1, 2) <> 12 Then
+ Throw New Exception("#A1 - Array Handling Statement failed")
+ End If
+ ReDim Preserve arr(1, 1)
+ arr(1, 2) = 2
+ End Sub
+
+End Module
+
--- /dev/null
+' ErrorMessage: System.ArrayTypeMismatchException: Attempted to store
+' an element of the incorrect type into the array.
+
+Imports System
+
+Module AssignmentStatements1
+
+ Sub main()
+
+ Dim sa(10) As String
+ Dim oa As Object() = sa
+ oa(0) = Nothing
+ oa(1) = "Hello "
+ oa(2) = "World"
+ oa(3) = New Date(2004, 8, 17)
+
+ End Sub
+
+
+End Module
--- /dev/null
+' System.InvalidCastException: Cast from string "Hello World" to type 'Integer' is not valid.
+
+Imports System
+
+Module AssignmentStatements2
+
+ Sub main()
+ Dim a As Integer
+ a = "Hello " + "World"
+ Console.WriteLine(a)
+ End Sub
+
+End Module
--- /dev/null
+' ErrorMessage: System.OverflowException: Arithmetic operation resulted in an overflow.
+
+Imports System
+
+Module AssignmentStatements3
+
+ Sub main()
+
+ Dim b As Byte = 0
+ b += 1000
+ If b <> 1000 Then
+ Throw New Exception("#AS3-Assignment Statement Failed")
+ End If
+
+ End Sub
+
+
+End Module
--- /dev/null
+' ErrorMessage: System.InvalidCastException: Cast from string "Hello " to type 'Double'
+' is not valid.
+
+Imports System
+
+Module AssignmentStatements4
+
+ Sub main()
+ Dim i As Integer = 0
+ Dim str As String = "Hello "
+ str += i
+ Console.WriteLine(str)
+ End Sub
+
+
+End Module
--- /dev/null
+
+Imports System
+
+Module AssignmentStatements5
+
+ Private str As String = "Hello VB.NET World"
+
+ Public ReadOnly Property mystr() As String
+ Get
+ Return str
+ End Get
+ End Property
+
+ Sub main()
+
+ Mid(mystr, 7) = "MS.NET"
+ Console.WriteLine(mystr)
+ If mystr <> "Hello MS.NETBasic " Then
+ Throw New Exception("#AS5 - Assignment Statement failed")
+ End If
+
+ End Sub
+
+End Module
--- /dev/null
+Imports System
+
+Module BoolLiteralTest1
+ Sub Main()
+ Try
+ Dim b As Boolean
+ b = Not True
+ Catch e As Exception
+ Console.WriteLine(e.Message)
+ End Try
+ End Sub
+End Module
--- /dev/null
+Module CharacterLiterals1
+ Sub Main()
+ Dim c As Char
+ c = "x"c
+
+ Dim a As String = "X"
+ If a <> c Then
+ Throw New System.Exception("a is not same as c")
+ End If
+ End Sub
+End Module
--- /dev/null
+'System.InvalidCastException: Cast from string "String" to type 'Boolean' is not valid.
+
+Imports System
+
+Module ConditionalStatements1
+
+ Sub Main()
+
+ if "String" Then
+ throw new exception("#CSC2")
+ end If
+
+ End Sub
+
+End Module
--- /dev/null
+Imports System
+Module DecimalLiteral
+ Sub Main()
+ Try
+ Dim a As Decimal
+ a="Hello"
+
+ Catch e As Exception
+ Console.WriteLine(e.Message)
+ End Try
+ End Sub
+End Module
--- /dev/null
+Imports System
+Module DoubleLiteral
+ Sub Main()
+ Try
+ Dim a As Double
+ a="Hello"
+
+ Catch e As Exception
+ Console.WriteLine(e.Message)
+ End Try
+ End Sub
+End Module
--- /dev/null
+' this could be a compile time exception too
+' But MS vb 7.0 is throwing type cast exception at runtime
+' hence I am keeping it as a Negetive-Runtime-Test candidate
+
+Public Class C1
+End Class
+
+Public Class C2
+ Inherits C1
+End Class
+
+Module InheritanceC3
+ Sub Main()
+ Dim b As C2 = New C1()
+ End Sub
+End Module
--- /dev/null
+Imports System
+Module IntegerLiteral
+ Sub Main()
+ Try
+ Dim a As Integer
+ a="Hello"
+ Catch e As Exception
+ Console.WriteLine(e.Message)
+ End Try
+ End Sub
+End Module
--- /dev/null
+Imports System
+
+Module IntegerLiteralTest1
+ Sub Main()
+ Try
+ Dim i As Integer
+ i = System.Int32.MaxValue
+ i = i + 1
+ Catch e As Exception
+ Console.WriteLine(e.Message)
+ End Try
+ End Sub
+
+End Module
--- /dev/null
+Imports System
+Module IntegerLiteralTest2
+ Sub Main()
+ Try
+ Dim i As Integer
+ i = System.Int32.MinValue
+ i = i - 1
+ Catch e As Exception
+ Console.WriteLine(e.Message)
+ End Try
+ End Sub
+End Module
--- /dev/null
+Imports System
+Module IntegerLiteralTest3
+ Sub Main()
+ Try
+ Dim l As Long
+ l = System.Int64.MaxValue
+ Console.WriteLine(l)
+ l = l + 1
+ Catch e As Exception
+ Console.WriteLine(e.Message)
+ End Try
+ End Sub
+End Module
--- /dev/null
+Imports System
+Module IntegerLiteralTest4
+ Sub Main()
+ Try
+ Dim l As Integer
+ l = System.Int32.MinValue
+ l = l - 1
+ Catch e As Exception
+ Console.WriteLine(e.Message)
+ End Try
+ End Sub
+End Module
--- /dev/null
+
+Option Strict On
+
+Imports System
+
+Module LikeOperator1
+ Sub Main()
+
+ Dim a As Boolean
+ a = "HELLO" Like "H[A- Z][!M-P][!A-K]O"
+ If a <> True Then
+ Console.WriteLine("#A1-LikeOperator:Unexpected behaviour")
+ End If
+
+ End Sub
+End Module
--- /dev/null
+Imports System
+Module LiteralNothing
+ Sub Main()
+ Try
+ Dim a As String="Hello"
+ a=Nothing
+ Dim b As String=a.Substring(2)
+ Catch e As Exception
+ Console.WriteLine(e.Message)
+ End Try
+ End Sub
+End Module
--- /dev/null
+' In all ambiguous situations, the name resolves to the function rather than the local
+' StackOverFlow Exception occurs
+
+Imports System
+
+Module LocalVariables1
+
+ Function f1() As Integer()
+ f1(0) = 1
+ f1(1) = 2
+ Dim x As Integer = f1(0)
+ End Function
+
+ Sub main()
+ Dim b() As Integer = f1()
+ Console.WriteLine("{0} {1}", b(0), b(1))
+ End Sub
+
+End Module
\ No newline at end of file
--- /dev/null
+
+Imports System
+
+Module LogicalOperators1
+ Sub main()
+
+ Dim a1 As Boolean = True
+ Dim b1 As String = "xyz"
+ If a1 And b1 Then
+ a1 = False
+ End If
+ End Sub
+End Module
\ No newline at end of file
--- /dev/null
+Imports System
+Module LongLiteral
+ Sub Main()
+ Try
+ Dim a As Long
+ a="Hello"
+ Catch e As Exception
+ Console.WriteLine(e.Message)
+ End Try
+ End Sub
+End Module
--- /dev/null
+Imports System
+
+Module LoopStatements1
+
+ Sub main()
+ Do While "Hello"
+ Console.WriteLine("Hello World")
+ Loop
+ End Sub
+
+End Module
\ No newline at end of file
--- /dev/null
+
+Imports System
+
+Module RelationalOperators1
+
+ Sub Main()
+
+ Dim a As Long = 0
+ Dim b As String = "Hello"
+
+ If a < b Then
+ Console.WriteLine("#A1-RelationalOperator: Not Expected")
+ End If
+
+ End Sub
+
+End Module
--- /dev/null
+'Unhandled Exception: System.InvalidCastException: Cast from string
+' to type 'Long' is not valid. ---> System.FormatException: Input string was not in a
+' correct format.
+' Strict On disallows implicit conversions from double to long
+
+'Option Strict On
+Imports System
+
+Module ShiftOperators1
+
+ Sub Main()
+
+ Dim b1 As String = "xyz"
+ b1 = b1 << 109
+ Console.WriteLine(b1)
+
+ End Sub
+
+End Module
\ No newline at end of file
--- /dev/null
+Imports System
+Module StringLiteral
+ Sub Main()
+ Try
+ Dim a As String="Hello"
+ Dim b As String="World"
+ Dim c As String=a*b
+ Catch e As Exception
+ Console.WriteLine(e.Message)
+ End Try
+
+ End Sub
+End Module
--- /dev/null
+' Unhandled Exception: System.ArgumentException: 'SyncLock' operand cannot
+' be of type 'Boolean' because 'Boolean' is not a reference type.
+
+Imports System
+
+Module SyncLock1
+ Class C
+ Private Shared count = 0
+
+ Sub IncrementCount()
+ SyncLock count = 0
+ count += 1
+ Console.WriteLine(count)
+ End SyncLock
+ End Sub
+ End Class
+
+ Sub Main()
+ Dim c As New C()
+ c.IncrementCount()
+ End Sub
+
+End Module
\ No newline at end of file