From 251dde0b88168f97dfa5acf87af26ade62e3b2fe Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 07:15:38 +0200 Subject: [PATCH 01/55] Adding SpanByte --- .../CoreLibrary.NoReflection.nfproj | 4 +- .../System/SpanByte.cs | 172 ++++++++++++++++++ nanoFramework.CoreLibrary/CoreLibrary.nfproj | 1 + nanoFramework.CoreLibrary/System/SpanByte.cs | 172 ++++++++++++++++++ 4 files changed, 346 insertions(+), 3 deletions(-) create mode 100644 nanoFramework.CoreLibrary.NoReflection/System/SpanByte.cs create mode 100644 nanoFramework.CoreLibrary/System/SpanByte.cs diff --git a/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj b/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj index 1d8d3dc9..b4e6ac98 100644 --- a/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj +++ b/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj @@ -189,6 +189,7 @@ + @@ -364,9 +365,6 @@ - - - diff --git a/nanoFramework.CoreLibrary.NoReflection/System/SpanByte.cs b/nanoFramework.CoreLibrary.NoReflection/System/SpanByte.cs new file mode 100644 index 00000000..b9189240 --- /dev/null +++ b/nanoFramework.CoreLibrary.NoReflection/System/SpanByte.cs @@ -0,0 +1,172 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +namespace System +{ + /// + /// Provides a type- and memory-safe representation of a contiguous region of arbitrary byte array + /// + public ref struct SpanByte + { + private byte[] _array; + private readonly int _start; + private readonly int _length; + + /// + /// Creates a new System.Span`1 object over the entirety of a specified array. + /// + /// The array from which to create the System.Span object. + public SpanByte(byte[] array) + { + _array = array; + _length = array != null ? array.Length : 0; + _start = 0; + } + + /// + /// Creates a new System.Span`1 object that includes a specified number of elements + /// of an array starting at a specified index. + /// + /// The source array. + /// The index of the first element to include in the new System.Span + /// The number of elements to include in the new System.Span + /// + /// array is null, but start or length is non-zero. -or- start is outside the bounds + /// of the array. -or- start and length exceeds the number of elements in the array. + /// + public SpanByte(byte[] array, int start, int length) + { + if (array != null) + { + if ((length > array.Length - start) || (start >= array.Length)) + { + throw new ArgumentOutOfRangeException($"Array length too small"); + } + } + else + { + if ((start != 0) || (length != 0)) + { + throw new ArgumentOutOfRangeException($"Array is null but start and length are not 0"); + } + } + + _array = array; + _start = start; + _length = length; + } + + /// + /// Gets the element at the specified zero-based index. + /// + /// The zero-based index of the element. + /// The element at the specified index. + public byte this[int index] + { + get + { + return _array[_start + index]; + } + set + { + _array[_start + index] = value; + } + } + + /// + /// Returns an empty System.Span object. + /// + public static SpanByte Empty => new SpanByte(); + + /// + /// Returns the length of the current span. + /// + public int Length => _length; + + /// + /// Returns a value that indicates whether the current System.Span is empty. + /// true if the current span is empty; otherwise, false. + /// + public bool IsEmpty => Length == 0; + + /// + /// Copies the contents of this System.Span into a destination System.Span. + /// + /// The destination System.Span object. + /// + /// destination is shorter than the source System.Span. + /// + public void CopyTo(SpanByte destination) + { + if (destination.Length < _length - _start) + { + throw new ArgumentException($"Destination too small"); + } + + for (int i = 0; i < _array.Length; i++) + { + destination[i] = _array[i]; + } + } + + /// + /// Forms a slice out of the current span that begins at a specified index. + /// + /// The index at which to begin the slice. + /// A span that consists of all elements of the current span from start to the end of the span. + /// start is less than zero or greater than System.Span.Length. + public SpanByte Slice(int start) + { + if ((start > _length - _start) || (start < 0)) + { + throw new ArgumentOutOfRangeException($"start is less than zero or greater than length"); + } + + return new SpanByte(_array, _start + start, Length - start - _start); + } + + /// + /// Forms a slice out of the current span starting at a specified index for a specified length. + /// + /// The index at which to begin this slice. + /// The desired length for the slice. + /// A span that consists of length elements from the current span starting at start. + /// start or start + length is less than zero or greater than System.Span.Length. + public SpanByte Slice(int start, int length) + { + if ((start < 0) || (start + length < 0) || (start + length > _length - _start)) + { + throw new ArgumentOutOfRangeException($"start or start + length is less than zero or greater than length"); + } + + return new SpanByte(_array, _start + start, length); + } + + /// + /// Copies the contents of this span into a new array. + /// + /// An array containing the data in the current span. + public byte[] ToArray() + { + byte[] array = new byte[Length]; + for (int i = 0; i < Length; i++) + { + array[i] = _array[_start + i]; + } + + return array; + } + + /// + /// Implicit conversion of an array to a span of byte + /// + /// + public static implicit operator SpanByte(byte[] array) + { + return new SpanByte(array); + } + } +} \ No newline at end of file diff --git a/nanoFramework.CoreLibrary/CoreLibrary.nfproj b/nanoFramework.CoreLibrary/CoreLibrary.nfproj index 4cb7dd30..a0ee7119 100644 --- a/nanoFramework.CoreLibrary/CoreLibrary.nfproj +++ b/nanoFramework.CoreLibrary/CoreLibrary.nfproj @@ -162,6 +162,7 @@ + diff --git a/nanoFramework.CoreLibrary/System/SpanByte.cs b/nanoFramework.CoreLibrary/System/SpanByte.cs new file mode 100644 index 00000000..b9189240 --- /dev/null +++ b/nanoFramework.CoreLibrary/System/SpanByte.cs @@ -0,0 +1,172 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +namespace System +{ + /// + /// Provides a type- and memory-safe representation of a contiguous region of arbitrary byte array + /// + public ref struct SpanByte + { + private byte[] _array; + private readonly int _start; + private readonly int _length; + + /// + /// Creates a new System.Span`1 object over the entirety of a specified array. + /// + /// The array from which to create the System.Span object. + public SpanByte(byte[] array) + { + _array = array; + _length = array != null ? array.Length : 0; + _start = 0; + } + + /// + /// Creates a new System.Span`1 object that includes a specified number of elements + /// of an array starting at a specified index. + /// + /// The source array. + /// The index of the first element to include in the new System.Span + /// The number of elements to include in the new System.Span + /// + /// array is null, but start or length is non-zero. -or- start is outside the bounds + /// of the array. -or- start and length exceeds the number of elements in the array. + /// + public SpanByte(byte[] array, int start, int length) + { + if (array != null) + { + if ((length > array.Length - start) || (start >= array.Length)) + { + throw new ArgumentOutOfRangeException($"Array length too small"); + } + } + else + { + if ((start != 0) || (length != 0)) + { + throw new ArgumentOutOfRangeException($"Array is null but start and length are not 0"); + } + } + + _array = array; + _start = start; + _length = length; + } + + /// + /// Gets the element at the specified zero-based index. + /// + /// The zero-based index of the element. + /// The element at the specified index. + public byte this[int index] + { + get + { + return _array[_start + index]; + } + set + { + _array[_start + index] = value; + } + } + + /// + /// Returns an empty System.Span object. + /// + public static SpanByte Empty => new SpanByte(); + + /// + /// Returns the length of the current span. + /// + public int Length => _length; + + /// + /// Returns a value that indicates whether the current System.Span is empty. + /// true if the current span is empty; otherwise, false. + /// + public bool IsEmpty => Length == 0; + + /// + /// Copies the contents of this System.Span into a destination System.Span. + /// + /// The destination System.Span object. + /// + /// destination is shorter than the source System.Span. + /// + public void CopyTo(SpanByte destination) + { + if (destination.Length < _length - _start) + { + throw new ArgumentException($"Destination too small"); + } + + for (int i = 0; i < _array.Length; i++) + { + destination[i] = _array[i]; + } + } + + /// + /// Forms a slice out of the current span that begins at a specified index. + /// + /// The index at which to begin the slice. + /// A span that consists of all elements of the current span from start to the end of the span. + /// start is less than zero or greater than System.Span.Length. + public SpanByte Slice(int start) + { + if ((start > _length - _start) || (start < 0)) + { + throw new ArgumentOutOfRangeException($"start is less than zero or greater than length"); + } + + return new SpanByte(_array, _start + start, Length - start - _start); + } + + /// + /// Forms a slice out of the current span starting at a specified index for a specified length. + /// + /// The index at which to begin this slice. + /// The desired length for the slice. + /// A span that consists of length elements from the current span starting at start. + /// start or start + length is less than zero or greater than System.Span.Length. + public SpanByte Slice(int start, int length) + { + if ((start < 0) || (start + length < 0) || (start + length > _length - _start)) + { + throw new ArgumentOutOfRangeException($"start or start + length is less than zero or greater than length"); + } + + return new SpanByte(_array, _start + start, length); + } + + /// + /// Copies the contents of this span into a new array. + /// + /// An array containing the data in the current span. + public byte[] ToArray() + { + byte[] array = new byte[Length]; + for (int i = 0; i < Length; i++) + { + array[i] = _array[_start + i]; + } + + return array; + } + + /// + /// Implicit conversion of an array to a span of byte + /// + /// + public static implicit operator SpanByte(byte[] array) + { + return new SpanByte(array); + } + } +} \ No newline at end of file From 572fc3e6f202d0cedcfc0ce973da24241879b2c1 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 07:20:36 +0200 Subject: [PATCH 02/55] adjusting comments and broken link --- .../CoreLibrary.NoReflection.nfproj | 5 ++++- nanoFramework.CoreLibrary/System/SpanByte.cs | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj b/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj index b4e6ac98..dcb5fceb 100644 --- a/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj +++ b/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj @@ -189,7 +189,7 @@ - + @@ -365,6 +365,9 @@ + + + diff --git a/nanoFramework.CoreLibrary/System/SpanByte.cs b/nanoFramework.CoreLibrary/System/SpanByte.cs index b9189240..cb17ed0e 100644 --- a/nanoFramework.CoreLibrary/System/SpanByte.cs +++ b/nanoFramework.CoreLibrary/System/SpanByte.cs @@ -16,7 +16,7 @@ public ref struct SpanByte private readonly int _length; /// - /// Creates a new System.Span`1 object over the entirety of a specified array. + /// Creates a new System.SpanByte object over the entirety of a specified array. /// /// The array from which to create the System.Span object. public SpanByte(byte[] array) @@ -27,7 +27,7 @@ public SpanByte(byte[] array) } /// - /// Creates a new System.Span`1 object that includes a specified number of elements + /// Creates a new System.SpanByte object that includes a specified number of elements /// of an array starting at a specified index. /// /// The source array. From 3d00523fc4839791941994c0547a53741eeec8c4 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 07:22:16 +0200 Subject: [PATCH 03/55] Removing un necessary file --- .../System/SpanByte.cs | 172 ------------------ 1 file changed, 172 deletions(-) delete mode 100644 nanoFramework.CoreLibrary.NoReflection/System/SpanByte.cs diff --git a/nanoFramework.CoreLibrary.NoReflection/System/SpanByte.cs b/nanoFramework.CoreLibrary.NoReflection/System/SpanByte.cs deleted file mode 100644 index b9189240..00000000 --- a/nanoFramework.CoreLibrary.NoReflection/System/SpanByte.cs +++ /dev/null @@ -1,172 +0,0 @@ -// -// Copyright (c) .NET Foundation and Contributors -// Portions Copyright (c) Microsoft Corporation. All rights reserved. -// See LICENSE file in the project root for full license information. -// - -namespace System -{ - /// - /// Provides a type- and memory-safe representation of a contiguous region of arbitrary byte array - /// - public ref struct SpanByte - { - private byte[] _array; - private readonly int _start; - private readonly int _length; - - /// - /// Creates a new System.Span`1 object over the entirety of a specified array. - /// - /// The array from which to create the System.Span object. - public SpanByte(byte[] array) - { - _array = array; - _length = array != null ? array.Length : 0; - _start = 0; - } - - /// - /// Creates a new System.Span`1 object that includes a specified number of elements - /// of an array starting at a specified index. - /// - /// The source array. - /// The index of the first element to include in the new System.Span - /// The number of elements to include in the new System.Span - /// - /// array is null, but start or length is non-zero. -or- start is outside the bounds - /// of the array. -or- start and length exceeds the number of elements in the array. - /// - public SpanByte(byte[] array, int start, int length) - { - if (array != null) - { - if ((length > array.Length - start) || (start >= array.Length)) - { - throw new ArgumentOutOfRangeException($"Array length too small"); - } - } - else - { - if ((start != 0) || (length != 0)) - { - throw new ArgumentOutOfRangeException($"Array is null but start and length are not 0"); - } - } - - _array = array; - _start = start; - _length = length; - } - - /// - /// Gets the element at the specified zero-based index. - /// - /// The zero-based index of the element. - /// The element at the specified index. - public byte this[int index] - { - get - { - return _array[_start + index]; - } - set - { - _array[_start + index] = value; - } - } - - /// - /// Returns an empty System.Span object. - /// - public static SpanByte Empty => new SpanByte(); - - /// - /// Returns the length of the current span. - /// - public int Length => _length; - - /// - /// Returns a value that indicates whether the current System.Span is empty. - /// true if the current span is empty; otherwise, false. - /// - public bool IsEmpty => Length == 0; - - /// - /// Copies the contents of this System.Span into a destination System.Span. - /// - /// The destination System.Span object. - /// - /// destination is shorter than the source System.Span. - /// - public void CopyTo(SpanByte destination) - { - if (destination.Length < _length - _start) - { - throw new ArgumentException($"Destination too small"); - } - - for (int i = 0; i < _array.Length; i++) - { - destination[i] = _array[i]; - } - } - - /// - /// Forms a slice out of the current span that begins at a specified index. - /// - /// The index at which to begin the slice. - /// A span that consists of all elements of the current span from start to the end of the span. - /// start is less than zero or greater than System.Span.Length. - public SpanByte Slice(int start) - { - if ((start > _length - _start) || (start < 0)) - { - throw new ArgumentOutOfRangeException($"start is less than zero or greater than length"); - } - - return new SpanByte(_array, _start + start, Length - start - _start); - } - - /// - /// Forms a slice out of the current span starting at a specified index for a specified length. - /// - /// The index at which to begin this slice. - /// The desired length for the slice. - /// A span that consists of length elements from the current span starting at start. - /// start or start + length is less than zero or greater than System.Span.Length. - public SpanByte Slice(int start, int length) - { - if ((start < 0) || (start + length < 0) || (start + length > _length - _start)) - { - throw new ArgumentOutOfRangeException($"start or start + length is less than zero or greater than length"); - } - - return new SpanByte(_array, _start + start, length); - } - - /// - /// Copies the contents of this span into a new array. - /// - /// An array containing the data in the current span. - public byte[] ToArray() - { - byte[] array = new byte[Length]; - for (int i = 0; i < Length; i++) - { - array[i] = _array[_start + i]; - } - - return array; - } - - /// - /// Implicit conversion of an array to a span of byte - /// - /// - public static implicit operator SpanByte(byte[] array) - { - return new SpanByte(array); - } - } -} \ No newline at end of file From 4235ba6132605698112ffb4b39c26032c551f7a5 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 07:23:18 +0200 Subject: [PATCH 04/55] missing line --- nanoFramework.CoreLibrary/System/SpanByte.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanoFramework.CoreLibrary/System/SpanByte.cs b/nanoFramework.CoreLibrary/System/SpanByte.cs index cb17ed0e..242874ea 100644 --- a/nanoFramework.CoreLibrary/System/SpanByte.cs +++ b/nanoFramework.CoreLibrary/System/SpanByte.cs @@ -169,4 +169,4 @@ public static implicit operator SpanByte(byte[] array) return new SpanByte(array); } } -} \ No newline at end of file +} From 14101691a8c54fe0cb7b5996dbd43148bee4bc47 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 07:44:30 +0200 Subject: [PATCH 05/55] adjusting language version --- .../CoreLibrary.NoReflection.nfproj | 1 + nanoFramework.CoreLibrary/CoreLibrary.nfproj | 1 + 2 files changed, 2 insertions(+) diff --git a/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj b/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj index dcb5fceb..f3ec15c0 100644 --- a/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj +++ b/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj @@ -24,6 +24,7 @@ $(DefineConstants) v1.0 bin\$(Configuration)\mscorlib.xml + 8.0 true diff --git a/nanoFramework.CoreLibrary/CoreLibrary.nfproj b/nanoFramework.CoreLibrary/CoreLibrary.nfproj index a0ee7119..23e95715 100644 --- a/nanoFramework.CoreLibrary/CoreLibrary.nfproj +++ b/nanoFramework.CoreLibrary/CoreLibrary.nfproj @@ -24,6 +24,7 @@ $(DefineConstants);NANOCLR_REFLECTION v1.0 bin\$(Configuration)\mscorlib.xml + 8.0 true From 544dc480ea2cac5e028cab61ceb2855b7007a9a5 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 08:05:19 +0200 Subject: [PATCH 06/55] removing language version as not supported in the build. Removing ref struct --- .../CoreLibrary.NoReflection.nfproj | 1 - nanoFramework.CoreLibrary/System/SpanByte.cs | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj b/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj index f3ec15c0..dcb5fceb 100644 --- a/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj +++ b/nanoFramework.CoreLibrary.NoReflection/CoreLibrary.NoReflection.nfproj @@ -24,7 +24,6 @@ $(DefineConstants) v1.0 bin\$(Configuration)\mscorlib.xml - 8.0 true diff --git a/nanoFramework.CoreLibrary/System/SpanByte.cs b/nanoFramework.CoreLibrary/System/SpanByte.cs index 242874ea..5cff8ea1 100644 --- a/nanoFramework.CoreLibrary/System/SpanByte.cs +++ b/nanoFramework.CoreLibrary/System/SpanByte.cs @@ -9,7 +9,7 @@ namespace System /// /// Provides a type- and memory-safe representation of a contiguous region of arbitrary byte array /// - public ref struct SpanByte + public struct SpanByte { private byte[] _array; private readonly int _start; From 384a8b1a6b1b8c9b7055bccae5e54a66b4064814 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 08:30:12 +0200 Subject: [PATCH 07/55] removing langVersion --- nanoFramework.CoreLibrary/CoreLibrary.nfproj | 1 - 1 file changed, 1 deletion(-) diff --git a/nanoFramework.CoreLibrary/CoreLibrary.nfproj b/nanoFramework.CoreLibrary/CoreLibrary.nfproj index 23e95715..a0ee7119 100644 --- a/nanoFramework.CoreLibrary/CoreLibrary.nfproj +++ b/nanoFramework.CoreLibrary/CoreLibrary.nfproj @@ -24,7 +24,6 @@ $(DefineConstants);NANOCLR_REFLECTION v1.0 bin\$(Configuration)\mscorlib.xml - 8.0 true From 145c229d3176cc5719f47194e12798deff835f06 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 10:28:13 +0200 Subject: [PATCH 08/55] fixing Slice tests and Silce(x) --- nanoFramework.CoreLibrary/System/SpanByte.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/nanoFramework.CoreLibrary/System/SpanByte.cs b/nanoFramework.CoreLibrary/System/SpanByte.cs index 5cff8ea1..ace9b04f 100644 --- a/nanoFramework.CoreLibrary/System/SpanByte.cs +++ b/nanoFramework.CoreLibrary/System/SpanByte.cs @@ -90,7 +90,7 @@ public byte this[int index] /// Returns a value that indicates whether the current System.Span is empty. /// true if the current span is empty; otherwise, false. /// - public bool IsEmpty => Length == 0; + public bool IsEmpty => _length == 0; /// /// Copies the contents of this System.Span into a destination System.Span. @@ -120,12 +120,12 @@ public void CopyTo(SpanByte destination) /// start is less than zero or greater than System.Span.Length. public SpanByte Slice(int start) { - if ((start > _length - _start) || (start < 0)) + if ((start > _length) || (start < 0)) { throw new ArgumentOutOfRangeException($"start is less than zero or greater than length"); } - return new SpanByte(_array, _start + start, Length - start - _start); + return new SpanByte(_array, _start + start, _length - start); } /// @@ -137,7 +137,7 @@ public SpanByte Slice(int start) /// start or start + length is less than zero or greater than System.Span.Length. public SpanByte Slice(int start, int length) { - if ((start < 0) || (start + length < 0) || (start + length > _length - _start)) + if ((start < 0) || (length < 0) || (length > _length - _start) || (start + _start > _length)) { throw new ArgumentOutOfRangeException($"start or start + length is less than zero or greater than length"); } @@ -151,7 +151,7 @@ public SpanByte Slice(int start, int length) /// An array containing the data in the current span. public byte[] ToArray() { - byte[] array = new byte[Length]; + byte[] array = new byte[_length]; for (int i = 0; i < Length; i++) { array[i] = _array[_start + i]; From ea2440b051603d5ba544d90045e02234789f363d Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 11:10:36 +0200 Subject: [PATCH 09/55] Adjusting throw conditions in slice --- nanoFramework.CoreLibrary/System/SpanByte.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanoFramework.CoreLibrary/System/SpanByte.cs b/nanoFramework.CoreLibrary/System/SpanByte.cs index ace9b04f..101e0675 100644 --- a/nanoFramework.CoreLibrary/System/SpanByte.cs +++ b/nanoFramework.CoreLibrary/System/SpanByte.cs @@ -137,7 +137,7 @@ public SpanByte Slice(int start) /// start or start + length is less than zero or greater than System.Span.Length. public SpanByte Slice(int start, int length) { - if ((start < 0) || (length < 0) || (length > _length - _start) || (start + _start > _length)) + if ((start < 0) || (length < 0) || (start + length > _length) || (start + _start > _length)) { throw new ArgumentOutOfRangeException($"start or start + length is less than zero or greater than length"); } From 44391d6ad566b1b05f72947ec4d5c4f24af94135 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 13:42:10 +0200 Subject: [PATCH 10/55] Adjusting based on PR feedbacks and comments --- nanoFramework.CoreLibrary/System/SpanByte.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/nanoFramework.CoreLibrary/System/SpanByte.cs b/nanoFramework.CoreLibrary/System/SpanByte.cs index 101e0675..5768164f 100644 --- a/nanoFramework.CoreLibrary/System/SpanByte.cs +++ b/nanoFramework.CoreLibrary/System/SpanByte.cs @@ -9,7 +9,8 @@ namespace System /// /// Provides a type- and memory-safe representation of a contiguous region of arbitrary byte array /// - public struct SpanByte + [Serializable, CLSCompliant(false)] + public readonly ref struct SpanByte { private byte[] _array; private readonly int _start; @@ -68,10 +69,20 @@ public byte this[int index] { get { + if (_start + index > _length) + { + throw new ArgumentOutOfRangeException($"Index out of range"); + } + return _array[_start + index]; } set { + if (_start + index > _length) + { + throw new ArgumentOutOfRangeException($"Index out of range"); + } + _array[_start + index] = value; } } From 705d371576bd27e98b3562487f0923c2255c7231 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 13:50:46 +0200 Subject: [PATCH 11/55] fixing readonly --- nanoFramework.CoreLibrary/System/SpanByte.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanoFramework.CoreLibrary/System/SpanByte.cs b/nanoFramework.CoreLibrary/System/SpanByte.cs index 5768164f..e79cad11 100644 --- a/nanoFramework.CoreLibrary/System/SpanByte.cs +++ b/nanoFramework.CoreLibrary/System/SpanByte.cs @@ -12,7 +12,7 @@ namespace System [Serializable, CLSCompliant(false)] public readonly ref struct SpanByte { - private byte[] _array; + private readonly byte[] _array; private readonly int _start; private readonly int _length; From d34be4db8e912fb5ee646e17a2385241e16068e4 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 13:57:36 +0200 Subject: [PATCH 12/55] extra space, Length to _length --- nanoFramework.CoreLibrary/System/SpanByte.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanoFramework.CoreLibrary/System/SpanByte.cs b/nanoFramework.CoreLibrary/System/SpanByte.cs index e79cad11..c8707599 100644 --- a/nanoFramework.CoreLibrary/System/SpanByte.cs +++ b/nanoFramework.CoreLibrary/System/SpanByte.cs @@ -163,7 +163,7 @@ public SpanByte Slice(int start, int length) public byte[] ToArray() { byte[] array = new byte[_length]; - for (int i = 0; i < Length; i++) + for (int i = 0; i < _length; i++) { array[i] = _array[_start + i]; } From 4e0f710effd810a749aa0b672ef18d8d97a7f62a Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 15:11:13 +0200 Subject: [PATCH 13/55] fixing check of lenght --- nanoFramework.CoreLibrary/System/SpanByte.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nanoFramework.CoreLibrary/System/SpanByte.cs b/nanoFramework.CoreLibrary/System/SpanByte.cs index c8707599..b94beb71 100644 --- a/nanoFramework.CoreLibrary/System/SpanByte.cs +++ b/nanoFramework.CoreLibrary/System/SpanByte.cs @@ -69,7 +69,7 @@ public byte this[int index] { get { - if (_start + index > _length) + if (index > _length) { throw new ArgumentOutOfRangeException($"Index out of range"); } @@ -78,7 +78,7 @@ public byte this[int index] } set { - if (_start + index > _length) + if (index > _length) { throw new ArgumentOutOfRangeException($"Index out of range"); } From e011fbbdb158359fdb044b4dcee5e8cf73c50ac2 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 15:16:02 +0200 Subject: [PATCH 14/55] correcxting array length check at SpenByte constructor --- nanoFramework.CoreLibrary/System/SpanByte.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanoFramework.CoreLibrary/System/SpanByte.cs b/nanoFramework.CoreLibrary/System/SpanByte.cs index b94beb71..2c9e566f 100644 --- a/nanoFramework.CoreLibrary/System/SpanByte.cs +++ b/nanoFramework.CoreLibrary/System/SpanByte.cs @@ -42,7 +42,7 @@ public SpanByte(byte[] array, int start, int length) { if (array != null) { - if ((length > array.Length - start) || (start >= array.Length)) + if ((length > array.Length - start) || (start > array.Length)) { throw new ArgumentOutOfRangeException($"Array length too small"); } From 2068165522272115a690d16b767f6a2f4a1f43d8 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 15:25:39 +0200 Subject: [PATCH 15/55] adjusting Slice validation check --- nanoFramework.CoreLibrary/System/SpanByte.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanoFramework.CoreLibrary/System/SpanByte.cs b/nanoFramework.CoreLibrary/System/SpanByte.cs index 2c9e566f..cea1acee 100644 --- a/nanoFramework.CoreLibrary/System/SpanByte.cs +++ b/nanoFramework.CoreLibrary/System/SpanByte.cs @@ -148,7 +148,7 @@ public SpanByte Slice(int start) /// start or start + length is less than zero or greater than System.Span.Length. public SpanByte Slice(int start, int length) { - if ((start < 0) || (length < 0) || (start + length > _length) || (start + _start > _length)) + if ((start < 0) || (length < 0) || (start + length > _length)) { throw new ArgumentOutOfRangeException($"start or start + length is less than zero or greater than length"); } From 79a8e631ab7aadd043adb5f97da9863a63430200 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 30 Sep 2020 15:40:49 +0200 Subject: [PATCH 16/55] correcting CopyTo --- nanoFramework.CoreLibrary/System/SpanByte.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nanoFramework.CoreLibrary/System/SpanByte.cs b/nanoFramework.CoreLibrary/System/SpanByte.cs index cea1acee..4ca605cf 100644 --- a/nanoFramework.CoreLibrary/System/SpanByte.cs +++ b/nanoFramework.CoreLibrary/System/SpanByte.cs @@ -112,14 +112,14 @@ public byte this[int index] /// public void CopyTo(SpanByte destination) { - if (destination.Length < _length - _start) + if (destination.Length < _length) { throw new ArgumentException($"Destination too small"); } - for (int i = 0; i < _array.Length; i++) + for (int i = 0; i < _length; i++) { - destination[i] = _array[i]; + destination[i] = _array[_start + i]; } } From c2c3a61d139fc149adb9e1a628390781f122684d Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Fri, 26 Feb 2021 22:58:18 +0300 Subject: [PATCH 17/55] Adding BitConverter t"est as an example --- Tests/NFUnitTestCoreLibrary/BitConverter.cs | 613 +++++++++++++++++ Tests/NFUnitTestCoreLibrary/Helpers.cs | 625 ++++++++++++++++++ .../NFUnitTestBitConverter.nfproj | 61 ++ .../Properties/AssemblyInfo.cs | 33 + Tests/NFUnitTestCoreLibrary/nano.runsettings | 13 + Tests/NFUnitTestCoreLibrary/packages.config | 5 + nanoFramework.CoreLibrary.sln | 17 +- 7 files changed, 1365 insertions(+), 2 deletions(-) create mode 100644 Tests/NFUnitTestCoreLibrary/BitConverter.cs create mode 100644 Tests/NFUnitTestCoreLibrary/Helpers.cs create mode 100644 Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj create mode 100644 Tests/NFUnitTestCoreLibrary/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestCoreLibrary/nano.runsettings create mode 100644 Tests/NFUnitTestCoreLibrary/packages.config diff --git a/Tests/NFUnitTestCoreLibrary/BitConverter.cs b/Tests/NFUnitTestCoreLibrary/BitConverter.cs new file mode 100644 index 00000000..321f276e --- /dev/null +++ b/Tests/NFUnitTestCoreLibrary/BitConverter.cs @@ -0,0 +1,613 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestCoreLibrary +{ + [TestClass] + public class Test1 + { + [Setup] + public void Initialize() + { + Debug.WriteLine("BitConverter tests initialized."); + } + + [Cleanup] + public void CleanUp() + { + Debug.WriteLine("Cleaning up after BitConverter tests."); + } + + //Test Case Calls + [TestMethod] + public void BitConverterTest_DoubleToInt64Bits() + { + Helper.DoubleToLongBits(1.0, 0x3FF0000000000000); + Helper.DoubleToLongBits(15.0, 0x402E000000000000); + Helper.DoubleToLongBits(255.0, 0x406FE00000000000); + Helper.DoubleToLongBits(4294967295.0, 0x41EFFFFFFFE00000); + Helper.DoubleToLongBits(0.00390625, 0x3F70000000000000); + Helper.DoubleToLongBits(0.00000000023283064365386962890625, 0x3DF0000000000000); + Helper.DoubleToLongBits(1.234567890123E-300, 0x01AA74FE1C1E7E45); + Helper.DoubleToLongBits(1.23456789012345E-150, 0x20D02A36586DB4BB); + Helper.DoubleToLongBits(1.2345678901234565, 0x3FF3C0CA428C59FA); + Helper.DoubleToLongBits(1.2345678901234567, 0x3FF3C0CA428C59FB); + Helper.DoubleToLongBits(1.2345678901234569, 0x3FF3C0CA428C59FC); + Helper.DoubleToLongBits(1.23456789012345678E+150, 0x5F182344CD3CDF9F); + Helper.DoubleToLongBits(1.234567890123456789E+300, 0x7E3D7EE8BCBBD352); + Helper.DoubleToLongBits(double.MinValue, unchecked((long)0xFFEFFFFFFFFFFFFF)); + Helper.DoubleToLongBits(double.MaxValue, 0x7FEFFFFFFFFFFFFF); + Helper.DoubleToLongBits(double.Epsilon, 0x0000000000000001); + Helper.DoubleToLongBits(double.NaN, unchecked((long)0xFFF8000000000000)); + Helper.DoubleToLongBits(double.NegativeInfinity, unchecked((long)0xFFF0000000000000)); + Helper.DoubleToLongBits(double.PositiveInfinity, 0x7FF0000000000000); + } + + [TestMethod] + public void BitConverterTest_GetBytesBool() + { + Helper.GetBytesBool(true, new byte[] { 1 }); + Helper.GetBytesBool(false, new byte[] { 0 }); + } + + [TestMethod] + public void BitConverterTest_GetBytesChar() + { + Helper.GetBytesChar('\0', new byte[] { 0x00, 0x00 }); + Helper.GetBytesChar(' ', new byte[] { 0x20, 0x00 }); + Helper.GetBytesChar('*', new byte[] { 0x2A, 0x00 }); + Helper.GetBytesChar('3', new byte[] { 0x33, 0x00 }); + Helper.GetBytesChar('A', new byte[] { 0x41, 0x00 }); + Helper.GetBytesChar('[', new byte[] { 0x5B, 0x00 }); + Helper.GetBytesChar('a', new byte[] { 0x61, 0x00 }); + Helper.GetBytesChar('{', new byte[] { 0x7B, 0x00 }); + Helper.GetBytesChar('测', new byte[] { 0x4B, 0x6D }); + } + + [TestMethod] + public void BitConverterTest_GetBytesDouble() + { + Helper.GetBytesDouble(0.0, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); + Helper.GetBytesDouble(1.0, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3F }); + Helper.GetBytesDouble(255.0, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0xE0, 0x6F, 0x40 }); + Helper.GetBytesDouble(4294967295.0, new byte[] { 0x00, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xEF, 0x41 }); + Helper.GetBytesDouble(0.00390625, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x3F }); + Helper.GetBytesDouble(0.00000000023283064365386962890625, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x3D }); + Helper.GetBytesDouble(1.23456789012345E-300, new byte[] { 0xDF, 0x88, 0x1E, 0x1C, 0xFE, 0x74, 0xAA, 0x01 }); + Helper.GetBytesDouble(1.2345678901234565, new byte[] { 0xFA, 0x59, 0x8C, 0x42, 0xCA, 0xC0, 0xF3, 0x3F }); + Helper.GetBytesDouble(1.2345678901234567, new byte[] { 0xFB, 0x59, 0x8C, 0x42, 0xCA, 0xC0, 0xF3, 0x3F }); + Helper.GetBytesDouble(1.2345678901234569, new byte[] { 0xFC, 0x59, 0x8C, 0x42, 0xCA, 0xC0, 0xF3, 0x3F }); + Helper.GetBytesDouble(1.23456789012345678E+300, new byte[] { 0x52, 0xD3, 0xBB, 0xBC, 0xE8, 0x7E, 0x3D, 0x7E }); + Helper.GetBytesDouble(double.MinValue, new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0xFF }); + Helper.GetBytesDouble(double.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xEF, 0x7F }); + Helper.GetBytesDouble(double.Epsilon, new byte[] { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); + Helper.GetBytesDouble(double.NaN, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF8, 0xFF }); + Helper.GetBytesDouble(double.NegativeInfinity, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xFF }); + Helper.GetBytesDouble(double.PositiveInfinity, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x7F }); + } + + [TestMethod] + public void BitConverterTest_GetBytesInt16() + { + Helper.GetBytesInt16(0, new byte[] { 0x00, 0x00 }); + Helper.GetBytesInt16(15, new byte[] { 0x0F, 0x00 }); + Helper.GetBytesInt16(-15, new byte[] { 0xF1, 0xFF }); + Helper.GetBytesInt16(10000, new byte[] { 0x10, 0x27 }); + Helper.GetBytesInt16(-10000, new byte[] { 0xF0, 0xD8 }); + Helper.GetBytesInt16(short.MinValue, new byte[] { 0x00, 0x80 }); + Helper.GetBytesInt16(short.MaxValue, new byte[] { 0xFF, 0x7F }); + } + + [TestMethod] + public void BitConverterTest_GetBytesInt32() + { + Helper.GetBytesInt32(0, new byte[] { 0x00, 0x00, 0x00, 0x00 }); + Helper.GetBytesInt32(15, new byte[] { 0x0F, 0x00, 0x00, 0x00 }); + Helper.GetBytesInt32(-15, new byte[] { 0xF1, 0xFF, 0xFF, 0xFF }); + Helper.GetBytesInt32(1048576, new byte[] { 0x00, 0x00, 0x10, 0x00 }); + Helper.GetBytesInt32(-1048576, new byte[] { 0x00, 0x00, 0xF0, 0xFF }); + Helper.GetBytesInt32(1000000000, new byte[] { 0x00, 0xCA, 0x9A, 0x3B }); + Helper.GetBytesInt32(-1000000000, new byte[] { 0x00, 0x36, 0x65, 0xC4 }); + Helper.GetBytesInt32(int.MinValue, new byte[] { 0x00, 0x00, 0x00, 0x80 }); + Helper.GetBytesInt32(int.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0x7F }); + } + + [TestMethod] + public void BitConverterTest_GetBytesInt64() + { + Helper.GetBytesInt64(0, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); + Helper.GetBytesInt64(16777215, new byte[] { 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00 }); + Helper.GetBytesInt64(-16777215, new byte[] { 0x01, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }); + Helper.GetBytesInt64(1000000000, new byte[] { 0x00, 0xCA, 0x9A, 0x3B, 0x00, 0x00, 0x00, 0x00 }); + Helper.GetBytesInt64(-1000000000, new byte[] { 0x00, 0x36, 0x65, 0xC4, 0xFF, 0xFF, 0xFF, 0xFF }); + Helper.GetBytesInt64(4294967296, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 }); + Helper.GetBytesInt64(-4294967296, new byte[] { 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF }); + Helper.GetBytesInt64(187649984473770, new byte[] { 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00 }); + Helper.GetBytesInt64(-187649984473770, new byte[] { 0x56, 0x55, 0x55, 0x55, 0x55, 0x55, 0xFF, 0xFF }); + Helper.GetBytesInt64(1000000000000000000, new byte[] { 0x00, 0x00, 0x64, 0xA7, 0xB3, 0xB6, 0xE0, 0x0D }); + Helper.GetBytesInt64(-1000000000000000000, new byte[] { 0x00, 0x00, 0x9C, 0x58, 0x4C, 0x49, 0x1F, 0xF2 }); + Helper.GetBytesInt64(long.MinValue, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80 }); + Helper.GetBytesInt64(long.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F }); + } + + [TestMethod] + public void BitConverterTest_GetBytesSingle() + { + Helper.GetBytesSingle(0.0F, new byte[] { 0x00, 0x00, 0x00, 0x00 }); + Helper.GetBytesSingle(1.0F, new byte[] { 0x00, 0x00, 0x80, 0x3F }); + Helper.GetBytesSingle(15.0F, new byte[] { 0x00, 0x00, 0x70, 0x41 }); + Helper.GetBytesSingle(65535.0F, new byte[] { 0x00, 0xFF, 0x7F, 0x47 }); + Helper.GetBytesSingle(0.00390625F, new byte[] { 0x00, 0x00, 0x80, 0x3B }); + Helper.GetBytesSingle(0.00000000023283064365386962890625F, new byte[] { 0x00, 0x00, 0x80, 0x2F }); + Helper.GetBytesSingle(1.2345E-35F, new byte[] { 0x49, 0x46, 0x83, 0x05 }); + Helper.GetBytesSingle(1.2345671F, new byte[] { 0x4B, 0x06, 0x9E, 0x3F }); + Helper.GetBytesSingle(1.2345673F, new byte[] { 0x4D, 0x06, 0x9E, 0x3F }); + Helper.GetBytesSingle(1.2345677F, new byte[] { 0x50, 0x06, 0x9E, 0x3F }); + Helper.GetBytesSingle(1.23456789E+35F, new byte[] { 0x1E, 0x37, 0xBE, 0x79 }); + Helper.GetBytesSingle(float.MinValue, new byte[] { 0xFF, 0xFF, 0x7F, 0xFF }); + Helper.GetBytesSingle(float.MaxValue, new byte[] { 0xFF, 0xFF, 0x7F, 0x7F }); + Helper.GetBytesSingle(float.Epsilon, new byte[] { 0x01, 0x00, 0x00, 0x00 }); + Helper.GetBytesSingle(0.0F / 0.0F, new byte[] { 0x00, 0x00, 0xC0, 0xFF }); + Helper.GetBytesSingle(-1.0F / 0.0F, new byte[] { 0x00, 0x00, 0x80, 0xFF }); + Helper.GetBytesSingle(1.0F / 0.0F, new byte[] { 0x00, 0x00, 0x80, 0x7F }); + } + + [TestMethod] + public void BitConverterTest_GetBytesUInt16() + { + Helper.GetBytesUInt16(15, new byte[] { 0x0F, 0x00 }); + Helper.GetBytesUInt16(1023, new byte[] { 0xFF, 0x03 }); + Helper.GetBytesUInt16(10000, new byte[] { 0x10, 0x27 }); + Helper.GetBytesUInt16(ushort.MinValue, new byte[] { 0x00, 0x00 }); + Helper.GetBytesUInt16((ushort)short.MaxValue, new byte[] { 0xFF, 0x7F }); + Helper.GetBytesUInt16(ushort.MaxValue, new byte[] { 0xFF, 0xFF }); + } + + [TestMethod] + public void BitConverterTest_GetBytesUInt32() + { + Helper.GetBytesUInt32(15, new byte[] { 0x0F, 0x00, 0x00, 0x00 }); + Helper.GetBytesUInt32(1023, new byte[] { 0xFF, 0x03, 0x00, 0x00 }); + Helper.GetBytesUInt32(1048576, new byte[] { 0x00, 0x00, 0x10, 0x00 }); + Helper.GetBytesUInt32(1000000000, new byte[] { 0x00, 0xCA, 0x9A, 0x3B }); + Helper.GetBytesUInt32(uint.MinValue, new byte[] { 0x00, 0x00, 0x00, 0x00 }); + Helper.GetBytesUInt32(int.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0x7F }); + Helper.GetBytesUInt32(uint.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0xFF }); + } + + [TestMethod] + public void BitConverterTest_GetBytesUInt64() + { + Helper.GetBytesUInt64(16777215, new byte[] { 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00 }); + Helper.GetBytesUInt64(1000000000, new byte[] { 0x00, 0xCA, 0x9A, 0x3B, 0x00, 0x00, 0x00, 0x00 }); + Helper.GetBytesUInt64(4294967296, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00 }); + Helper.GetBytesUInt64(187649984473770, new byte[] { 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0xAA, 0x00, 0x00 }); + Helper.GetBytesUInt64(1000000000000000000, new byte[] { 0x00, 0x00, 0x64, 0xA7, 0xB3, 0xB6, 0xE0, 0x0D }); + Helper.GetBytesUInt64(10000000000000000000, new byte[] { 0x00, 0x00, 0xE8, 0x89, 0x04, 0x23, 0xC7, 0x8A }); + Helper.GetBytesUInt64(ulong.MinValue, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }); + Helper.GetBytesUInt64(long.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x7F }); + Helper.GetBytesUInt64(ulong.MaxValue, new byte[] { 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF }); + } + + [TestMethod] + public void BitConverterTest_LongBitsToDouble() + { + Helper.LongBitsToDouble(0x0000000000000000, 0.0000000000000000E+000); + Helper.LongBitsToDouble(0x3FF0000000000000, 1.0000000000000000E+000); + Helper.LongBitsToDouble(0x402E000000000000, 1.5000000000000000E+001); + Helper.LongBitsToDouble(0x406FE00000000000, 2.5500000000000000E+002); + Helper.LongBitsToDouble(0x41EFFFFFFFE00000, 4.2949672950000000E+009); + Helper.LongBitsToDouble(0x3F70000000000000, 3.9062500000000000E-003); + Helper.LongBitsToDouble(0x3DF0000000000000, 2.3283064365386963E-010); + Helper.LongBitsToDouble(0x0000000000000001, 4.9406564584124654E-324); + Helper.LongBitsToDouble(0x000000000000FFFF, 3.2378592100206092E-319); + Helper.LongBitsToDouble(0x0000FFFFFFFFFFFF, 1.3906711615669959E-309); + Helper.LongBitsToDouble(unchecked((long)0xFFFFFFFFFFFFFFFF), double.NaN); + Helper.LongBitsToDouble(unchecked((long)0xFFF0000000000000), double.NegativeInfinity); + Helper.LongBitsToDouble(0x7FF0000000000000, double.PositiveInfinity); + Helper.LongBitsToDouble(unchecked((long)0xFFEFFFFFFFFFFFFF), double.MinValue); + Helper.LongBitsToDouble(0x7FEFFFFFFFFFFFFF, double.MaxValue); + Helper.LongBitsToDouble(long.MinValue, 0.0000000000000000E+000); + Helper.LongBitsToDouble(long.MaxValue, double.NaN); + } + + [TestMethod] + public void BitConverterTest_ToBoolean() + { + var byteArray = new byte[] { 0, 1, 2, 4, 8, 16, 32, 64, 128, 255 }; + + Helper.BAToBool(byteArray, 0, false); + Helper.BAToBool(byteArray, 1, true); + Helper.BAToBool(byteArray, 3, true); + Helper.BAToBool(byteArray, 5, true); + Helper.BAToBool(byteArray, 8, true); + Helper.BAToBool(byteArray, 9, true); + + Helper.BAToBoolThrow(byteArray, int.MinValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToBoolThrow(byteArray, -1, typeof(ArgumentOutOfRangeException)); + Helper.BAToBoolThrow(byteArray, byteArray.Length, typeof(ArgumentOutOfRangeException)); + Helper.BAToBoolThrow(byteArray, int.MaxValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToBoolThrow(new byte[] { }, 1, typeof(ArgumentOutOfRangeException)); + Helper.BAToBoolThrow(null, 1, typeof(ArgumentNullException)); + } + + [TestMethod] + public void BitConverterTest_ToChar() + { + var byteArray = new byte[] { 32, 0, 0, 42, 0, 65, 0, 125, 0, 197, 0, 168, 3, 41, 4, 172, 32 }; + + Helper.BAToChar(byteArray, 0, ' '); + Helper.BAToChar(byteArray, 1, '\0'); + Helper.BAToChar(byteArray, 3, '*'); + Helper.BAToChar(byteArray, 5, 'A'); + Helper.BAToChar(byteArray, 7, '}'); + Helper.BAToChar(byteArray, 9, 'Å'); + Helper.BAToChar(byteArray, 11, 'Ψ'); + Helper.BAToChar(byteArray, 13, 'Щ'); + Helper.BAToChar(byteArray, 15, '€'); + + Helper.BAToCharThrow(byteArray, int.MinValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToCharThrow(byteArray, -1, typeof(ArgumentOutOfRangeException)); + Helper.BAToCharThrow(byteArray, byteArray.Length - 1, typeof(ArgumentException)); + Helper.BAToCharThrow(byteArray, byteArray.Length, typeof(ArgumentOutOfRangeException)); + Helper.BAToCharThrow(byteArray, int.MaxValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToCharThrow(new byte[] { }, 1, typeof(ArgumentOutOfRangeException)); + Helper.BAToCharThrow(null, 1, typeof(ArgumentNullException)); + } + + [TestMethod] + public void BitConverterTest_ToDouble() + { + var byteArray = new byte[]{ + 0, 0, 0, 0, 0, 0, 0, 0, 240, 63, + 0, 0, 0, 0, 0, 224, 111, 64, 0, 0, + 224, 255, 255, 255, 239, 65, 0, 0, 0, 0, + 0, 0, 112, 63, 0, 0, 0, 0, 0, 0, + 240, 61, 223, 136, 30, 28, 254, 116, 170, 1, + 250, 89, 140, 66, 202, 192, 243, 63, 251, 89, + 140, 66, 202, 192, 243, 63, 252, 89, 140, 66, + 202, 192, 243, 63, 82, 211, 187, 188, 232, 126, + 61, 126, 255, 255, 255, 255, 255, 255, 239, 255, + 255, 255, 255, 255, 255, 239, 127, 1, 0, 0, + 0, 0, 0, 0, 0, 248, 255, 0, 0, 0, + 0, 0, 0, 240, 255, 0, 0, 0, 0, 0, + 0, 240, 127 }; + + Helper.BAToDouble(byteArray, 0, 0.0000000000000000E+000); + Helper.BAToDouble(byteArray, 2, 1.0000000000000000E+000); + Helper.BAToDouble(byteArray, 10, 2.5500000000000000E+002); + Helper.BAToDouble(byteArray, 18, 4.2949672950000000E+009); + Helper.BAToDouble(byteArray, 26, 3.9062500000000000E-003); + Helper.BAToDouble(byteArray, 34, 2.3283064365386963E-010); + Helper.BAToDouble(byteArray, 42, 1.2345678901234500E-300); + Helper.BAToDouble(byteArray, 50, 1.2345678901234565E+000); + Helper.BAToDouble(byteArray, 58, 1.2345678901234567E+000); + Helper.BAToDouble(byteArray, 66, 1.2345678901234569E+000); + Helper.BAToDouble(byteArray, 74, 1.2345678901234569E+300); + Helper.BAToDouble(byteArray, 82, double.MinValue); + Helper.BAToDouble(byteArray, 89, double.MaxValue); + Helper.BAToDouble(byteArray, 97, double.Epsilon); + Helper.BAToDouble(byteArray, 99, double.NaN); + Helper.BAToDouble(byteArray, 107, double.NegativeInfinity); + Helper.BAToDouble(byteArray, 115, double.PositiveInfinity); + + Helper.BAToDoubleThrow(byteArray, int.MinValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToDoubleThrow(byteArray, -1, typeof(ArgumentOutOfRangeException)); + Helper.BAToDoubleThrow(byteArray, byteArray.Length - 7, typeof(ArgumentException)); + Helper.BAToDoubleThrow(byteArray, byteArray.Length - 1, typeof(ArgumentException)); + Helper.BAToDoubleThrow(byteArray, byteArray.Length, typeof(ArgumentOutOfRangeException)); + Helper.BAToDoubleThrow(byteArray, int.MaxValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToDoubleThrow(new byte[] { }, 1, typeof(ArgumentOutOfRangeException)); + Helper.BAToDoubleThrow(null, 1, typeof(ArgumentNullException)); + } + + [TestMethod] + public void BitConverterTest_ToInt16() + { + var byteArray = new byte[] { 15, 0, 0, 128, 16, 39, 240, 216, 241, 255, 127 }; + + Helper.BAToInt16(byteArray, 1, 0); + Helper.BAToInt16(byteArray, 0, 15); + Helper.BAToInt16(byteArray, 8, -15); + Helper.BAToInt16(byteArray, 4, 10000); + Helper.BAToInt16(byteArray, 6, -10000); + Helper.BAToInt16(byteArray, 9, short.MaxValue); + Helper.BAToInt16(byteArray, 2, short.MinValue); + + Helper.BAToInt16Throw(byteArray, int.MinValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt16Throw(byteArray, -1, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt16Throw(byteArray, byteArray.Length - 1, typeof(ArgumentException)); + Helper.BAToInt16Throw(byteArray, byteArray.Length, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt16Throw(byteArray, int.MaxValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt16Throw(new byte[] { }, 1, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt16Throw(null, 1, typeof(ArgumentNullException)); + } + + [TestMethod] + public void BitConverterTest_Int32() + { + var byteArray = new byte[]{ + 15, 0, 0, 0, 0, 128, 0, 0, 16, 0, + 0, 240, 255, 0, 202, 154, 59, 0, 54, 101, + 196, 241, 255, 255, 255, 127 }; + + Helper.BAToInt32(byteArray, 1, 0); + Helper.BAToInt32(byteArray, 0, 15); + Helper.BAToInt32(byteArray, 21, -15); + Helper.BAToInt32(byteArray, 6, 1048576); + Helper.BAToInt32(byteArray, 9, -1048576); + Helper.BAToInt32(byteArray, 13, 1000000000); + Helper.BAToInt32(byteArray, 17, -1000000000); + Helper.BAToInt32(byteArray, 22, int.MaxValue); + Helper.BAToInt32(byteArray, 2, int.MinValue); + + Helper.BAToInt32Throw(byteArray, int.MinValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt32Throw(byteArray, -1, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt32Throw(byteArray, byteArray.Length - 3, typeof(ArgumentException)); + Helper.BAToInt32Throw(byteArray, byteArray.Length - 1, typeof(ArgumentException)); + Helper.BAToInt32Throw(byteArray, byteArray.Length, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt32Throw(byteArray, int.MaxValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt32Throw(new byte[] { }, 1, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt32Throw(null, 1, typeof(ArgumentNullException)); + } + + [TestMethod] + public void BitConverterTest_Int64() + { + var byteArray = new byte[]{ + 0, 54, 101, 196, 255, 255, 255, 255, 0, 0, + 0, 0, 0, 0, 0, 0, 128, 0, 202, 154, + 59, 0, 0, 0, 0, 1, 0, 0, 0, 0, + 255, 255, 255, 255, 1, 0, 0, 255, 255, 255, + 255, 255, 255, 255, 127, 86, 85, 85, 85, 85, + 85, 255, 255, 170, 170, 170, 170, 170, 170, 0, + 0, 100, 167, 179, 182, 224, 13, 0, 0, 156, + 88, 76, 73, 31, 242 }; + + Helper.BAToInt64(byteArray, 8, 0); + Helper.BAToInt64(byteArray, 5, 16777215); + Helper.BAToInt64(byteArray, 34, -16777215); + Helper.BAToInt64(byteArray, 17, 1000000000); + Helper.BAToInt64(byteArray, 0, -1000000000); + Helper.BAToInt64(byteArray, 21, 4294967296); + Helper.BAToInt64(byteArray, 26, -4294967296); + Helper.BAToInt64(byteArray, 53, 187649984473770); + Helper.BAToInt64(byteArray, 45, -187649984473770); + Helper.BAToInt64(byteArray, 59, 1000000000000000000); + Helper.BAToInt64(byteArray, 67, -1000000000000000000); + Helper.BAToInt64(byteArray, 37, long.MaxValue); + Helper.BAToInt64(byteArray, 9, long.MinValue); + + Helper.BAToInt64Throw(byteArray, int.MinValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt64Throw(byteArray, -1, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt64Throw(byteArray, byteArray.Length - 7, typeof(ArgumentException)); + Helper.BAToInt64Throw(byteArray, byteArray.Length - 1, typeof(ArgumentException)); + Helper.BAToInt64Throw(byteArray, byteArray.Length, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt64Throw(byteArray, int.MaxValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt64Throw(new byte[] { }, 1, typeof(ArgumentOutOfRangeException)); + Helper.BAToInt64Throw(null, 1, typeof(ArgumentNullException)); + } + + [TestMethod] + public void BitConverterTest_ToSingle() + { + var byteArray = new byte[]{ + 0, 0, 0, 0, 128, 63, 0, 0, 112, 65, + 0, 255, 127, 71, 0, 0, 128, 59, 0, 0, + 128, 47, 73, 70, 131, 5, 75, 6, 158, 63, + 77, 6, 158, 63, 80, 6, 158, 63, 30, 55, + 190, 121, 255, 255, 127, 255, 255, 127, 127, 1, + 0, 0, 0, 192, 255, 0, 0, 128, 255, 0, + 0, 128, 127 }; + + Helper.BAToSingle(byteArray, 0, 0.0000000E+000F); + Helper.BAToSingle(byteArray, 2, 1.0000000E+000F); + Helper.BAToSingle(byteArray, 6, 1.5000000E+001F); + Helper.BAToSingle(byteArray, 10, 6.5535000E+004F); + Helper.BAToSingle(byteArray, 14, 3.9062500E-003F); + Helper.BAToSingle(byteArray, 18, 2.3283064E-010F); + Helper.BAToSingle(byteArray, 22, 1.2345000E-035F); + Helper.BAToSingle(byteArray, 26, 1.2345671E+000F); + Helper.BAToSingle(byteArray, 30, 1.2345673E+000F); + Helper.BAToSingle(byteArray, 34, 1.2345676E+000F); + Helper.BAToSingle(byteArray, 38, 1.2345679E+035F); + Helper.BAToSingle(byteArray, 42, float.MinValue); + Helper.BAToSingle(byteArray, 45, float.MaxValue); + Helper.BAToSingle(byteArray, 49, float.Epsilon); + Helper.BAToSingle(byteArray, 51, 0.0F / 0.0F); + Helper.BAToSingle(byteArray, 55, -1.0F / 0.0F); + Helper.BAToSingle(byteArray, 59, 1.0F / 0.0F); + + Helper.BAToSingleThrow(byteArray, int.MinValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToSingleThrow(byteArray, -1, typeof(ArgumentOutOfRangeException)); + Helper.BAToSingleThrow(byteArray, byteArray.Length - 3, typeof(ArgumentException)); + Helper.BAToSingleThrow(byteArray, byteArray.Length - 1, typeof(ArgumentException)); + Helper.BAToSingleThrow(byteArray, byteArray.Length, typeof(ArgumentOutOfRangeException)); + Helper.BAToSingleThrow(byteArray, int.MaxValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToSingleThrow(new byte[] { }, 1, typeof(ArgumentOutOfRangeException)); + Helper.BAToSingleThrow(null, 1, typeof(ArgumentNullException)); + } + + [TestMethod] + public void BitConverterTest_ToUInt16() + { + var byteArray = new byte[] { 15, 0, 0, 255, 3, 16, 39, 255, 255, 127 }; + + Helper.BAToUInt16(byteArray, 1, 0); + Helper.BAToUInt16(byteArray, 0, 15); + Helper.BAToUInt16(byteArray, 3, 1023); + Helper.BAToUInt16(byteArray, 5, 10000); + Helper.BAToUInt16(byteArray, 8, (ushort)short.MaxValue); + Helper.BAToUInt16(byteArray, 7, ushort.MaxValue); + + Helper.BAToUInt16Throw(byteArray, int.MinValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt16Throw(byteArray, -1, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt16Throw(byteArray, byteArray.Length - 1, typeof(ArgumentException)); + Helper.BAToUInt16Throw(byteArray, byteArray.Length, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt16Throw(byteArray, int.MaxValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt16Throw(new byte[] { }, 1, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt16Throw(null, 1, typeof(ArgumentNullException)); + } + + [TestMethod] + public void BitConverterTest_ToUInt32() + { + var byteArray = new byte[]{ + 15, 0, 0, 0, 0, 16, 0, 255, 3, 0, + 0, 202, 154, 59, 255, 255, 255, 255, 127 }; + + Helper.BAToUInt32(byteArray, 1, 0); + Helper.BAToUInt32(byteArray, 0, 15); + Helper.BAToUInt32(byteArray, 7, 1023); + Helper.BAToUInt32(byteArray, 3, 1048576); + Helper.BAToUInt32(byteArray, 10, 1000000000); + Helper.BAToUInt32(byteArray, 15, int.MaxValue); + Helper.BAToUInt32(byteArray, 14, uint.MaxValue); + + Helper.BAToUInt32Throw(byteArray, int.MinValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt32Throw(byteArray, -1, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt32Throw(byteArray, byteArray.Length - 3, typeof(ArgumentException)); + Helper.BAToUInt32Throw(byteArray, byteArray.Length - 1, typeof(ArgumentException)); + Helper.BAToUInt32Throw(byteArray, byteArray.Length, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt32Throw(byteArray, int.MaxValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt32Throw(new byte[] { }, 1, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt32Throw(null, 1, typeof(ArgumentNullException)); + } + + [TestMethod] + public void BitConverterTest_ToUInt64() + { + var byteArray = new byte[]{ + 255, 255, 255, 0, 0, 0, 0, 0, 0, 0, + 0, 1, 0, 0, 0, 100, 167, 179, 182, 224, + 13, 0, 202, 154, 59, 0, 0, 0, 0, 170, + 170, 170, 170, 170, 170, 0, 0, 232, 137, 4, + 35, 199, 138, 255, 255, 255, 255, 255, 255, 255, + 255, 127 }; + + Helper.BAToUInt64(byteArray, 3, 0); + Helper.BAToUInt64(byteArray, 0, 16777215); + Helper.BAToUInt64(byteArray, 21, 1000000000); + Helper.BAToUInt64(byteArray, 7, 4294967296); + Helper.BAToUInt64(byteArray, 29, 187649984473770); + Helper.BAToUInt64(byteArray, 13, 1000000000000000000); + Helper.BAToUInt64(byteArray, 35, 10000000000000000000); + Helper.BAToUInt64(byteArray, 44, long.MaxValue); + Helper.BAToUInt64(byteArray, 43, ulong.MaxValue); + + Helper.BAToUInt64Throw(byteArray, int.MinValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt64Throw(byteArray, -1, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt64Throw(byteArray, byteArray.Length - 7, typeof(ArgumentException)); + Helper.BAToUInt64Throw(byteArray, byteArray.Length - 1, typeof(ArgumentException)); + Helper.BAToUInt64Throw(byteArray, byteArray.Length, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt64Throw(byteArray, int.MaxValue, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt64Throw(new byte[] { }, 1, typeof(ArgumentOutOfRangeException)); + Helper.BAToUInt64Throw(null, 1, typeof(ArgumentNullException)); + } + + [TestMethod] + public void BitConverterTest_ToString() + { + Helper.WriteByteArray(new byte[] { 0, 1, 2, 4, 8, 16, 32, 64, 128, 255 }, + "00-01-02-04-08-10-20-40-80-FF"); + + Helper.WriteByteArray(new byte[] { + 32, 0, 0, 42, 0, 65, 0, 125, 0, 197, + 0, 168, 3, 41, 4, 172, 32 }, + "20-00-00-2A-00-41-00-7D-00-C5-00-A8-03-29-04-AC-20"); + + Helper.WriteByteArray(new byte[] { 15, 0, 0, 128, 16, 39, 240, 216, 241, 255, 127 }, + "0F-00-00-80-10-27-F0-D8-F1-FF-7F"); + + Helper.WriteByteArray(new byte[] { + 15, 0, 0, 0, 0, 16, 0, 255, 3, 0, + 0, 202, 154, 59, 255, 255, 255, 255, 127 }, + "0F-00-00-00-00-10-00-FF-03-00-00-CA-9A-3B-FF-FF-FF-FF-7F"); + + Helper.WriteMultiLineByteArray(new byte[]{ + 0, 0, 0, 0, 128, 63, 0, 0, 112, 65, + 0, 255, 127, 71, 0, 0, 128, 59, 0, 0, + 128, 47, 73, 70, 131, 5, 75, 6, 158, 63, + 77, 6, 158, 63, 80, 6, 158, 63, 30, 55, + 190, 121, 255, 255, 127, 255, 255, 127, 127, 1, + 0, 0, 0, 192, 255, 0, 0, 128, 255, 0, + 0, 128, 127 }, +@"00-00-00-00-80-3F-00-00-70-41-00-FF-7F-47-00-00-80-3B-00-00 +80-2F-49-46-83-05-4B-06-9E-3F-4D-06-9E-3F-50-06-9E-3F-1E-37 +BE-79-FF-FF-7F-FF-FF-7F-7F-01-00-00-00-C0-FF-00-00-80-FF-00 +00-80-7F"); + + Helper.WriteMultiLineByteArray(new byte[]{ + 255, 255, 255, 0, 0, 20, 0, 33, 0, 0, + 0, 1, 0, 0, 0, 100, 167, 179, 182, 224, + 13, 0, 202, 154, 59, 0, 143, 91, 0, 170, + 170, 170, 170, 170, 170, 0, 0, 232, 137, 4, + 35, 199, 138, 255, 232, 244, 255, 252, 205, 255, + 255, 129 }, +@"FF-FF-FF-00-00-14-00-21-00-00-00-01-00-00-00-64-A7-B3-B6-E0 +0D-00-CA-9A-3B-00-8F-5B-00-AA-AA-AA-AA-AA-AA-00-00-E8-89-04 +23-C7-8A-FF-E8-F4-FF-FC-CD-FF-FF-81"); + + Helper.WriteMultiLineByteArray(new byte[]{ + 0, 222, 0, 0, 0, 224, 111, 64, 0, 0, + 224, 255, 255, 255, 239, 65, 0, 0, 131, 0, + 0, 0, 112, 63, 0, 143, 0, 100, 0, 0, + 240, 61, 223, 136, 30, 28, 254, 116, 170, 1, + 250, 89, 140, 66, 202, 192, 243, 63, 251, 89, + 140, 66, 202, 192, 243, 63, 252, 89, 140, 66, + 202, 192, 243, 63, 82, 211, 187, 188, 232, 126, + 255, 255, 255, 244, 255, 239, 127, 1, 0, 0, + 0, 10, 17, 0, 0, 248, 255, 0, 88, 0, + 91, 0, 0, 240, 255, 0, 0, 240, 157 }, +@"00-DE-00-00-00-E0-6F-40-00-00-E0-FF-FF-FF-EF-41-00-00-83-00 +00-00-70-3F-00-8F-00-64-00-00-F0-3D-DF-88-1E-1C-FE-74-AA-01 +FA-59-8C-42-CA-C0-F3-3F-FB-59-8C-42-CA-C0-F3-3F-FC-59-8C-42 +CA-C0-F3-3F-52-D3-BB-BC-E8-7E-FF-FF-FF-F4-FF-EF-7F-01-00-00 +00-0A-11-00-00-F8-FF-00-58-00-5B-00-00-F0-FF-00-00-F0-9D"); + } + + [TestMethod] + public void BitConverterTest_ToStringEmpty() + { + var empty = new byte[] { }; + + Assert.Equal(BitConverter.ToString(empty), string.Empty); + Assert.Equal(BitConverter.ToString(empty, 0), string.Empty); + Assert.Equal(BitConverter.ToString(empty, 0, 0), string.Empty); + } + + [TestMethod] + public void BitConverterTest_ToStringThrow() + { + var bytes = new byte[] { 0, 1, 2, 4, 8, 16, 32, 64, 128, 255 }; + + Helper.ToStringThrow(null, typeof(ArgumentNullException)); + Helper.ToStringThrow(null, 0, typeof(ArgumentNullException)); + Helper.ToStringThrow(null, 0, 0, typeof(ArgumentNullException)); + + Helper.ToStringThrow(bytes, int.MinValue, typeof(ArgumentOutOfRangeException)); + Helper.ToStringThrow(bytes, -1, typeof(ArgumentOutOfRangeException)); + Helper.ToStringThrow(bytes, bytes.Length, typeof(ArgumentOutOfRangeException)); + Helper.ToStringThrow(bytes, int.MaxValue, typeof(ArgumentOutOfRangeException)); + + Helper.ToStringThrow(bytes, int.MinValue, 1, typeof(ArgumentOutOfRangeException)); + Helper.ToStringThrow(bytes, -1, 1, typeof(ArgumentOutOfRangeException)); + Helper.ToStringThrow(bytes, bytes.Length, 1, typeof(ArgumentOutOfRangeException)); + Helper.ToStringThrow(bytes, int.MaxValue, 1, typeof(ArgumentOutOfRangeException)); + Helper.ToStringThrow(bytes, 0, -1, typeof(ArgumentOutOfRangeException)); + Helper.ToStringThrow(bytes, 0, int.MinValue, typeof(ArgumentOutOfRangeException)); + Helper.ToStringThrow(bytes, 0, bytes.Length + 1, typeof(ArgumentException)); + Helper.ToStringThrow(bytes, 0, int.MaxValue, typeof(ArgumentException)); + Helper.ToStringThrow(bytes, 1, bytes.Length, typeof(ArgumentException)); + Helper.ToStringThrow(bytes, 1, int.MaxValue, typeof(ArgumentException)); + Helper.ToStringThrow(bytes, bytes.Length - 1, 2, typeof(ArgumentException)); + Helper.ToStringThrow(bytes, bytes.Length - 1, int.MaxValue, typeof(ArgumentException)); + + var empty = new byte[] { }; + Helper.ToStringThrow(empty, 1, typeof(ArgumentOutOfRangeException)); + Helper.ToStringThrow(empty, 1, 0, typeof(ArgumentOutOfRangeException)); + Helper.ToStringThrow(empty, 0, 1, typeof(ArgumentOutOfRangeException)); + } + } +} diff --git a/Tests/NFUnitTestCoreLibrary/Helpers.cs b/Tests/NFUnitTestCoreLibrary/Helpers.cs new file mode 100644 index 00000000..017ce5c5 --- /dev/null +++ b/Tests/NFUnitTestCoreLibrary/Helpers.cs @@ -0,0 +1,625 @@ +using System; + +namespace NFUnitTestCoreLibrary +{ + class Helper + { + static string DigitialToHex(int x) + { + switch (x) + { + case 0: return "0"; + case 1: return "1"; + case 2: return "2"; + case 3: return "3"; + case 4: return "4"; + case 5: return "5"; + case 6: return "6"; + case 7: return "7"; + case 8: return "8"; + case 9: return "9"; + case 10: return "A"; + case 11: return "B"; + case 12: return "C"; + case 13: return "D"; + case 14: return "E"; + case 15: return "F"; + default: throw new Exception(); + } + } + + static string ByteToHex(byte b) + { + return DigitialToHex(b / 16) + DigitialToHex(b % 16); + } + + static string LongToHex(long l) + { + string sHex = string.Empty; + + for (int i = 0; i < 8; i++) + { + sHex = ByteToHex((byte)(l & 0xff)) + sHex; + l >>= 8; + } + + return sHex; + } + + static bool CompareByteArray(byte[] left, byte[] right) + { + if (left.Length != right.Length) + { + return false; + } + + for (int i = 0; i < left.Length; i++) + { + if (left[i] != right[i]) + { + return false; + } + } + + return true; + } + + static string ByteArrayToHex(byte[] bs) + { + string sHex = string.Empty; + + foreach (byte b in bs) + { + if (sHex.Length > 0) + { + sHex += "-"; + } + + sHex += ByteToHex(b); + } + + return sHex; + } + + static public void DoubleToLongBits(double input, long expected) + { + long ret = BitConverter.DoubleToInt64Bits(input); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.DoubleToInt64Bit result:{LongToHex(ret)} expected:{LongToHex(expected)} input:{input}"); + } + } + + static public void GetBytesBool(bool input, byte[] expected) + { + byte[] ret = BitConverter.GetBytes(input); + + if (!CompareByteArray(ret, expected)) + { + throw new Exception( + $"BitConverter.GetBytes result:{ByteArrayToHex(ret)} expected:{ByteArrayToHex(expected)} input:{input}"); + } + } + + static public void GetBytesChar(char input, byte[] expected) + { + byte[] ret = BitConverter.GetBytes(input); + + if (!CompareByteArray(ret, expected)) + { + throw new Exception( + $"BitConverter.GetBytes result:{ByteArrayToHex(ret)} expected:{ByteArrayToHex(expected)} input:{input}"); + } + } + + static public void GetBytesDouble(double input, byte[] expected) + { + byte[] ret = BitConverter.GetBytes(input); + + if (!CompareByteArray(ret, expected)) + { + throw new Exception( + $"BitConverter.GetBytes result:{ByteArrayToHex(ret)} expected:{ByteArrayToHex(expected)} input:{input}"); + } + } + + static public void GetBytesSingle(float input, byte[] expected) + { + byte[] ret = BitConverter.GetBytes(input); + + if (!CompareByteArray(ret, expected)) + { + throw new Exception( + $"BitConverter.GetBytes result:{ByteArrayToHex(ret)} expected:{ByteArrayToHex(expected)} input:{input}"); + } + } + + static public void GetBytesInt64(long input, byte[] expected) + { + byte[] ret = BitConverter.GetBytes(input); + + if (!CompareByteArray(ret, expected)) + { + throw new Exception( + $"BitConverter.GetBytes result:{ByteArrayToHex(ret)} expected:{ByteArrayToHex(expected)} input:{input}"); + } + } + + static public void GetBytesInt32(int input, byte[] expected) + { + byte[] ret = BitConverter.GetBytes(input); + + if (!CompareByteArray(ret, expected)) + { + throw new Exception( + $"BitConverter.GetBytes result:{ByteArrayToHex(ret)} expected:{ByteArrayToHex(expected)} input:{input}"); + } + } + + static public void GetBytesInt16(short input, byte[] expected) + { + byte[] ret = BitConverter.GetBytes(input); + + if (!CompareByteArray(ret, expected)) + { + throw new Exception( + $"BitConverter.GetBytes result:{ByteArrayToHex(ret)} expected:{ByteArrayToHex(expected)} input:{input}"); + } + } + + static public void GetBytesUInt64(ulong input, byte[] expected) + { + byte[] ret = BitConverter.GetBytes(input); + + if (!CompareByteArray(ret, expected)) + { + throw new Exception( + $"BitConverter.GetBytes result:{ByteArrayToHex(ret)} expected:{ByteArrayToHex(expected)} input:{input}"); + } + } + + static public void GetBytesUInt32(uint input, byte[] expected) + { + byte[] ret = BitConverter.GetBytes(input); + + if (!CompareByteArray(ret, expected)) + { + throw new Exception( + $"BitConverter.GetBytes result:{ByteArrayToHex(ret)} expected:{ByteArrayToHex(expected)} input:{input}"); + } + } + + static public void GetBytesUInt16(ushort input, byte[] expected) + { + byte[] ret = BitConverter.GetBytes(input); + + if (!CompareByteArray(ret, expected)) + { + throw new Exception( + $"BitConverter.GetBytes result:{ByteArrayToHex(ret)} expected:{ByteArrayToHex(expected)} input:{input}"); + } + } + + static public void LongBitsToDouble(long input, double expected) + { + double ret = BitConverter.Int64BitsToDouble(input); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.Int64BitsToDouble result:{ret} expected:{expected} input:{input}"); + } + } + + static public void BAToBool(byte[] bytes, int index, bool expected) + { + bool ret = BitConverter.ToBoolean(bytes, index); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.ToBoolean result:{ret} expected:{expected} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToBoolThrow(byte[] bytes, int index, Type expectedExceptionType) + { + Exception exception = null; + + try + { + BitConverter.ToBoolean(bytes, index); + } + catch (Exception e) + { + exception = e; + } + + if (exception == null || exception.GetType() != expectedExceptionType) + { + throw new Exception( + $"BitConverter.ToBoolean expected exception:{expectedExceptionType} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToChar(byte[] bytes, int index, char expected) + { + char ret = BitConverter.ToChar(bytes, index); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.ToChar result:{ret} expected:{expected} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToCharThrow(byte[] bytes, int index, Type expectedExceptionType) + { + Exception exception = null; + + try + { + BitConverter.ToChar(bytes, index); + } + catch (Exception e) + { + exception = e; + } + + if (exception == null || exception.GetType() != expectedExceptionType) + { + throw new Exception( + $"BitConverter.ToChar exception:{exception} expected:{expectedExceptionType} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToDouble(byte[] bytes, int index, double expected) + { + double ret = BitConverter.ToDouble(bytes, index); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.ToDouble result:{ret} expected:{expected} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToDoubleThrow(byte[] bytes, int index, Type expectedExceptionType) + { + Exception exception = null; + + try + { + BitConverter.ToDouble(bytes, index); + } + catch (Exception e) + { + exception = e; + } + + if (exception == null || exception.GetType() != expectedExceptionType) + { + throw new Exception( + $"BitConverter.ToDouble exception:{exception} expected:{expectedExceptionType} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToInt16(byte[] bytes, int index, short expected) + { + short ret = BitConverter.ToInt16(bytes, index); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.ToInt16 result:{ret} expected:{expected} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToInt16Throw(byte[] bytes, int index, Type expectedExceptionType) + { + Exception exception = null; + + try + { + BitConverter.ToInt16(bytes, index); + } + catch (Exception e) + { + exception = e; + } + + if (exception == null || exception.GetType() != expectedExceptionType) + { + throw new Exception( + $"BitConverter.ToInt16 exception:{exception} expected:{expectedExceptionType} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToInt32(byte[] bytes, int index, int expected) + { + int ret = BitConverter.ToInt32(bytes, index); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.ToInt32 result:{ret} expected:{expected} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToInt32Throw(byte[] bytes, int index, Type expectedExceptionType) + { + Exception exception = null; + + try + { + BitConverter.ToInt32(bytes, index); + } + catch (Exception e) + { + exception = e; + } + + if (exception == null || exception.GetType() != expectedExceptionType) + { + throw new Exception( + $"BitConverter.ToInt32 exception:{exception} expected:{expectedExceptionType} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToInt64(byte[] bytes, int index, long expected) + { + long ret = BitConverter.ToInt64(bytes, index); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.ToInt64 result:{ret} expected:{expected} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToInt64Throw(byte[] bytes, int index, Type expectedExceptionType) + { + Exception exception = null; + + try + { + BitConverter.ToInt64(bytes, index); + } + catch (Exception e) + { + exception = e; + } + + if (exception == null || exception.GetType() != expectedExceptionType) + { + throw new Exception( + $"BitConverter.ToInt64 exception:{exception} expected:{expectedExceptionType} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToSingle(byte[] bytes, int index, float expected) + { + float ret = BitConverter.ToSingle(bytes, index); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.ToSingle result:{ret} expected:{expected} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToSingleThrow(byte[] bytes, int index, Type expectedExceptionType) + { + Exception exception = null; + + try + { + BitConverter.ToSingle(bytes, index); + } + catch (Exception e) + { + exception = e; + } + + if (exception == null || exception.GetType() != expectedExceptionType) + { + throw new Exception( + $"BitConverter.ToSingle exception:{exception} expected:{expectedExceptionType} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToUInt16(byte[] bytes, int index, ushort expected) + { + ushort ret = BitConverter.ToUInt16(bytes, index); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.ToUInt16 result:{ret} expected:{expected} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToUInt16Throw(byte[] bytes, int index, Type expectedExceptionType) + { + Exception exception = null; + + try + { + BitConverter.ToUInt16(bytes, index); + } + catch (Exception e) + { + exception = e; + } + + if (exception == null || exception.GetType() != expectedExceptionType) + { + throw new Exception( + $"BitConverter.ToUInt16 exception:{exception} expected:{expectedExceptionType} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToUInt32(byte[] bytes, int index, uint expected) + { + uint ret = BitConverter.ToUInt32(bytes, index); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.ToUInt32 result:{ret} expected:{expected} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToUInt32Throw(byte[] bytes, int index, Type expectedExceptionType) + { + Exception exception = null; + + try + { + BitConverter.ToUInt32(bytes, index); + } + catch (Exception e) + { + exception = e; + } + + if (exception == null || exception.GetType() != expectedExceptionType) + { + throw new Exception( + $"BitConverter.ToUInt32 exception:{exception} expected:{expectedExceptionType} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToUInt64(byte[] bytes, int index, ulong expected) + { + ulong ret = BitConverter.ToUInt64(bytes, index); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.ToUInt64 result:{ret} expected:{expected} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void BAToUInt64Throw(byte[] bytes, int index, Type expectedExceptionType) + { + Exception exception = null; + + try + { + BitConverter.ToUInt64(bytes, index); + } + catch (Exception e) + { + exception = e; + } + + if (exception == null || exception.GetType() != expectedExceptionType) + { + throw new Exception( + $"BitConverter.ToUInt64 exception:{exception} expected:{expectedExceptionType} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void WriteByteArray(byte[] bytes, string expected) + { + string ret = BitConverter.ToString(bytes); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.ToString result:{ret} expected:{expected} input:{ByteArrayToHex(bytes)}"); + } + } + + static public void WriteMultiLineByteArray(byte[] bytes, string expected) + { + string ret = string.Empty; + + const int rowSize = 20; + int i; + for (i = 0; i < bytes.Length - rowSize; i += rowSize) + { + if (ret.Length > 0) + { + ret += "\r\n"; + } + ret += BitConverter.ToString(bytes, i, rowSize); + } + + if (ret.Length > 0) + { + ret += "\r\n"; + } + ret += BitConverter.ToString(bytes, i); + + if (ret != expected) + { + throw new Exception( + $"BitConverter.ToString(2) result:{ret} expected:{expected} input:{ByteArrayToHex(bytes)}"); + } + } + + static public void ToStringThrow(byte[] bytes, Type expectedExceptionType) + { + Exception exception = null; + + try + { + BitConverter.ToString(bytes); + } + catch (Exception e) + { + exception = e; + } + + if (exception == null || exception.GetType() != expectedExceptionType) + { + throw new Exception( + $"BitConverter.ToString exception:{exception} expected:{expectedExceptionType} input:{ByteArrayToHex(bytes)}"); + } + } + + static public void ToStringThrow(byte[] bytes, int index, Type expectedExceptionType) + { + Exception exception = null; + + try + { + BitConverter.ToString(bytes, index); + } + catch (Exception e) + { + exception = e; + } + + if (exception == null || exception.GetType() != expectedExceptionType) + { + throw new Exception( + $"BitConverter.ToString exception:{exception} expected:{expectedExceptionType} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + + static public void ToStringThrow(byte[] bytes, int index, int length, Type expectedExceptionType) + { + Exception exception = null; + + try + { + BitConverter.ToString(bytes, index, length); + } + catch (Exception e) + { + exception = e; + } + + if (exception == null || exception.GetType() != expectedExceptionType) + { + throw new Exception( + $"BitConverter.ToString exception:{exception} expected:{expectedExceptionType} input:{ByteArrayToHex(bytes)} index:{index}"); + } + } + } +} diff --git a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj new file mode 100644 index 00000000..9101d272 --- /dev/null +++ b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj @@ -0,0 +1,61 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 8d47514f-552c-4862-961f-0caa315a231f + Library + Properties + 512 + NFUnitTestCoreLibrary + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + + packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + True + True + + + packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/Properties/AssemblyInfo.cs b/Tests/NFUnitTestCoreLibrary/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestCoreLibrary/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestCoreLibrary/nano.runsettings b/Tests/NFUnitTestCoreLibrary/nano.runsettings new file mode 100644 index 00000000..62f0a008 --- /dev/null +++ b/Tests/NFUnitTestCoreLibrary/nano.runsettings @@ -0,0 +1,13 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + + \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/packages.config b/Tests/NFUnitTestCoreLibrary/packages.config new file mode 100644 index 00000000..dcab08b1 --- /dev/null +++ b/Tests/NFUnitTestCoreLibrary/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 68a1a642..426e973f 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.27130.2010 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.31019.35 MinimumVisualStudioVersion = 10.0.40219.1 Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "CoreLibrary", "nanoFramework.CoreLibrary\CoreLibrary.nfproj", "{BE7B95D5-087C-45F8-8197-4B438BEDFE11}" EndProject @@ -15,6 +15,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution version.json = version.json EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{0BAE286A-5434-4F56-A9F1-41B72056170E}" +EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestBitConverter", "Tests\NFUnitTestCoreLibrary\NFUnitTestBitConverter.nfproj", "{8D47514F-552C-4862-961F-0CAA315A231F}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -29,10 +33,19 @@ Global {D1DAD305-BC77-4BDC-BCDA-ADAEF1D93455}.Debug|Any CPU.Build.0 = Debug|Any CPU {D1DAD305-BC77-4BDC-BCDA-ADAEF1D93455}.Release|Any CPU.ActiveCfg = Release|Any CPU {D1DAD305-BC77-4BDC-BCDA-ADAEF1D93455}.Release|Any CPU.Build.0 = Release|Any CPU + {8D47514F-552C-4862-961F-0CAA315A231F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8D47514F-552C-4862-961F-0CAA315A231F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8D47514F-552C-4862-961F-0CAA315A231F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {8D47514F-552C-4862-961F-0CAA315A231F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8D47514F-552C-4862-961F-0CAA315A231F}.Release|Any CPU.Build.0 = Release|Any CPU + {8D47514F-552C-4862-961F-0CAA315A231F}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {8D47514F-552C-4862-961F-0CAA315A231F} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} EndGlobalSection From 3e3deecf9c285661c0e919a3e9c03e414f229e61 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Sat, 27 Feb 2021 09:58:45 +0300 Subject: [PATCH 18/55] Fixing test for BitConverter --- Tests/NFUnitTestCoreLibrary/BitConverter.cs | 10 ++++++++++ Tests/NFUnitTestCoreLibrary/Helpers.cs | 17 ++++++++++++++++- .../NFUnitTestBitConverter.nfproj | 6 +++--- Tests/NFUnitTestCoreLibrary/packages.config | 2 +- 4 files changed, 30 insertions(+), 5 deletions(-) diff --git a/Tests/NFUnitTestCoreLibrary/BitConverter.cs b/Tests/NFUnitTestCoreLibrary/BitConverter.cs index 321f276e..27b61d10 100644 --- a/Tests/NFUnitTestCoreLibrary/BitConverter.cs +++ b/Tests/NFUnitTestCoreLibrary/BitConverter.cs @@ -212,6 +212,16 @@ public void BitConverterTest_LongBitsToDouble() Helper.LongBitsToDouble(long.MaxValue, double.NaN); } + [TestMethod] + public void IsNan() + { + double one = double.NaN; + if(!double.IsNaN(one)) + { + throw new Exception($"double.NaN: {one} should be {double.NaN}"); + } + } + [TestMethod] public void BitConverterTest_ToBoolean() { diff --git a/Tests/NFUnitTestCoreLibrary/Helpers.cs b/Tests/NFUnitTestCoreLibrary/Helpers.cs index 017ce5c5..ff31afd0 100644 --- a/Tests/NFUnitTestCoreLibrary/Helpers.cs +++ b/Tests/NFUnitTestCoreLibrary/Helpers.cs @@ -165,7 +165,7 @@ static public void GetBytesInt16(short input, byte[] expected) if (!CompareByteArray(ret, expected)) { throw new Exception( - $"BitConverter.GetBytes result:{ByteArrayToHex(ret)} expected:{ByteArrayToHex(expected)} input:{input}"); + $"BitConverter.GetBytes result:{ByteArrayToHex(ret)} expected:{ByteArrayToHex(expected)} input:{input}"); } } @@ -206,6 +206,11 @@ static public void LongBitsToDouble(long input, double expected) { double ret = BitConverter.Int64BitsToDouble(input); + if (double.IsNaN(ret) && double.IsNaN(expected)) + { + return; + } + if (ret != expected) { throw new Exception( @@ -279,6 +284,11 @@ static public void BAToDouble(byte[] bytes, int index, double expected) { double ret = BitConverter.ToDouble(bytes, index); + if (double.IsNaN(ret) && double.IsNaN(expected)) + { + return; + } + if (ret != expected) { throw new Exception( @@ -403,6 +413,11 @@ static public void BAToSingle(byte[] bytes, int index, float expected) { float ret = BitConverter.ToSingle(bytes, index); + if (double.IsNaN(ret) && double.IsNaN(expected)) + { + return; + } + if (ret != expected) { throw new Exception( diff --git a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj index 9101d272..08c36552 100644 --- a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj +++ b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj @@ -37,13 +37,13 @@ True True - - packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.52\lib\nanoFramework.TestFramework.dll True True - packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.52\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestCoreLibrary/packages.config b/Tests/NFUnitTestCoreLibrary/packages.config index dcab08b1..b0598293 100644 --- a/Tests/NFUnitTestCoreLibrary/packages.config +++ b/Tests/NFUnitTestCoreLibrary/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file From bd5701f1591f81c711bff87560033603b2c0bb17 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Sun, 28 Feb 2021 09:53:18 +0300 Subject: [PATCH 19/55] Adding categories and variables tests --- .../NFUnitTestBitConverter.nfproj | 6 +- Tests/NFUnitTestCoreLibrary/nano.runsettings | 3 +- Tests/NFUnitTestCoreLibrary/packages.config | 2 +- Tests/NFUnitTestVariables/CategoryTests.cs | 1870 +++++++++++++++++ .../NFUnitTestVariables.nfproj | 61 + .../Properties/AssemblyInfo.cs | 33 + Tests/NFUnitTestVariables/VariableTests.cs | 558 +++++ Tests/NFUnitTestVariables/nano.runsettings | 14 + Tests/NFUnitTestVariables/packages.config | 5 + nanoFramework.CoreLibrary.sln | 9 + 10 files changed, 2556 insertions(+), 5 deletions(-) create mode 100644 Tests/NFUnitTestVariables/CategoryTests.cs create mode 100644 Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj create mode 100644 Tests/NFUnitTestVariables/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestVariables/VariableTests.cs create mode 100644 Tests/NFUnitTestVariables/nano.runsettings create mode 100644 Tests/NFUnitTestVariables/packages.config diff --git a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj index 08c36552..ed3e14bc 100644 --- a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj +++ b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj @@ -37,13 +37,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.52\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.52\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestCoreLibrary/nano.runsettings b/Tests/NFUnitTestCoreLibrary/nano.runsettings index 62f0a008..fa881e3a 100644 --- a/Tests/NFUnitTestCoreLibrary/nano.runsettings +++ b/Tests/NFUnitTestCoreLibrary/nano.runsettings @@ -8,6 +8,7 @@ Framework40 - None + None + False \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/packages.config b/Tests/NFUnitTestCoreLibrary/packages.config index b0598293..1adb9284 100644 --- a/Tests/NFUnitTestCoreLibrary/packages.config +++ b/Tests/NFUnitTestCoreLibrary/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/CategoryTests.cs b/Tests/NFUnitTestVariables/CategoryTests.cs new file mode 100644 index 00000000..1b44fde8 --- /dev/null +++ b/Tests/NFUnitTestVariables/CategoryTests.cs @@ -0,0 +1,1870 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestVariables +{ + [TestClass] + public class CategoryTests + { + [Setup] + public void Initialize() + { + Debug.WriteLine("Adding set up for the tests."); + // Add your functionality here. + } + + [Cleanup] + public void CleanUp() + { + Debug.WriteLine("Cleaning up after the tests"); + } + + //Categories Test methods + //The following tests were ported from folder current\test\cases\client\CLR\Conformance\10_classes\Categories + //static01,static02,static03,static04,static05,static06,static07,static09,static11,static12,static13,static14,static15,static16,static17,static18,static19,static20,static21,inst018,inst019,inst020,inst021,inst022,inst023,inst024,inst026,inst028,inst029,inst030,inst031,inst032,inst033,inst034,inst035,inst036,inst037,inst038,inst039,inst040,inst041,inst042,inst043,inst044,inst046,inst048,inst049,inst050,inst051,inst052,inst053,inst054 + + //Test Case Calls + + [TestMethod] + public void Categories_static01_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static01.testMethod(); + } + [TestMethod] + public void Categories_static02_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static02.testMethod(); + } + [TestMethod] + public void Categories_static03_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static03.testMethod(); + } + [TestMethod] + public void Categories_static04_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static04.testMethod(); + } + [TestMethod] + public void Categories_static05_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static05.testMethod(); + } + + [TestMethod] + public void Categories_static06_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static06.testMethod(); + } + [TestMethod] + public void Categories_static07_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static07.testMethod(); + } + [TestMethod] + public void Categories_static09_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static09.testMethod(); + } + [TestMethod] + public void Categories_static11_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static11.testMethod(); + } + + [TestMethod] + public void Categories_static12_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static12.testMethod(); + } + [TestMethod] + public void Categories_static13_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static13.testMethod(); + } + [TestMethod] + public void Categories_static14_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static14.testMethod(); + } + [TestMethod] + public void Categories_static15_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static15.testMethod(); + } + [TestMethod] + public void Categories_static16_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static16.testMethod(); + } + [TestMethod] + public void Categories_static17_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine(" Categories_TestClass_?_A field declared with the static modifier is called a"); + Debug.WriteLine("static variable. Categories_TestClass_?_A static variable comes into existence"); + Debug.WriteLine("when the type in which it is declared is loaded, and "); + Debug.WriteLine("ceases to exist when the type in which it is declared"); + Debug.WriteLine("is unloaded."); + Categories_TestClass_static17.testMethod(); + } + + [TestMethod] + public void Categories_static18_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine("The initial value of a static variable is the default value"); + Debug.WriteLine("of the variable's type."); + Categories_TestClass_static18.testMethod(); + } + [TestMethod] + public void Categories_static19_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine("The initial value of a static variable is the default value"); + Debug.WriteLine("of the variable's type."); + Categories_TestClass_static19.testMethod(); + } + + [TestMethod] + public void Categories_static20_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine("The initial value of a static variable is the default value"); + Debug.WriteLine("of the variable's type."); + Categories_TestClass_static20.testMethod(); + } + /* + [TestMethod] + public void Categories_static21_Test() + { + Debug.WriteLine("Section 5"); + Categories_TestClass_static21.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + */ + [TestMethod] + public void Categories_inst018_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst018.testMethod(); + } + [TestMethod] + public void Categories_inst019_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst019.testMethod(); + } + [TestMethod] + public void Categories_inst020_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst020.testMethod(); + } + [TestMethod] + public void Categories_inst021_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst021.testMethod(); + } + [TestMethod] + public void Categories_inst022_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst022.testMethod(); + } + [TestMethod] + public void Categories_inst023_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst023.testMethod(); + } + [TestMethod] + public void Categories_inst024_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst024.testMethod(); + } + [TestMethod] + public void Categories_inst026_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst026.testMethod(); + } + [TestMethod] + public void Categories_inst028_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst028.testMethod(); + } + [TestMethod] + public void Categories_inst029_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst029.testMethod(); + } + [TestMethod] + public void Categories_inst030_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst030.testMethod(); + } + [TestMethod] + public void Categories_inst031_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst031.testMethod(); + } + [TestMethod] + public void Categories_inst032_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst032.testMethod(); + } + [TestMethod] + public void Categories_inst033_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst033.testMethod(); + } + [TestMethod] + public void Categories_inst034_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a class comes into existence when "); + Debug.WriteLine("a new instance of that class is created, and ceases to exist"); + Debug.WriteLine("when there are no references to that instance and the finalizer"); + Debug.WriteLine("of the instance has executed."); + Categories_TestClass_inst034.testMethod(); + } + [TestMethod] + public void Categories_inst035_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine("The initial value of an instance variable is the default value"); + Debug.WriteLine("of the variable's type."); + Categories_TestClass_inst035.testMethod(); + } + [TestMethod] + public void Categories_inst036_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine("The initial value of an instance variable is the default value"); + Debug.WriteLine("of the variable's type."); + Categories_TestClass_inst036.testMethod(); + } + [TestMethod] + public void Categories_inst037_Test() + { + Debug.WriteLine("Section 5.1.1"); + Debug.WriteLine("The initial value of an instance variable is the default value"); + Debug.WriteLine("of the variable's type."); + Categories_TestClass_inst037.testMethod(); + } + [TestMethod] + public void Categories_inst038_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst038.testMethod(); + } + [TestMethod] + public void Categories_inst039_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst039.testMethod(); + } + [TestMethod] + public void Categories_inst040_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst040.testMethod(); + } + [TestMethod] + public void Categories_inst041_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst041.testMethod(); + } + [TestMethod] + public void Categories_inst042_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst042.testMethod(); + } + [TestMethod] + public void Categories_inst043_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst043.testMethod(); + } + [TestMethod] + public void Categories_inst044_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst044.testMethod(); + } + [TestMethod] + public void Categories_inst046_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst046.testMethod(); + } + [TestMethod] + public void Categories_inst048_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst048.testMethod(); + } + [TestMethod] + public void Categories_inst049_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst049.testMethod(); + } + [TestMethod] + public void Categories_inst050_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst050.testMethod(); + } + [TestMethod] + public void Categories_inst051_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst051.testMethod(); + } + [TestMethod] + public void Categories_inst052_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst052.testMethod(); + } + [TestMethod] + public void Categories_inst053_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst053.testMethod(); + } + [TestMethod] + public void Categories_inst054_Test() + { + Debug.WriteLine("Section 5.1.2"); + Debug.WriteLine("An instance variable of a struct has exactly the"); + Debug.WriteLine("same lifetime as the struct variable to which it"); + Debug.WriteLine("belongs. In other words, when a variable of a "); + Debug.WriteLine("struct type comes into existence or ceases to "); + Debug.WriteLine("exist, so do the instance variables of the struct."); + Categories_TestClass_inst054.testMethod(); + } + + + //Compiled Test Cases + + public class Categories_TestClass_static01_1 + { + public static byte b1 = 1; + } + public class Categories_TestClass_static01 + { + public static byte b1 = 2; + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static01_1.b1, (byte)1); + Assert.Equal(Categories_TestClass_static01.b1, (byte)2); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_static02_1 + { + public static char c1 = 'a'; + } + public class Categories_TestClass_static02 + { + public static char c1 = 'b'; + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static02_1.c1, 'a'); + Assert.Equal(Categories_TestClass_static02.c1, 'b'); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_static03_1 + { + public static short s1 = 1; + } + public class Categories_TestClass_static03 + { + public static short s1 = 2; + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static03_1.s1, (short)1); + Assert.Equal(Categories_TestClass_static03.s1, (short)2); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_static04_1 + { + public static int i1 = 1; + } + public class Categories_TestClass_static04 + { + public static int i1 = 2; + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static04_1.i1, 1); + Assert.Equal(Categories_TestClass_static04.i1, 2); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_static05_1 + { + public static long l1 = 1L; + } + public class Categories_TestClass_static05 + { + public static long l1 = 2L; + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static05_1.l1, 1L); + Assert.Equal(Categories_TestClass_static05.l1, 2L); + } + public static void testMethod() + { + Main_old(); + } + } + + public class Categories_TestClass_static06_1 + { + public static float f1 = 1f; + } + public class Categories_TestClass_static06 + { + public static float f1 = 2f; + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static06_1.f1, 1f); + Assert.Equal(Categories_TestClass_static06.f1, 2f); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_static07_1 + { + public static double d1 = 1d; + } + public class Categories_TestClass_static07 + { + public static double d1 = 2d; + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static07_1.d1, 1d); + Assert.Equal(Categories_TestClass_static07.d1, 2d); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_static09_1 + { + public static bool b1 = true; + } + public class Categories_TestClass_static09 + { + public static bool b1 = false; + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static09_1.b1, true); + Assert.Equal(Categories_TestClass_static09.b1, false); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_static11_1 + { + public static string s1 = "string1"; + } + public class Categories_TestClass_static11 + { + public static string s1 = "string2"; + public static void Main_old() + { + Assert.True(Categories_TestClass_static11_1.s1.Equals("string1")); + Assert.True(Categories_TestClass_static11.s1.Equals("string2")); + } + public static void testMethod() + { + Main_old(); + } + } + + public struct Categories_TestClass_static12_Str + { + public Categories_TestClass_static12_Str(int intJ) + { + intI = intJ; + } + public int intI; + } + public class Categories_TestClass_static12_1 + { + public static Categories_TestClass_static12_Str s1 = new Categories_TestClass_static12_Str(1); + } + public class Categories_TestClass_static12 + { + public static Categories_TestClass_static12_Str s1 = new Categories_TestClass_static12_Str(2); + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static12_1.s1.intI, 1); + Assert.Equal(Categories_TestClass_static12.s1.intI, 2); + } + public static void testMethod() + { + Main_old(); + } + } + public enum Categories_TestClass_static13_En { a = 1, b = 2 } + public class Categories_TestClass_static13_1 + { + public static Categories_TestClass_static13_En E = Categories_TestClass_static13_En.a; + } + public class Categories_TestClass_static13 + { + public static Categories_TestClass_static13_En E = Categories_TestClass_static13_En.b; + public static void Main_old() + { + if (Categories_TestClass_static13_1.E != Categories_TestClass_static13_En.a) + { + throw new Exception($"enums not equal"); + } + if (Categories_TestClass_static13.E != Categories_TestClass_static13_En.b) + { + throw new Exception($"enums not equal"); + } + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_static14_C + { + public Categories_TestClass_static14_C(int intJ) + { + intI = intJ; + } + public int intI; + } + public class Categories_TestClass_static14_1 + { + public static Categories_TestClass_static14_C c1 = new Categories_TestClass_static14_C(1); + } + public class Categories_TestClass_static14 + { + public static Categories_TestClass_static14_C c1 = new Categories_TestClass_static14_C(2); + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static14_1.c1.intI, 1); + Assert.Equal(Categories_TestClass_static14.c1.intI, 2); + } + public static void testMethod() + { + Main_old(); + } + } + public interface Categories_TestClass_static15_Inter + { + int intRet(); + } + public class Categories_TestClass_static15_2 : Categories_TestClass_static15_Inter + { + public Categories_TestClass_static15_2(int intJ) + { + intI = intJ; + } + public int intI; + public int intRet() + { + return intI; + } + } + public class Categories_TestClass_static15_1 + { + public static Categories_TestClass_static15_Inter i1 = (Categories_TestClass_static15_Inter)new Categories_TestClass_static15_2(1); + } + public class Categories_TestClass_static15 + { + public static Categories_TestClass_static15_Inter i1 = (Categories_TestClass_static15_Inter)new Categories_TestClass_static15_2(2); + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static15_1.i1.intRet(), 1); + Assert.Equal(Categories_TestClass_static15.i1.intRet(), 2); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_static16_1 + { + public static int[] i = new int[] { 1 }; + } + public class Categories_TestClass_static16 + { + public static int[] i = new int[] { 2 }; + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static16_1.i[0], 1); + Assert.Equal(Categories_TestClass_static16.i[0], 2); + } + public static void testMethod() + { + Main_old(); + } + } + public delegate int Categories_TestClass_static17_Del(); + public class Categories_TestClass_static17_1 + { + public static int RetInt() + { + return 1; + } + public static Categories_TestClass_static17_Del d = new Categories_TestClass_static17_Del(RetInt); + } + public class Categories_TestClass_static17 + { + public static int RetInt() + { + return 2; + } + public static Categories_TestClass_static17_Del d = new Categories_TestClass_static17_Del(RetInt); + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static17_1.d(), 1); + Assert.Equal(Categories_TestClass_static17.d(), 2); + } + public static void testMethod() + { + Main_old(); + } + } + + public class Categories_TestClass_static18 + { + public static byte b1; + public static char c1; + public static short s1; + public static int i1; + public static long l1; + public static float f1; + public static double d1; + public static bool b2; + public static void Main_old() + { + Assert.Equal(Categories_TestClass_static18.b1, (byte)0); + Assert.Equal(Categories_TestClass_static18.c1, '\x0000'); + Assert.Equal(Categories_TestClass_static18.s1, (short)0); + Assert.Equal(Categories_TestClass_static18.i1, 0); + Assert.Equal(Categories_TestClass_static18.l1, 0L); + Assert.Equal(Categories_TestClass_static18.f1, 0f); + Assert.Equal(Categories_TestClass_static18.d1, 0d); + Assert.Equal(Categories_TestClass_static18.b2, false); + } + public static void testMethod() + { + Main_old(); + } + } + public enum Categories_TestClass_static19_En { a = 1 } + public struct Categories_TestClass_static19_Str + { + public byte b1; + public char c1; + public short s1; + public int i1; + public long l1; + public float f1; + public double d1; + public bool b2; + } + public class Categories_TestClass_static19 + { + static Categories_TestClass_static19_Str MS; + static Categories_TestClass_static19_En ME; + public static void Main_old() + { + Assert.Equal(MS.b1, (byte)0); + Assert.Equal(MS.c1, '\x0000'); + Assert.Equal(MS.s1, (short)0); + Assert.Equal(MS.i1, 0); + Assert.Equal(MS.l1, 0L); + Assert.Equal(MS.f1, 0f); + Assert.Equal(MS.d1, 0d); + Assert.Equal(MS.b2, false); + if (ME != (Categories_TestClass_static19_En)0) + { + throw new Exception("Enums not equal"); + } + } + public static void testMethod() + { + Main_old(); + } + } + + public interface Categories_TestClass_static20_Inter { } + public class Categories_TestClass_static20_1 { } + public delegate int Categories_TestClass_static20_Del(); + public class Categories_TestClass_static20 + { + public static string MS;//string + public static Categories_TestClass_static20_Inter MI;//interface + public static Categories_TestClass_static20 MC;//class + public static int[] MA;//array + public static Categories_TestClass_static20_Del MD;//delegate + public static void Main_old() + { + Assert.Null(Categories_TestClass_static20.MS); + Assert.Null(Categories_TestClass_static20.MI); + Assert.Null(Categories_TestClass_static20.MC); + Assert.Null(Categories_TestClass_static20.MA); + Assert.Null(Categories_TestClass_static20.MD); + } + public static void testMethod() + { + Main_old(); + } + } + /* + public class Categories_TestClass_static21 + { + const string s = null; + public static void Main_old() + { + if (s == null) + { + return 0; + } + else + { + return 1; + } + } + public static void testMethod() + { + Main_old(); + } + } + */ + + public class Categories_TestClass_inst018_1 + { + public byte b1 = 1; + } + public class Categories_TestClass_inst018 + { + public byte b1 = 2; + public static void Main_old() + { + Categories_TestClass_inst018_1 Test1 = new Categories_TestClass_inst018_1(); + Categories_TestClass_inst018 Test2 = new Categories_TestClass_inst018(); + Assert.Equal(Test1.b1, (byte)1); + Assert.Equal(Test2.b1, (byte)2); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_inst019_1 + { + public char c1 = 'a'; + } + public class Categories_TestClass_inst019 + { + public char c1 = 'b'; + public static void Main_old() + { + Categories_TestClass_inst019_1 Test1 = new Categories_TestClass_inst019_1(); + Categories_TestClass_inst019 Test2 = new Categories_TestClass_inst019(); + Assert.Equal(Test1.c1, 'a'); + Assert.Equal(Test2.c1, 'b'); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_inst020_1 + { + public short s1 = 1; + } + public class Categories_TestClass_inst020 + { + public short s1 = 2; + public static void Main_old() + { + Categories_TestClass_inst020_1 Test1 = new Categories_TestClass_inst020_1(); + Categories_TestClass_inst020 Test2 = new Categories_TestClass_inst020(); + Assert.Equal(Test1.s1, (short)1); + Assert.Equal(Test2.s1, (short)2); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_inst021_1 + { + public int i1 = 1; + } + public class Categories_TestClass_inst021 + { + public int i1 = 2; + public static void Main_old() + { + Categories_TestClass_inst021_1 Test1 = new Categories_TestClass_inst021_1(); + Categories_TestClass_inst021 Test2 = new Categories_TestClass_inst021(); + Assert.Equal(Test1.i1, 1); + Assert.Equal(Test2.i1, 2); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_inst022_1 + { + public long l1 = 1L; + } + public class Categories_TestClass_inst022 + { + public long l1 = 2L; + public static void Main_old() + { + Categories_TestClass_inst022_1 Test1 = new Categories_TestClass_inst022_1(); + Categories_TestClass_inst022 Test2 = new Categories_TestClass_inst022(); + Assert.Equal(Test1.l1, 1L); + Assert.Equal(Test2.l1, 2L); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_inst023_1 + { + public float f1 = 1f; + } + public class Categories_TestClass_inst023 + { + public float f1 = 2f; + public static void Main_old() + { + Categories_TestClass_inst023_1 Test1 = new Categories_TestClass_inst023_1(); + Categories_TestClass_inst023 Test2 = new Categories_TestClass_inst023(); + Assert.Equal(Test1.f1, 1f); + Assert.Equal(Test2.f1, 2f); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_inst024_1 + { + public double d1 = 1d; + } + public class Categories_TestClass_inst024 + { + public double d1 = 2d; + public static void Main_old() + { + Categories_TestClass_inst024_1 Test1 = new Categories_TestClass_inst024_1(); + Categories_TestClass_inst024 Test2 = new Categories_TestClass_inst024(); + Assert.Equal(Test1.d1, 1d); + Assert.Equal(Test2.d1, 2d); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_inst026_1 + { + public bool b1 = true; + } + public class Categories_TestClass_inst026 + { + public bool b1 = false; + public static void Main_old() + { + Categories_TestClass_inst026_1 Test1 = new Categories_TestClass_inst026_1(); + Categories_TestClass_inst026 Test2 = new Categories_TestClass_inst026(); + Assert.Equal(Test1.b1, true); + Assert.Equal(Test2.b1, false); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_inst028_1 + { + public string s1 = "string1"; + } + public class Categories_TestClass_inst028 + { + public string s1 = "string2"; + public static void Main_old() + { + Categories_TestClass_inst028_1 Test1 = new Categories_TestClass_inst028_1(); + Categories_TestClass_inst028 Test2 = new Categories_TestClass_inst028(); + Assert.True(Test1.s1.Equals("string1")); + Assert.True(Test2.s1.Equals("string2")); + } + public static void testMethod() + { + Main_old(); + } + } + public struct Categories_TestClass_inst029_Str + { + public Categories_TestClass_inst029_Str(int intJ) + { + intI = intJ; + } + public int intI; + } + public class Categories_TestClass_inst029_1 + { + public Categories_TestClass_inst029_Str s1 = new Categories_TestClass_inst029_Str(1); + } + public class Categories_TestClass_inst029 + { + public Categories_TestClass_inst029_Str s1 = new Categories_TestClass_inst029_Str(2); + public static void Main_old() + { + Categories_TestClass_inst029_1 Test1 = new Categories_TestClass_inst029_1(); + Categories_TestClass_inst029 Test2 = new Categories_TestClass_inst029(); + Assert.Equal(Test1.s1.intI, 1); + Assert.Equal(Test2.s1.intI, 2); + } + public static void testMethod() + { + Main_old(); + } + } + public enum Categories_TestClass_inst030_En { a = 1, b = 2 } + public class Categories_TestClass_inst030_1 + { + public Categories_TestClass_inst030_En E = Categories_TestClass_inst030_En.a; + } + public class Categories_TestClass_inst030 + { + public Categories_TestClass_inst030_En E = Categories_TestClass_inst030_En.b; + public static void Main_old() + { + Categories_TestClass_inst030_1 Test1 = new Categories_TestClass_inst030_1(); + Categories_TestClass_inst030 Test2 = new Categories_TestClass_inst030(); + if (Test1.E != Categories_TestClass_inst030_En.a) + { + throw new Exception("Enums are not equal"); + } + if (Test2.E != Categories_TestClass_inst030_En.b) + { + throw new Exception("Enums are not equal"); + } + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_inst031_2 + { + public Categories_TestClass_inst031_2(int intJ) + { + intI = intJ; + } + public int intI; + } + public class Categories_TestClass_inst031_1 + { + public Categories_TestClass_inst031_2 c1 = new Categories_TestClass_inst031_2(1); + } + public class Categories_TestClass_inst031 + { + public Categories_TestClass_inst031_2 c1 = new Categories_TestClass_inst031_2(2); + public static void Main_old() + { + Categories_TestClass_inst031_1 Test1 = new Categories_TestClass_inst031_1(); + Categories_TestClass_inst031 Test2 = new Categories_TestClass_inst031(); + Assert.Equal(Test1.c1.intI, 1); + Assert.Equal(Test2.c1.intI, 2); + } + public static void testMethod() + { + Main_old(); + } + } + public interface Categories_TestClass_inst032_Inter + { + int intRet(); + } + public class Categories_TestClass_inst032_2 : Categories_TestClass_inst032_Inter + { + public Categories_TestClass_inst032_2(int intJ) + { + intI = intJ; + } + public int intI; + public int intRet() + { + return intI; + } + } + public class Categories_TestClass_inst032_1 + { + public Categories_TestClass_inst032_Inter i1 = (Categories_TestClass_inst032_Inter)new Categories_TestClass_inst032_2(1); + } + public class Categories_TestClass_inst032 + { + public Categories_TestClass_inst032_Inter i1 = (Categories_TestClass_inst032_Inter)new Categories_TestClass_inst032_2(2); + public static void Main_old() + { + Categories_TestClass_inst032_1 Test1 = new Categories_TestClass_inst032_1(); + Categories_TestClass_inst032 Test2 = new Categories_TestClass_inst032(); + Assert.Equal(Test1.i1.intRet(), 1); + Assert.Equal(Test2.i1.intRet(), 2); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_inst033_1 + { + public int[] i = new int[] { 1 }; + } + public class Categories_TestClass_inst033 + { + public int[] i = new int[] { 2 }; + public static void Main_old() + { + Categories_TestClass_inst033_1 Test1 = new Categories_TestClass_inst033_1(); + Categories_TestClass_inst033 Test2 = new Categories_TestClass_inst033(); + Assert.Equal(Test1.i[0], 1); + Assert.Equal(Test2.i[0], 2); + } + public static void testMethod() + { + Main_old(); + } + } + public delegate int Categories_TestClass_inst034_Del(); + public class Categories_TestClass_inst034_1 + { + public static int RetInt() + { + return 1; + } + public Categories_TestClass_inst034_Del d = new Categories_TestClass_inst034_Del(RetInt); + } + public class Categories_TestClass_inst034 + { + public static int RetInt() + { + return 2; + } + public Categories_TestClass_inst034_Del d = new Categories_TestClass_inst034_Del(RetInt); + public static void Main_old() + { + Categories_TestClass_inst034_1 Test1 = new Categories_TestClass_inst034_1(); + Categories_TestClass_inst034 Test2 = new Categories_TestClass_inst034(); + Assert.Equal(Test1.d(), 1); + Assert.Equal(Test2.d(), 2); + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_inst035 + { + public byte b1; + public char c1; + public short s1; + public int i1; + public long l1; + public float f1; + public double d1; + //public double m1; + public bool b2; + public static void Main_old() + { + Categories_TestClass_inst035 Test = new Categories_TestClass_inst035(); + Assert.Equal(Test.b1, (byte)0); + Assert.Equal(Test.c1, '\x0000'); + Assert.Equal(Test.s1, (short)0); + Assert.Equal(Test.i1, 0); + Assert.Equal(Test.l1, 0L); + Assert.Equal(Test.f1, 0f); + Assert.Equal(Test.d1, 0d); + Assert.Equal(Test.b2, false); + } + public static void testMethod() + { + Main_old(); + } + } + public interface Categories_TestClass_inst036_Inter { } + public class Categories_TestClass_inst036_2 { } + public delegate int Categories_TestClass_inst036_Del(); + public class Categories_TestClass_inst036 + { + public string MS;//string + public Categories_TestClass_inst036_Inter MI;//interface + public Categories_TestClass_inst036 MC;//class + public int[] MA;//array + public Categories_TestClass_inst036_Del MD;//delegate + public static void Main_old() + { + Categories_TestClass_inst036 Test = new Categories_TestClass_inst036(); + Assert.Null(Test.MS); + Assert.Null(Test.MI); + Assert.Null(Test.MC); + Assert.Null(Test.MA); + Assert.Null(Test.MD); + } + public static void testMethod() + { + Main_old(); + } + } + public enum Categories_TestClass_inst037_En { a = 1 } + public struct Categories_TestClass_inst037_Str + { + public byte b1; + public char c1; + public short s1; + public int i1; + public long l1; + public float f1; + public double d1; + public bool b2; + } + public class Categories_TestClass_inst037 + { + Categories_TestClass_inst037_Str MS; + Categories_TestClass_inst037_En ME; + public static void Main_old() + { + Categories_TestClass_inst037 Test = new Categories_TestClass_inst037(); + Assert.Equal(Test.MS.b1, (byte)0); + Assert.Equal(Test.MS.c1, '\x0000'); + Assert.Equal(Test.MS.s1, (short)0); + Assert.Equal(Test.MS.i1, 0); + Assert.Equal(Test.MS.l1, 0L); + Assert.Equal(Test.MS.f1, 0f); + Assert.Equal(Test.MS.d1, 0d); + Assert.Equal(Test.MS.b2, false); + if (Test.ME != (Categories_TestClass_inst037_En)0) + { + throw new Exception("Enums are not equal"); + } + } + public static void testMethod() + { + Main_old(); + } + } + public struct Categories_TestClass_inst038_Str1 + { + public Categories_TestClass_inst038_Str1(byte b2) + { + b1 = b2; + } + public byte b1; + } + public struct Categories_TestClass_inst038 + { + public Categories_TestClass_inst038(byte b2) + { + b1 = b2; + } + public byte b1; + public static void Main_old() + { + Categories_TestClass_inst038_Str1 Test1 = new Categories_TestClass_inst038_Str1((byte)1); + Categories_TestClass_inst038 Test2 = new Categories_TestClass_inst038((byte)2); + Assert.Equal(Test1.b1, (byte)1); + Assert.Equal(Test2.b1, (byte)2); + } + public static void testMethod() + { + Main_old(); + } + } + public struct Categories_TestClass_inst039_Str1 + { + public Categories_TestClass_inst039_Str1(char c2) + { + c1 = c2; + } + public char c1; + } + public struct Categories_TestClass_inst039 + { + public Categories_TestClass_inst039(char c2) + { + c1 = c2; + } + public char c1; + public static void Main_old() + { + Categories_TestClass_inst039_Str1 Test1 = new Categories_TestClass_inst039_Str1('a'); + Categories_TestClass_inst039 Test2 = new Categories_TestClass_inst039('b'); + Assert.Equal(Test1.c1, 'a'); + Assert.Equal(Test2.c1, 'b'); + } + public static void testMethod() + { + Main_old(); + } + } + public struct Categories_TestClass_inst040_Str1 + { + public Categories_TestClass_inst040_Str1(short s2) + { + s1 = s2; + } + public short s1; + } + public struct Categories_TestClass_inst040 + { + public Categories_TestClass_inst040(short s2) + { + s1 = s2; + } + public short s1; + public static void Main_old() + { + Categories_TestClass_inst040_Str1 Test1 = new Categories_TestClass_inst040_Str1((short)1); + Categories_TestClass_inst040 Test2 = new Categories_TestClass_inst040((short)2); + Assert.Equal(Test1.s1, (short)1); + Assert.Equal(Test2.s1, (short)2); + } + public static void testMethod() + { + Main_old(); + } + } + public struct Categories_TestClass_inst041_Str1 + { + public Categories_TestClass_inst041_Str1(int i2) + { + i1 = i2; + } + public int i1; + } + public struct Categories_TestClass_inst041 + { + public Categories_TestClass_inst041(int i2) + { + i1 = i2; + } + public int i1; + public static void Main_old() + { + Categories_TestClass_inst041_Str1 Test1 = new Categories_TestClass_inst041_Str1(1); + Categories_TestClass_inst041 Test2 = new Categories_TestClass_inst041(2); + Assert.Equal(Test1.i1, 1); + Assert.Equal(Test2.i1, 2); + } + public static void testMethod() + { + Main_old(); + } + } + public struct Categories_TestClass_inst042_Str1 + { + public Categories_TestClass_inst042_Str1(long l2) + { + l1 = l2; + } + public long l1; + } + public struct Categories_TestClass_inst042 + { + public Categories_TestClass_inst042(long l2) + { + l1 = l2; + } + public long l1; + public static void Main_old() + { + Categories_TestClass_inst042_Str1 Test1 = new Categories_TestClass_inst042_Str1(1L); + Categories_TestClass_inst042 Test2 = new Categories_TestClass_inst042(2L); + Assert.Equal(Test1.l1, 1L); + Assert.Equal(Test2.l1, 2L); + } + public static void testMethod() + { + Main_old(); + } + } + public struct Categories_TestClass_inst043_Str1 + { + public Categories_TestClass_inst043_Str1(float f2) + { + f1 = f2; + } + public float f1; + } + public struct Categories_TestClass_inst043 + { + public Categories_TestClass_inst043(float f2) + { + f1 = f2; + } + public float f1; + public static void Main_old() + { + Categories_TestClass_inst043_Str1 Test1 = new Categories_TestClass_inst043_Str1(1f); + Categories_TestClass_inst043 Test2 = new Categories_TestClass_inst043(2f); + Assert.Equal(Test1.f1, 1f); + Assert.Equal(Test2.f1, 2f); + } + public static void testMethod() + { + Main_old(); + } + } + public struct Categories_TestClass_inst044_Str1 + { + public Categories_TestClass_inst044_Str1(double d2) + { + d1 = d2; + } + public double d1; + } + public struct Categories_TestClass_inst044 + { + public Categories_TestClass_inst044(double d2) + { + d1 = d2; + } + public double d1; + public static void Main_old() + { + Categories_TestClass_inst044_Str1 Test1 = new Categories_TestClass_inst044_Str1(1d); + Categories_TestClass_inst044 Test2 = new Categories_TestClass_inst044(2d); + Assert.Equal(Test1.d1, 1d); + Assert.Equal(Test2.d1, 2d); + } + public static void testMethod() + { + Main_old(); + } + } + public struct Categories_TestClass_inst046_Str1 + { + public Categories_TestClass_inst046_Str1(bool b2) + { + b1 = b2; + } + public bool b1; + } + public struct Categories_TestClass_inst046 + { + public Categories_TestClass_inst046(bool b2) + { + b1 = b2; + } + public bool b1; + public static void Main_old() + { + Categories_TestClass_inst046_Str1 Test1 = new Categories_TestClass_inst046_Str1(true); + Categories_TestClass_inst046 Test2 = new Categories_TestClass_inst046(false); + Assert.Equal(Test1.b1, true); + Assert.Equal(Test2.b1, false); + } + public static void testMethod() + { + Main_old(); + } + } + public struct Categories_TestClass_inst048_Str1 + { + public Categories_TestClass_inst048_Str1(string s2) + { + s1 = s2; + } + public string s1; + } + public struct Categories_TestClass_inst048 + { + public Categories_TestClass_inst048(string s2) + { + s1 = s2; + } + public string s1; + public static void Main_old() + { + Categories_TestClass_inst048_Str1 Test1 = new Categories_TestClass_inst048_Str1("string1"); + Categories_TestClass_inst048 Test2 = new Categories_TestClass_inst048("string2"); + Assert.True(Test1.s1.Equals("string1")); + Assert.True(Test2.s1.Equals("string2")); + } + public static void testMethod() + { + Main_old(); + } + } + public struct Categories_TestClass_inst049_Str + { + public Categories_TestClass_inst049_Str(int intJ) + { + intI = intJ; + } + public int intI; + } + public struct Categories_TestClass_inst049_Str1 + { + public Categories_TestClass_inst049_Str1(int intI) + { + s1 = new Categories_TestClass_inst049_Str(1); + } + public Categories_TestClass_inst049_Str s1; + } + public struct Categories_TestClass_inst049 + { + public Categories_TestClass_inst049(int intI) + { + s1 = new Categories_TestClass_inst049_Str(2); + } + public Categories_TestClass_inst049_Str s1; + public static void Main_old() + { + Categories_TestClass_inst049_Str1 Test1 = new Categories_TestClass_inst049_Str1(0); + Categories_TestClass_inst049 Test2 = new Categories_TestClass_inst049(0); + Assert.Equal(Test1.s1.intI, 1); + Assert.Equal(Test2.s1.intI, 2); + } + public static void testMethod() + { + Main_old(); + } + } + public enum Categories_TestClass_inst050_En { a = 1, b = 2 } + public struct Categories_TestClass_inst050_Str1 + { + public Categories_TestClass_inst050_Str1(int intI) + { + E = Categories_TestClass_inst050_En.a; + } + public Categories_TestClass_inst050_En E; + } + public struct Categories_TestClass_inst050 + { + public Categories_TestClass_inst050(int intI) + { + E = Categories_TestClass_inst050_En.b; + } + public Categories_TestClass_inst050_En E; + public static void Main_old() + { + Categories_TestClass_inst050_Str1 Test1 = new Categories_TestClass_inst050_Str1(0); + Categories_TestClass_inst050 Test2 = new Categories_TestClass_inst050(0); + if (Test1.E != Categories_TestClass_inst050_En.a) + { + throw new Exception("Enums are not equal"); + } + if (Test2.E != Categories_TestClass_inst050_En.b) + { + throw new Exception("Enums are not equal"); + } + } + public static void testMethod() + { + Main_old(); + } + } + public class Categories_TestClass_inst051_C + { + public Categories_TestClass_inst051_C(int intJ) + { + intI = intJ; + } + public int intI; + } + public struct Categories_TestClass_inst051_Str1 + { + public Categories_TestClass_inst051_Str1(int intI) + { + c1 = new Categories_TestClass_inst051_C(1); + } + public Categories_TestClass_inst051_C c1; + } + public struct Categories_TestClass_inst051 + { + public Categories_TestClass_inst051(int intI) + { + c1 = new Categories_TestClass_inst051_C(2); + } + public Categories_TestClass_inst051_C c1; + public static void Main_old() + { + Categories_TestClass_inst051_Str1 Test1 = new Categories_TestClass_inst051_Str1(0); + Categories_TestClass_inst051 Test2 = new Categories_TestClass_inst051(0); + Assert.Equal(Test1.c1.intI, 1); + Assert.Equal(Test2.c1.intI, 2); + } + public static void testMethod() + { + Main_old(); + } + } + public interface Categories_TestClass_inst052_Inter + { + int intRet(); + } + public class Categories_TestClass_inst052_C : Categories_TestClass_inst052_Inter + { + public Categories_TestClass_inst052_C(int intJ) + { + intI = intJ; + } + public int intI; + public int intRet() + { + return intI; + } + } + public struct Categories_TestClass_inst052_Str1 + { + public Categories_TestClass_inst052_Str1(int intI) + { + i1 = (Categories_TestClass_inst052_Inter)new Categories_TestClass_inst052_C(1); + } + + public Categories_TestClass_inst052_Inter i1; + } + public struct Categories_TestClass_inst052 + { + public Categories_TestClass_inst052(int intI) + { + i1 = (Categories_TestClass_inst052_Inter)new Categories_TestClass_inst052_C(2); + } + public Categories_TestClass_inst052_Inter i1; + public static void Main_old() + { + Categories_TestClass_inst052_Str1 Test1 = new Categories_TestClass_inst052_Str1(0); + Categories_TestClass_inst052 Test2 = new Categories_TestClass_inst052(0); + Assert.Equal(Test1.i1.intRet(), 1); + Assert.Equal(Test2.i1.intRet(), 2); + } + public static void testMethod() + { + Main_old(); + } + } + public struct Categories_TestClass_inst053_Str1 + { + public Categories_TestClass_inst053_Str1(int intI) + { + i = new int[] { 1 }; + } + + public int[] i; + } + public struct Categories_TestClass_inst053 + { + public Categories_TestClass_inst053(int intI) + { + i = new int[] { 2 }; + } + public int[] i; + public static void Main_old() + { + Categories_TestClass_inst053_Str1 Test1 = new Categories_TestClass_inst053_Str1(0); + Categories_TestClass_inst053 Test2 = new Categories_TestClass_inst053(0); + Assert.Equal(Test1.i[0], 1); + Assert.Equal(Test2.i[0], 2); + } + public static void testMethod() + { + Main_old(); + } + } + public delegate int Categories_TestClass_inst054_Del(); + public struct Categories_TestClass_inst054_Str1 + { + public Categories_TestClass_inst054_Str1(int intI) + { + d = new Categories_TestClass_inst054_Del(RetInt); + } + + public Categories_TestClass_inst054_Del d; + public static int RetInt() + { + return 1; + } + } + public struct Categories_TestClass_inst054 + { + public Categories_TestClass_inst054(int intI) + { + d = new Categories_TestClass_inst054_Del(RetInt); + } + public Categories_TestClass_inst054_Del d; + public static int RetInt() + { + return 2; + } + public static void Main_old() + { + Categories_TestClass_inst054_Str1 Test1 = new Categories_TestClass_inst054_Str1(0); + Categories_TestClass_inst054 Test2 = new Categories_TestClass_inst054(0); + Assert.Equal(Test1.d(), 1); + Assert.Equal(Test2.d(), 2); + } + public static void testMethod() + { + Main_old(); + } + } + } +} diff --git a/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj b/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj new file mode 100644 index 00000000..f30e8a2e --- /dev/null +++ b/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj @@ -0,0 +1,61 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 6d93536d-2cfc-4bb8-b490-080eb11d40dd + Library + Properties + 512 + NFUnitTestVariables + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/Properties/AssemblyInfo.cs b/Tests/NFUnitTestVariables/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestVariables/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestVariables/VariableTests.cs b/Tests/NFUnitTestVariables/VariableTests.cs new file mode 100644 index 00000000..c4f28975 --- /dev/null +++ b/Tests/NFUnitTestVariables/VariableTests.cs @@ -0,0 +1,558 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestVariables +{ + [TestClass] + class VariableTests + { + [Setup] + public void InitializeVariables() + { + Debug.WriteLine("Adding set up for the tests"); + } + + [Cleanup] + public void CleanUpVariables() + { + Debug.WriteLine("Cleaning up after the tests"); + } + + //Variables Test methods + //The following tests were ported from folder current\test\cases\client\CLR\Conformance\10_classes\Variables + //S5_range_byte_0.cs,S5_range_byte_1.cs,S5_range_char_0.cs,S5_range_char_1.cs,S5_range_double_0.cs,S5_range_double_1.cs,S5_range_float_0.cs,S5_range_float_1.cs,S5_range_int_0.cs,S5_range_int_1.cs,S5_range_int_3.cs,S5_range_long_0.cs,S5_range_long_1.cs,S5_range_long_3.cs,S5_range_short_0.cs,S5_range_short_1.cs + + //Test Case Calls + [TestMethod] + public void Variables_S5_range_byte_0_Test() + { + Debug.WriteLine("S5_range_byte_0.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("byte"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: 255Y"); + Variables_TestClass_S5_range_byte_0.testMethod(); + } + [TestMethod] + public void Variables_S5_range_byte_1_Test() + { + Debug.WriteLine("S5_range_byte_1.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("byte"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: 0Y"); + Variables_TestClass_S5_range_byte_1.testMethod(); + } + [TestMethod] + public void Variables_S5_range_char_0_Test() + { + Debug.WriteLine("S5_range_char_0.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("char"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: 65535"); + Variables_TestClass_S5_range_char_0.testMethod(); + } + [TestMethod] + public void Variables_S5_range_char_1_Test() + { + Debug.WriteLine("S5_range_char_1.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("char"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: 0"); + Variables_TestClass_S5_range_char_1.testMethod(); + } + [TestMethod] + public void Variables_S5_range_double_0_Test() + { + Debug.WriteLine("S5_range_double_0.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("double"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: 1.7e308d"); + Variables_TestClass_S5_range_double_0.testMethod(); + } + [TestMethod] + public void Variables_S5_range_double_1_Test() + { + Debug.WriteLine("S5_range_double_1.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("double"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: -1.7e308d"); + Variables_TestClass_S5_range_double_1.testMethod(); + } + [TestMethod] + public void Variables_S5_range_float_0_Test() + { + Debug.WriteLine("S5_range_float_0.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("float"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: 3.4e38F"); + Variables_TestClass_S5_range_float_0.testMethod(); + } + [TestMethod] + public void Variables_S5_range_float_1_Test() + { + Debug.WriteLine("S5_range_float_1.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("float"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: -3.4e38F"); + Variables_TestClass_S5_range_float_1.testMethod(); + } + [TestMethod] + public void Variables_S5_range_int_0_Test() + { + Debug.WriteLine("S5_range_int_0.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("int"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: 2147483647"); + Variables_TestClass_S5_range_int_0.testMethod(); + } + [TestMethod] + public void Variables_S5_range_int_1_Test() + { + Debug.WriteLine("S5_range_int_1.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("int"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: -2147483647"); + Variables_TestClass_S5_range_int_1.testMethod(); + } + [TestMethod] + public void Variables_S5_range_int_3_Test() + { + Debug.WriteLine("S5_range_int_3.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("int"); + Debug.WriteLine(" CompilesOK: 0"); + Debug.WriteLine(" Value: -2147483648"); + Variables_TestClass_S5_range_int_3.testMethod(); + } + [TestMethod] + public void Variables_S5_range_long_0_Test() + { + Debug.WriteLine("S5_range_long_0.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("long"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: 9223372036854775807L"); + Variables_TestClass_S5_range_long_0.testMethod(); + } + [TestMethod] + public void Variables_S5_range_long_1_Test() + { + Debug.WriteLine("S5_range_long_1.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("long"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: -9223372036854775807L"); + Variables_TestClass_S5_range_long_1.testMethod(); + } + [TestMethod] + public void Variables_S5_range_long_3_Test() + { + Debug.WriteLine("S5_range_long_3.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("long"); + Debug.WriteLine(" CompilesOK: 0"); + Debug.WriteLine(" Value: -9223372036854775808L"); + Variables_TestClass_S5_range_long_3.testMethod(); + } + [TestMethod] + public void Variables_S5_range_short_0_Test() + { + Debug.WriteLine("S5_range_short_0.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("short"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: 32767S"); + Variables_TestClass_S5_range_short_0.testMethod(); + } + [TestMethod] + public void Variables_S5_range_short_1_Test() + { + Debug.WriteLine("S5_range_short_1.sc"); + Debug.WriteLine("This is a variable range test:"); + Debug.WriteLine("short"); + Debug.WriteLine(" CompilesOK: 1"); + Debug.WriteLine(" Value: -32767S"); + Variables_TestClass_S5_range_short_1.testMethod(); + } + + public class Variables_TestClass_S5_range_byte_0 + { + public static void Main_old() + { + byte var; + byte var2; + var = 255; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_byte_1 + { + public static void Main_old() + { + byte var; + byte var2; + var = 0; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_char_0 + { + public static void Main_old() + { + char var; + char var2; + var = (char)65535; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_char_1 + { + public static void Main_old() + { + char var; + char var2; + var = (char)0; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_double_0 + { + public static void Main_old() + { + double var; + double var2; + var = 1.7e308d; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_double_1 + { + public static void Main_old() + { + double var; + double var2; + var = -1.7e308d; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_float_0 + { + public static void Main_old() + { + float var; + float var2; + var = 3.4e38F; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_float_1 + { + public static void Main_old() + { + float var; + float var2; + var = -3.4e38F; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_int_0 + { + public static void Main_old() + { + int var; + int var2; + var = 2147483647; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_int_1 + { + public static void Main_old() + { + int var; + int var2; + var = -2147483647; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_int_3 + { + public static void Main_old() + { + int var; + int var2; + var = -2147483648; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_long_0 + { + public static void Main_old() + { + long var; + long var2; + var = 9223372036854775807L; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_long_1 + { + public static void Main_old() + { + long var; + long var2; + var = -9223372036854775807L; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_long_3 + { + public static void Main_old() + { + long var; + long var2; + var = -9223372036854775808L; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_short_0 + { + public static void Main_old() + { + short var; + short var2; + var = 32767; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + public class Variables_TestClass_S5_range_short_1 + { + public static void Main_old() + { + short var; + short var2; + var = -32767; + var2 = var; + return; + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch + { + return false; + } + return true; + } + } + + } +} diff --git a/Tests/NFUnitTestVariables/nano.runsettings b/Tests/NFUnitTestVariables/nano.runsettings new file mode 100644 index 00000000..fa881e3a --- /dev/null +++ b/Tests/NFUnitTestVariables/nano.runsettings @@ -0,0 +1,14 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + False + + \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/packages.config b/Tests/NFUnitTestVariables/packages.config new file mode 100644 index 00000000..1adb9284 --- /dev/null +++ b/Tests/NFUnitTestVariables/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 426e973f..57413be1 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -19,6 +19,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{0BAE286A EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestBitConverter", "Tests\NFUnitTestCoreLibrary\NFUnitTestBitConverter.nfproj", "{8D47514F-552C-4862-961F-0CAA315A231F}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestVariables", "Tests\NFUnitTestVariables\NFUnitTestVariables.nfproj", "{6D93536D-2CFC-4BB8-B490-080EB11D40DD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -39,12 +41,19 @@ Global {8D47514F-552C-4862-961F-0CAA315A231F}.Release|Any CPU.ActiveCfg = Release|Any CPU {8D47514F-552C-4862-961F-0CAA315A231F}.Release|Any CPU.Build.0 = Release|Any CPU {8D47514F-552C-4862-961F-0CAA315A231F}.Release|Any CPU.Deploy.0 = Release|Any CPU + {6D93536D-2CFC-4BB8-B490-080EB11D40DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6D93536D-2CFC-4BB8-B490-080EB11D40DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6D93536D-2CFC-4BB8-B490-080EB11D40DD}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {6D93536D-2CFC-4BB8-B490-080EB11D40DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6D93536D-2CFC-4BB8-B490-080EB11D40DD}.Release|Any CPU.Build.0 = Release|Any CPU + {6D93536D-2CFC-4BB8-B490-080EB11D40DD}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection GlobalSection(NestedProjects) = preSolution {8D47514F-552C-4862-961F-0CAA315A231F} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {6D93536D-2CFC-4BB8-B490-080EB11D40DD} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From a3f311b2133ee6d3801855301e78af3c87a5f2a7 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Sun, 28 Feb 2021 12:04:47 +0300 Subject: [PATCH 20/55] Adding all type tests --- Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj | 65 + .../Properties/AssemblyInfo.cs | 33 + .../UnitTestValueArrayTypess.cs | 205 ++ .../UnitTestValueDefultConstTests.cs | 251 +++ .../UnitTestValueFloatTests.cs | 843 ++++++++ .../UnitTestValueIntegralTests.cs | 1728 +++++++++++++++++ .../UnitTestValueSimpleTests.cs | 220 +++ Tests/NFUnitTestTypes/UnitTestValueTests.cs | 78 + Tests/NFUnitTestTypes/nano.runsettings | 14 + Tests/NFUnitTestTypes/packages.config | 5 + nanoFramework.CoreLibrary.sln | 9 + 11 files changed, 3451 insertions(+) create mode 100644 Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj create mode 100644 Tests/NFUnitTestTypes/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestTypes/UnitTestValueArrayTypess.cs create mode 100644 Tests/NFUnitTestTypes/UnitTestValueDefultConstTests.cs create mode 100644 Tests/NFUnitTestTypes/UnitTestValueFloatTests.cs create mode 100644 Tests/NFUnitTestTypes/UnitTestValueIntegralTests.cs create mode 100644 Tests/NFUnitTestTypes/UnitTestValueSimpleTests.cs create mode 100644 Tests/NFUnitTestTypes/UnitTestValueTests.cs create mode 100644 Tests/NFUnitTestTypes/nano.runsettings create mode 100644 Tests/NFUnitTestTypes/packages.config diff --git a/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj b/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj new file mode 100644 index 00000000..15b2b7ac --- /dev/null +++ b/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj @@ -0,0 +1,65 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 05b18d3a-f70d-4104-8f78-fdc577e11081 + Library + Properties + 512 + NFUnitTestTypes + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/Properties/AssemblyInfo.cs b/Tests/NFUnitTestTypes/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestTypes/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestTypes/UnitTestValueArrayTypess.cs b/Tests/NFUnitTestTypes/UnitTestValueArrayTypess.cs new file mode 100644 index 00000000..2cf60455 --- /dev/null +++ b/Tests/NFUnitTestTypes/UnitTestValueArrayTypess.cs @@ -0,0 +1,205 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestTypes +{ + [TestClass] + public class ValueArrayTypes + { + [TestMethod] + public void ValueArray01_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" byte is an alias for System.Byte"); + ValueArrayTestClass01.testMethod(); + } + + [TestMethod] + public void ValueArray02_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" char is an alias for System.Char"); + ValueArrayTestClass02.testMethod(); + } + + [TestMethod] + public void ValueArray03_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" short is an alias for System.Int16"); + ValueArrayTestClass03.testMethod(); + } + + [TestMethod] + public void ValueArray04_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" int is an alias for System.Int32"); + ValueArrayTestClass04.testMethod(); + } + + [TestMethod] + public void ValueArray05_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" long is an alias for System.Int64"); + ValueArrayTestClass05.testMethod(); + } + + [TestMethod] + public void ValueArray06_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" float is an alias for System.Single"); + ValueArrayTestClass06.testMethod(); + } + + [TestMethod] + public void ValueArray07_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" double is an alias for System.Double"); + ValueArrayTestClass07.testMethod(); + } + [TestMethod] + public void ValueArray09_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" bool is an alias for System.Boolean"); + ValueArrayTestClass09.testMethod(); + } + + [TestMethod] + public void ValueArray12_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" Because a simple type aliases a struct type, every simple type has members."); + Debug.WriteLine("This test is expected to fail"); + ValueArrayTestClass12.testMethod(); + } + + [TestMethod] + public void ValueArray13_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" sbyte is an alias for System.SByte"); + ValueArrayTestClass13.testMethod(); + } + + [TestMethod] + public void ValueArray14_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" ushort is an alias for System.UInt16"); + ValueArrayTestClass14.testMethod(); + } + [TestMethod] + public void ValueArray15_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" uint is an alias for System.UInt32"); + ValueArrayTestClass15.testMethod(); + } + + + //Compiled Test Cases + public class ValueArrayTestClass01 + { + public static void testMethod() + { + byte[] b = { 0 }; + Assert.IsType(b.GetType(), Type.GetType("System.Byte[]")); + } + } + public class ValueArrayTestClass02 + { + public static void testMethod() + { + char[] c = { 'a' }; + Assert.IsType(c.GetType(), Type.GetType("System.Char[]")); + } + } + public class ValueArrayTestClass03 + { + public static void testMethod() + { + short[] s = { 0 }; + Assert.IsType(s.GetType(), Type.GetType("System.Int16[]")); + } + } + public class ValueArrayTestClass04 + { + public static void testMethod() + { + int[] i = { 0 }; + Assert.IsType(i.GetType(), Type.GetType("System.Int32[]")); + } + } + public class ValueArrayTestClass05 + { + public static void testMethod() + { + long[] l = { 0L }; + Assert.IsType(l.GetType(), Type.GetType("System.Int64[]")); + } + } + public class ValueArrayTestClass06 + { + public static void testMethod() + { + float[] f = { 0.0f }; + Assert.IsType(f.GetType(), Type.GetType("System.Single[]")); + } + } + public class ValueArrayTestClass07 + { + public static void testMethod() + { + double[] d = { 0.0d }; + Assert.IsType(d.GetType(), Type.GetType("System.Double[]")); + } + } + public class ValueArrayTestClass09 + { + public static void testMethod() + { + bool[] b = { true }; + Assert.IsType(b.GetType(), Type.GetType("System.Boolean[]")); + } + } + + public class ValueArrayTestClass12 + { + public static void testMethod() + { + string[] b = { "string" }; + Assert.IsType(b.GetType(), Type.GetType("System.String[]")); + } + } + public class ValueArrayTestClass13 + { + public static void testMethod() + { + sbyte[] b = { 0 }; + Assert.IsType(b.GetType(), Type.GetType("System.SByte[]")); + } + } + public class ValueArrayTestClass14 + { + public static void testMethod() + { + ushort[] s = { 0 }; + Assert.IsType(s.GetType(), Type.GetType("System.UInt16[]")); + } + } + public class ValueArrayTestClass15 + { + public static void testMethod() + { + uint[] i = { 0 }; + Assert.IsType(i.GetType(), Type.GetType("System.UInt32[]")); + } + } + } +} diff --git a/Tests/NFUnitTestTypes/UnitTestValueDefultConstTests.cs b/Tests/NFUnitTestTypes/UnitTestValueDefultConstTests.cs new file mode 100644 index 00000000..c628b2de --- /dev/null +++ b/Tests/NFUnitTestTypes/UnitTestValueDefultConstTests.cs @@ -0,0 +1,251 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestTypes +{ + [TestClass] + class UnitTestValueDefultConstTests + { + [TestMethod] + public void ValueDefault_Const01_Test() + { + Debug.WriteLine("Testing byte == 0"); + ValueDefault_ConstTestClass01.testMethod(); + } + + [TestMethod] + public void ValueDefault_Const02_Test() + { + Debug.WriteLine("Testing short == 0"); + ValueDefault_ConstTestClass02.testMethod(); + } + + [TestMethod] + public void ValueDefault_Const03_Test() + { + Debug.WriteLine("Testing int == 0"); + ValueDefault_ConstTestClass03.testMethod(); + } + + [TestMethod] + public void ValueDefault_Const04_Test() + { + Debug.WriteLine("Testing long == 0L"); + ValueDefault_ConstTestClass04.testMethod(); + } + + [TestMethod] + public void ValueDefault_Const05_Test() + { + Debug.WriteLine("Testing char == \x0000"); + ValueDefault_ConstTestClass05.testMethod(); + } + + [TestMethod] + public void ValueDefault_Const06_Test() + { + Debug.WriteLine("Testing float == 0.0f"); + ValueDefault_ConstTestClass06.testMethod(); + } + + [TestMethod] + public void ValueDefault_Const07_Test() + { + Debug.WriteLine("Testing double == 0.0d"); + ValueDefault_ConstTestClass07.testMethod(); + } + + [TestMethod] + public void ValueDefault_Const09_Test() + { + Debug.WriteLine("Testing bool == false"); + ValueDefault_ConstTestClass09.testMethod(); + } + + [TestMethod] + public void ValueDefault_Const11_Test() + { + Debug.WriteLine("Testing enum"); + ValueDefault_ConstTestClass11.testMethod(); + } + + [TestMethod] + public void ValueDefault_Const12_Test() + { + Debug.WriteLine("Testing struct"); + ValueDefault_ConstTestClass12.testMethod(); + } + + [TestMethod] + public void ValueDefault_Const14_Test() + { + Debug.WriteLine("Testing sbyte == 0"); + ValueDefault_ConstTestClass14.testMethod(); + } + + [TestMethod] + public void ValueDefault_Const15_Test() + { + Debug.WriteLine("Testing ushort == 0"); + ValueDefault_ConstTestClass15.testMethod(); + } + + [TestMethod] + public void ValueDefault_Const16_Test() + { + Debug.WriteLine("Testing uint == 0"); + ValueDefault_ConstTestClass16.testMethod(); + } + + [TestMethod] + public void ValueDefault_Const17_Test() + { + Debug.WriteLine("Testing ulong == 0"); + ValueDefault_ConstTestClass17.testMethod(); + } + + //Compiled Test Cases + public class ValueDefault_ConstTestClass01 + { + public static void testMethod() + { + byte b = new byte(); + Assert.Equal(b, (byte)0); + } + } + + public class ValueDefault_ConstTestClass02 + { + public static void testMethod() + { + short s = new short(); + Assert.Equal(s, (short)0); + } + } + + public class ValueDefault_ConstTestClass03 + { + public static void testMethod() + { + int i = new int(); + Assert.Equal(i, 0); + } + } + + public class ValueDefault_ConstTestClass04 + { + public static void testMethod() + { + long l = new long(); + Assert.Equal(l, 0L); + } + } + + public class ValueDefault_ConstTestClass05 + { + public static void testMethod() + { + char c = new char(); + Assert.Equal(c, '\x0000'); + } + } + + public class ValueDefault_ConstTestClass06 + { + public static void testMethod() + { + float f = new float(); + Assert.Equal(f, 0.0f); + } + } + + public class ValueDefault_ConstTestClass07 + { + public static void testMethod() + { + double d = new double(); + Assert.Equal(d, 0.0d); + } + } + + public class ValueDefault_ConstTestClass09 + { + public static void testMethod() + { + bool b = new bool(); + Assert.Equal(b, false); + } + } + + enum E { a = 1, b = 2 }; + public class ValueDefault_ConstTestClass11 + { + public static void testMethod() + { + E e = new E(); + if (e != ((E)0)) + { + throw new Exception("Enums are not equal"); + } + } + } + + struct MyStruct + { + public int I; + public Object MyObj; + } + + public class ValueDefault_ConstTestClass12 + { + public static void testMethod() + { + MyStruct TC = new MyStruct(); + if ((TC.I == 0) && (TC.MyObj == null)) + { + return; + } + + throw new Exception("Elements not equal"); + } + } + + public class ValueDefault_ConstTestClass14 + { + public static void testMethod() + { + sbyte b = new sbyte(); + Assert.Equal(b, (sbyte)0); + } + } + + public class ValueDefault_ConstTestClass15 + { + public static void testMethod() + { + ushort b = new ushort(); + Assert.Equal(b, (ushort)0); + } + } + + public class ValueDefault_ConstTestClass16 + { + public static void testMethod() + { + uint b = new uint(); + Assert.Equal(b , (uint)0) ; + } + } + + public class ValueDefault_ConstTestClass17 + { + public static void testMethod() + { + ulong b = new ulong(); + Assert.Equal(b, (ulong)0); + } + } + + } +} diff --git a/Tests/NFUnitTestTypes/UnitTestValueFloatTests.cs b/Tests/NFUnitTestTypes/UnitTestValueFloatTests.cs new file mode 100644 index 00000000..b24fc14b --- /dev/null +++ b/Tests/NFUnitTestTypes/UnitTestValueFloatTests.cs @@ -0,0 +1,843 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestTypes +{ + [TestClass] + class UnitTestValueFloatTests + { + [TestMethod] + public void ValueFloat04_Test() + { + Debug.WriteLine("Testing float type is kept after addition with other types"); + ValueFloatTestClass04.testMethod(); + } + + [TestMethod] + public void ValueFloat05_Test() + { + Debug.WriteLine("Testing double type is kept after addition with other types"); + ValueFloatTestClass05.testMethod(); + } + + [TestMethod] + public void ValueFloat06_Test() + { + Debug.WriteLine("Testing float type is kept after subtraction with other types"); + ValueFloatTestClass06.testMethod(); + } + + [TestMethod] + public void ValueFloat07_Test() + { + Debug.WriteLine("Testing double type is kept after subtraction with other types"); + ValueFloatTestClass07.testMethod(); + } + + [TestMethod] + public void ValueFloat08_Test() + { + Debug.WriteLine("Testing float type is kept after multiplication with other types"); + ValueFloatTestClass08.testMethod(); + } + + [TestMethod] + public void ValueFloat09_Test() + { + Debug.WriteLine("Testing double type is kept after maultiplication with other types"); + ValueFloatTestClass09.testMethod(); + } + + [TestMethod] + public void ValueFloat10_Test() + { + Debug.WriteLine("Testing float type is kept after division with other types"); + ValueFloatTestClass10.testMethod(); + } + + [TestMethod] + public void ValueFloat11_Test() + { + Debug.WriteLine("Testing double type is kept after division with other types"); + ValueFloatTestClass11.testMethod(); + } + + [TestMethod] + public void ValueFloat12_Test() + { + Debug.WriteLine("Testing float type is kept after modulus with other types"); + ValueFloatTestClass12.testMethod(); + } + + [TestMethod] + public void ValueFloat13_Test() + { + Debug.WriteLine("Testing double type is kept after modulus with other types"); + ValueFloatTestClass13.testMethod(); + } + + [TestMethod] + public void ValueFloat14_Test() + { + Debug.WriteLine("Testing that equality operations return bool type objects"); + ValueFloatTestClass14.testMethod(); + } + + [TestMethod] + public void ValueFloat15_Test() + { + Debug.WriteLine("Testing that equality operations return bool type objects"); + ValueFloatTestClass15.testMethod(); + } + + [TestMethod] + public void ValueFloat16_Test() + { + Debug.WriteLine("Testing that non-equality operations return bool type objects"); + ValueFloatTestClass16.testMethod(); + } + + [TestMethod] + public void ValueFloat17_Test() + { + Debug.WriteLine("Testing that non-equality operations return bool type objects"); + ValueFloatTestClass17.testMethod(); + } + + [TestMethod] + public void ValueFloat18_Test() + { + Debug.WriteLine("Testing that greater than operations return bool type objects"); + ValueFloatTestClass18.testMethod(); + } + + [TestMethod] + public void ValueFloat19_Test() + { + Debug.WriteLine("Testing that greater than operations return bool type objects"); + ValueFloatTestClass19.testMethod(); + } + + [TestMethod] + public void ValueFloat20_Test() + { + Debug.WriteLine("Testing that less than operations return bool type objects"); + ValueFloatTestClass20.testMethod(); + } + + [TestMethod] + public void ValueFloat21_Test() + { + Debug.WriteLine("Testing that less than operations return bool type objects"); + ValueFloatTestClass21.testMethod(); + } + + [TestMethod] + public void ValueFloat22_Test() + { + Debug.WriteLine("Testing that greater than or equal operations return bool type objects"); + ValueFloatTestClass22.testMethod(); + } + + [TestMethod] + public void ValueFloat23_Test() + { + Debug.WriteLine("Testing that greater than or equal operations return bool type objects"); + ValueFloatTestClass23.testMethod(); + } + + [TestMethod] + public void ValueFloat24_Test() + { + Debug.WriteLine("Testing that less than or equal operations return bool type objects"); + ValueFloatTestClass24.testMethod(); + } + + [TestMethod] + public void ValueFloat25_Test() + { + Debug.WriteLine("Testing that less than or equal operations return bool type objects"); + ValueFloatTestClass25.testMethod(); + } + + [TestMethod] + public void ValueFloat26_Test() + { + Debug.WriteLine("Testing that double keeps its type in all operations with float"); + ValueFloatTestClass26.testMethod(); + } + + [TestMethod] + public void ValueFloat27_Test() + { + Debug.WriteLine("Testing that comparisons between floats and doubles return bools"); + ValueFloatTestClass27.testMethod(); + } + + [TestMethod] + public void ValueFloat28_Test() + { + Debug.WriteLine("Testing that float keeps its type after any operation with a float"); + ValueFloatTestClass28.testMethod(); + } + + [TestMethod] + public void ValueFloat29_Test() + { + Debug.WriteLine("Testing that comparisons between floats return bools"); + ValueFloatTestClass29.testMethod(); + } + + [TestMethod] + public void ValueFloat30_Test() + { + Debug.WriteLine("Testing float and double .epsilon values"); + ValueFloatTestClass30.testMethod(); + } + + public class ValueFloatTestClass04 + { + public static void testMethod() + { + int intRet = 0; + float f1 = 11.0f; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((f1 + s1).GetType(), f1.GetType()); + Assert.IsType((s1 + f1).GetType(), f1.GetType()); + Assert.IsType((f1 + b1).GetType(), f1.GetType()); + Assert.IsType((b1 + f1).GetType(), f1.GetType()); + Assert.IsType((f1 + i1).GetType(), f1.GetType()); + Assert.IsType((i1 + f1).GetType(), f1.GetType()); + Assert.IsType((f1 + l1).GetType(), f1.GetType()); + Assert.IsType((l1 + f1).GetType(), f1.GetType()); + Assert.IsType((f1 + c1).GetType(), f1.GetType()); + Assert.IsType((c1 + f1).GetType(), f1.GetType()); + } + } + public class ValueFloatTestClass05 + { + public static void testMethod() + { + int intRet = 0; + double d1 = 11.0d; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((d1 + s1).GetType(), d1.GetType()); + Assert.IsType((s1 + d1).GetType(), d1.GetType()); + Assert.IsType((d1 + b1).GetType(), d1.GetType()); + Assert.IsType((b1 + d1).GetType(), d1.GetType()); + Assert.IsType((d1 + i1).GetType(), d1.GetType()); + Assert.IsType((i1 + d1).GetType(), d1.GetType()); + Assert.IsType((d1 + l1).GetType(), d1.GetType()); + Assert.IsType((l1 + d1).GetType(), d1.GetType()); + Assert.IsType((d1 + c1).GetType(), d1.GetType()); + Assert.IsType((c1 + d1).GetType(), d1.GetType()); + } + } + public class ValueFloatTestClass06 + { + public static void testMethod() + { + int intRet = 0; + float f1 = 11.0f; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((f1 - s1).GetType(), f1.GetType()); + Assert.IsType((s1 - f1).GetType(), f1.GetType()); + Assert.IsType((f1 - b1).GetType(), f1.GetType()); + Assert.IsType((b1 - f1).GetType(), f1.GetType()); + Assert.IsType((f1 - i1).GetType(), f1.GetType()); + Assert.IsType((i1 - f1).GetType(), f1.GetType()); + Assert.IsType((f1 - l1).GetType(), f1.GetType()); + Assert.IsType((l1 - f1).GetType(), f1.GetType()); + Assert.IsType((f1 - c1).GetType(), f1.GetType()); + Assert.IsType((c1 - f1).GetType(), f1.GetType()); + } + } + public class ValueFloatTestClass07 + { + public static void testMethod() + { + int intRet = 0; + double d1 = 11.0d; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((d1 - s1).GetType(), d1.GetType()); + Assert.IsType((s1 - d1).GetType(), d1.GetType()); + Assert.IsType((d1 - b1).GetType(), d1.GetType()); + Assert.IsType((b1 - d1).GetType(), d1.GetType()); + Assert.IsType((d1 - i1).GetType(), d1.GetType()); + Assert.IsType((i1 - d1).GetType(), d1.GetType()); + Assert.IsType((d1 - l1).GetType(), d1.GetType()); + Assert.IsType((l1 - d1).GetType(), d1.GetType()); + Assert.IsType((d1 - c1).GetType(), d1.GetType()); + Assert.IsType((c1 - d1).GetType(), d1.GetType()); + } + } + public class ValueFloatTestClass08 + { + public static void testMethod() + { + int intRet = 0; + float f1 = 11.0f; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((f1 * s1).GetType(), f1.GetType()); + Assert.IsType((s1 * f1).GetType(), f1.GetType()); + Assert.IsType((f1 * b1).GetType(), f1.GetType()); + Assert.IsType((b1 * f1).GetType(), f1.GetType()); + Assert.IsType((f1 * i1).GetType(), f1.GetType()); + Assert.IsType((i1 * f1).GetType(), f1.GetType()); + Assert.IsType((f1 * l1).GetType(), f1.GetType()); + Assert.IsType((l1 * f1).GetType(), f1.GetType()); + Assert.IsType((f1 * c1).GetType(), f1.GetType()); + Assert.IsType((c1 * f1).GetType(), f1.GetType()); + } + } + public class ValueFloatTestClass09 + { + public static void testMethod() + { + int intRet = 0; + double d1 = 11.0d; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((d1 * s1).GetType(), d1.GetType()); + Assert.IsType((s1 * d1).GetType(), d1.GetType()); + Assert.IsType((d1 * b1).GetType(), d1.GetType()); + Assert.IsType((b1 * d1).GetType(), d1.GetType()); + Assert.IsType((d1 * i1).GetType(), d1.GetType()); + Assert.IsType((i1 * d1).GetType(), d1.GetType()); + Assert.IsType((d1 * l1).GetType(), d1.GetType()); + Assert.IsType((l1 * d1).GetType(), d1.GetType()); + Assert.IsType((d1 * c1).GetType(), d1.GetType()); + Assert.IsType((c1 * d1).GetType(), d1.GetType()); + } + } + public class ValueFloatTestClass10 + { + public static void testMethod() + { + int intRet = 0; + float f1 = 11.0f; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((f1 / s1).GetType(), f1.GetType()); + Assert.IsType((s1 / f1).GetType(), f1.GetType()); + Assert.IsType((f1 / b1).GetType(), f1.GetType()); + Assert.IsType((b1 / f1).GetType(), f1.GetType()); + Assert.IsType((f1 / i1).GetType(), f1.GetType()); + Assert.IsType((i1 / f1).GetType(), f1.GetType()); + Assert.IsType((f1 / l1).GetType(), f1.GetType()); + Assert.IsType((l1 / f1).GetType(), f1.GetType()); + Assert.IsType((f1 / c1).GetType(), f1.GetType()); + Assert.IsType((c1 / f1).GetType(), f1.GetType()); + } + } + public class ValueFloatTestClass11 + { + public static void testMethod() + { + int intRet = 0; + double d1 = 11.0d; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((d1 / s1).GetType(), d1.GetType()); + Assert.IsType((s1 / d1).GetType(), d1.GetType()); + Assert.IsType((d1 / b1).GetType(), d1.GetType()); + Assert.IsType((b1 / d1).GetType(), d1.GetType()); + Assert.IsType((d1 / i1).GetType(), d1.GetType()); + Assert.IsType((i1 / d1).GetType(), d1.GetType()); + Assert.IsType((d1 / l1).GetType(), d1.GetType()); + Assert.IsType((l1 / d1).GetType(), d1.GetType()); + Assert.IsType((d1 / c1).GetType(), d1.GetType()); + Assert.IsType((c1 / d1).GetType(), d1.GetType()); + } + } + public class ValueFloatTestClass12 + { + public static void testMethod() + { + int intRet = 0; + float f1 = 11.0f; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((f1 % s1).GetType(), f1.GetType()); + Assert.IsType((s1 % f1).GetType(), f1.GetType()); + Assert.IsType((f1 % b1).GetType(), f1.GetType()); + Assert.IsType((b1 % f1).GetType(), f1.GetType()); + Assert.IsType((f1 % i1).GetType(), f1.GetType()); + Assert.IsType((i1 % f1).GetType(), f1.GetType()); + Assert.IsType((f1 % l1).GetType(), f1.GetType()); + Assert.IsType((l1 % f1).GetType(), f1.GetType()); + Assert.IsType((f1 % c1).GetType(), f1.GetType()); + Assert.IsType((c1 % f1).GetType(), f1.GetType()); + } + } + public class ValueFloatTestClass13 + { + public static void testMethod() + { + int intRet = 0; + double d1 = 11.0d; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((d1 % s1).GetType(), d1.GetType()); + Assert.IsType((s1 % d1).GetType(), d1.GetType()); + Assert.IsType((d1 % b1).GetType(), d1.GetType()); + Assert.IsType((b1 % d1).GetType(), d1.GetType()); + Assert.IsType((d1 % i1).GetType(), d1.GetType()); + Assert.IsType((i1 % d1).GetType(), d1.GetType()); + Assert.IsType((d1 % l1).GetType(), d1.GetType()); + Assert.IsType((l1 % d1).GetType(), d1.GetType()); + Assert.IsType((d1 % c1).GetType(), d1.GetType()); + Assert.IsType((c1 % d1).GetType(), d1.GetType()); + } + } + public class ValueFloatTestClass14 + { + public static void testMethod() + { + int intRet = 0; + bool b = true; + float f1 = 11.0f; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((f1 == s1).GetType(), b.GetType()); + Assert.IsType((s1 == f1).GetType(), b.GetType()); + Assert.IsType((f1 == b1).GetType(), b.GetType()); + Assert.IsType((b1 == f1).GetType(), b.GetType()); + Assert.IsType((f1 == i1).GetType(), b.GetType()); + Assert.IsType((i1 == f1).GetType(), b.GetType()); + Assert.IsType((f1 == l1).GetType(), b.GetType()); + Assert.IsType((l1 == f1).GetType(), b.GetType()); + Assert.IsType((f1 == c1).GetType(), b.GetType()); + Assert.IsType((c1 == f1).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass15 + { + public static void testMethod() + { + int intRet = 0; + + bool b = false; + double d1 = 11.0d; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((d1 == s1).GetType(), b.GetType()); + Assert.IsType((s1 == d1).GetType(), b.GetType()); + Assert.IsType((d1 == b1).GetType(), b.GetType()); + Assert.IsType((b1 == d1).GetType(), b.GetType()); + Assert.IsType((d1 == i1).GetType(), b.GetType()); + Assert.IsType((i1 == d1).GetType(), b.GetType()); + Assert.IsType((d1 == l1).GetType(), b.GetType()); + Assert.IsType((l1 == d1).GetType(), b.GetType()); + Assert.IsType((d1 == c1).GetType(), b.GetType()); + Assert.IsType((c1 == d1).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass16 + { + public static void testMethod() + { + int intRet = 0; + bool b = true; + float f1 = 11.0f; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((f1 != s1).GetType(), b.GetType()); + Assert.IsType((s1 != f1).GetType(), b.GetType()); + Assert.IsType((f1 != b1).GetType(), b.GetType()); + Assert.IsType((b1 != f1).GetType(), b.GetType()); + Assert.IsType((f1 != i1).GetType(), b.GetType()); + Assert.IsType((i1 != f1).GetType(), b.GetType()); + Assert.IsType((f1 != l1).GetType(), b.GetType()); + Assert.IsType((l1 != f1).GetType(), b.GetType()); + Assert.IsType((f1 != c1).GetType(), b.GetType()); + Assert.IsType((c1 != f1).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass17 + { + public static void testMethod() + { + int intRet = 0; + + bool b = false; + double d1 = 11.0d; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((d1 != s1).GetType(), b.GetType()); + Assert.IsType((s1 != d1).GetType(), b.GetType()); + Assert.IsType((d1 != b1).GetType(), b.GetType()); + Assert.IsType((b1 != d1).GetType(), b.GetType()); + Assert.IsType((d1 != i1).GetType(), b.GetType()); + Assert.IsType((i1 != d1).GetType(), b.GetType()); + Assert.IsType((d1 != l1).GetType(), b.GetType()); + Assert.IsType((l1 != d1).GetType(), b.GetType()); + Assert.IsType((d1 != c1).GetType(), b.GetType()); + Assert.IsType((c1 != d1).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass18 + { + public static void testMethod() + { + int intRet = 0; + bool b = true; + float f1 = 11.0f; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((f1 > s1).GetType(), b.GetType()); + Assert.IsType((s1 > f1).GetType(), b.GetType()); + Assert.IsType((f1 > b1).GetType(), b.GetType()); + Assert.IsType((b1 > f1).GetType(), b.GetType()); + Assert.IsType((f1 > i1).GetType(), b.GetType()); + Assert.IsType((i1 > f1).GetType(), b.GetType()); + Assert.IsType((f1 > l1).GetType(), b.GetType()); + Assert.IsType((l1 > f1).GetType(), b.GetType()); + Assert.IsType((f1 > c1).GetType(), b.GetType()); + Assert.IsType((c1 > f1).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass19 + { + public static void testMethod() + { + int intRet = 0; + + bool b = false; + double d1 = 11.0d; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((d1 > s1).GetType(), b.GetType()); + Assert.IsType((s1 > d1).GetType(), b.GetType()); + Assert.IsType((d1 > b1).GetType(), b.GetType()); + Assert.IsType((b1 > d1).GetType(), b.GetType()); + Assert.IsType((d1 > i1).GetType(), b.GetType()); + Assert.IsType((i1 > d1).GetType(), b.GetType()); + Assert.IsType((d1 > l1).GetType(), b.GetType()); + Assert.IsType((l1 > d1).GetType(), b.GetType()); + Assert.IsType((d1 > c1).GetType(), b.GetType()); + Assert.IsType((c1 > d1).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass20 + { + public static void testMethod() + { + int intRet = 0; + bool b = true; + float f1 = 11.0f; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((f1 < s1).GetType(), b.GetType()); + Assert.IsType((s1 < f1).GetType(), b.GetType()); + Assert.IsType((f1 < b1).GetType(), b.GetType()); + Assert.IsType((b1 < f1).GetType(), b.GetType()); + Assert.IsType((f1 < i1).GetType(), b.GetType()); + Assert.IsType((i1 < f1).GetType(), b.GetType()); + Assert.IsType((f1 < l1).GetType(), b.GetType()); + Assert.IsType((l1 < f1).GetType(), b.GetType()); + Assert.IsType((f1 < c1).GetType(), b.GetType()); + Assert.IsType((c1 < f1).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass21 + { + public static void testMethod() + { + int intRet = 0; + + bool b = false; + double d1 = 11.0d; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((d1 < s1).GetType(), b.GetType()); + Assert.IsType((s1 < d1).GetType(), b.GetType()); + Assert.IsType((d1 < b1).GetType(), b.GetType()); + Assert.IsType((b1 < d1).GetType(), b.GetType()); + Assert.IsType((d1 < i1).GetType(), b.GetType()); + Assert.IsType((i1 < d1).GetType(), b.GetType()); + Assert.IsType((d1 < l1).GetType(), b.GetType()); + Assert.IsType((l1 < d1).GetType(), b.GetType()); + Assert.IsType((d1 < c1).GetType(), b.GetType()); + Assert.IsType((c1 < d1).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass22 + { + public static void testMethod() + { + int intRet = 0; + bool b = true; + float f1 = 11.0f; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((f1 >= s1).GetType(), b.GetType()); + Assert.IsType((s1 >= f1).GetType(), b.GetType()); + Assert.IsType((f1 >= b1).GetType(), b.GetType()); + Assert.IsType((b1 >= f1).GetType(), b.GetType()); + Assert.IsType((f1 >= i1).GetType(), b.GetType()); + Assert.IsType((i1 >= f1).GetType(), b.GetType()); + Assert.IsType((f1 >= l1).GetType(), b.GetType()); + Assert.IsType((l1 >= f1).GetType(), b.GetType()); + Assert.IsType((f1 >= c1).GetType(), b.GetType()); + Assert.IsType((c1 >= f1).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass23 + { + public static void testMethod() + { + int intRet = 0; + + bool b = false; + double d1 = 11.0d; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((d1 >= s1).GetType(), b.GetType()); + Assert.IsType((s1 >= d1).GetType(), b.GetType()); + Assert.IsType((d1 >= b1).GetType(), b.GetType()); + Assert.IsType((b1 >= d1).GetType(), b.GetType()); + Assert.IsType((d1 >= i1).GetType(), b.GetType()); + Assert.IsType((i1 >= d1).GetType(), b.GetType()); + Assert.IsType((d1 >= l1).GetType(), b.GetType()); + Assert.IsType((l1 >= d1).GetType(), b.GetType()); + Assert.IsType((d1 >= c1).GetType(), b.GetType()); + Assert.IsType((c1 >= d1).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass24 + { + public static void testMethod() + { + int intRet = 0; + bool b = true; + float f1 = 11.0f; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((f1 <= s1).GetType(), b.GetType()); + Assert.IsType((s1 <= f1).GetType(), b.GetType()); + Assert.IsType((f1 <= b1).GetType(), b.GetType()); + Assert.IsType((b1 <= f1).GetType(), b.GetType()); + Assert.IsType((f1 <= i1).GetType(), b.GetType()); + Assert.IsType((i1 <= f1).GetType(), b.GetType()); + Assert.IsType((f1 <= l1).GetType(), b.GetType()); + Assert.IsType((l1 <= f1).GetType(), b.GetType()); + Assert.IsType((f1 <= c1).GetType(), b.GetType()); + Assert.IsType((c1 <= f1).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass25 + { + public static void testMethod() + { + int intRet = 0; + + bool b = false; + double d1 = 11.0d; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + + Assert.IsType((d1 <= s1).GetType(), b.GetType()); + Assert.IsType((s1 <= d1).GetType(), b.GetType()); + Assert.IsType((d1 <= b1).GetType(), b.GetType()); + Assert.IsType((b1 <= d1).GetType(), b.GetType()); + Assert.IsType((d1 <= i1).GetType(), b.GetType()); + Assert.IsType((i1 <= d1).GetType(), b.GetType()); + Assert.IsType((d1 <= l1).GetType(), b.GetType()); + Assert.IsType((l1 <= d1).GetType(), b.GetType()); + Assert.IsType((d1 <= c1).GetType(), b.GetType()); + Assert.IsType((c1 <= d1).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass26 + { + public static void testMethod() + { + int intRet = 0; + double d1 = 11.0d; + float f1 = 12.0f; + + Assert.IsType((d1 + f1).GetType(), d1.GetType()); + Assert.IsType((f1 + d1).GetType(), d1.GetType()); + Assert.IsType((d1 + d1).GetType(), d1.GetType()); + Assert.IsType((d1 - f1).GetType(), d1.GetType()); + Assert.IsType((f1 - d1).GetType(), d1.GetType()); + Assert.IsType((d1 - d1).GetType(), d1.GetType()); + Assert.IsType((d1 * f1).GetType(), d1.GetType()); + Assert.IsType((f1 * d1).GetType(), d1.GetType()); + Assert.IsType((d1 * d1).GetType(), d1.GetType()); + Assert.IsType((d1 / f1).GetType(), d1.GetType()); + Assert.IsType((f1 / d1).GetType(), d1.GetType()); + Assert.IsType((d1 / d1).GetType(), d1.GetType()); + Assert.IsType((d1 % f1).GetType(), d1.GetType()); + Assert.IsType((f1 % d1).GetType(), d1.GetType()); + Assert.IsType((d1 % d1).GetType(), d1.GetType()); + } + } + public class ValueFloatTestClass27 + { + public static void testMethod() + { + int intRet = 0; + double d1 = 11.0d; + float f1 = 12.0f; + bool b = false; + Assert.IsType((d1 == f1).GetType(), b.GetType()); + Assert.IsType((f1 == d1).GetType(), b.GetType()); + Assert.IsType((d1 == d1).GetType(), b.GetType()); + Assert.IsType((d1 != f1).GetType(), b.GetType()); + Assert.IsType((f1 != d1).GetType(), b.GetType()); + Assert.IsType((d1 != d1).GetType(), b.GetType()); + Assert.IsType((d1 > f1).GetType(), b.GetType()); + Assert.IsType((f1 > d1).GetType(), b.GetType()); + Assert.IsType((d1 > d1).GetType(), b.GetType()); + Assert.IsType((d1 < f1).GetType(), b.GetType()); + Assert.IsType((f1 < d1).GetType(), b.GetType()); + Assert.IsType((d1 < d1).GetType(), b.GetType()); + Assert.IsType((d1 >= f1).GetType(), b.GetType()); + Assert.IsType((f1 >= d1).GetType(), b.GetType()); + Assert.IsType((d1 >= d1).GetType(), b.GetType()); + Assert.IsType((d1 <= f1).GetType(), b.GetType()); + Assert.IsType((f1 <= d1).GetType(), b.GetType()); + Assert.IsType((d1 <= d1).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass28 + { + public static void testMethod() + { + int intRet = 0; + float f1 = 11.0f; + float f2 = 12.0f; + + Assert.IsType((f1 + f2).GetType(), f1.GetType()); + Assert.IsType((f1 - f2).GetType(), f1.GetType()); + Assert.IsType((f1 * f2).GetType(), f1.GetType()); + Assert.IsType((f1 / f2).GetType(), f1.GetType()); + Assert.IsType((f1 % f2).GetType(), f1.GetType()); + } + } + public class ValueFloatTestClass29 + { + public static void testMethod() + { + int intRet = 0; + double f1 = 11.0d; + float f2 = 12.0f; + bool b = false; + Assert.IsType((f1 == f2).GetType(), b.GetType()); + Assert.IsType((f1 != f2).GetType(), b.GetType()); + Assert.IsType((f1 > f2).GetType(), b.GetType()); + Assert.IsType((f1 < f2).GetType(), b.GetType()); + Assert.IsType((f1 >= f2).GetType(), b.GetType()); + Assert.IsType((f1 <= f2).GetType(), b.GetType()); + } + } + public class ValueFloatTestClass30 + { + public static void testMethod() + { + float f1 = float.Epsilon; + double d1 = double.Epsilon; + Assert.Equal((float)(f1 / 2.0f), 0.0f); + Assert.Equal((float)(f1 * 0.5f), 0.0f); + Assert.Equal((double)(d1 / 2.0d), (double)0.0d); + Assert.Equal((double)(d1 * 0.5d), (double)0.0d); + } + } + + } +} diff --git a/Tests/NFUnitTestTypes/UnitTestValueIntegralTests.cs b/Tests/NFUnitTestTypes/UnitTestValueIntegralTests.cs new file mode 100644 index 00000000..4f03efdd --- /dev/null +++ b/Tests/NFUnitTestTypes/UnitTestValueIntegralTests.cs @@ -0,0 +1,1728 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestTypes +{ + [TestClass] + class UnitTestValueIntegralTests + { + [TestMethod] + public void ValueIntegral01_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the +, - and ~ unary operators, of the operand is of type long, the"); + Debug.WriteLine(" operation is performed using 64-bit precision, and the type of the result"); + Debug.WriteLine(" is long. Otherwise, the operand is converted to int, and operation is"); + Debug.WriteLine(" performed using 32-bit precision, and the type of the result is int."); + ValueIntegralTestClass01.testMethod(); + } + [TestMethod] + public void ValueIntegral05_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the +, - and ~ unary operators, of the operand is of type long, the"); + Debug.WriteLine(" operation is performed using 64-bit precision, and the type of the result"); + Debug.WriteLine(" is long. Otherwise, the operand is converted to int, and operation is"); + Debug.WriteLine(" performed using 32-bit precision, and the type of the result is int."); + ValueIntegralTestClass05.testMethod(); + } + [TestMethod] + public void ValueIntegral09_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the +, - and ~ unary operators, of the operand is of type long, the"); + Debug.WriteLine(" operation is performed using 64-bit precision, and the type of the result"); + Debug.WriteLine(" is long. Otherwise, the operand is converted to int, and operation is"); + Debug.WriteLine(" performed using 32-bit precision, and the type of the result is int."); + ValueIntegralTestClass09.testMethod(); + } + [TestMethod] + public void ValueIntegral13_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass13.testMethod(); + } + [TestMethod] + public void ValueIntegral14_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass14.testMethod(); + } + [TestMethod] + public void ValueIntegral15_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass15.testMethod(); + } + [TestMethod] + public void ValueIntegral16_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass16.testMethod(); + } + [TestMethod] + public void ValueIntegral17_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass17.testMethod(); + } + [TestMethod] + public void ValueIntegral18_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass18.testMethod(); + } + [TestMethod] + public void ValueIntegral19_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass19.testMethod(); + } + [TestMethod] + public void ValueIntegral20_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass20.testMethod(); + } + [TestMethod] + public void ValueIntegral21_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass21.testMethod(); + } + [TestMethod] + public void ValueIntegral22_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass22.testMethod(); + } + [TestMethod] + public void ValueIntegral23_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass23.testMethod(); + } + [TestMethod] + public void ValueIntegral24_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass24.testMethod(); + } + [TestMethod] + public void ValueIntegral25_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass25.testMethod(); + } + [TestMethod] + public void ValueIntegral26_Test() + { + Debug.WriteLine(" For the binary operators other than shift, if at least one"); + Debug.WriteLine(" operand is of type long, then both operands are converted to long, the operation"); + Debug.WriteLine(" is performed using 64-bit precision, and the type of the result is long or bool. "); + Debug.WriteLine(" Otherwise, both operands are converted to int, the operation is performed using "); + Debug.WriteLine(" 32-bit precision, and the type of the result is int or bool."); + ValueIntegralTestClass26.testMethod(); + } + [TestMethod] + public void ValueIntegral27_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the shift operators, if the left-hand operand is of type long,"); + Debug.WriteLine(" the operation is performed using 64-bit precision, and the type of the result"); + Debug.WriteLine(" is long. Otherwise, the left hand-operand is converted to int, the operation is "); + Debug.WriteLine(" performed using 32-bit precision, and the type of the result is int."); + ValueIntegralTestClass27.testMethod(); + } + [TestMethod] + public void ValueIntegral28_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the shift operators, if the left-hand operand is of type long,"); + Debug.WriteLine(" the operation is performed using 64-bit precision, and the type of the result"); + Debug.WriteLine(" is long. Otherwise, the left hand-operand is converted to int, the operation is "); + Debug.WriteLine(" performed using 32-bit precision, and the type of the result is int."); + ValueIntegralTestClass28.testMethod(); + } + [TestMethod] + public void ValueIntegral38_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" Constants of the char type must be written as character-literals."); + Debug.WriteLine(" Character constants can only be written as integer-literals"); + Debug.WriteLine(" in combination with a cast. For example, (char)10 is the same as"); + Debug.WriteLine(" '\x000A'."); + ValueIntegralTestClass38.testMethod(); + } + [TestMethod] + public void ValueIntegral39_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the unary + and ~ operators, the operand is converted"); + Debug.WriteLine(" to type T, where T is the first of int, uint, long, and"); + Debug.WriteLine(" ulong that can fully represent all possible values of the"); + Debug.WriteLine(" operand. The operation is then performed using the precision "); + Debug.WriteLine(" of type T, and the type of the result is T."); + ValueIntegralTestClass39.testMethod(); + } + [TestMethod] + public void ValueIntegral42_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the unary + and ~ operators, the operand is converted"); + Debug.WriteLine(" to type T, where T is the first of int, uint, long, and"); + Debug.WriteLine(" ulong that can fully represent all possible values of the"); + Debug.WriteLine(" operand. The operation is then performed using the precision "); + Debug.WriteLine(" of type T, and the type of the result is T."); + ValueIntegralTestClass42.testMethod(); + } + [TestMethod] + public void ValueIntegral45_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the unary - operator, the operand is converted"); + Debug.WriteLine(" to type T, where T is the first of int and long that "); + Debug.WriteLine(" can fully represent all possible values of the "); + Debug.WriteLine(" operand. The operation is then performed using the"); + Debug.WriteLine(" precision of type T, and the type of the result is T."); + Debug.WriteLine(" The unary - operator cannot be applied to operands of"); + Debug.WriteLine(" type ulong."); + ValueIntegralTestClass45.testMethod(); + } + [TestMethod] + public void ValueIntegral49_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass49.testMethod(); + } + [TestMethod] + public void ValueIntegral50_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass50.testMethod(); + } + [TestMethod] + public void ValueIntegral51_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass51.testMethod(); + } + [TestMethod] + public void ValueIntegral52_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass52.testMethod(); + } + [TestMethod] + public void ValueIntegral53_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass53.testMethod(); + } + [TestMethod] + public void ValueIntegral54_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass54.testMethod(); + } + [TestMethod] + public void ValueIntegral55_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass55.testMethod(); + } + [TestMethod] + public void ValueIntegral56_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass56.testMethod(); + } + [TestMethod] + public void ValueIntegral57_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass57.testMethod(); + } + [TestMethod] + public void ValueIntegral58_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass58.testMethod(); + } + [TestMethod] + public void ValueIntegral59_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass59.testMethod(); + } + [TestMethod] + public void ValueIntegral60_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass60.testMethod(); + } + [TestMethod] + public void ValueIntegral61_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass61.testMethod(); + } + [TestMethod] + public void ValueIntegral62_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary operators except shift, the operands"); + Debug.WriteLine(" are converted to type T, where T is the first of int, uint, long, and ulong"); + Debug.WriteLine(" that can fully represent all possible values of each operand. The operation"); + Debug.WriteLine(" is then performed using the precision of type T, and the type of the result"); + Debug.WriteLine(" is T (or bool for relational operators)."); + ValueIntegralTestClass62.testMethod(); + } + [TestMethod] + public void ValueIntegral63_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary shift operators, the left operand"); + Debug.WriteLine(" is converted to type T, where T is the first of int,"); + Debug.WriteLine(" uint, long, and ulong that can fully represent all possible"); + Debug.WriteLine(" values of the operand. The operation is then performed"); + Debug.WriteLine(" using the precision of type T, and the type of the result"); + Debug.WriteLine(" T."); + ValueIntegralTestClass63.testMethod(); + } + [TestMethod] + public void ValueIntegral64_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" For the binary shift operators, the left operand"); + Debug.WriteLine(" is converted to type T, where T is the first of int,"); + Debug.WriteLine(" uint, long, and ulong that can fully represent all possible"); + Debug.WriteLine(" values of the operand. The operation is then performed"); + Debug.WriteLine(" using the precision of type T, and the type of the result"); + Debug.WriteLine(" T."); + ValueIntegralTestClass64.testMethod(); + } + [TestMethod] + public void ValueIntegral70_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" Constants of the char type must be written as character-literals."); + Debug.WriteLine(" Character constants can only be written as integer-literals"); + Debug.WriteLine(" in compination with a cast. For example, (char)10 is the same "); + Debug.WriteLine(" as '\x000a'."); + ValueIntegralTestClass70.testMethod(); + } + + + //Compiled Test Cases + public class ValueIntegralTestClass01 + { + public static void testMethod() + { + short s1 = 2; + short s2 = (short)-s1; + byte b1 = 3; + int b2 = -b1; + int i1 = 4; + int i2 = -i1; + long l1 = 5L; + long l2 = -l1; + char c1 = (char)6; + int c2 = -c1; + + Assert.Equal(s2, (short)-2); + Assert.Equal(b2, -3); + Assert.Equal(i2, -4); + Assert.Equal(l2, -5L); + Assert.Equal(c2, -6); + Assert.Equal(i2, -4); + Assert.Equal(l2, -5L); + Assert.Equal(c2, -6); + } + } + public class ValueIntegralTestClass05 + { + public static void testMethod() + { + short s1 = 2; + short s2 = (short)+s1; + byte b1 = 3; + int b2 = +b1; + int i1 = 4; + int i2 = +i1; + long l1 = 5; + long l2 = +l1; + char c1 = (char)6; + int c2 = +c1; + + Assert.Equal(s2, (short)2); + Assert.Equal(b2, 3); + Assert.Equal(i2, 4); + Assert.Equal(l2, 5L); + Assert.Equal(c2, 6); + } + } + public class ValueIntegralTestClass09 + { + public static void testMethod() + { + short s1 = 2; + short s2 = (short)~s1; + byte b1 = 3; + int b2 = ~b1; + int i1 = 4; + int i2 = ~i1; + long l1 = 5L; + long l2 = ~l1; + char c1 = (char)6; + int c2 = ~c1; + + Assert.Equal(s2, (short)-3); + Assert.Equal(b2, -4); + Assert.Equal(i2, -5); + Assert.Equal(l2, -6L); + Assert.Equal(c2, -7); + } + } + public class ValueIntegralTestClass13 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + //short + Assert.IsType((s1 + s1).GetType(), i1.GetType()); + Assert.IsType((s1 + b1).GetType(), i1.GetType()); + Assert.IsType((s1 + i1).GetType(), i1.GetType()); + Assert.IsType((s1 + l1).GetType(), l1.GetType()); + Assert.IsType((s1 + c1).GetType(), i1.GetType()); + //byte + Assert.IsType((b1 + b1).GetType(), i1.GetType()); + Assert.IsType((b1 + i1).GetType(), i1.GetType()); + Assert.IsType((b1 + l1).GetType(), l1.GetType()); + Assert.IsType((b1 + c1).GetType(), i1.GetType()); + //int + Assert.IsType((i1 + i1).GetType(), i1.GetType()); + Assert.IsType((i1 + l1).GetType(), l1.GetType()); + Assert.IsType((i1 + c1).GetType(), i1.GetType()); + //long + Assert.IsType((l1 + l1).GetType(), l1.GetType()); + Assert.IsType((l1 + c1).GetType(), l1.GetType()); + //char + Assert.IsType((c1 + c1).GetType(), i1.GetType()); + } + } + public class ValueIntegralTestClass14 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + //short + Assert.IsType((s1 - s1).GetType(), i1.GetType()); + Assert.IsType((s1 - b1).GetType(), i1.GetType()); + Assert.IsType((s1 - i1).GetType(), i1.GetType()); + Assert.IsType((s1 - l1).GetType(), l1.GetType()); + Assert.IsType((s1 - c1).GetType(), i1.GetType()); + //byte + Assert.IsType((b1 - b1).GetType(), i1.GetType()); + Assert.IsType((b1 - i1).GetType(), i1.GetType()); + Assert.IsType((b1 - l1).GetType(), l1.GetType()); + Assert.IsType((b1 - c1).GetType(), i1.GetType()); + //int + Assert.IsType((i1 - i1).GetType(), i1.GetType()); + Assert.IsType((i1 - l1).GetType(), l1.GetType()); + Assert.IsType((i1 - c1).GetType(), i1.GetType()); + //long + Assert.IsType((l1 - l1).GetType(), l1.GetType()); + Assert.IsType((l1 - c1).GetType(), l1.GetType()); + //char + Assert.IsType((c1 - c1).GetType(), i1.GetType()); + } + } + public class ValueIntegralTestClass15 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + //short + Assert.IsType((s1 * s1).GetType(), i1.GetType()); + Assert.IsType((s1 * b1).GetType(), i1.GetType()); + Assert.IsType((s1 * i1).GetType(), i1.GetType()); + Assert.IsType((s1 * l1).GetType(), l1.GetType()); + Assert.IsType((s1 * c1).GetType(), i1.GetType()); + //byte + Assert.IsType((b1 * b1).GetType(), i1.GetType()); + Assert.IsType((b1 * i1).GetType(), i1.GetType()); + Assert.IsType((b1 * l1).GetType(), l1.GetType()); + Assert.IsType((b1 * c1).GetType(), i1.GetType()); + //int + Assert.IsType((i1 * i1).GetType(), i1.GetType()); + Assert.IsType((i1 * l1).GetType(), l1.GetType()); + Assert.IsType((i1 * c1).GetType(), i1.GetType()); + //long + Assert.IsType((l1 * l1).GetType(), l1.GetType()); + Assert.IsType((l1 * c1).GetType(), l1.GetType()); + //char + Assert.IsType((c1 * c1).GetType(), i1.GetType()); + } + } + public class ValueIntegralTestClass16 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + Assert.IsType((s1 / s1).GetType(), i1.GetType()); + Assert.IsType((s1 / b1).GetType(), i1.GetType()); + Assert.IsType((s1 / i1).GetType(), i1.GetType()); + Assert.IsType((s1 / l1).GetType(), l1.GetType()); + Assert.IsType((s1 / c1).GetType(), i1.GetType()); + Assert.IsType((b1 / b1).GetType(), i1.GetType()); + Assert.IsType((b1 / i1).GetType(), i1.GetType()); + Assert.IsType((b1 / l1).GetType(), l1.GetType()); + Assert.IsType((b1 / c1).GetType(), i1.GetType()); + Assert.IsType((i1 / i1).GetType(), i1.GetType()); + Assert.IsType((i1 / l1).GetType(), l1.GetType()); + Assert.IsType((i1 / c1).GetType(), i1.GetType()); + Assert.IsType((l1 / l1).GetType(), l1.GetType()); + Assert.IsType((l1 / c1).GetType(), l1.GetType()); + Assert.IsType((c1 / c1).GetType(), i1.GetType()); + } + } + public class ValueIntegralTestClass17 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + //short + Assert.IsType((s1 % s1).GetType(), i1.GetType()); + Assert.IsType((s1 % b1).GetType(), i1.GetType()); + Assert.IsType((s1 % i1).GetType(), i1.GetType()); + Assert.IsType((s1 % l1).GetType(), l1.GetType()); + Assert.IsType((s1 % c1).GetType(), i1.GetType()); + Assert.IsType((b1 % b1).GetType(), i1.GetType()); + Assert.IsType((b1 % i1).GetType(), i1.GetType()); + Assert.IsType((b1 % l1).GetType(), l1.GetType()); + Assert.IsType((b1 % c1).GetType(), i1.GetType()); + Assert.IsType((i1 % i1).GetType(), i1.GetType()); + Assert.IsType((i1 % l1).GetType(), l1.GetType()); + Assert.IsType((i1 % c1).GetType(), i1.GetType()); + Assert.IsType((l1 % l1).GetType(), l1.GetType()); + Assert.IsType((l1 % c1).GetType(), l1.GetType()); + Assert.IsType((c1 % c1).GetType(), i1.GetType()); + } + } + public class ValueIntegralTestClass18 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + //short + Assert.IsType((s1 & s1).GetType(), i1.GetType()); + Assert.IsType((s1 & b1).GetType(), i1.GetType()); + Assert.IsType((s1 & i1).GetType(), i1.GetType()); + Assert.IsType((s1 & l1).GetType(), l1.GetType()); + Assert.IsType((s1 & c1).GetType(), i1.GetType()); + Assert.IsType((b1 & b1).GetType(), i1.GetType()); + Assert.IsType((b1 & i1).GetType(), i1.GetType()); + Assert.IsType((b1 & l1).GetType(), l1.GetType()); + Assert.IsType((b1 & c1).GetType(), i1.GetType()); + Assert.IsType((i1 & i1).GetType(), i1.GetType()); + Assert.IsType((i1 & l1).GetType(), l1.GetType()); + Assert.IsType((i1 & c1).GetType(), i1.GetType()); + Assert.IsType((l1 & l1).GetType(), l1.GetType()); + Assert.IsType((l1 & c1).GetType(), l1.GetType()); + Assert.IsType((c1 & c1).GetType(), i1.GetType()); + } + } + public class ValueIntegralTestClass19 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + //short + Assert.IsType((s1 ^ s1).GetType(), i1.GetType()); + Assert.IsType((s1 ^ b1).GetType(), i1.GetType()); + Assert.IsType((s1 ^ i1).GetType(), i1.GetType()); + Assert.IsType((s1 ^ l1).GetType(), l1.GetType()); + Assert.IsType((s1 ^ c1).GetType(), i1.GetType()); + Assert.IsType((b1 ^ b1).GetType(), i1.GetType()); + Assert.IsType((b1 ^ i1).GetType(), i1.GetType()); + Assert.IsType((b1 ^ l1).GetType(), l1.GetType()); + Assert.IsType((b1 ^ c1).GetType(), i1.GetType()); + Assert.IsType((i1 ^ i1).GetType(), i1.GetType()); + Assert.IsType((i1 ^ l1).GetType(), l1.GetType()); + Assert.IsType((i1 ^ c1).GetType(), i1.GetType()); + Assert.IsType((l1 ^ l1).GetType(), l1.GetType()); + Assert.IsType((l1 ^ c1).GetType(), l1.GetType()); + Assert.IsType((c1 ^ c1).GetType(), i1.GetType()); + } + } + public class ValueIntegralTestClass20 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + //short + Assert.IsType((s1 | s1).GetType(), i1.GetType()); + Assert.IsType((s1 | b1).GetType(), i1.GetType()); + Assert.IsType((s1 | i1).GetType(), i1.GetType()); + Assert.IsType((s1 | l1).GetType(), l1.GetType()); + Assert.IsType((s1 | c1).GetType(), i1.GetType()); + Assert.IsType((b1 | b1).GetType(), i1.GetType()); + Assert.IsType((b1 | i1).GetType(), i1.GetType()); + Assert.IsType((b1 | l1).GetType(), l1.GetType()); + Assert.IsType((b1 | c1).GetType(), i1.GetType()); + Assert.IsType((i1 | i1).GetType(), i1.GetType()); + Assert.IsType((i1 | l1).GetType(), l1.GetType()); + Assert.IsType((i1 | c1).GetType(), i1.GetType()); + Assert.IsType((l1 | l1).GetType(), l1.GetType()); + Assert.IsType((l1 | c1).GetType(), l1.GetType()); + Assert.IsType((c1 | c1).GetType(), i1.GetType()); + } + } + public class ValueIntegralTestClass21 + { + public static void testMethod() + { + int intRet = 0; + bool TestBool = false; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + //short + Assert.IsType((s1 == s1).GetType(), TestBool.GetType()); + Assert.IsType((s1 == b1).GetType(), TestBool.GetType()); + Assert.IsType((s1 == i1).GetType(), TestBool.GetType()); + Assert.IsType((s1 == l1).GetType(), TestBool.GetType()); + Assert.IsType((s1 == c1).GetType(), TestBool.GetType()); + Assert.IsType((b1 == b1).GetType(), TestBool.GetType()); + Assert.IsType((b1 == i1).GetType(), TestBool.GetType()); + Assert.IsType((b1 == l1).GetType(), TestBool.GetType()); + Assert.IsType((b1 == c1).GetType(), TestBool.GetType()); + Assert.IsType((i1 == i1).GetType(), TestBool.GetType()); + Assert.IsType((i1 == l1).GetType(), TestBool.GetType()); + Assert.IsType((i1 == c1).GetType(), TestBool.GetType()); + Assert.IsType((l1 == l1).GetType(), TestBool.GetType()); + Assert.IsType((l1 == c1).GetType(), TestBool.GetType()); + Assert.IsType((c1 == c1).GetType(), TestBool.GetType()); + } + } + public class ValueIntegralTestClass22 + { + public static void testMethod() + { + int intRet = 0; + bool TestBool = false; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + //short + Assert.IsType((s1 != s1).GetType(), TestBool.GetType()); + Assert.IsType((s1 != b1).GetType(), TestBool.GetType()); + Assert.IsType((s1 != i1).GetType(), TestBool.GetType()); + Assert.IsType((s1 != l1).GetType(), TestBool.GetType()); + Assert.IsType((s1 != c1).GetType(), TestBool.GetType()); + Assert.IsType((b1 != b1).GetType(), TestBool.GetType()); + Assert.IsType((b1 != i1).GetType(), TestBool.GetType()); + Assert.IsType((b1 != l1).GetType(), TestBool.GetType()); + Assert.IsType((b1 != c1).GetType(), TestBool.GetType()); + Assert.IsType((i1 != i1).GetType(), TestBool.GetType()); + Assert.IsType((i1 != l1).GetType(), TestBool.GetType()); + Assert.IsType((i1 != c1).GetType(), TestBool.GetType()); + Assert.IsType((l1 != l1).GetType(), TestBool.GetType()); + Assert.IsType((l1 != c1).GetType(), TestBool.GetType()); + Assert.IsType((c1 != c1).GetType(), TestBool.GetType()); + } + } + public class ValueIntegralTestClass23 + { + public static void testMethod() + { + bool TestBool = false; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + //short + Assert.IsType((s1 > s1).GetType(), TestBool.GetType()); + Assert.IsType((s1 > b1).GetType(), TestBool.GetType()); + Assert.IsType((s1 > i1).GetType(), TestBool.GetType()); + Assert.IsType((s1 > l1).GetType(), TestBool.GetType()); + Assert.IsType((s1 > c1).GetType(), TestBool.GetType()); + Assert.IsType((b1 > b1).GetType(), TestBool.GetType()); + Assert.IsType((b1 > i1).GetType(), TestBool.GetType()); + Assert.IsType((b1 > l1).GetType(), TestBool.GetType()); + Assert.IsType((b1 > c1).GetType(), TestBool.GetType()); + Assert.IsType((i1 > i1).GetType(), TestBool.GetType()); + Assert.IsType((i1 > l1).GetType(), TestBool.GetType()); + Assert.IsType((i1 > c1).GetType(), TestBool.GetType()); + Assert.IsType((l1 > l1).GetType(), TestBool.GetType()); + Assert.IsType((l1 > c1).GetType(), TestBool.GetType()); + Assert.IsType((c1 > c1).GetType(), TestBool.GetType()); + } + } + public class ValueIntegralTestClass24 + { + public static void testMethod() + { + bool TestBool = false; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + //short + Assert.IsType((s1 < s1).GetType(), TestBool.GetType()); + Assert.IsType((s1 < b1).GetType(), TestBool.GetType()); + Assert.IsType((s1 < i1).GetType(), TestBool.GetType()); + Assert.IsType((s1 < l1).GetType(), TestBool.GetType()); + Assert.IsType((s1 < c1).GetType(), TestBool.GetType()); + Assert.IsType((b1 < b1).GetType(), TestBool.GetType()); + Assert.IsType((b1 < i1).GetType(), TestBool.GetType()); + Assert.IsType((b1 < l1).GetType(), TestBool.GetType()); + Assert.IsType((b1 < c1).GetType(), TestBool.GetType()); + Assert.IsType((i1 < i1).GetType(), TestBool.GetType()); + Assert.IsType((i1 < l1).GetType(), TestBool.GetType()); + Assert.IsType((i1 < c1).GetType(), TestBool.GetType()); + Assert.IsType((l1 < l1).GetType(), TestBool.GetType()); + Assert.IsType((l1 < c1).GetType(), TestBool.GetType()); + Assert.IsType((c1 < c1).GetType(), TestBool.GetType()); + } + } + public class ValueIntegralTestClass25 + { + public static void testMethod() + { + bool TestBool = false; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + //short + Assert.IsType((s1 >= s1).GetType(), TestBool.GetType()); + Assert.IsType((s1 >= b1).GetType(), TestBool.GetType()); + Assert.IsType((s1 >= i1).GetType(), TestBool.GetType()); + Assert.IsType((s1 >= l1).GetType(), TestBool.GetType()); + Assert.IsType((s1 >= c1).GetType(), TestBool.GetType()); + Assert.IsType((b1 >= b1).GetType(), TestBool.GetType()); + Assert.IsType((b1 >= i1).GetType(), TestBool.GetType()); + Assert.IsType((b1 >= l1).GetType(), TestBool.GetType()); + Assert.IsType((b1 >= c1).GetType(), TestBool.GetType()); + Assert.IsType((i1 >= i1).GetType(), TestBool.GetType()); + Assert.IsType((i1 >= l1).GetType(), TestBool.GetType()); + Assert.IsType((i1 >= c1).GetType(), TestBool.GetType()); + Assert.IsType((l1 >= l1).GetType(), TestBool.GetType()); + Assert.IsType((l1 >= c1).GetType(), TestBool.GetType()); + Assert.IsType((c1 >= c1).GetType(), TestBool.GetType()); + } + } + public class ValueIntegralTestClass26 + { + public static void testMethod() + { + bool TestBool = false; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + //short + Assert.IsType((s1 <= s1).GetType(), TestBool.GetType()); + Assert.IsType((s1 <= b1).GetType(), TestBool.GetType()); + Assert.IsType((s1 <= i1).GetType(), TestBool.GetType()); + Assert.IsType((s1 <= l1).GetType(), TestBool.GetType()); + Assert.IsType((s1 <= c1).GetType(), TestBool.GetType()); + Assert.IsType((b1 <= b1).GetType(), TestBool.GetType()); + Assert.IsType((b1 <= i1).GetType(), TestBool.GetType()); + Assert.IsType((b1 <= l1).GetType(), TestBool.GetType()); + Assert.IsType((b1 <= c1).GetType(), TestBool.GetType()); + Assert.IsType((i1 <= i1).GetType(), TestBool.GetType()); + Assert.IsType((i1 <= l1).GetType(), TestBool.GetType()); + Assert.IsType((i1 <= c1).GetType(), TestBool.GetType()); + Assert.IsType((l1 <= l1).GetType(), TestBool.GetType()); + Assert.IsType((l1 <= c1).GetType(), TestBool.GetType()); + Assert.IsType((c1 <= c1).GetType(), TestBool.GetType()); + } + } + public class ValueIntegralTestClass27 + { + public static void testMethod() + { + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + Assert.IsType((s1 << 1).GetType(), i1.GetType()); + Assert.IsType((b1 << 1).GetType(), i1.GetType()); + Assert.IsType((i1 << 1).GetType(), i1.GetType()); + Assert.IsType((l1 << 1).GetType(), l1.GetType()); + Assert.IsType((c1 << 1).GetType(), i1.GetType()); + } + } + public class ValueIntegralTestClass28 + { + public static void testMethod() + { + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + Assert.IsType((s1 >> 1).GetType(), i1.GetType()); + Assert.IsType((b1 >> 1).GetType(), i1.GetType()); + Assert.IsType((i1 >> 1).GetType(), i1.GetType()); + Assert.IsType((l1 >> 1).GetType(), l1.GetType()); + Assert.IsType((c1 >> 1).GetType(), i1.GetType()); + } + } + public class ValueIntegralTestClass38 + { + public static void testMethod() + { + char c = '\x000A'; + Assert.Equal(c, (char)10); + } + } + public class ValueIntegralTestClass39 + { + public static void testMethod() + { + ushort s1 = 2; + ushort s2 = (ushort)+s1; + sbyte b1 = 3; + int b2 = +b1; + uint i1 = 4; + uint i2 = +i1; + ulong l1 = 5ul; + ulong l2 = +l1; + + Assert.Equal(s2, (ushort)2); + Assert.Equal(b2, 3); + Assert.Equal(i2, 4); + Assert.Equal(l2, 5ul); + } + } + public class ValueIntegralTestClass42 + { + public static void testMethod() + { + checked + { + ushort s1 = 2; + int s2 = ~s1; + sbyte b1 = 3; + int b2 = ~b1; + uint i1 = 4; + uint i2 = ~i1; + ulong l1 = 5ul; + ulong l2 = ~l1; + + Assert.Equal(s2, -3); + Assert.Equal(b2, -4); + Assert.Equal(i2, 4294967291u); + Assert.Equal(l2, 18446744073709551610ul); + } + } + } + public class ValueIntegralTestClass45 + { + public static void testMethod() + { + ushort s1 = 2; + int s2 = -s1; + sbyte b1 = 3; + int b2 = -b1; + uint i1 = 4; + long i2 = -i1; + + Assert.Equal(s2, -2); + Assert.Equal(b2, -3); + Assert.Equal(i2, -4); + } + } + public class ValueIntegralTestClass49 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + //ushort + Assert.IsType((s2 + s1).GetType(), i1.GetType()); + Assert.IsType((s2 + b1).GetType(), i1.GetType()); + Assert.IsType((s2 + i1).GetType(), i1.GetType()); + Assert.IsType((s2 + l1).GetType(), l1.GetType()); + Assert.IsType((s2 + c1).GetType(), i1.GetType()); + Assert.IsType((s2 + s2).GetType(), i1.GetType()); + Assert.IsType((s2 + b2).GetType(), i1.GetType()); + Assert.IsType((s2 + i2).GetType(), i2.GetType()); + Assert.IsType((s2 + l2).GetType(), l2.GetType()); + Assert.IsType((b2 + s1).GetType(), i1.GetType()); + Assert.IsType((b2 + b1).GetType(), i1.GetType()); + Assert.IsType((b2 + i1).GetType(), i1.GetType()); + Assert.IsType((b2 + l1).GetType(), l1.GetType()); + Assert.IsType((b2 + c1).GetType(), i1.GetType()); + Assert.IsType((b2 + s2).GetType(), i1.GetType()); + Assert.IsType((b2 + b2).GetType(), i1.GetType()); + Assert.IsType((b2 + i2).GetType(), l1.GetType()); + Assert.IsType((i2 + s1).GetType(), l1.GetType()); + Assert.IsType((i2 + b1).GetType(), i2.GetType()); + Assert.IsType((i2 + i1).GetType(), l1.GetType()); + Assert.IsType((i2 + l1).GetType(), l1.GetType()); + Assert.IsType((i2 + c1).GetType(), i2.GetType()); + Assert.IsType((i2 + s2).GetType(), i2.GetType()); + Assert.IsType((i2 + b2).GetType(), l1.GetType()); + Assert.IsType((i2 + i2).GetType(), i2.GetType()); + Assert.IsType((i2 + l2).GetType(), l2.GetType()); + Assert.IsType((l2 + b1).GetType(), l2.GetType()); + Assert.IsType((l2 + c1).GetType(), l2.GetType()); + Assert.IsType((l2 + s2).GetType(), l2.GetType()); + Assert.IsType((l2 + i2).GetType(), l2.GetType()); + Assert.IsType((l2 + l2).GetType(), l2.GetType()); + } + } + public class ValueIntegralTestClass50 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + //ushort + Assert.IsType((s2 - s1).GetType(), i1.GetType()); + Assert.IsType((s2 - i1).GetType(), i1.GetType()); + Assert.IsType((s2 - l1).GetType(), l1.GetType()); + Assert.IsType((s2 - c1).GetType(), i1.GetType()); + Assert.IsType((s2 - s2).GetType(), i1.GetType()); + Assert.IsType((s2 - b2).GetType(), i1.GetType()); + Assert.IsType((s2 - i2).GetType(), i2.GetType()); + Assert.IsType((s2 - l2).GetType(), l2.GetType()); + Assert.IsType((b2 - s1).GetType(), i1.GetType()); + Assert.IsType((b2 - b1).GetType(), i1.GetType()); + Assert.IsType((b2 - i1).GetType(), i1.GetType()); + Assert.IsType((b2 - l1).GetType(), l1.GetType()); + Assert.IsType((b2 - c1).GetType(), i1.GetType()); + Assert.IsType((b2 - s2).GetType(), i1.GetType()); + Assert.IsType((b2 - b2).GetType(), i1.GetType()); + Assert.IsType((b2 - i2).GetType(), l1.GetType()); + Assert.IsType((i2 - s1).GetType(), l1.GetType()); + Assert.IsType((i2 - b1).GetType(), i2.GetType()); + Assert.IsType((i2 - i1).GetType(), l1.GetType()); + Assert.IsType((i2 - l1).GetType(), l1.GetType()); + Assert.IsType((i2 - c1).GetType(), i2.GetType()); + Assert.IsType((i2 - s2).GetType(), i2.GetType()); + Assert.IsType((i2 - b2).GetType(), l1.GetType()); + Assert.IsType((i2 - i2).GetType(), i2.GetType()); + Assert.IsType((i2 - l2).GetType(), l2.GetType()); + Assert.IsType((l2 - b1).GetType(), l2.GetType()); + Assert.IsType((l2 - c1).GetType(), l2.GetType()); + Assert.IsType((l2 - s2).GetType(), l2.GetType()); + Assert.IsType((l2 - i2).GetType(), l2.GetType()); + Assert.IsType((l2 - l2).GetType(), l2.GetType()); + } + } + public class ValueIntegralTestClass51 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + //ushort + Assert.IsType((s2 * s1).GetType(), i1.GetType()); + Assert.IsType((s2 * b1).GetType(), i1.GetType()); + Assert.IsType((s2 * i1).GetType(), i1.GetType()); + Assert.IsType((s2 * l1).GetType(), l1.GetType()); + Assert.IsType((s2 * c1).GetType(), i1.GetType()); + Assert.IsType((s2 * s2).GetType(), i1.GetType()); + Assert.IsType((s2 * b2).GetType(), i1.GetType()); + Assert.IsType((s2 * i2).GetType(), i2.GetType()); + Assert.IsType((s2 * l2).GetType(), l2.GetType()); + Assert.IsType((b2 * s1).GetType(), i1.GetType()); + Assert.IsType((b2 * b1).GetType(), i1.GetType()); + Assert.IsType((b2 * i1).GetType(), i1.GetType()); + Assert.IsType((b2 * l1).GetType(), l1.GetType()); + Assert.IsType((b2 * c1).GetType(), i1.GetType()); + Assert.IsType((b2 * s2).GetType(), i1.GetType()); + Assert.IsType((b2 * b2).GetType(), i1.GetType()); + Assert.IsType((b2 * i2).GetType(), l1.GetType()); + Assert.IsType((i2 * s1).GetType(), l1.GetType()); + Assert.IsType((i2 * b1).GetType(), i2.GetType()); + Assert.IsType((i2 * i1).GetType(), l1.GetType()); + Assert.IsType((i2 * l1).GetType(), l1.GetType()); + Assert.IsType((i2 * c1).GetType(), i2.GetType()); + Assert.IsType((i2 * s2).GetType(), i2.GetType()); + Assert.IsType((i2 * b2).GetType(), l1.GetType()); + Assert.IsType((i2 * i2).GetType(), i2.GetType()); + Assert.IsType((i2 * l2).GetType(), l2.GetType()); + Assert.IsType((l2 * b1).GetType(), l2.GetType()); + Assert.IsType((l2 * c1).GetType(), l2.GetType()); + Assert.IsType((l2 * s2).GetType(), l2.GetType()); + Assert.IsType((l2 * i2).GetType(), l2.GetType()); + Assert.IsType((l2 * l2).GetType(), l2.GetType()); + } + } + public class ValueIntegralTestClass52 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + //ushort + Assert.IsType((s2 / s1).GetType(), i1.GetType()); + Assert.IsType((s2 / b1).GetType(), i1.GetType()); + Assert.IsType((s2 / i1).GetType(), i1.GetType()); + Assert.IsType((s2 / l1).GetType(), l1.GetType()); + Assert.IsType((s2 / c1).GetType(), i1.GetType()); + Assert.IsType((s2 / s2).GetType(), i1.GetType()); + Assert.IsType((s2 / b2).GetType(), i1.GetType()); + Assert.IsType((s2 / i2).GetType(), i2.GetType()); + Assert.IsType((s2 / l2).GetType(), l2.GetType()); + Assert.IsType((b2 / s1).GetType(), i1.GetType()); + Assert.IsType((b2 / b1).GetType(), i1.GetType()); + Assert.IsType((b2 / i1).GetType(), i1.GetType()); + Assert.IsType((b2 / l1).GetType(), l1.GetType()); + Assert.IsType((b2 / c1).GetType(), i1.GetType()); + Assert.IsType((b2 / s2).GetType(), i1.GetType()); + Assert.IsType((b2 / b2).GetType(), i1.GetType()); + Assert.IsType((b2 / i2).GetType(), l1.GetType()); + Assert.IsType((i2 / s1).GetType(), l1.GetType()); + Assert.IsType((i2 / b1).GetType(), i2.GetType()); + Assert.IsType((i2 / i1).GetType(), l1.GetType()); + Assert.IsType((i2 / l1).GetType(), l1.GetType()); + Assert.IsType((i2 / c1).GetType(), i2.GetType()); + Assert.IsType((i2 / s2).GetType(), i2.GetType()); + Assert.IsType((i2 / b2).GetType(), l1.GetType()); + Assert.IsType((i2 / i2).GetType(), i2.GetType()); + Assert.IsType((i2 / l2).GetType(), l2.GetType()); + Assert.IsType((l2 / b1).GetType(), l2.GetType()); + Assert.IsType((l2 / c1).GetType(), l2.GetType()); + Assert.IsType((l2 / s2).GetType(), l2.GetType()); + Assert.IsType((l2 / i2).GetType(), l2.GetType()); + Assert.IsType((l2 / l2).GetType(), l2.GetType()); + } + } + public class ValueIntegralTestClass53 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + //ushort + Assert.IsType((s2 % s1).GetType(), i1.GetType()); + Assert.IsType((s2 % b1).GetType(), i1.GetType()); + Assert.IsType((s2 % i1).GetType(), i1.GetType()); + Assert.IsType((s2 % l1).GetType(), l1.GetType()); + Assert.IsType((s2 % c1).GetType(), i1.GetType()); + Assert.IsType((s2 % s2).GetType(), i1.GetType()); + Assert.IsType((s2 % b2).GetType(), i1.GetType()); + Assert.IsType((s2 % i2).GetType(), i2.GetType()); + Assert.IsType((s2 % l2).GetType(), l2.GetType()); + Assert.IsType((b2 % s1).GetType(), i1.GetType()); + Assert.IsType((b2 % b1).GetType(), i1.GetType()); + Assert.IsType((b2 % i1).GetType(), i1.GetType()); + Assert.IsType((b2 % l1).GetType(), l1.GetType()); + Assert.IsType((b2 % c1).GetType(), i1.GetType()); + Assert.IsType((b2 % s2).GetType(), i1.GetType()); + Assert.IsType((b2 % b2).GetType(), i1.GetType()); + Assert.IsType((b2 % i2).GetType(), l1.GetType()); + Assert.IsType((i2 % s1).GetType(), l1.GetType()); + Assert.IsType((i2 % b1).GetType(), i2.GetType()); + Assert.IsType((i2 % i1).GetType(), l1.GetType()); + Assert.IsType((i2 % l1).GetType(), l1.GetType()); + Assert.IsType((i2 % c1).GetType(), i2.GetType()); + Assert.IsType((i2 % s2).GetType(), i2.GetType()); + Assert.IsType((i2 % b2).GetType(), l1.GetType()); + Assert.IsType((i2 % i2).GetType(), i2.GetType()); + Assert.IsType((i2 % l2).GetType(), l2.GetType()); + Assert.IsType((l2 % b1).GetType(), l2.GetType()); + Assert.IsType((l2 % c1).GetType(), l2.GetType()); + Assert.IsType((l2 % s2).GetType(), l2.GetType()); + Assert.IsType((l2 % i2).GetType(), l2.GetType()); + Assert.IsType((l2 % l2).GetType(), l2.GetType()); + } + } + public class ValueIntegralTestClass54 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + //ushort + Assert.IsType((s2 & s1).GetType(), i1.GetType()); + Assert.IsType((s2 & b1).GetType(), i1.GetType()); + Assert.IsType((s2 & i1).GetType(), i1.GetType()); + Assert.IsType((s2 & l1).GetType(), l1.GetType()); + Assert.IsType((s2 & c1).GetType(), i1.GetType()); + Assert.IsType((s2 & s2).GetType(), i1.GetType()); + Assert.IsType((s2 & b2).GetType(), i1.GetType()); + Assert.IsType((s2 & i2).GetType(), i2.GetType()); + Assert.IsType((s2 & l2).GetType(), l2.GetType()); + Assert.IsType((b2 & s1).GetType(), i1.GetType()); + Assert.IsType((b2 & b1).GetType(), i1.GetType()); + Assert.IsType((b2 & i1).GetType(), i1.GetType()); + Assert.IsType((b2 & l1).GetType(), l1.GetType()); + Assert.IsType((b2 & c1).GetType(), i1.GetType()); + Assert.IsType((b2 & s2).GetType(), i1.GetType()); + Assert.IsType((b2 & b2).GetType(), i1.GetType()); + Assert.IsType((b2 & i2).GetType(), l1.GetType()); + Assert.IsType((i2 & s1).GetType(), l1.GetType()); + Assert.IsType((i2 & b1).GetType(), i2.GetType()); + Assert.IsType((i2 & i1).GetType(), l1.GetType()); + Assert.IsType((i2 & l1).GetType(), l1.GetType()); + Assert.IsType((i2 & c1).GetType(), i2.GetType()); + Assert.IsType((i2 & s2).GetType(), i2.GetType()); + Assert.IsType((i2 & b2).GetType(), l1.GetType()); + Assert.IsType((i2 & i2).GetType(), i2.GetType()); + Assert.IsType((i2 & l2).GetType(), l2.GetType()); + Assert.IsType((l2 & b1).GetType(), l2.GetType()); + Assert.IsType((l2 & c1).GetType(), l2.GetType()); + Assert.IsType((l2 & s2).GetType(), l2.GetType()); + Assert.IsType((l2 & i2).GetType(), l2.GetType()); + Assert.IsType((l2 & l2).GetType(), l2.GetType()); + } + } + public class ValueIntegralTestClass55 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + //ushort + Assert.IsType((s2 ^ s1).GetType(), i1.GetType()); + Assert.IsType((s2 ^ b1).GetType(), i1.GetType()); + Assert.IsType((s2 ^ i1).GetType(), i1.GetType()); + Assert.IsType((s2 ^ l1).GetType(), l1.GetType()); + Assert.IsType((s2 ^ c1).GetType(), i1.GetType()); + Assert.IsType((s2 ^ s2).GetType(), i1.GetType()); + Assert.IsType((s2 ^ b2).GetType(), i1.GetType()); + Assert.IsType((s2 ^ i2).GetType(), i2.GetType()); + Assert.IsType((s2 ^ l2).GetType(), l2.GetType()); + Assert.IsType((b2 ^ s1).GetType(), i1.GetType()); + Assert.IsType((b2 ^ b1).GetType(), i1.GetType()); + Assert.IsType((b2 ^ i1).GetType(), i1.GetType()); + Assert.IsType((b2 ^ l1).GetType(), l1.GetType()); + Assert.IsType((b2 ^ c1).GetType(), i1.GetType()); + Assert.IsType((b2 ^ s2).GetType(), i1.GetType()); + Assert.IsType((b2 ^ b2).GetType(), i1.GetType()); + Assert.IsType((b2 ^ i2).GetType(), l1.GetType()); + Assert.IsType((i2 ^ s1).GetType(), l1.GetType()); + Assert.IsType((i2 ^ b1).GetType(), i2.GetType()); + Assert.IsType((i2 ^ i1).GetType(), l1.GetType()); + Assert.IsType((i2 ^ l1).GetType(), l1.GetType()); + Assert.IsType((i2 ^ c1).GetType(), i2.GetType()); + Assert.IsType((i2 ^ s2).GetType(), i2.GetType()); + Assert.IsType((i2 ^ b2).GetType(), l1.GetType()); + Assert.IsType((i2 ^ i2).GetType(), i2.GetType()); + Assert.IsType((i2 ^ l2).GetType(), l2.GetType()); + Assert.IsType((l2 ^ b1).GetType(), l2.GetType()); + Assert.IsType((l2 ^ c1).GetType(), l2.GetType()); + Assert.IsType((l2 ^ s2).GetType(), l2.GetType()); + Assert.IsType((l2 ^ i2).GetType(), l2.GetType()); + Assert.IsType((l2 ^ l2).GetType(), l2.GetType()); + } + } + public class ValueIntegralTestClass56 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + //ushort + Assert.IsType((s2 | s1).GetType(), i1.GetType()); + Assert.IsType((s2 | b1).GetType(), i1.GetType()); + Assert.IsType((s2 | i1).GetType(), i1.GetType()); + Assert.IsType((s2 | l1).GetType(), l1.GetType()); + Assert.IsType((s2 | c1).GetType(), i1.GetType()); + Assert.IsType((s2 | s2).GetType(), i1.GetType()); + Assert.IsType((s2 | b2).GetType(), i1.GetType()); + Assert.IsType((s2 | i2).GetType(), i2.GetType()); + Assert.IsType((s2 | l2).GetType(), l2.GetType()); + Assert.IsType((b2 | s1).GetType(), i1.GetType()); + Assert.IsType((b2 | b1).GetType(), i1.GetType()); + Assert.IsType((b2 | i1).GetType(), i1.GetType()); + Assert.IsType((b2 | l1).GetType(), l1.GetType()); + Assert.IsType((b2 | c1).GetType(), i1.GetType()); + Assert.IsType((b2 | s2).GetType(), i1.GetType()); + Assert.IsType((b2 | b2).GetType(), i1.GetType()); + Assert.IsType((b2 | i2).GetType(), l1.GetType()); + Assert.IsType((i2 | s1).GetType(), l1.GetType()); + Assert.IsType((i2 | b1).GetType(), i2.GetType()); + Assert.IsType((i2 | i1).GetType(), l1.GetType()); + Assert.IsType((i2 | l1).GetType(), l1.GetType()); + Assert.IsType((i2 | c1).GetType(), i2.GetType()); + Assert.IsType((i2 | s2).GetType(), i2.GetType()); + Assert.IsType((i2 | b2).GetType(), l1.GetType()); + Assert.IsType((i2 | i2).GetType(), i2.GetType()); + Assert.IsType((i2 | l2).GetType(), l2.GetType()); + Assert.IsType((l2 | b1).GetType(), l2.GetType()); + Assert.IsType((l2 | c1).GetType(), l2.GetType()); + Assert.IsType((l2 | s2).GetType(), l2.GetType()); + Assert.IsType((l2 | i2).GetType(), l2.GetType()); + Assert.IsType((l2 | l2).GetType(), l2.GetType()); + } + } + public class ValueIntegralTestClass57 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + bool b = true; + //ushort + Assert.IsType((s2 == s1).GetType(), b.GetType()); + Assert.IsType((s2 == b1).GetType(), b.GetType()); + Assert.IsType((s2 == i1).GetType(), b.GetType()); + Assert.IsType((s2 == l1).GetType(), b.GetType()); + Assert.IsType((s2 == c1).GetType(), b.GetType()); + Assert.IsType((s2 == s2).GetType(), b.GetType()); + Assert.IsType((s2 == b2).GetType(), b.GetType()); + Assert.IsType((s2 == i2).GetType(), b.GetType()); + Assert.IsType((s2 == l2).GetType(), b.GetType()); + Assert.IsType((b2 == s1).GetType(), b.GetType()); + Assert.IsType((b2 == b1).GetType(), b.GetType()); + Assert.IsType((b2 == i1).GetType(), b.GetType()); + Assert.IsType((b2 == l1).GetType(), b.GetType()); + Assert.IsType((b2 == c1).GetType(), b.GetType()); + Assert.IsType((b2 == s2).GetType(), b.GetType()); + Assert.IsType((b2 == b2).GetType(), b.GetType()); + Assert.IsType((b2 == i2).GetType(), b.GetType()); + Assert.IsType((i2 == s1).GetType(), b.GetType()); + Assert.IsType((i2 == b1).GetType(), b.GetType()); + Assert.IsType((i2 == i1).GetType(), b.GetType()); + Assert.IsType((i2 == l1).GetType(), b.GetType()); + Assert.IsType((i2 == c1).GetType(), b.GetType()); + Assert.IsType((i2 == s2).GetType(), b.GetType()); + Assert.IsType((i2 == b2).GetType(), b.GetType()); + Assert.IsType((i2 == i2).GetType(), b.GetType()); + Assert.IsType((i2 == l2).GetType(), b.GetType()); + Assert.IsType((l2 == b1).GetType(), b.GetType()); + Assert.IsType((l2 == c1).GetType(), b.GetType()); + Assert.IsType((l2 == s2).GetType(), b.GetType()); + Assert.IsType((l2 == i2).GetType(), b.GetType()); + Assert.IsType((l2 == l2).GetType(), b.GetType()); + } + } + public class ValueIntegralTestClass58 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + bool b = true; + //ushort + Assert.IsType((s2 != s1).GetType(), b.GetType()); + Assert.IsType((s2 != b1).GetType(), b.GetType()); + Assert.IsType((s2 != i1).GetType(), b.GetType()); + Assert.IsType((s2 != l1).GetType(), b.GetType()); + Assert.IsType((s2 != c1).GetType(), b.GetType()); + Assert.IsType((s2 != s2).GetType(), b.GetType()); + Assert.IsType((s2 != b2).GetType(), b.GetType()); + Assert.IsType((s2 != i2).GetType(), b.GetType()); + Assert.IsType((s2 != l2).GetType(), b.GetType()); + Assert.IsType((b2 != s1).GetType(), b.GetType()); + Assert.IsType((b2 != b1).GetType(), b.GetType()); + Assert.IsType((b2 != i1).GetType(), b.GetType()); + Assert.IsType((b2 != l1).GetType(), b.GetType()); + Assert.IsType((b2 != c1).GetType(), b.GetType()); + Assert.IsType((b2 != s2).GetType(), b.GetType()); + Assert.IsType((b2 != b2).GetType(), b.GetType()); + Assert.IsType((b2 != i2).GetType(), b.GetType()); + Assert.IsType((i2 != s1).GetType(), b.GetType()); + Assert.IsType((i2 != b1).GetType(), b.GetType()); + Assert.IsType((i2 != i1).GetType(), b.GetType()); + Assert.IsType((i2 != l1).GetType(), b.GetType()); + Assert.IsType((i2 != c1).GetType(), b.GetType()); + Assert.IsType((i2 != s2).GetType(), b.GetType()); + Assert.IsType((i2 != b2).GetType(), b.GetType()); + Assert.IsType((i2 != i2).GetType(), b.GetType()); + Assert.IsType((i2 != l2).GetType(), b.GetType()); + Assert.IsType((l2 != b1).GetType(), b.GetType()); + Assert.IsType((l2 != c1).GetType(), b.GetType()); + Assert.IsType((l2 != s2).GetType(), b.GetType()); + Assert.IsType((l2 != i2).GetType(), b.GetType()); + Assert.IsType((l2 != l2).GetType(), b.GetType()); + } + } + public class ValueIntegralTestClass59 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + bool b = true; + //ushort + Assert.IsType((s2 > s1).GetType(), b.GetType()); + Assert.IsType((s2 > b1).GetType(), b.GetType()); + Assert.IsType((s2 > i1).GetType(), b.GetType()); + Assert.IsType((s2 > l1).GetType(), b.GetType()); + Assert.IsType((s2 > c1).GetType(), b.GetType()); + Assert.IsType((s2 > s2).GetType(), b.GetType()); + Assert.IsType((s2 > b2).GetType(), b.GetType()); + Assert.IsType((s2 > i2).GetType(), b.GetType()); + Assert.IsType((s2 > l2).GetType(), b.GetType()); + Assert.IsType((b2 > s1).GetType(), b.GetType()); + Assert.IsType((b2 > b1).GetType(), b.GetType()); + Assert.IsType((b2 > i1).GetType(), b.GetType()); + Assert.IsType((b2 > l1).GetType(), b.GetType()); + Assert.IsType((b2 > c1).GetType(), b.GetType()); + Assert.IsType((b2 > s2).GetType(), b.GetType()); + Assert.IsType((b2 > b2).GetType(), b.GetType()); + Assert.IsType((b2 > i2).GetType(), b.GetType()); + Assert.IsType((i2 > s1).GetType(), b.GetType()); + Assert.IsType((i2 > b1).GetType(), b.GetType()); + Assert.IsType((i2 > i1).GetType(), b.GetType()); + Assert.IsType((i2 > l1).GetType(), b.GetType()); + Assert.IsType((i2 > c1).GetType(), b.GetType()); + Assert.IsType((i2 > s2).GetType(), b.GetType()); + Assert.IsType((i2 > b2).GetType(), b.GetType()); + Assert.IsType((i2 > i2).GetType(), b.GetType()); + Assert.IsType((i2 > l2).GetType(), b.GetType()); + Assert.IsType((l2 > b1).GetType(), b.GetType()); + Assert.IsType((l2 > c1).GetType(), b.GetType()); + Assert.IsType((l2 > s2).GetType(), b.GetType()); + Assert.IsType((l2 > i2).GetType(), b.GetType()); + Assert.IsType((l2 > l2).GetType(), b.GetType()); + } + } + public class ValueIntegralTestClass60 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + bool b = true; + //ushort + Assert.IsType((s2 < s1).GetType(), b.GetType()); + Assert.IsType((s2 < b1).GetType(), b.GetType()); + Assert.IsType((s2 < i1).GetType(), b.GetType()); + Assert.IsType((s2 < l1).GetType(), b.GetType()); + Assert.IsType((s2 < c1).GetType(), b.GetType()); + Assert.IsType((s2 < s2).GetType(), b.GetType()); + Assert.IsType((s2 < b2).GetType(), b.GetType()); + Assert.IsType((s2 < i2).GetType(), b.GetType()); + Assert.IsType((s2 < l2).GetType(), b.GetType()); + Assert.IsType((b2 < s1).GetType(), b.GetType()); + Assert.IsType((b2 < b1).GetType(), b.GetType()); + Assert.IsType((b2 < i1).GetType(), b.GetType()); + Assert.IsType((b2 < l1).GetType(), b.GetType()); + Assert.IsType((b2 < c1).GetType(), b.GetType()); + Assert.IsType((b2 < s2).GetType(), b.GetType()); + Assert.IsType((b2 < b2).GetType(), b.GetType()); + Assert.IsType((b2 < i2).GetType(), b.GetType()); + Assert.IsType((i2 < s1).GetType(), b.GetType()); + Assert.IsType((i2 < b1).GetType(), b.GetType()); + Assert.IsType((i2 < i1).GetType(), b.GetType()); + Assert.IsType((i2 < l1).GetType(), b.GetType()); + Assert.IsType((i2 < c1).GetType(), b.GetType()); + Assert.IsType((i2 < s2).GetType(), b.GetType()); + Assert.IsType((i2 < b2).GetType(), b.GetType()); + Assert.IsType((i2 < i2).GetType(), b.GetType()); + Assert.IsType((i2 < l2).GetType(), b.GetType()); + Assert.IsType((l2 < b1).GetType(), b.GetType()); + Assert.IsType((l2 < c1).GetType(), b.GetType()); + Assert.IsType((l2 < s2).GetType(), b.GetType()); + Assert.IsType((l2 < i2).GetType(), b.GetType()); + Assert.IsType((l2 < l2).GetType(), b.GetType()); + } + } + public class ValueIntegralTestClass61 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + bool b = true; + //ushort + Assert.IsType((s2 >= s1).GetType(), b.GetType()); + Assert.IsType((s2 >= b1).GetType(), b.GetType()); + Assert.IsType((s2 >= i1).GetType(), b.GetType()); + Assert.IsType((s2 >= l1).GetType(), b.GetType()); + Assert.IsType((s2 >= c1).GetType(), b.GetType()); + Assert.IsType((s2 >= s2).GetType(), b.GetType()); + Assert.IsType((s2 >= b2).GetType(), b.GetType()); + Assert.IsType((s2 >= i2).GetType(), b.GetType()); + Assert.IsType((s2 >= l2).GetType(), b.GetType()); + Assert.IsType((b2 >= s1).GetType(), b.GetType()); + Assert.IsType((b2 >= b1).GetType(), b.GetType()); + Assert.IsType((b2 >= i1).GetType(), b.GetType()); + Assert.IsType((b2 >= l1).GetType(), b.GetType()); + Assert.IsType((b2 >= c1).GetType(), b.GetType()); + Assert.IsType((b2 >= s2).GetType(), b.GetType()); + Assert.IsType((b2 >= b2).GetType(), b.GetType()); + Assert.IsType((b2 >= i2).GetType(), b.GetType()); + Assert.IsType((i2 >= s1).GetType(), b.GetType()); + Assert.IsType((i2 >= b1).GetType(), b.GetType()); + Assert.IsType((i2 >= i1).GetType(), b.GetType()); + Assert.IsType((i2 >= l1).GetType(), b.GetType()); + Assert.IsType((i2 >= c1).GetType(), b.GetType()); + Assert.IsType((i2 >= s2).GetType(), b.GetType()); + Assert.IsType((i2 >= b2).GetType(), b.GetType()); + Assert.IsType((i2 >= i2).GetType(), b.GetType()); + Assert.IsType((i2 >= l2).GetType(), b.GetType()); + Assert.IsType((l2 >= b1).GetType(), b.GetType()); + Assert.IsType((l2 >= c1).GetType(), b.GetType()); + Assert.IsType((l2 >= s2).GetType(), b.GetType()); + Assert.IsType((l2 >= i2).GetType(), b.GetType()); + Assert.IsType((l2 >= l2).GetType(), b.GetType()); + } + } + public class ValueIntegralTestClass62 + { + public static void testMethod() + { + int intRet = 0; + short s1 = 2; + byte b1 = 3; + int i1 = 4; + long l1 = 5L; + char c1 = (char)6; + ushort s2 = 7; + sbyte b2 = 8; + uint i2 = 9; + ulong l2 = 10; + bool b = true; + //ushort + Assert.IsType((s2 <= s1).GetType(), b.GetType()); + Assert.IsType((s2 <= b1).GetType(), b.GetType()); + Assert.IsType((s2 <= i1).GetType(), b.GetType()); + Assert.IsType((s2 <= l1).GetType(), b.GetType()); + Assert.IsType((s2 <= c1).GetType(), b.GetType()); + Assert.IsType((s2 <= s2).GetType(), b.GetType()); + Assert.IsType((s2 <= b2).GetType(), b.GetType()); + Assert.IsType((s2 <= i2).GetType(), b.GetType()); + Assert.IsType((s2 <= l2).GetType(), b.GetType()); + Assert.IsType((b2 <= s1).GetType(), b.GetType()); + Assert.IsType((b2 <= b1).GetType(), b.GetType()); + Assert.IsType((b2 <= i1).GetType(), b.GetType()); + Assert.IsType((b2 <= l1).GetType(), b.GetType()); + Assert.IsType((b2 <= c1).GetType(), b.GetType()); + Assert.IsType((b2 <= s2).GetType(), b.GetType()); + Assert.IsType((b2 <= b2).GetType(), b.GetType()); + Assert.IsType((b2 <= i2).GetType(), b.GetType()); + Assert.IsType((i2 <= s1).GetType(), b.GetType()); + Assert.IsType((i2 <= b1).GetType(), b.GetType()); + Assert.IsType((i2 <= i1).GetType(), b.GetType()); + Assert.IsType((i2 <= l1).GetType(), b.GetType()); + Assert.IsType((i2 <= c1).GetType(), b.GetType()); + Assert.IsType((i2 <= s2).GetType(), b.GetType()); + Assert.IsType((i2 <= b2).GetType(), b.GetType()); + Assert.IsType((i2 <= i2).GetType(), b.GetType()); + Assert.IsType((i2 <= l2).GetType(), b.GetType()); + Assert.IsType((l2 <= b1).GetType(), b.GetType()); + Assert.IsType((l2 <= c1).GetType(), b.GetType()); + Assert.IsType((l2 <= s2).GetType(), b.GetType()); + Assert.IsType((l2 <= i2).GetType(), b.GetType()); + Assert.IsType((l2 <= l2).GetType(), b.GetType()); + } + } + public class ValueIntegralTestClass63 + { + public static void testMethod() + { + int intRet = 0; + ushort s1 = 2; + sbyte b1 = 3; + uint i1 = 4; + ulong l1 = 5L; + int i = 1; + + Assert.IsType((s1 << 1).GetType(), i.GetType()); + Assert.IsType((b1 << 1).GetType(), i.GetType()); + Assert.IsType((i1 << 1).GetType(), i1.GetType()); + Assert.IsType((l1 << 1).GetType(), l1.GetType()); + } + } + public class ValueIntegralTestClass64 + { + public static void testMethod() + { + int intRet = 0; + ushort s1 = 2; + sbyte b1 = 3; + uint i1 = 4; + ulong l1 = 5L; + int i = 1; + + Assert.IsType((s1 >> 1).GetType(), i.GetType()); + Assert.IsType((b1 >> 1).GetType(), i.GetType()); + Assert.IsType((i1 >> 1).GetType(), i1.GetType()); + Assert.IsType((l1 >> 1).GetType(), l1.GetType()); + } + } + public class ValueIntegralTestClass70 + { + public static void testMethod() + { + char c = (char)10; + Assert.Equal(c, '\x000a'); + } + } + + } +} diff --git a/Tests/NFUnitTestTypes/UnitTestValueSimpleTests.cs b/Tests/NFUnitTestTypes/UnitTestValueSimpleTests.cs new file mode 100644 index 00000000..4271917d --- /dev/null +++ b/Tests/NFUnitTestTypes/UnitTestValueSimpleTests.cs @@ -0,0 +1,220 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestTypes +{ + [TestClass] + class UnitTestValueSimpleTests + { + [TestMethod] + public void ValueSimple01_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" byte is an alias for System.Byte"); + ValueSimpleTestClass01.testMethod(); + } + [TestMethod] + public void ValueSimple02_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" char is an alias for System.Char"); + ValueSimpleTestClass02.testMethod(); + } + [TestMethod] + public void ValueSimple03_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" short is an alias for System.Int16"); + ValueSimpleTestClass03.testMethod(); + } + [TestMethod] + public void ValueSimple04_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" int is an alias for System.Int32"); + ValueSimpleTestClass04.testMethod(); + } + [TestMethod] + public void ValueSimple05_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" long is an alias for System.Int64"); + ValueSimpleTestClass05.testMethod(); + } + [TestMethod] + public void ValueSimple06_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" float is an alias for System.Single"); + ValueSimpleTestClass06.testMethod(); + } + [TestMethod] + public void ValueSimple07_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" double is an alias for System.Double"); + ValueSimpleTestClass07.testMethod(); + } + [TestMethod] + public void ValueSimple09_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" bool is an alias for System.Boolean"); + ValueSimpleTestClass09.testMethod(); + } + [TestMethod] + public void ValueSimple11_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" A simple type and the structure type it aliases are completely indistinguishable."); + Debug.WriteLine(" In other words, writing the reserved work byte is exactly the same as writing "); + Debug.WriteLine(" System.Byte, and writing System.Int32 is exactly the same as writing the reserved"); + Debug.WriteLine(" word int."); + ValueSimpleTestClass11.testMethod(); + } + [TestMethod] + public void ValueSimple12_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" Because a simple type aliases a struct type, every simple type has members."); + ValueSimpleTestClass12.testMethod(); + } + [TestMethod] + public void ValueSimple13_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" sbyte is an alias for System.SByte"); + ValueSimpleTestClass13.testMethod(); + } + [TestMethod] + public void ValueSimple14_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" ushort is an alias for System.UInt16"); + ValueSimpleTestClass14.testMethod(); + } + [TestMethod] + public void ValueSimple15_Test() + { + Debug.WriteLine(" Section 4.1"); + Debug.WriteLine(" uint is an alias for System.UInt32"); + ValueSimpleTestClass15.testMethod(); + } + + + //Compiled Test Cases + public class ValueSimpleTestClass01 + { + public static void testMethod() + { + byte b = 0; + Assert.IsType(b.GetType(), Type.GetType("System.Byte")); + } + } + public class ValueSimpleTestClass02 + { + public static void testMethod() + { + char c = 'a'; + Assert.IsType(c.GetType(), Type.GetType("System.Char")); + } + } + public class ValueSimpleTestClass03 + { + public static void testMethod() + { + short s = 0; + Assert.IsType(s.GetType(), Type.GetType("System.Int16")); + } + } + public class ValueSimpleTestClass04 + { + public static void testMethod() + { + int i = 0; + Assert.IsType(i.GetType(), Type.GetType("System.Int32")); + } + } + public class ValueSimpleTestClass05 + { + public static void testMethod() + { + long l = 0L; + Assert.IsType(l.GetType(), Type.GetType("System.Int64")); + } + } + public class ValueSimpleTestClass06 + { + public static void testMethod() + { + float f = 0.0f; + Assert.IsType(f.GetType(), Type.GetType("System.Single")); + } + } + public class ValueSimpleTestClass07 + { + public static void testMethod() + { + double d = 0.0d; + Assert.IsType(d.GetType(), Type.GetType("System.Double")); + } + } + public class ValueSimpleTestClass09 + { + public static void testMethod() + { + bool b = true; + Assert.IsType(b.GetType(), Type.GetType("System.Boolean")); + } + } + public class ValueSimpleTestClass11 + { + public static void testMethod() + { + System.Byte b = 2; + System.Int32 i = 2; + Assert.Equal(b, (System.Byte)2); + Assert.Equal(i, 2); + } + } + public class ValueSimpleTestClass12 + { + public static void testMethod() + { + int i = int.MaxValue; + Assert.Equal(i, Int32.MaxValue); + string s = i.ToString(); + Assert.True(s.Equals(Int32.MaxValue.ToString())); + i = 123; + string t = 123.ToString(); + Assert.True(t.Equals(i.ToString())); + } + } + public class ValueSimpleTestClass13 + { + public static void testMethod() + { + sbyte b = 0; + Assert.IsType(b.GetType(), Type.GetType("System.SByte")); + } + } + public class ValueSimpleTestClass14 + { + public static void testMethod() + { + ushort s = 0; + Assert.IsType(s.GetType(), Type.GetType("System.UInt16")); + } + } + public class ValueSimpleTestClass15 + { + public static void testMethod() + { + uint i = 0; + Assert.IsType(i.GetType(), Type.GetType("System.UInt32")); + } + } + + } +} diff --git a/Tests/NFUnitTestTypes/UnitTestValueTests.cs b/Tests/NFUnitTestTypes/UnitTestValueTests.cs new file mode 100644 index 00000000..59934279 --- /dev/null +++ b/Tests/NFUnitTestTypes/UnitTestValueTests.cs @@ -0,0 +1,78 @@ +using nanoFramework.TestFramework; +using System; + +namespace NFUnitTestTypes +{ + [TestClass] + class UnitTestValueTests + { + [TestMethod] + public void Value7_Test() + { + ValueTestClass7.testMethod(); + } + + [TestMethod] + public void Value8_Test() + { + ValueTestClass8.testMethod(); + } + + [TestMethod] + public void Value9_Test() + { + ValueTestClass9.testMethod(); + } + + //Compiled Test Cases + public struct ValueTestClass7_Struct + { + public int MyInt; + } + + public class ValueTestClass7 + { + public static void testMethod() + { + ValueTestClass7_Struct MS = new ValueTestClass7_Struct(); + ValueTestClass7_Struct MS2; + + MS.MyInt = 3; + MS2 = MS; + MS.MyInt = 4; + + Assert.Equal(MS2.MyInt, 3); + } + } + + public class ValueTestClass8 + { + public static void testMethod() + { + int MyInt; + int MyInt2; + + MyInt = 3; + MyInt2 = MyInt; + MyInt = 4; + Assert.Equal(MyInt2, 3); + } + } + + enum ValueTestClass9_Enum { a = 1, b = 2 } + + public class ValueTestClass9 + { + public static void testMethod() + { + ValueTestClass9_Enum Enum1; + ValueTestClass9_Enum Enum2; + Enum1 = ValueTestClass9_Enum.a; + Enum2 = Enum1; + Enum1 = ValueTestClass9_Enum.b; + Assert.Equal((int)Enum2, (int)ValueTestClass9_Enum.a); + } + } + + } +} diff --git a/Tests/NFUnitTestTypes/nano.runsettings b/Tests/NFUnitTestTypes/nano.runsettings new file mode 100644 index 00000000..fa881e3a --- /dev/null +++ b/Tests/NFUnitTestTypes/nano.runsettings @@ -0,0 +1,14 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + False + + \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/packages.config b/Tests/NFUnitTestTypes/packages.config new file mode 100644 index 00000000..1adb9284 --- /dev/null +++ b/Tests/NFUnitTestTypes/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 57413be1..1eb7426e 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -21,6 +21,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestBitConverter", "T EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestVariables", "Tests\NFUnitTestVariables\NFUnitTestVariables.nfproj", "{6D93536D-2CFC-4BB8-B490-080EB11D40DD}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestTypes", "Tests\NFUnitTestTypes\NFUnitTestTypes.nfproj", "{05B18D3A-F70D-4104-8F78-FDC577E11081}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -47,6 +49,12 @@ Global {6D93536D-2CFC-4BB8-B490-080EB11D40DD}.Release|Any CPU.ActiveCfg = Release|Any CPU {6D93536D-2CFC-4BB8-B490-080EB11D40DD}.Release|Any CPU.Build.0 = Release|Any CPU {6D93536D-2CFC-4BB8-B490-080EB11D40DD}.Release|Any CPU.Deploy.0 = Release|Any CPU + {05B18D3A-F70D-4104-8F78-FDC577E11081}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {05B18D3A-F70D-4104-8F78-FDC577E11081}.Debug|Any CPU.Build.0 = Debug|Any CPU + {05B18D3A-F70D-4104-8F78-FDC577E11081}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {05B18D3A-F70D-4104-8F78-FDC577E11081}.Release|Any CPU.ActiveCfg = Release|Any CPU + {05B18D3A-F70D-4104-8F78-FDC577E11081}.Release|Any CPU.Build.0 = Release|Any CPU + {05B18D3A-F70D-4104-8F78-FDC577E11081}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -54,6 +62,7 @@ Global GlobalSection(NestedProjects) = preSolution {8D47514F-552C-4862-961F-0CAA315A231F} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {6D93536D-2CFC-4BB8-B490-080EB11D40DD} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {05B18D3A-F70D-4104-8F78-FDC577E11081} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From b869b003ed33bb705baff08f7e01539dc3ac8f3e Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Sun, 28 Feb 2021 12:56:21 +0300 Subject: [PATCH 21/55] adding thread part 1 --- Tests/NFUnitTestCoreLibrary/BitConverter.cs | 8 +- Tests/NFUnitTestCoreLibrary/Helpers.cs | 8 +- .../NFUnitTestThread/NFUnitTestThread.nfproj | 60 + .../Properties/AssemblyInfo.cs | 33 + Tests/NFUnitTestThread/UnitTestThreadTest.cs | 1206 +++++++++++++++++ Tests/NFUnitTestThread/nano.runsettings | 14 + Tests/NFUnitTestThread/packages.config | 5 + .../UnitTestValueArrayTypess.cs | 6 + .../UnitTestValueDefultConstTests.cs | 8 +- .../UnitTestValueFloatTests.cs | 8 +- .../UnitTestValueIntegralTests.cs | 8 +- .../UnitTestValueSimpleTests.cs | 8 +- Tests/NFUnitTestTypes/UnitTestValueTests.cs | 8 +- Tests/NFUnitTestVariables/CategoryTests.cs | 6 + Tests/NFUnitTestVariables/VariableTests.cs | 8 +- nanoFramework.CoreLibrary.sln | 9 + 16 files changed, 1395 insertions(+), 8 deletions(-) create mode 100644 Tests/NFUnitTestThread/NFUnitTestThread.nfproj create mode 100644 Tests/NFUnitTestThread/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestThread/UnitTestThreadTest.cs create mode 100644 Tests/NFUnitTestThread/nano.runsettings create mode 100644 Tests/NFUnitTestThread/packages.config diff --git a/Tests/NFUnitTestCoreLibrary/BitConverter.cs b/Tests/NFUnitTestCoreLibrary/BitConverter.cs index 27b61d10..55239dbe 100644 --- a/Tests/NFUnitTestCoreLibrary/BitConverter.cs +++ b/Tests/NFUnitTestCoreLibrary/BitConverter.cs @@ -1,4 +1,10 @@ -using nanoFramework.TestFramework; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/Tests/NFUnitTestCoreLibrary/Helpers.cs b/Tests/NFUnitTestCoreLibrary/Helpers.cs index ff31afd0..1260c85f 100644 --- a/Tests/NFUnitTestCoreLibrary/Helpers.cs +++ b/Tests/NFUnitTestCoreLibrary/Helpers.cs @@ -1,4 +1,10 @@ -using System; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using System; namespace NFUnitTestCoreLibrary { diff --git a/Tests/NFUnitTestThread/NFUnitTestThread.nfproj b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj new file mode 100644 index 00000000..544665e4 --- /dev/null +++ b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj @@ -0,0 +1,60 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + bdbfd5e3-46c4-4acd-b66c-60f00618fd91 + Library + Properties + 512 + NFUnitTestThread + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestThread/Properties/AssemblyInfo.cs b/Tests/NFUnitTestThread/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestThread/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestThread/UnitTestThreadTest.cs b/Tests/NFUnitTestThread/UnitTestThreadTest.cs new file mode 100644 index 00000000..14e59cc0 --- /dev/null +++ b/Tests/NFUnitTestThread/UnitTestThreadTest.cs @@ -0,0 +1,1206 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using System.Threading; + +namespace NFUnitTestThread +{ + [TestClass] + public class ThreadTest + { + class Work + { + public static void DoWork() + { + Thread.Sleep(300); + Debug.WriteLine("Static thread procedure DoWork."); + Thread.Sleep(300); + } + public int m_data = 0; + public Thread currThread; + public void DoMoreWork() + { + Debug.WriteLine("Instance thread procedure DoMoreWork. Data= " + m_data); + currThread = Thread.CurrentThread; + } + public static void DoWorkAbort() + { + Thread.Sleep(300); + Debug.WriteLine("Static thread procedure DoWorkAbort."); + Thread.Sleep(10000); + } + public Thread m_toJoin = null; + public void DoWorkJoin() + { + m_toJoin.Join(); + Debug.WriteLine("Instance thread procedure DoWorkJoin."); + } + + public static bool hasAborted = false; + public static void DoWorkThreadAbortException() + { + while (!hasAborted) + { + try + { + while (true) ; + } + catch (ThreadAbortException e) + { + hasAborted = true; + Debug.WriteLine("Thread State = " + Thread.CurrentThread.ThreadState); + Debug.WriteLine("verifying ThreadAbortException named " + e.ToString() + " is thrown"); + } + } + } + + public static bool run = false; + public void DoWorkThreadState() + { + while (run) + ; + } + } + + [TestMethod] + public void Threading_Basic_Test1() + { + /// + /// 1. Starts two threads + /// 2. Verifies that they execute in a reasonable time + /// + /// + Debug.WriteLine("Starting a thread without explicit declaration of ThreadStart Delegate"); + Debug.WriteLine("Starts two threads, waits for them to complete and passes, "); + Debug.WriteLine("this may erroneously fail for extremely slow devices."); + Debug.WriteLine("All other threading tests are dependant on this, if this fails, "); + Debug.WriteLine("all other results are invalid."); + + Debug.WriteLine("Starting thread 1"); + Thread newThread1 = new Thread(Work.DoWork); + newThread1.Start(); + + Debug.WriteLine("Starting thread 2"); + Work w = new Work(); + w.m_data = 42; + Thread newThread2 = new Thread(w.DoMoreWork); + newThread2.Start(); + Thread.Sleep(1); + + Debug.WriteLine("Waiting for them to finish"); + int slept = 0; + while ((newThread1.ThreadState != ThreadState.Stopped + || newThread2.ThreadState != ThreadState.Stopped) && slept < 1000) + { + Thread.Sleep(100); + slept += 100; + } + if (!(newThread1.ThreadState == ThreadState.Stopped && + newThread2.ThreadState == ThreadState.Stopped)) + { + Debug.WriteLine("The threads took more than 1000msec to come to Stopped state"); + throw new Exception("The threads took more than 1000msec to come to Stopped state"); + } + } + + [TestMethod] + public void Threading_ThreadStart_Test2() + { + /// + /// 1. Starts two threads with ThreadStart Delegate, + /// 2. Verifies that they execute in a reasonable time + /// + /// + Debug.WriteLine("Starts two threads with ThreadStart Delegate,"); + Debug.WriteLine("waits for them to complete and passes, "); + Debug.WriteLine("this may erroneously fail for extremely slow devices."); + Debug.WriteLine("This explicit declaration is not necessary as of .Net 2.0"); + + ThreadStart threadDelegate = new ThreadStart(Work.DoWork); + Thread newThread1 = new Thread(threadDelegate); + Debug.WriteLine("Starting thread 1"); + newThread1.Start(); + Work w = new Work(); + w.m_data = 42; + threadDelegate = new ThreadStart(w.DoMoreWork); + Thread newThread2 = new Thread(threadDelegate); + Debug.WriteLine("Starting thread 2"); + newThread2.Start(); + Thread.Sleep(1); + + Debug.WriteLine("Waiting for them to complete"); + int slept = 0; + while ((newThread1.ThreadState != ThreadState.Stopped + || newThread2.ThreadState != ThreadState.Stopped) && slept < 1000) + { + Thread.Sleep(100); + slept += 100; + } + if (!(newThread1.ThreadState == ThreadState.Stopped + && newThread2.ThreadState == ThreadState.Stopped)) + { + Debug.WriteLine("The threads took more than 1000msec to come to Stopped state"); + throw new Exception("The threads took more than 1000msec to come to Stopped state"); + } + } + + [TestMethod] + public void Threading_Abort_Test3() + { + /// + /// 1. Starts two threads one of which has a very long execution time + /// 2. Calls Abort on the long thread + /// 3. Verifies that the aborted thread stops immediately + /// 4. Verifies that the short thread finishes normally + /// + /// + Debug.WriteLine("Starting long thread"); + Thread newThread1 = new Thread(Work.DoWorkAbort); + newThread1.Start(); + + Debug.WriteLine("Starting short thread"); + Work w = new Work(); + w.m_data = 42; + Thread newThread2 = new Thread(w.DoMoreWork); + newThread2.Start(); + Thread.Sleep(1); + + Debug.WriteLine("Aborting long thread and verifying it's Aborted"); + newThread1.Abort(); + ThreadState tState = newThread1.ThreadState; + if (tState != ThreadState.Aborted + && newThread1.ThreadState != ThreadState.Stopped) + { + Debug.WriteLine("Expected long thread state Aborted/Stopped '" + ThreadState.Aborted + + "/" + ThreadState.Stopped + "' but got '" + tState + "'"); + throw new Exception("Expected long thread state Aborted/Stopped '" + ThreadState.Aborted + + "/" + ThreadState.Stopped + "' but got '" + tState + "'"); + } + int slept = 0; + + Debug.WriteLine("Waiting for 1 or both threads to finish"); + while ((newThread1.ThreadState != ThreadState.Stopped || + newThread2.ThreadState != ThreadState.Stopped) && slept < 1000) + { + Thread.Sleep(100); + slept += 100; + } + ThreadState tState1 = newThread1.ThreadState, tState2 = newThread2.ThreadState; + if (tState1 != ThreadState.Stopped || tState2 != ThreadState.Stopped) + { + Debug.WriteLine("Expected both threads in Stopped state '" + ThreadState.Stopped + + "' but got Thread1 in '" + tState1 + "' and Thread2 in '" + tState2 + "'"); + throw new Exception("Expected both threads in Stopped state '" + ThreadState.Stopped + + "' but got Thread1 in '" + tState1 + "' and Thread2 in '" + tState2 + "'"); + } + Debug.WriteLine("This is Fixed, see 17343 for details"); + } + + [TestMethod] + public void Threading_IsAlive_Test4() + { + /// + /// 1. Starts two threads one of which has a very long execution time + /// 2. Calls Abort() on the long thread + /// 3. Verifies that the aborted thread stops immediately using the IsAlive Property + /// 4. Verifies that the short thread finishes normally using the IsAlive Property + /// + /// + + Debug.WriteLine("Starts two threads, aborts one and verifies the IsAlive property, "); + Debug.WriteLine("this may erroneously fail for extremely slow devices."); + Debug.WriteLine("Starting long thread and verifying it's alive"); + Thread newThread1 = new Thread(Work.DoWorkAbort); + newThread1.Start(); + + Debug.WriteLine("Starting short thread"); + Work w = new Work(); + w.m_data = 42; + Thread newThread2 = new Thread(w.DoMoreWork); + newThread2.Start(); + if (!newThread1.IsAlive) + { + Debug.WriteLine("Long thread not alive"); + throw new Exception("Long thread not alive"); + } + Debug.WriteLine("Aborting long thread, waiting and verifying both threads are dead"); + newThread1.Abort(); + int slept = 0; + while ((newThread1.IsAlive || newThread2.IsAlive) && slept < 1000) + { + Thread.Sleep(100); + slept += 100; + } + + if (newThread1.IsAlive || newThread2.IsAlive) + { + Debug.WriteLine("Expected both threads dead but got long thread '" + + newThread1.ThreadState + "' and short thread '" + newThread2.ThreadState + "'"); + throw new Exception("Expected both threads dead but got long thread '" + + newThread1.ThreadState + "' and short thread '" + newThread2.ThreadState + "'"); + } + } + + [TestMethod] + public void Threading_Join_Test5() + { + /// + /// 1. Starts a thread + /// 2. Starts a second thread that Join()s the first + /// 3. Verifies that they finish in a reasonable amount of time + /// + /// + + Debug.WriteLine("Starts two threads, the second thread Join()s the first"); + Debug.WriteLine("Verifies they finish in a reasonable amount of time"); + Debug.WriteLine("this may erroneously fail for extremely slow or fast devices."); + + Thread newThread1 = new Thread(Work.DoWork); + newThread1.Start(); + + Work w = new Work(); + w.m_data = 42; + w.m_toJoin = newThread1; + Thread newThread2 = new Thread(w.DoWorkJoin); + newThread2.Start(); + Thread.Sleep(1); + int slept = 0; + while (newThread2.IsAlive && slept < 1000) + { + Thread.Sleep(100); + slept += 100; + } + if (newThread1.IsAlive || newThread2.IsAlive) + { + Debug.WriteLine("Expected both threads dead but got thread1 '" + newThread1.ThreadState + + "' and thread2 '" + newThread2.ThreadState + "'"); + throw new Exception("Expected both threads dead but got thread1 '" + newThread1.ThreadState + + "' and thread2 '" + newThread2.ThreadState + "'"); + } + } + + static class PriorityTest + { + static public ManualResetEvent loopSwitch = new ManualResetEvent(false); + static public ManualResetEvent startSecond = new ManualResetEvent(false); + static public ManualResetEvent keepAlive = new ManualResetEvent(false); + static public long resultLowest = 0; + static public long resultBelow = 0; + static public long resultNorm = 0; + static public long resultAbove = 0; + static public long resultHighest = 0; + static public long resultControl = 0; + + static public long resultNewLowest = 0; + static public long resultNewBelow = 0; + static public long resultNewNorm = 0; + static public long resultNewAbove = 0; + static public long resultNewHighest = 0; + static public long resultNewControl = 0; + + static public void ThreadMethodLowest() + { + long threadCount = 0; + long fakeCount = 0; + + while (!loopSwitch.WaitOne(0, false)) + { + threadCount++; + } + resultLowest = threadCount; + startSecond.WaitOne(); + while (!keepAlive.WaitOne(0, false)) + { + fakeCount++; + } + resultNewLowest = fakeCount; + } + static public void ThreadMethodBelow() + { + long threadCount = 0; + long fakeCount = 0; + + while (!loopSwitch.WaitOne(0, false)) + { + threadCount++; + } + resultBelow = threadCount; + startSecond.WaitOne(); + while (!keepAlive.WaitOne(0, false)) + { + fakeCount++; + } + resultNewBelow = fakeCount; + } + static public void ThreadMethodNorm() + { + long threadCount = 0; + long fakeCount = 0; + + while (!loopSwitch.WaitOne(0, false)) + { + threadCount++; + } + resultNorm = threadCount; + startSecond.WaitOne(); + while (!keepAlive.WaitOne(0, false)) + { + fakeCount++; + } + resultNewNorm = fakeCount; + } + static public void ThreadMethodAbove() + { + long threadCount = 0; + long fakeCount = 0; + + while (!loopSwitch.WaitOne(0, false)) + { + threadCount++; + } + resultAbove = threadCount; + startSecond.WaitOne(); + while (!keepAlive.WaitOne(0, false)) + { + fakeCount++; + } + resultNewAbove = fakeCount; + } + static public void ThreadMethodHighest() + { + long threadCount = 0; + long fakeCount = 0; + + while (!loopSwitch.WaitOne(0, false)) + { + threadCount++; + } + resultHighest = threadCount; + startSecond.WaitOne(); + while (!keepAlive.WaitOne(0, false)) + { + fakeCount++; + } + resultNewHighest = fakeCount; + } + static public void ThreadMethodControl() + { + long threadCount = 0; + long fakeCount = 0; + + while (!loopSwitch.WaitOne(0, false)) + { + threadCount++; + } + resultControl = threadCount; + startSecond.WaitOne(); + while (!keepAlive.WaitOne(0, false)) + { + fakeCount++; + } + resultNewControl = fakeCount; + } + } + + static Thread threadLowest = new Thread(PriorityTest.ThreadMethodLowest); + static Thread threadBelow = new Thread(PriorityTest.ThreadMethodBelow); + static Thread threadNorm = new Thread(PriorityTest.ThreadMethodNorm); + static Thread threadAbove = new Thread(PriorityTest.ThreadMethodAbove); + static Thread threadHighest = new Thread(PriorityTest.ThreadMethodHighest); + static Thread threadControl = new Thread(PriorityTest.ThreadMethodControl); + + public double Tolerance(long level1, long level2) + { + long temp = (level1 - level2); + temp = temp < 0 ? -temp : temp; + + return (level2 == 0) ? 100.0 : (temp * 100) / level2; + } + + [TestMethod] + public void Threading_Priority_Test6() + { + /// + /// 1. Starts five threads of increasing priority + /// 2. Waits for them to complete work + /// 3. Verifies that they get increasing amounts of attention + /// + /// + + const double acceptedTolerance = 5.0; // 5% tolerance + + Debug.WriteLine("Starts five threads of increasing priority and a control thread, priority not set "); + Debug.WriteLine("verifies that they get increasing amounts of attention"); + Debug.WriteLine("This is Fixed, see 17201 for details"); + + threadLowest.Priority = ThreadPriority.Lowest; + threadBelow.Priority = ThreadPriority.BelowNormal; + threadNorm.Priority = ThreadPriority.Normal; + threadAbove.Priority = ThreadPriority.AboveNormal; + threadHighest.Priority = ThreadPriority.Highest; + + Debug.WriteLine("Starting Threads"); + threadHighest.Start(); + threadAbove.Start(); + threadNorm.Start(); + threadBelow.Start(); + threadLowest.Start(); + threadControl.Start(); + + Debug.WriteLine("Allow counting for 1 seconds."); + Thread.Sleep(1000); + PriorityTest.loopSwitch.Set(); + Thread.Sleep(1000); + + Debug.WriteLine("Lowest " + PriorityTest.resultLowest); + Debug.WriteLine("Below " + PriorityTest.resultBelow); + Debug.WriteLine("Normal " + PriorityTest.resultNorm); + Debug.WriteLine("Above " + PriorityTest.resultAbove); + Debug.WriteLine("Highest " + PriorityTest.resultHighest); + Debug.WriteLine("Control Thread " + PriorityTest.resultControl); + + Debug.WriteLine("Verifies that each thread recieves attention less than or equal"); + Debug.WriteLine("to higher priority threads."); + Debug.WriteLine("Accepted tolerance : " + acceptedTolerance + "%"); + + PriorityTest.startSecond.Set(); + PriorityTest.keepAlive.Set(); + + if ((PriorityTest.resultLowest <= 0) || + (Tolerance(2 * PriorityTest.resultLowest, PriorityTest.resultBelow) > acceptedTolerance) || + (Tolerance(2 * PriorityTest.resultBelow, PriorityTest.resultNorm) > acceptedTolerance) || + (Tolerance(2 * PriorityTest.resultNorm, PriorityTest.resultAbove) > acceptedTolerance) || + (Tolerance(2 * PriorityTest.resultAbove, PriorityTest.resultHighest) > acceptedTolerance) || + (Tolerance(PriorityTest.resultNorm, PriorityTest.resultControl) > acceptedTolerance)) + { + Debug.WriteLine("Lowest thread should execute at least once, got " + PriorityTest.resultLowest); + Debug.WriteLine("Deviation b/n 2*Lowest and Below " + Tolerance(2 * PriorityTest.resultLowest, PriorityTest.resultBelow)); + Debug.WriteLine("Deviation b/n 2*Below and Normal " + Tolerance(2 * PriorityTest.resultBelow, PriorityTest.resultNorm)); + Debug.WriteLine("Deviation b/n 2*Normal and Above " + Tolerance(2 * PriorityTest.resultNorm, PriorityTest.resultAbove)); + Debug.WriteLine("Deviation b/n 2*Above and Highest " + Tolerance(2 * PriorityTest.resultAbove, PriorityTest.resultHighest)); + Debug.WriteLine("Deviation b/n Normal and Control " + Tolerance(PriorityTest.resultNorm, PriorityTest.resultControl)); + throw new Exception("Tolerance not met"); + } + } + + [TestMethod] + public void Threading_Suspend_Resume_Test7() + { + /// + /// 1. Starts two threads + /// 2. Suspends them + /// 3. Verifies that they do not terminate while suspended + /// 4. Resumes them + /// 5. Verifies that they finish in a reasonable amount of time + /// + /// + Debug.WriteLine("Starts two threads, suspends and resumes them, "); + Debug.WriteLine("this may erroneously fail for extremely slow devices."); + + Thread newThread1 = new Thread(Work.DoWork); + newThread1.Start(); + + Work w = new Work(); + w.m_data = 42; + w.m_toJoin = newThread1; + Thread newThread2 = new Thread(w.DoWorkJoin); + newThread2.Start(); + Thread.Sleep(1); + + newThread2.Suspend(); + newThread1.Suspend(); + ThreadState tState = newThread2.ThreadState; + if ((int)tState != 96) + { + Debug.WriteLine("expected Thread2 in WaitSleepJoin + Suspended ('96') but got '" + + tState + "'"); + throw new Exception("expected Thread2 in WaitSleepJoin + Suspended ('96') but got '" + + tState + "'"); + + } + newThread2.Resume(); + tState = newThread1.ThreadState; + if ((int)tState != 96) + { + Debug.WriteLine("expected Thread1 in WaitSleepJoin + Suspended ('96') but got '" + + tState + "'"); + throw new Exception("expected Thread1 in WaitSleepJoin + Suspended ('96') but got '" + + tState + "'"); + } + newThread1.Resume(); + + int slept = 0; + while ((newThread1.IsAlive || newThread2.IsAlive) && slept < 1000) + { + Thread.Sleep(100); + slept += 100; + } + if (newThread1.IsAlive || newThread2.IsAlive) + { + Debug.WriteLine("expected both threads dead after 1000msec but got thread1 '" + + newThread1.ThreadState + "' and thread2 '" + newThread2.ThreadState + "'"); + throw new Exception("expected both threads dead after 1000msec but got thread1 '" + + newThread1.ThreadState + "' and thread2 '" + newThread2.ThreadState + "'"); + } + } + + public static bool sleptCorrect(int Msec) + { + TimeSpan zeroDuration = new TimeSpan(0); + const long TicksPerMillisecond = TimeSpan.TicksPerMillisecond; + long startTime = DateTime.UtcNow.Ticks; + + Thread.Sleep(Msec); + long sleptSpan = DateTime.UtcNow.Ticks - startTime; + if ((sleptSpan / TicksPerMillisecond) < Msec) + { + Debug.WriteLine("Expected the thread slept for at least " + Msec + " Msec. but slept only for " + + (sleptSpan / TicksPerMillisecond) + " Msec"); + return false; + } + + Debug.WriteLine(Msec + " Msec sleep success, slept for " + + (sleptSpan / TicksPerMillisecond) + " Msec"); + return true; + } + + [TestMethod] + public void Threading_SleepApprox_Test8() + { + /// + /// 1. Sleeps the main thread for increasing amounts of time + /// 2. Verifies the thread sleeps at least for the time requested + /// + /// + Debug.WriteLine("This test verifies the thread slept at least for the amount of time required"); + Debug.WriteLine("This is Fixed, see 20831 for details"); + int[] sleepTime = new int[] { 10, 100, 1000, 10000, 60000 }; + for (int i = 0; i < sleepTime.Length; i++) + { + if (!sleptCorrect(sleepTime[i])) + { + throw new Exception("Thread didn't sleep enough"); + } + } + } + + [TestMethod] + public void Threading_Suspend_Suspend_Test9() + { + /// + /// 1. Starts two threads and suspends the first thread twice + /// 2. Gets the state of the 1st thread + /// 3. Resumes the 1st thread + /// 4. Verifies that calling Suspend for the 2nd time has no effect + /// + /// + + Debug.WriteLine("Starts two threads and suspends the first thread twice"); + Debug.WriteLine("Gets the state of the 1st thread"); + Debug.WriteLine("Resumes the 1st thread "); + Debug.WriteLine("Verifies that calling Suspend for the 2nd time has no effect"); + Debug.WriteLine("This is Fixed, see 20247 for details"); + Work.run = true; + Work w1 = new Work(); + Thread newThread1 = new Thread(w1.DoWorkThreadState); + newThread1.Start(); + newThread1.Suspend(); + newThread1.Suspend(); + + Work w2 = new Work(); + w2.m_data = 42; + Thread newThread2 = new Thread(w2.DoMoreWork); + newThread2.Start(); + + ThreadState tState = newThread1.ThreadState; + newThread1.Resume(); + newThread1.Abort(); + if (tState != ThreadState.Suspended) + { + Debug.WriteLine("Suspending twice, expected thread state Suspended(" + + ThreadState.Suspended + ") but got '" + tState + "'"); + throw new Exception("Suspending twice, expected thread state Suspended(" + + ThreadState.Suspended + ") but got '" + tState + "'"); + + } + } + + [TestMethod] + public void Threading_ThreadState_Unstarted_Running_WaitSleepJoin_Test10() + { + /// + /// 1. Creates a thread and verifies its state is Unstarted + /// 2. Starts a thread and verifies its state is Running + /// 3. Sleeps a thread and verifies its state is WaitSleepJoin + /// 4. Joins a thread and verifies its state is WaitSleepJoin + /// + /// + + Debug.WriteLine("Creating a thread and verifing its state is Unstarted"); + Thread newThread1 = new Thread(Work.DoWork); + ThreadState tState = newThread1.ThreadState; + if (tState != ThreadState.Unstarted) + { + Debug.WriteLine("Expected thread state Unstarted(" + ThreadState.Unstarted + + ") but got '" + tState + "'"); + throw new Exception("Expected thread state Unstarted(" + ThreadState.Unstarted + + ") but got '" + tState + "'"); + } + + Debug.WriteLine("Verifying the state of the current thread is Running"); + newThread1.Start(); + tState = Thread.CurrentThread.ThreadState; + if (tState != ThreadState.Running) + { + Debug.WriteLine("expected the state of current thread Running(" + ThreadState.Running + + ") but got '" + tState + "'"); + throw new Exception("expected the state of current thread Running(" + ThreadState.Running + + ") but got '" + tState + "'"); + } + + Debug.WriteLine("Sleeping a thread and verifing its state is WaitSleepJoin"); + Thread.Sleep(100); + tState = newThread1.ThreadState; + if (tState != ThreadState.WaitSleepJoin) + { + Debug.WriteLine("expected thread1 in WaitSleepJoin(" + ThreadState.WaitSleepJoin + + ") but got '" + newThread1.ThreadState + "'"); + throw new Exception("expected thread1 in WaitSleepJoin(" + ThreadState.WaitSleepJoin + + ") but got '" + newThread1.ThreadState + "'"); + } + Debug.WriteLine(" Joining a thread and verifing its state is WaitSleepJoin"); + Work w = new Work(); + Thread newThread3 = new Thread(Work.DoWork); + w.m_toJoin = newThread3; + Thread newThread2 = new Thread(w.DoWorkJoin); + newThread3.Start(); + newThread2.Start(); + Thread.Sleep(0); + tState = newThread2.ThreadState; + if (tState != ThreadState.WaitSleepJoin) + { + Debug.WriteLine("expected a joined sleeping thread in WaitSleepJoin state(" + + ThreadState.WaitSleepJoin + ") but got '" + tState + "'"); + throw new Exception("expected a joined sleeping thread in WaitSleepJoin state(" + + ThreadState.WaitSleepJoin + ") but got '" + tState + "'"); + } + } + + [TestMethod] + public void Threading_ThreadState_Suspend_Test11() + { + /// + /// 1. Starts a thread and Suspends it immediately + /// 2. Starts a second thread + /// 3. Gets the state of the 1st thread and Resumes it + /// 4. Verifies that the state of the 1st thread was Suspended + /// + /// + + Debug.WriteLine("Starts a thread and Suspends it immediately"); + Debug.WriteLine("Starts a second thread"); + Debug.WriteLine("Gets the state of the 1st thread and Resumes it"); + Debug.WriteLine("Verifies that the state of the 1st thread was Suspended"); + Debug.WriteLine("This is Fixed, see 20249 for details"); + Work.run = true; + Work w1 = new Work(); + Thread newThread1 = new Thread(w1.DoWorkThreadState); + newThread1.Start(); + newThread1.Suspend(); + + Work w2 = new Work(); + w2.m_data = 42; + Thread newThread2 = new Thread(w2.DoMoreWork); + newThread2.Start(); + + ThreadState tState = newThread1.ThreadState; + newThread1.Resume(); + newThread1.Abort(); + if (tState != ThreadState.Suspended) + { + Debug.WriteLine("expected state Suspended(" + ThreadState.Suspended + ") but got '" + tState + "'"); + throw new Exception("expected state Suspended(" + ThreadState.Suspended + ") but got '" + tState + "'"); + } + } + + [TestMethod] + public void Threading_ThreadState_SuspendRequested_Test12() + { + /// + /// 1. Starts 10 threads and Suspends all of them + /// 2. Immediately verifies the state is SuspendRequested + /// 3. It's an approximate test + /// + /// + + Debug.WriteLine("This currently fails, see 20737 for details"); + Debug.WriteLine("Starting 10 Threads"); + Thread[] newThread = new Thread[10]; + Work[] w = new Work[10]; + int i = 0, k = 0; + Work.run = true; + while (i < 10) + { + w[i] = new Work(); + newThread[i] = new Thread(w[i].DoWorkThreadState); + newThread[i].Start(); + i++; + } + Debug.WriteLine("Suspending the Threads and checking for SuspendRequested"); + Debug.WriteLine("At least one of the threads should be in SuspendRequested"); + while (k < 10) + { + while (newThread[k].ThreadState != ThreadState.Suspended) + { + newThread[k].Suspend(); + if (newThread[k].ThreadState == ThreadState.SuspendRequested) + { + throw new Exception("Thread not properly susended"); + break; + } + } + newThread[k].Resume(); + k++; + } + k--; + while (k >= 0) + { + newThread[k].Abort(); + k--; + } + Work.run = false; + } + + [TestMethod] + public void Threading_ThreadState_Abort_Stopped_Test13() + { + /// + /// 1. Starts a thread and Aborts it immediately + /// 2. Starts a second thread + /// 3. Gets the state of the 1st thread thread + /// 4. Verifies the state of the 1st thread is Aborted + /// + /// + + Debug.WriteLine("Starts a thread and Aborts it immediately"); + Debug.WriteLine("Starts a second thread"); + Debug.WriteLine("Gets the state of the 1st thread"); + Debug.WriteLine("Verifies the state of the 1st thread is Aborted"); + Debug.WriteLine("This is Fixed, see 20495 for details"); + + DateTime t1, t2; + TimeSpan period; + Thread newThread1 = new Thread(Work.DoWork); + newThread1.Start(); + newThread1.Abort(); + t1 = DateTime.UtcNow; + + Work w = new Work(); + w.m_data = 42; + Thread newThread2 = new Thread(w.DoMoreWork); + newThread2.Start(); + Debug.WriteLine("Pass Requires either of the next two compared values to be equal"); + Debug.WriteLine(newThread1.ThreadState + " Compare to " + ThreadState.Aborted); + Debug.WriteLine(newThread1.ThreadState + " Compare to " + ThreadState.Stopped); + t2 = DateTime.UtcNow; + ThreadState tState = newThread1.ThreadState; + period = t2 - t1; + Debug.WriteLine("Waited for at least " + period.Milliseconds.ToString() + " before checking the state"); + if (tState != ThreadState.Aborted && tState != ThreadState.Stopped) + { + Debug.WriteLine("expected the thread to be in Aborted/Stopped(" + ThreadState.Aborted + + "/" + ThreadState.Stopped + ") state but got '" + tState + "'"); + throw new Exception("expected the thread to be in Aborted/Stopped(" + ThreadState.Aborted + + "/" + ThreadState.Stopped + ") state but got '" + tState + "'"); + } + } + + [TestMethod] + public void Threading_Abort_ThreadStateException_Test14() + { + /// + /// 1. Creates a thread, Aborts it without starting it + /// 2. Verifies Exception is thrown. + /// + /// + + Debug.WriteLine("The type of exception thrown should be ThreadStateException"); + Thread newThread1 = new Thread(Work.DoWork); + try + { + Debug.WriteLine("Aborting a thread not started should throw exception"); + newThread1.Abort(); + } + catch (Exception e) + { + Debug.WriteLine("Correctly threw " + e.ToString() + " in an attempt to Abort Unstarted thread"); + return; + } + + throw new Exception("Not Correctly threw Exception in an attempt to Abort Unstarted thread"); + } + + [TestMethod] + public void Threading_Abort_ThreadAbortException_Test15() + { + /// + /// 1. starts a thread and Aborts it immediately + /// 2. verifies ThreadAbortException is thrown + /// + /// + + Work.hasAborted = false; + Thread newThread1 = new Thread(Work.DoWorkThreadAbortException); + Debug.WriteLine("This is Fixed, see 20743 for details"); + Debug.WriteLine("starting a thread and Aborting it immediately"); + newThread1.Start(); + Thread.Sleep(50); + newThread1.Abort(); + Thread.Sleep(500); + Debug.WriteLine("Verifying"); + if (!Work.hasAborted) + { + Debug.WriteLine("Aborting a Thread didn't throw ThreadAbortException"); + throw new Exception("Aborting a Thread didn't throw ThreadAbortException"); + } + } + + [TestMethod] + public void Threading_Join_Timeout_Test16() + { + /// + /// 1. Starts two threads + /// 2. both threads joins the main thread using Join(int millisecondsTimeout) Join(TimeSpan timeout) + /// 3. Verifies the calling thread is blocked until the specified amount of time elapses + /// + /// + + Debug.WriteLine("Starts two threads"); + Debug.WriteLine("Both threads Joins the main thread"); + Debug.WriteLine("verify calling thread (main thread) is blocked for millisecondsTimeout"); + Debug.WriteLine("This is fixed, see 20739 for details"); + Work.run = true; + Work w = new Work(); + + Thread newThread1 = new Thread(w.DoWorkThreadState); + newThread1.Start(); + Thread.Sleep(50); + DateTime d1 = DateTime.UtcNow; + newThread1.Join(250); + DateTime d2 = DateTime.UtcNow; + TimeSpan duration1 = d2 - d1; + newThread1.Abort(); + Thread newThread2 = new Thread(w.DoWorkThreadState); + newThread2.Start(); + Thread.Sleep(50); + DateTime d3 = DateTime.UtcNow; + newThread1.Join(new TimeSpan(0, 0, 0, 0, 250)); + DateTime d4 = DateTime.UtcNow; + TimeSpan duration2 = d4 - d3; + newThread2.Abort(); + int result1 = duration1.CompareTo(new TimeSpan(0, 0, 0, 0, 250)); + int result2 = duration1.CompareTo(new TimeSpan(0, 0, 0, 0, 250)); + if (result1 < 0 || result2 < 0) + { + Debug.WriteLine("expected the main thread to be blocked at least for '250' msec. but was blocked for '" + + duration1.ToString() + "' by Thread1 and '" + duration2.ToString() + "' by Thread2"); + throw new Exception("expected the main thread to be blocked at least for '250' msec. but was blocked for '" + + duration1.ToString() + "' by Thread1 and '" + duration2.ToString() + "' by Thread2"); + } + } + + [TestMethod] + public void Threading_Join_ArgumentOutOfRangeException_Test17() + { + /// + /// 1. Start a thread that Join(TimeSpan timeout)s passing negative value + /// 2. Verify ArgumentOutOfRangeException is thrown + /// + + Thread newThread1 = new Thread(Work.DoWork); + newThread1.Start(); + Assert.Trows(typeof(ArgumentOutOfRangeException), () => { newThread1.Join(-77); }); + } + + [TestMethod] + public void Threading_Sleep_ArgumentOutOfRangeException_Test18() + { + /// + /// 1. Sleep a thread passing a negative argument + /// 2. Verify ArgumentOutOfRangeException exception is thrown + /// + /// + + Debug.WriteLine("Verify ArgumentOutOfRangeException exception is thrown"); + Debug.WriteLine("Why not for -1 ?"); + Assert.Trows(typeof(ArgumentOutOfRangeException), () => { Thread.Sleep(-2); }); + } + + [TestMethod] + public void Threading_Join_ThreadStateException_Test19() + { + /// + /// 1. Join a thread that is not Started + /// 2. verify ThreadStateException is thrown + /// + /// + + Debug.WriteLine("The type of exception thrown should be ThreadStateException"); + Thread newThread1 = new Thread(Work.DoWork); + Assert.Trows(typeof(Exception), () => { newThread1.Join(); }); + } + + [TestMethod] + public void Threading_Suspend_ThreadStateException_Test20() + { + /// + /// 1. Suspend a thread that is not Started + /// 2. verify ThreadStateException is thrown + /// + /// + + Debug.WriteLine("The type of exception thrown should be ThreadStateException"); + Thread newThread1 = new Thread(Work.DoWork); + Assert.Trows(typeof(Exception), () => { newThread1.Suspend(); }); + } + + [TestMethod] + public void Threading_Resume_ThreadStateException_Test21() + { + + /// + /// 1. Resume a thread that is not Started + /// 2. verify ThreadStateException is thrown + /// + /// + + Debug.WriteLine("The type of exception thrown should be ThreadStateException"); + Thread newThread1 = new Thread(Work.DoWork); + Assert.Trows(typeof(Exception), () => { newThread1.Resume(); }); + } + + static bool sleepZero = false; + static bool sleepResult = false; + public static void SleepTest() + { + while (sleepZero) + sleepResult = true; + } + + [TestMethod] + public void Threading_Sleep_Zero_Test22() + { + /// + /// 1. Start a thread, + /// 2. Sleep the main thread for 0 (zero) milliseconds and + /// 3. verify that thread rescheduling is taken place right away + /// + /// + + Debug.WriteLine("Starting a thread , Thread.Sleep(0) on the main thread"); + Debug.WriteLine("Verify the thread is immediately scheduled to execute"); + Debug.WriteLine("This is fixed, see 20753 for details"); + sleepZero = true; + Thread t1 = new Thread(new ThreadStart(SleepTest)); + t1.Start(); + Thread.Sleep(50); + sleepResult = false; + Thread.Sleep(0); + if (!sleepResult) + { + Debug.WriteLine("Test Thread.Sleep(0) Failed"); + throw new Exception("Test Thread.Sleep(0) Failed"); + } + else + { + Debug.WriteLine("Test Thread.Sleep(0) Successful"); + } + sleepZero = false; + } + + [TestMethod] + public void Threading_Priority_Change_Test23() + { + /// + /// 1. Starts five threads of increasing priority + /// 2. Change their priorities to different levels + /// 3. Verifies that they get increasing amounts of attention + /// 4. based on their new priority level. + /// + /// + + const double acceptedTolerance = 5.0; // 5% tolerance + Debug.WriteLine("Starts five threads of increasing priority and "); + Debug.WriteLine("a control thread priority not set "); + Debug.WriteLine("verifies that they get increasing amounts of attention"); + + PriorityTest.loopSwitch.Reset(); + PriorityTest.startSecond.Reset(); + PriorityTest.keepAlive.Reset(); + + Thread threadLowest = new Thread(PriorityTest.ThreadMethodLowest); + Thread threadBelow = new Thread(PriorityTest.ThreadMethodBelow); + Thread threadNorm = new Thread(PriorityTest.ThreadMethodNorm); + Thread threadAbove = new Thread(PriorityTest.ThreadMethodAbove); + Thread threadHighest = new Thread(PriorityTest.ThreadMethodHighest); + Thread threadControl = new Thread(PriorityTest.ThreadMethodControl); + + threadLowest.Priority = ThreadPriority.Lowest; + threadBelow.Priority = ThreadPriority.BelowNormal; + threadNorm.Priority = ThreadPriority.Normal; + threadAbove.Priority = ThreadPriority.AboveNormal; + threadHighest.Priority = ThreadPriority.Highest; + + Debug.WriteLine("Starting Threads"); + threadHighest.Start(); + threadAbove.Start(); + threadNorm.Start(); + threadBelow.Start(); + threadLowest.Start(); + threadControl.Start(); + + Debug.WriteLine("Allow counting for 1 seconds."); + Thread.Sleep(1000); + PriorityTest.loopSwitch.Set(); + Thread.Sleep(1000); + + Debug.WriteLine("Lowest " + PriorityTest.resultLowest); + Debug.WriteLine("Below " + PriorityTest.resultBelow); + Debug.WriteLine("Normal " + PriorityTest.resultNorm); + Debug.WriteLine("Above " + PriorityTest.resultAbove); + Debug.WriteLine("Highest " + PriorityTest.resultHighest); + Debug.WriteLine("Control Thread " + PriorityTest.resultControl); + + threadLowest.Priority = ThreadPriority.BelowNormal; + threadBelow.Priority = ThreadPriority.Normal; + threadNorm.Priority = ThreadPriority.AboveNormal; + threadAbove.Priority = ThreadPriority.Highest; + threadHighest.Priority = ThreadPriority.Lowest; + Debug.WriteLine("Thread Priorities of each thread changed"); + Debug.WriteLine("Allow counting for 1 seconds."); + + PriorityTest.startSecond.Set(); + Thread.Sleep(1000); + PriorityTest.keepAlive.Set(); + Thread.Sleep(1000); + + Debug.WriteLine("Lowest - > Below " + PriorityTest.resultNewLowest); + Debug.WriteLine("Below - > Normal " + PriorityTest.resultNewBelow); + Debug.WriteLine("Normal - > Above " + PriorityTest.resultNewNorm); + Debug.WriteLine("Above - > Highest " + PriorityTest.resultNewAbove); + Debug.WriteLine("Highest - > Lowest " + PriorityTest.resultNewHighest); + Debug.WriteLine("Control Thread " + PriorityTest.resultNewControl); + + Debug.WriteLine("Verifies that each thread recieves attention less than or equal"); + Debug.WriteLine("to higher priority threads based on the newly assigned priorities."); + Debug.WriteLine("Accepted Tolerance : " + acceptedTolerance + "%"); + + if ((PriorityTest.resultNewHighest <= 0) || + (Tolerance(2 * PriorityTest.resultNewHighest, PriorityTest.resultNewLowest) > acceptedTolerance) || + (Tolerance(2 * PriorityTest.resultNewLowest, PriorityTest.resultNewBelow) > acceptedTolerance) || + (Tolerance(2 * PriorityTest.resultNewBelow, PriorityTest.resultNewNorm) > acceptedTolerance) || + (Tolerance(2 * PriorityTest.resultNewNorm, PriorityTest.resultNewAbove) > acceptedTolerance) || + (Tolerance(PriorityTest.resultNewBelow, PriorityTest.resultNewControl) > acceptedTolerance)) + { + Debug.WriteLine("NewHighest thread should execute at least once, got " + PriorityTest.resultNewHighest); + Debug.WriteLine("Deviation b/n 2*NewHighest and NewLowest " + Tolerance(2 * PriorityTest.resultNewHighest, PriorityTest.resultNewLowest)); + Debug.WriteLine("Deviation b/n 2*NewLowest and NewBelow " + Tolerance(2 * PriorityTest.resultNewLowest, PriorityTest.resultNewBelow)); + Debug.WriteLine("Deviation b/n 2*NewBelow and NewNorm " + Tolerance(2 * PriorityTest.resultNewBelow, PriorityTest.resultNewNorm)); + Debug.WriteLine("Deviation b/n 2*NewNorm and NewAbove " + Tolerance(2 * PriorityTest.resultNewNorm, PriorityTest.resultNewAbove)); + Debug.WriteLine("Deviation b/n NewBelow and Control " + Tolerance(PriorityTest.resultNewBelow, PriorityTest.resultNewControl)); + throw new Exception("Failed to change priority"); + } + } + + [TestMethod] + public void Threading_CurrentThread_Test24() + { + /// + /// 1. Start a thread + /// 2. Verify Thread.CurrentThread gives the thread itself + /// + /// + + Debug.WriteLine("Starting the Thread"); + Work w = new Work(); + w.m_data = 7; + Thread newThread1 = new Thread(w.DoMoreWork); + newThread1.Start(); + Thread.Sleep(1); + Debug.WriteLine("verifying Thread.CurrentThread gives the Thread itself"); + if (!newThread1.Equals(w.currThread)) + { + Debug.WriteLine("Comparing the Thread with its own (Thread.Equals(Thread.CurrentThread)) failed"); + throw new Exception("Comparing the Thread with its own (Thread.Equals(Thread.CurrentThread)) failed"); + } + } + + //[TestMethod] + //public void Threading_GetDomain_Test25() + //{ + // /// + // /// 1. Get the application domain in which the current thread is running + // /// 2. Verify it's the current domain + // /// + // /// + + // Debug.WriteLine("Getting the AppDomain"); + // AppDomain domain = Thread.GetDomain(); + // Debug.WriteLine("Verifying the domain"); + + // if (!domain.Equals(AppDomain.CurrentDomain)) + // { + // Debug.WriteLine("Thread.GetDomain().Equals(AppDomain.CurrentDomain) Failed"); + // throw new Exception("Thread.GetDomain().Equals(AppDomain.CurrentDomain) Failed"); + // } + //} + + [TestMethod] + public void Threading_Thread_CurrentThread_Suspend_Test26() + { + int count = 0; + Debug.WriteLine("This is fixed, see 19911 for details"); + Thread newThread = new Thread(new ThreadStart( + delegate + { + count += 2; + Debug.WriteLine("2) Worker thread started..."); + Debug.WriteLine("Suspending Worker thread..."); + Thread.CurrentThread.Suspend(); + Debug.WriteLine("4) Worker thread resumed..."); + count += 5; + } + )); + + if (count != 0) + { + Debug.WriteLine("Failure verifying counter reset to zero before starting the thread"); + throw new Exception("Failure verifying counter reset to zero before starting the thread"); + } + Debug.WriteLine("1) Starting worker..."); + newThread.Start(); + Thread.Sleep(3000); + if (count != 2) + { + Debug.WriteLine("Failure : Worker Thread is not Suspended !"); + throw new Exception("Failure : Worker Thread is not Suspended !"); + } + Debug.WriteLine("3) Wake up suspended thread..."); + newThread.Resume(); + Thread.Sleep(3000); + Debug.WriteLine("5) Main thread finished"); + if (count != 7) + { + Debug.WriteLine("Worker thread not finished for 3000msec after resumed"); + throw new Exception("Worker thread not finished for 3000msec after resumed"); + } + } + + } +} diff --git a/Tests/NFUnitTestThread/nano.runsettings b/Tests/NFUnitTestThread/nano.runsettings new file mode 100644 index 00000000..38fae61f --- /dev/null +++ b/Tests/NFUnitTestThread/nano.runsettings @@ -0,0 +1,14 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + True + + \ No newline at end of file diff --git a/Tests/NFUnitTestThread/packages.config b/Tests/NFUnitTestThread/packages.config new file mode 100644 index 00000000..1adb9284 --- /dev/null +++ b/Tests/NFUnitTestThread/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/UnitTestValueArrayTypess.cs b/Tests/NFUnitTestTypes/UnitTestValueArrayTypess.cs index 2cf60455..9ac345b4 100644 --- a/Tests/NFUnitTestTypes/UnitTestValueArrayTypess.cs +++ b/Tests/NFUnitTestTypes/UnitTestValueArrayTypess.cs @@ -1,3 +1,9 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/Tests/NFUnitTestTypes/UnitTestValueDefultConstTests.cs b/Tests/NFUnitTestTypes/UnitTestValueDefultConstTests.cs index c628b2de..da4e6e5b 100644 --- a/Tests/NFUnitTestTypes/UnitTestValueDefultConstTests.cs +++ b/Tests/NFUnitTestTypes/UnitTestValueDefultConstTests.cs @@ -1,4 +1,10 @@ -using nanoFramework.TestFramework; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/Tests/NFUnitTestTypes/UnitTestValueFloatTests.cs b/Tests/NFUnitTestTypes/UnitTestValueFloatTests.cs index b24fc14b..3a0c1234 100644 --- a/Tests/NFUnitTestTypes/UnitTestValueFloatTests.cs +++ b/Tests/NFUnitTestTypes/UnitTestValueFloatTests.cs @@ -1,4 +1,10 @@ -using nanoFramework.TestFramework; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/Tests/NFUnitTestTypes/UnitTestValueIntegralTests.cs b/Tests/NFUnitTestTypes/UnitTestValueIntegralTests.cs index 4f03efdd..fafb1044 100644 --- a/Tests/NFUnitTestTypes/UnitTestValueIntegralTests.cs +++ b/Tests/NFUnitTestTypes/UnitTestValueIntegralTests.cs @@ -1,4 +1,10 @@ -using nanoFramework.TestFramework; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/Tests/NFUnitTestTypes/UnitTestValueSimpleTests.cs b/Tests/NFUnitTestTypes/UnitTestValueSimpleTests.cs index 4271917d..4e64a399 100644 --- a/Tests/NFUnitTestTypes/UnitTestValueSimpleTests.cs +++ b/Tests/NFUnitTestTypes/UnitTestValueSimpleTests.cs @@ -1,4 +1,10 @@ -using nanoFramework.TestFramework; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/Tests/NFUnitTestTypes/UnitTestValueTests.cs b/Tests/NFUnitTestTypes/UnitTestValueTests.cs index 59934279..fd808bb6 100644 --- a/Tests/NFUnitTestTypes/UnitTestValueTests.cs +++ b/Tests/NFUnitTestTypes/UnitTestValueTests.cs @@ -1,4 +1,10 @@ -using nanoFramework.TestFramework; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; using System; namespace NFUnitTestTypes diff --git a/Tests/NFUnitTestVariables/CategoryTests.cs b/Tests/NFUnitTestVariables/CategoryTests.cs index 1b44fde8..fb28528a 100644 --- a/Tests/NFUnitTestVariables/CategoryTests.cs +++ b/Tests/NFUnitTestVariables/CategoryTests.cs @@ -1,3 +1,9 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/Tests/NFUnitTestVariables/VariableTests.cs b/Tests/NFUnitTestVariables/VariableTests.cs index c4f28975..2f14ce1e 100644 --- a/Tests/NFUnitTestVariables/VariableTests.cs +++ b/Tests/NFUnitTestVariables/VariableTests.cs @@ -1,4 +1,10 @@ -using nanoFramework.TestFramework; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 1eb7426e..567c31d2 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -23,6 +23,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestVariables", "Test EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestTypes", "Tests\NFUnitTestTypes\NFUnitTestTypes.nfproj", "{05B18D3A-F70D-4104-8F78-FDC577E11081}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestThread", "Tests\NFUnitTestThread\NFUnitTestThread.nfproj", "{BDBFD5E3-46C4-4ACD-B66C-60F00618FD91}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -55,6 +57,12 @@ Global {05B18D3A-F70D-4104-8F78-FDC577E11081}.Release|Any CPU.ActiveCfg = Release|Any CPU {05B18D3A-F70D-4104-8F78-FDC577E11081}.Release|Any CPU.Build.0 = Release|Any CPU {05B18D3A-F70D-4104-8F78-FDC577E11081}.Release|Any CPU.Deploy.0 = Release|Any CPU + {BDBFD5E3-46C4-4ACD-B66C-60F00618FD91}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BDBFD5E3-46C4-4ACD-B66C-60F00618FD91}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BDBFD5E3-46C4-4ACD-B66C-60F00618FD91}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {BDBFD5E3-46C4-4ACD-B66C-60F00618FD91}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BDBFD5E3-46C4-4ACD-B66C-60F00618FD91}.Release|Any CPU.Build.0 = Release|Any CPU + {BDBFD5E3-46C4-4ACD-B66C-60F00618FD91}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -63,6 +71,7 @@ Global {8D47514F-552C-4862-961F-0CAA315A231F} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {6D93536D-2CFC-4BB8-B490-080EB11D40DD} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {05B18D3A-F70D-4104-8F78-FDC577E11081} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {BDBFD5E3-46C4-4ACD-B66C-60F00618FD91} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From b3f1deef95d3e020303f57a4f0be3d48e9d41991 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Sun, 28 Feb 2021 14:20:22 +0300 Subject: [PATCH 22/55] Adding thread and system lib part 1 --- .../NFUnitTestSystemLib.nfproj | 60 ++ .../Properties/AssemblyInfo.cs | 33 + Tests/NFUnitTestSystemLib/UnitTestGuid.cs | 324 ++++++++++ Tests/NFUnitTestSystemLib/nano.runsettings | 13 + Tests/NFUnitTestSystemLib/packages.config | 5 + .../NFUnitTestThread/NFUnitTestThread.nfproj | 6 + .../UnitTestAutoResetEvents.cs | 290 +++++++++ .../NFUnitTestThread/UnitTestInterlocTests.cs | 288 +++++++++ .../NFUnitTestThread/UnitTestMonitorTests.cs | 237 ++++++++ Tests/NFUnitTestThread/UnitTestTimeTests.cs | 573 ++++++++++++++++++ .../NFUnitTestThread/UnitTestTimeoutTests.cs | 81 +++ .../UnitTestWaitHandleTests.cs | 160 +++++ Tests/NFUnitTestThread/nano.runsettings | 2 +- nanoFramework.CoreLibrary.sln | 9 + 14 files changed, 2080 insertions(+), 1 deletion(-) create mode 100644 Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj create mode 100644 Tests/NFUnitTestSystemLib/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestSystemLib/UnitTestGuid.cs create mode 100644 Tests/NFUnitTestSystemLib/nano.runsettings create mode 100644 Tests/NFUnitTestSystemLib/packages.config create mode 100644 Tests/NFUnitTestThread/UnitTestAutoResetEvents.cs create mode 100644 Tests/NFUnitTestThread/UnitTestInterlocTests.cs create mode 100644 Tests/NFUnitTestThread/UnitTestMonitorTests.cs create mode 100644 Tests/NFUnitTestThread/UnitTestTimeTests.cs create mode 100644 Tests/NFUnitTestThread/UnitTestTimeoutTests.cs create mode 100644 Tests/NFUnitTestThread/UnitTestWaitHandleTests.cs diff --git a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj new file mode 100644 index 00000000..795ef072 --- /dev/null +++ b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj @@ -0,0 +1,60 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + e63a23a8-5335-4976-ba47-0ac7f1aedd32 + Library + Properties + 512 + NFUnitTestSystemLib + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestSystemLib/Properties/AssemblyInfo.cs b/Tests/NFUnitTestSystemLib/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestSystemLib/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestSystemLib/UnitTestGuid.cs b/Tests/NFUnitTestSystemLib/UnitTestGuid.cs new file mode 100644 index 00000000..9a885e07 --- /dev/null +++ b/Tests/NFUnitTestSystemLib/UnitTestGuid.cs @@ -0,0 +1,324 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Collections; +using System.Diagnostics; + +namespace NFUnitTestSystemLib +{ + [TestClass] + public class UnitTestGuid + { + [TestMethod] + public void Guid_Test() + { + /// + /// 1. Creates a Guid with Guid.NewGuid() + /// 2. Verifies the Guid is with Byte Array length 16 + /// 3. Creates same Guid + /// 4. Verifies the two Guids are equal with CompareTo + /// 5. Verifies the two Guids are equal with Equals + /// 6. Creates another Guid with Guid.NewGuid() + /// 7. Verifies the new Guid is not equal to the previous Guid with CompareTo + /// 8. Verifies the new Guid is not equal to the previous Guid with Equal + /// + /// + Guid theGuid = Guid.NewGuid(); + + byte[] bGuid1 = theGuid.ToByteArray(); + Assert.Equal(bGuid1.Length, 16); + Guid theSameGuid = new Guid(bGuid1); + // must be the same + Assert.Equal(theGuid.CompareTo(theSameGuid), 0); + Assert.True(theGuid.Equals(theSameGuid)); + Guid anotherGuid = Guid.NewGuid(); + + // must be the different + Assert.Equal(theGuid.CompareTo(anotherGuid), 0); + Assert.True(theGuid.Equals(anotherGuid)); + } + + /// + /// A utility to a generate random byte array of specified length. + /// + /// + /// + public static byte[] GetRandomBytes(int length) + { + byte[] byteArr = new byte[length]; + Random s_random = new Random(); + s_random.NextBytes(byteArr); + return byteArr; + } + + [TestMethod] + public void ByteArrayConstructor_Test2() + { + /// + /// 1. Creates a Guid with byte Array of size 16 and random byte values + /// 2. Verifies exception is not thrown + /// + /// + + Byte[] guid16 = GetRandomBytes(16); + Guid myGuid1 = new Guid(guid16); + } + + [TestMethod] + public void ArgumentException_Test3() + { + /// + /// 1. Creates a Guid with byte Array of random size b/n 0 to 100 but not 16 + /// 2. Verifies ArgumentException is thrown + /// + /// + + int size = 16; + + //size could be set to any Random number b/n 0 and 2147483647 + //System.OutOfMemoryException will be thrown + Random random = new Random(); + while (size == 16) + { + size = random.Next(100); + } + Byte[] guidNot16 = GetRandomBytes(size); + Assert.Trows(typeof(ArgumentException), () => { Guid myGuid1 = new Guid(guidNot16); }); + } + + [TestMethod] + public void ArgumentNullException_Test4() + { + /// + /// 1. Creates a Guid with byte Array of null + /// 2. Verifies ArgumentNullException is thrown + /// + /// + + Byte[] nullByte = null; + Assert.Trows(typeof(ArgumentNullException), () => { Guid myGuid1 = new Guid(nullByte); }); + } + + public static Guid GetGuid() + { + return new Guid(0x4dff36b5, 0x9dde, 0x4f76, 0x9a, 0x2a, 0x96, 0x43, 0x50, 0x47, 0x06, 0x3d); + } + + // This can't be run as there is no GetTypesImplementingInterface + //[TestMethod] + //public void Reflection_Unboxing_Test5() + //{ + // /// + // /// 1. Creates a Guid using a method + // /// 2. Invokes the method using Reflection + // /// 3. Casts the returned obj from the method back to Guid + // /// 4. Verifies Exception is not thrown when castin a Guid obj back to Guid + // /// + // /// + + // Guid[] a = new Guid[] { GetGuid(), GetGuid(), GetGuid() }; + + // IList list = (IList)a; + + // Guid g = (Guid)list[1]; + + // Debug.WriteLine(g.ToString()); + // Type t = Type.GetType("Microsoft.SPOT.Platform.Tests.ITest"); + + // Type[] apps = System.Reflection.GetTypesImplementingInterface(t); + + // foreach (Type app in apps) + // { + // MethodInfo method = app.GetMethod("GetGuid", BindingFlags.Static | BindingFlags.Public); + // if (method != null) + // { + // object o = method.Invoke(null, null); + // try + // { + // Guid guid = (Guid)o; + // } + // catch (Exception ex) + // { + // Debug.WriteLine("Caught : " + ex.Message); + // testResult = MFTestResults.Fail; + // } + // } + // } + // return testResult; + //} + + [TestMethod] + public void Int_Short_Constructor_Test6() + { + /// + /// 1. Creates Guid(int, short, short, byte, byte ...) + /// 2. Verifies exception is not thrown + /// + /// + + Random random = new Random(); + int _int = random.Next(Int32.MaxValue); + short _short1 = (short)random.Next(32768); + short _short2 = (short)random.Next(32768); + Byte[] _bArr = GetRandomBytes(8); + Guid _guid = new Guid(_int, _short1, _short2, _bArr[0], _bArr[1], _bArr[2], _bArr[3], _bArr[4], _bArr[5], _bArr[6], _bArr[7]); + } + + [TestMethod] + public void UInt_Ushort_Constructor_Test7() + { + /// + /// 1. Creates a Guid(uint, ushort, byte, byte ...) + /// 2. Verifies exception is not thrown + /// + /// + + Random random = new Random(); + int randoInt = random.Next(Int32.MaxValue); + uint _uInt = (uint)(randoInt * 2); + ushort _uShort1 = (ushort)random.Next(65536); + ushort _uShort2 = (ushort)random.Next(65536); + Byte[] _bArr = GetRandomBytes(8); + Guid _guid = new Guid(_uInt, _uShort1, _uShort1, _bArr[0], _bArr[1], _bArr[2], _bArr[3], _bArr[4], _bArr[5], _bArr[6], _bArr[7]); + } + + [TestMethod] + public void Guid_Empty_Test8() + { + /// + /// 1. Creates an Empty Guid with Guid.Empty + /// 2. Extracts all the bytes in the Guid + /// 3. Verifies all bytes have zero (0) value + /// + /// + Guid guid = Guid.Empty; + Byte[] _bArr = guid.ToByteArray(); + for (int i = 0; i < 16; i++) + { + Assert.Equal(_bArr[i], (byte)0); + } + } + + [TestMethod] + public void Guid_CompareTo_Test9() + { + /// + /// 1. Creates Guids with different values + /// 2. Verifies their equality using CompareTo + /// + /// + + Guid guid1 = Guid.Empty; + Debug.WriteLine("Verifing any instance of Guid, regardless of its value, is greater than null"); + Assert.Equal(guid1.CompareTo(null), 1); + Byte[] _bArr = new Byte[16]; + Debug.WriteLine("Creating a Guid with all bytes zero"); + Guid guid2 = new Guid(_bArr); + Assert.Equal(guid1.CompareTo(guid2), 0); + Guid guid3 = new Guid(0x4dff36b5, 0x9dde, 0x4f76, 0x9a, 0x2a, 0x96, 0x43, 0x50, 0x47, 0x06, 0x3d); + if (guid3.CompareTo(guid1) <= 0) + { + throw new Exception("Expected : " + guid3.ToString() + " is greater than " + guid1.ToString()); + } + Guid guid4 = new Guid(0x4dff36b5, 0x9dde, 0x4f76, 0x9a, 0x2a, 0x96, 0x43, 0x50, 0x47, 0x06, 0x3d); + Assert.Equal(guid4.CompareTo(guid3), 0); + Guid guid5 = new Guid(0x4dff36b5, 0x9dde, 0x4f76, 0x9a, 0x2a, 0x96, 0x43, 0x50, 0x47, 0x06, 0x3e); + if (guid5.CompareTo(guid4) <= 0) + { + throw new Exception("Expected : " + guid5.ToString() + " is greater than " + guid4.ToString()); + } + if (guid4.CompareTo(guid5) >= 0) + { + throw new Exception("Expected : " + guid4.ToString() + " is less than " + guid5.ToString()); + } + } + + [TestMethod] + public void Guid_ToString_Test10() + { + /// + /// 1. Creates 4 Guids and Converts them ToString + /// 2. Verifies the Conversion of Guids to string is correct + /// + /// + + String[] strArr1 = new String[] { "00000000-0000-0000-0000-000000000000", + "00000000-0000-0000-0000-000000000000", + "4dff36b5-9dde-4f76-9a2a-96435047063d", + "ffffffff-ffff-ffff-ffff-ffffffffffff"}; + Guid guid1 = Guid.Empty; + Byte[] _byteArr1 = new Byte[16]; + Guid guid2 = new Guid(_byteArr1); + Guid guid3 = new Guid(0x4dff36b5, 0x9dde, 0x4f76, 0x9a, 0x2a, 0x96, 0x43, 0x50, 0x47, 0x06, 0x3d); + Byte[] _byteArr2 = new Byte[16]; + for (int i = 0; i < _byteArr2.Length; i++) + { + _byteArr2[i] = Byte.MaxValue; + } + Guid guid4 = new Guid(_byteArr2); + String[] strArr2 = new String[] { guid1.ToString(), guid2.ToString(), guid3.ToString(), guid4.ToString() }; + for (int i = 0; i < strArr1.Length; i++) + { + Debug.WriteLine(strArr1[i]); + Assert.Equal(String.Compare(strArr1[i], strArr2[i]), 0); + } + } + + [TestMethod] + public void Guid_Equals_Test11() + { + /// + /// 1. Creates 3 Arrays of Guids with different constructors same value + /// 2. Verifies the Guids are equal + /// + /// + + Debug.WriteLine("Creating 3 Guids with Guid.Empty and hex values"); + Guid guid11 = Guid.Empty; + Guid guid12 = new Guid(0x4dff36b5, 0x9dde, 0x4f76, 0x9a, 0x2a, 0x96, 0x43, 0x50, 0x47, 0x06, 0x3d); + Guid guid13 = new Guid(0x7FFFFFFF, 0x7FFF, 0x7FFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF); + Guid[] gArr1 = new Guid[] { guid11, guid12, guid13 }; + + Debug.WriteLine("Creating Guids with 16 bytes constructor"); + Byte[] _bArr1 = new Byte[16]; + Guid guid21 = new Guid(_bArr1); + Byte[] _bArr2 = new Byte[] { 181, 54, 255, 77, 222, 157, 118, 79, 154, 42, 150, 67, 80, 71, 6, 61 }; + Guid guid22 = new Guid(_bArr2); + Byte[] _bArr3 = new Byte[] { 255, 255, 255, 127, 255, 127, 255, 127, 255, 255, 255, 255, 255, 255, 255, 255 }; + Guid guid23 = new Guid(_bArr3); + Guid[] gArr2 = new Guid[] { guid21, guid22, guid23 }; + + Debug.WriteLine("Creating 3 Guids with Guid(int, short, short, byte ....) constructor"); + Guid guid31 = new Guid(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + Guid guid32 = new Guid(1308571317, 40414, 20342, 154, 42, 150, 67, 80, 71, 6, 61); + Guid guid33 = new Guid(int.MaxValue, short.MaxValue, short.MaxValue, byte.MaxValue, byte.MaxValue, + byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue); + Guid[] gArr3 = new Guid[] { guid31, guid32, guid33 }; + + for (int i = 0; i < 3; i++) + { + if ((!gArr1[i].Equals(gArr2[i])) || (gArr1[i].GetHashCode() != gArr2[i].GetHashCode())) + { + Debug.WriteLine(i + " Expecting : " + gArr1[i].ToString() + " equals " + gArr2[i].ToString() + " comparing 1 and 2"); + throw new Exception(" Expecting : hashcode " + gArr1[i].GetHashCode().ToString() + " equals " + gArr2[i].GetHashCode().ToString()); + } + if ((!gArr1[i].Equals(gArr3[i])) || (gArr1[i].GetHashCode() != gArr3[i].GetHashCode())) + { + Debug.WriteLine(i + " Expecting : " + gArr1[i].ToString() + " equals " + gArr3[i].ToString() + " comparing 1 and 3"); + throw new Exception(" Expecting : hashcode " + gArr1[i].GetHashCode().ToString() + " equals " + gArr3[i].GetHashCode().ToString()); + } + if ((!gArr2[i].Equals(gArr3[i])) || (gArr2[i].GetHashCode() != gArr3[i].GetHashCode())) + { + Debug.WriteLine(i + " Expecting : " + gArr2[i].ToString() + " equals " + gArr3[i].ToString() + " comparing 2 and 3"); + throw new Exception(" Expecting : hashcode " + gArr2[i].GetHashCode().ToString() + " equals " + gArr3[i].GetHashCode().ToString()); + } + } + } + + } +} diff --git a/Tests/NFUnitTestSystemLib/nano.runsettings b/Tests/NFUnitTestSystemLib/nano.runsettings new file mode 100644 index 00000000..62f0a008 --- /dev/null +++ b/Tests/NFUnitTestSystemLib/nano.runsettings @@ -0,0 +1,13 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + + \ No newline at end of file diff --git a/Tests/NFUnitTestSystemLib/packages.config b/Tests/NFUnitTestSystemLib/packages.config new file mode 100644 index 00000000..dcab08b1 --- /dev/null +++ b/Tests/NFUnitTestSystemLib/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestThread/NFUnitTestThread.nfproj b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj index 544665e4..69557609 100644 --- a/Tests/NFUnitTestThread/NFUnitTestThread.nfproj +++ b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj @@ -27,8 +27,14 @@ $(MSBuildProjectDirectory)\nano.runsettings + + + + + + diff --git a/Tests/NFUnitTestThread/UnitTestAutoResetEvents.cs b/Tests/NFUnitTestThread/UnitTestAutoResetEvents.cs new file mode 100644 index 00000000..6e17bb48 --- /dev/null +++ b/Tests/NFUnitTestThread/UnitTestAutoResetEvents.cs @@ -0,0 +1,290 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using System.Threading; + +namespace NFUnitTestThread +{ + [TestClass] + class UnitTestAutoResetEvents + { + class Waiter + { + public static AutoResetEvent are1 = new AutoResetEvent(false); + public static AutoResetEvent are2 = new AutoResetEvent(true); + public bool flag; + public int wait; + public DateTime t1; + public DateTime t2; + + public void DoWait() + { + Debug.WriteLine("Waiting..."); + t1 = DateTime.UtcNow; + are1.WaitOne(); + t2 = DateTime.UtcNow; + flag = true; + Debug.WriteLine("Notified"); + } + + public void DoWaitTimeOut() + { + Debug.WriteLine("Waiting..."); + are1.WaitOne(wait, false); + flag = true; + } + + public void DoWaitReset() + { + Debug.WriteLine("Waiting..."); + are2.WaitOne(); + flag = true; + } + } + + [TestMethod] + public void AutoReset1_WaitOne_Set_Test() + { + /// + ///Start a thread and make it wait by calling WaitOne until signaled by another thread. + ///Verify that it continues executing when Set by the other thread. + /// + /// + + Debug.WriteLine("Starts a thread and calls WaitOne inside the thread "); + Debug.WriteLine("Signals The thread to continue execution"); + Debug.WriteLine("Verifies the thread has waited and continued execution upon calling Set"); + + Debug.WriteLine("Starting Thread"); + Waiter newWaiter1 = new Waiter(); + Thread newThread1 = new Thread(newWaiter1.DoWait); + newThread1.Start(); + + Debug.WriteLine("Waiting and Signaling after 1000msec."); + Thread.Sleep(1000); + + Debug.WriteLine("wake it up"); + DateTime t3 = DateTime.UtcNow; + Waiter.are1.Set(); + + Debug.WriteLine("Waiting the thread to finish and also to get t2"); + Thread.Sleep(10); + TimeSpan duration1 = newWaiter1.t2 - newWaiter1.t1; + TimeSpan duration2 = newWaiter1.t2 - t3; + + // Assuming atleast the thread should wait for 750ms + if (duration1.CompareTo(new TimeSpan(0, 0, 0, 0, 750)) <= 0) + { + Debug.WriteLine("The thread should have waited atleast 750 msec."); + throw new Exception("The thread should have waited atleast 750 msec."); + } + if (duration2.CompareTo(new TimeSpan(0, 0, 0, 0, 0)) < 0) + { + Debug.WriteLine("The thread continued executing before it's signaled"); + throw new Exception("The thread continued executing before it's signaled"); + } + } + + [TestMethod] + public void AutoReset2_Set_WaitOne_Set_Test() + { + /// + ///Calls Set repeatedly while no thread was blocked + ///Starts two threads and call WaitOne on both. + ///Call Set by a third unblocked thread with access to the AutoResetEvent and + ///verify that only one blocked thread is released. + /// + /// + + Debug.WriteLine("Calls Set repeatedly while no thread was blocked"); + Debug.WriteLine("Starts two threads and calls WaitOne on both threads "); + Debug.WriteLine("Signals The thread to continue execution calling Set once"); + Debug.WriteLine("Verifies only one blocked thread is released"); + + Waiter.are1.Set(); + Waiter.are1.Set(); + + Waiter newWaiter1 = new Waiter(); + newWaiter1.flag = false; + Thread newThread1 = new Thread(newWaiter1.DoWait); + Waiter newWaiter2 = new Waiter(); + newWaiter2.flag = false; + Thread newThread2 = new Thread(newWaiter2.DoWait); + Debug.WriteLine("Starting The threads"); + newThread1.Start(); + newThread2.Start(); + + Debug.WriteLine("Waiting and verifying only one of the threads is signaled"); + Thread.Sleep(1000); + Debug.WriteLine("flag1 XOR flag2 = ~((flag1 & flag2)||(~flag1 & ~flag2))"); + if ((newWaiter1.flag && newWaiter2.flag) || ((!newWaiter1.flag) && (!newWaiter2.flag))) + { + Debug.WriteLine("Only One of the threads should have been signaled"); + throw new Exception("Only One of the threads should have been signaled"); + } + Waiter.are1.Set(); + } + + [TestMethod] + public void AutoReset3_TwoWaitOne_TwoSet_Test() + { + /// + ///Start two threads and call WaitOne on both. + ///Call Set twice by a third unblocked thread with access to the AutoResetEvent and + ///verify that both blocked threads are released. + /// + /// + + Debug.WriteLine("Starts two threads and calls WaitOne on both threads "); + Debug.WriteLine("Signals The threads to continue execution calling Set twice"); + Debug.WriteLine("Verifies both blocked threads are released"); + + Waiter newWaiter1 = new Waiter(); + Thread newThread1 = new Thread(newWaiter1.DoWait); + newWaiter1.flag = false; + Waiter newWaiter2 = new Waiter(); + Thread newThread2 = new Thread(newWaiter2.DoWait); + newWaiter2.flag = false; + Debug.WriteLine("Starting threads, waiting and verifying both are waiting"); + newThread1.Start(); + newThread2.Start(); + Thread.Sleep(1000); + if (newWaiter1.flag || newWaiter2.flag) + { + Debug.WriteLine("Failure: One or both threads are not waiting, Thread1 = '" + + newWaiter1.flag + "' Thread2 = '" + newWaiter2.flag + "'"); + throw new Exception("Failure: One or both threads are not waiting, Thread1 = '" + + newWaiter1.flag + "' Thread2 = '" + newWaiter2.flag + "'"); + } + Debug.WriteLine("Signaling twice, waiting and verifying both threads are signaled"); + Waiter.are1.Set(); + Waiter.are1.Set(); + Thread.Sleep(1000); + if (!newWaiter1.flag || !newWaiter2.flag) + { + Debug.WriteLine("Not both threads are signaled, Thread1 = '" + newWaiter1.flag + + "' and Thread2 = '" + newWaiter2.flag + "'"); + throw new Exception("Not both threads are signaled, Thread1 = '" + newWaiter1.flag + + "' and Thread2 = '" + newWaiter2.flag + "'"); + } + } + + [TestMethod] + public void AutoReset4_WaitOne_TimeOut_Test() + { + /// + ///Starts a thread and call WaitOne passing timeout parameter + ///Verify that the wait will end because of a timeout rather than obtaining a signal. + /// + /// + + Debug.WriteLine("Starts a thread and call WatiOne passing timeout parameter"); + Debug.WriteLine("verifies the wait will end because of timeout"); + Debug.WriteLine("Starts a 2nd thread and call WatiOne passing Timeout.Infinite"); + Debug.WriteLine("verifies the wait will not end for 3 sec (assumed Infinite)"); + + Waiter newWaiter1 = new Waiter(); + newWaiter1.wait = 100; + newWaiter1.flag = false; + Thread newThread1 = new Thread(newWaiter1.DoWaitTimeOut); + Debug.WriteLine("Starting thread, waiting and verifying wait timeouts"); + newThread1.Start(); + Thread.Sleep(500); + if (!newWaiter1.flag) + { + Debug.WriteLine("Waited for 500msec. but Thread should have timeouted in " + newWaiter1.wait + ""); + throw new Exception("Waited for 500msec. but Thread should have timeouted in " + newWaiter1.wait + ""); + } + Waiter newWaiter2 = new Waiter(); + newWaiter2.wait = -1; + newWaiter2.flag = false; + Thread newThread2 = new Thread(newWaiter2.DoWaitTimeOut); + Debug.WriteLine("Starting thread, waiting for Timeout.Infinite and verifying"); + newThread2.Start(); + Thread.Sleep(3000); + if (newWaiter2.flag) + { + Debug.WriteLine("Failure: thread didn't wait for Infinite.Timeout"); + throw new Exception("Failure: thread didn't wait for Infinite.Timeout"); + } + Debug.WriteLine("finally signaling the Infinite.Timeout thread"); + Waiter.are1.Set(); + } + + [TestMethod] + public void AutoReset5_Reset_Test() + { + /// + ///Creates an AutoResetEvent having an initial state signaled + ///Starts a thread, calls WaitOne and verifies the thread is not blocked + ///Starts another thread, calls WaitOne and verifies it's auto reset (nonsignaled) + ///calls Set and verify it's set (Signaled) + ///calls Set, calls Reset, starts a thread and calls WaitOne on the thread + ///Verifies that the thread remains blocked + /// + /// + + Debug.WriteLine("Creates an AutoResetEvent having an initial state signaled"); + Debug.WriteLine("Start a thread, call WaitOne and verify the thread is not blocked"); + Debug.WriteLine("Starts a 2nd thread, call WaitOne and verify it's auto reset (thread is blocked)"); + Debug.WriteLine("call Set and verify it's set (signaled)"); + Debug.WriteLine("call Set, call Reset, starts a thread and call WaitOne on the thread"); + Debug.WriteLine("Verify the thread remains blocked"); + + Waiter newWaiter1 = new Waiter(); + newWaiter1.flag = false; + Thread newThread1 = new Thread(newWaiter1.DoWaitReset); + Debug.WriteLine("Starting thread, waiting and verifying thread not blocked if initial state is signaled"); + newThread1.Start(); + Thread.Sleep(100); + if (!newWaiter1.flag) + { + Debug.WriteLine("Faiure : AutoResetEvent initial state signaled but blocked thread"); + throw new Exception("Faiure : AutoResetEvent initial state signaled but blocked thread"); + } + + Waiter newWaiter2 = new Waiter(); + newWaiter2.flag = false; + Thread newThread2 = new Thread(newWaiter2.DoWaitReset); + Debug.WriteLine("Starting thread, waiting and verifying autoreset blocks the thread"); + newThread2.Start(); + Thread.Sleep(100); + if (newWaiter2.flag) + { + Debug.WriteLine("Failure : AutoResetEvent not autoreseted"); + throw new Exception("Failure : AutoResetEvent not autoreseted"); + } + Debug.WriteLine("Signaling, waiting and verifying"); + Waiter.are2.Set(); + Thread.Sleep(100); + if (!newWaiter2.flag) + { + Debug.WriteLine("Failure : AutoResetEvent signaled but thread blocked"); + throw new Exception("Failure : AutoResetEvent signaled but thread blocked"); + } + Debug.WriteLine("Set, Reset, Start a thread, waiting and verifying thread remain blocked"); + Waiter newWaiter3 = new Waiter(); + newWaiter3.flag = false; + Thread newThread3 = new Thread(newWaiter3.DoWaitReset); + Waiter.are2.Set(); + Waiter.are2.Reset(); + newThread3.Start(); + Thread.Sleep(100); + if (newWaiter3.flag) + { + Debug.WriteLine("Failure: a Reseted AutoResetEvent didn't block thread"); + throw new Exception("Failure: a Reseted AutoResetEvent didn't block thread"); + } + + Debug.WriteLine("Finally Setting the reseted AutoResetEvent"); + Waiter.are2.Set(); + } + + } +} diff --git a/Tests/NFUnitTestThread/UnitTestInterlocTests.cs b/Tests/NFUnitTestThread/UnitTestInterlocTests.cs new file mode 100644 index 00000000..aa21def3 --- /dev/null +++ b/Tests/NFUnitTestThread/UnitTestInterlocTests.cs @@ -0,0 +1,288 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using System.Threading; + +namespace NFUnitTestThread +{ + [TestClass] + class UnitTestInterlocTests + { + public static int interCount = 0; + static public void ThreadIncrementor() + { + Thread.Sleep(new Random().Next(10)); + Interlocked.Increment(ref interCount); + } + + static public void ThreadDecrementor() + { + Thread.Sleep(new Random().Next(10)); + Interlocked.Decrement(ref interCount); + } + + static public void ThreadIncrementorStarter() + { + Thread[] threadArrayInc = new Thread[4]; + for (int i = 0; i < 4; i++) + { + Debug.WriteLine("Attempting to start inc thread " + i); + threadArrayInc[i] = new Thread(ThreadIncrementor); + threadArrayInc[i].Start(); + Thread.Sleep(1); + } + Thread.Sleep(100); + for (int i = 0; i < 4; i++) + { + threadArrayInc[i].Join(); + } + } + + static public void ThreadDecrementorStarter() + { + Thread[] threadArrayDec = new Thread[5]; + for (int i = 0; i < 5; i++) + { + Debug.WriteLine("Attempting to start dec thread " + i); + threadArrayDec[i] = new Thread(ThreadDecrementor); + threadArrayDec[i].Start(); + Thread.Sleep(1); + } + Thread.Sleep(100); + for (int i = 0; i < 5; i++) + { + threadArrayDec[i].Join(); + } + } + + static public void ThreadIncrementor2Starter() + { + + Thread[] threadArrayInc2 = new Thread[6]; + for (int i = 0; i < 6; i++) + { + Debug.WriteLine("Attempting to start inc2 thread " + i); + threadArrayInc2[i] = new Thread(ThreadIncrementor); + threadArrayInc2[i].Start(); + Thread.Sleep(1); + } + Thread.Sleep(100); + for (int i = 0; i < 6; i++) + { + threadArrayInc2[i].Join(); + } + } + + [TestMethod] + public void Interlocked1_Inc_Dec_Test() + { + /// + /// 1. Starts 4 threads that run asynchronously + /// 2. Each thread calls Interlocked.Increment or Decrement. + /// 3. Waits for execution and then verifies that all expected operations completed + /// + /// + Debug.WriteLine("Starts several async threads that call interlocked "); + Debug.WriteLine("Increment and Decrement, this may erroneously pass."); + Debug.WriteLine("This may erroneously fail for extremely slow devices."); + + Debug.WriteLine("Starting several threads, incrementing, decrementing,"); + Debug.WriteLine("waiting till all threads finish and verifying"); + Thread incThread = new Thread(ThreadIncrementorStarter); + incThread.Start(); + Thread.Sleep(1); + + Thread decThread = new Thread(ThreadDecrementorStarter); + decThread.Start(); + Thread.Sleep(1); + + Thread inc2Thread = new Thread(ThreadIncrementor2Starter); + inc2Thread.Start(); + Thread.Sleep(1); + + Thread lastThread = new Thread(ThreadDecrementor); + lastThread.Start(); + Thread.Sleep(1); + + Debug.WriteLine("Waiting for execution"); + int slept = 0; + while ((incThread.IsAlive || decThread.IsAlive || + inc2Thread.IsAlive || lastThread.IsAlive) && slept < 5000) + { + Thread.Sleep(100); + slept += 100; + } + + Debug.WriteLine("Verifying all increment/decrement operations done correctly"); + if (interCount != 4) + { + Debug.WriteLine("expected final increment/decrement result = '4' but got '" + interCount + "'"); + throw new Exception("expected final increment/decrement result = '4' but got '" + interCount + "'"); + } + Debug.WriteLine("Verifying all threads are finished"); + if (slept >= 5000) + { + Debug.WriteLine("Expcted all threads be done in '5000' msec but took '" + slept + "'"); + throw new Exception("Expcted all threads be done in '5000' msec but took '" + slept + "'"); + } + } + + [TestMethod] + public void Interlocked2_Compare_Exchange_Test() + { + /// + /// 1. Starts 4 threads that run asynchronously + /// 2. Each thread calls Interlocked.Compare or CompareExchange + /// 3. Waits for execution and then verifies that all expected operations completed + /// + /// + + Debug.WriteLine("Starts 4 async threads that call interlocked Compare, CompareExchange"); + Debug.WriteLine("This may erroneously pass."); + Debug.WriteLine("this may erroneously fail for extremely slow devices."); + + Debug.WriteLine("Starting the 4 threads"); + Thread incThread = new Thread(ThreadIncrementorStarter); + incThread.Start(); + + Thread decThread = new Thread(ThreadDecrementorStarter); + decThread.Start(); + + Thread inc2Thread = new Thread(ThreadIncrementor2Starter); + inc2Thread.Start(); + + Thread lastThread = new Thread(ThreadDecrementor); + lastThread.Start(); + Thread.Sleep(1); + int comp = 10; + Debug.WriteLine("Waiting for execution"); + while ((0 != Interlocked.CompareExchange(ref interCount, 0, comp)) || + (incThread.IsAlive || decThread.IsAlive || inc2Thread.IsAlive || + lastThread.IsAlive)) + { + Debug.WriteLine( + Interlocked.Exchange(ref interCount, 0).ToString() + " " + + incThread.IsAlive.ToString() + " " + + decThread.IsAlive.ToString() + " " + + inc2Thread.IsAlive.ToString() + " " + + lastThread.IsAlive.ToString()); + Debug.WriteLine("Setting Count to 0"); + Interlocked.Exchange(ref interCount, 0); + Thread.Sleep(10); + } + int slept = 0; + while ((incThread.IsAlive || decThread.IsAlive || inc2Thread.IsAlive || + lastThread.IsAlive) && slept < 5000) + { + Thread.Sleep(100); + slept += 100; + } + Debug.WriteLine("Verifying all Interlocked.Compare/CompareExchange operations done correctly"); + if (interCount != 0) + { + Debug.WriteLine("expected final Compare/CompareExchange result = '0' but got '" + interCount + "'"); + throw new Exception("expected final Compare/CompareExchange result = '0' but got '" + interCount + "'"); + } + Debug.WriteLine("Verifying all threads are finished"); + if (slept >= 5000) + { + Debug.WriteLine("Expcted all threads be done in '5000' msec but took '" + slept + "'"); + throw new Exception("Expcted all threads be done in '5000' msec but took '" + slept + "'"); + } + } + + [TestMethod] + public void Interlocked3_Exchange_Boundary_Test() + { + /// + /// 1. creates 3 int variables initialized to the boundary values of signed int 32 + /// 2. passes all possible combinations of the values to Interlocked.Exchange + /// 3. verifies Exchange and also verifies original value is returned + /// + /// + + Debug.WriteLine("This is Fixed, see 20323 for details"); + int[] value = new int[] { -2147483648, 0, 2147483647 }; + int temp1, temp2; + Debug.WriteLine("Verification of original value returned needs temp1 = temp2"); + Debug.WriteLine("Verifies Exchange "); + + for (int i = 0; i < 3; i++) + { + for (int j = 0; j < 3; j++) + { + temp1 = value[i]; + temp2 = Interlocked.Exchange(ref value[i], value[j]); + if (temp1 != temp2) + { + Debug.WriteLine("Failure : expected Interlocked.Exchange returns" + + " the original value '" + temp1 + "' but got '" + temp2 + "'"); + break; + } + if (value[i] != value[j]) + { + Debug.WriteLine("Failure : "); + Debug.WriteLine(value[j] + " is not stored at location1"); + break; + } + value[i] = temp1; + } + } + } + + [TestMethod] + public void Interlocked4_CompareExchange_Boundary_Test() + { + /// + /// 1. creates 3 int variables initialized to the boundary values of signed int 32 + /// 2. passes all posible combinations of the values to Interlocked.CompareExchange + /// 3. verifies Exchange upon equality and also verifies original value is returned + /// + /// + + Debug.WriteLine("This is Fixed, see 20323 for details"); + int[] value = new int[] { -2147483648, 0, 2147483647 }; + int temp1, temp2; + + Debug.WriteLine("Verifies the original value is returned at all time"); + Debug.WriteLine("Verifies value is stored in location1 upon equality"); + for (int r = 0; r < 3; r++) + { + for (int p = 0; p < 3; p++) + { + for (int q = 0; q < 3; q++) + { + temp1 = value[r]; + temp2 = Interlocked.CompareExchange(ref value[r], value[p], value[q]); + + if (temp1 != temp2) + { + Debug.WriteLine("Failure : expected Interlocked.CompareExchange returns" + + " the original vaue '" + temp1 + "' but returned '" + temp2 + "'"); + break; + } + if (r == q) + { + + if (value[r] != value[p]) + { + Debug.WriteLine("Failure : expected Interlocked.CompareExchange replaces the original value '" + + temp1 + "' upon equality of the two comparands '" + value[r] + "' and '" + value[q] + "'"); + Debug.WriteLine(value[p] + " is not stored at location1"); + break; + } + } + value[r] = temp1; + } + } + } + } + + } +} diff --git a/Tests/NFUnitTestThread/UnitTestMonitorTests.cs b/Tests/NFUnitTestThread/UnitTestMonitorTests.cs new file mode 100644 index 00000000..a8f8cecd --- /dev/null +++ b/Tests/NFUnitTestThread/UnitTestMonitorTests.cs @@ -0,0 +1,237 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using System.Threading; + +namespace NFUnitTestThread +{ + [TestClass] + class UnitTestMonitorTests + { + public static int monCount = 0; + public static object mutex = new object(); + static public void MonitoredThreadIncrementor() + { + Thread.Sleep(new Random().Next(10)); + Monitor.Enter(mutex); + monCount++; + Monitor.Exit(mutex); + } + static public void MonitoredThreadDecrementor() + { + Thread.Sleep(new Random().Next(10)); + Monitor.Enter(mutex); + monCount--; + Monitor.Exit(mutex); + } + static public void MonitoredThreadIncrementorStarter() + { + Thread[] threadArrayInc = new Thread[4]; + for (int i = 0; i < 4; i++) + { + Debug.WriteLine("Attempting to start inc thread " + i); + threadArrayInc[i] = new Thread(MonitoredThreadIncrementor); + threadArrayInc[i].Start(); + Thread.Sleep(1); + } + Thread.Sleep(10); + for (int i = 0; i < 4; i++) + { + threadArrayInc[i].Join(); + } + } + static public void MonitoredThreadDecrementorStarter() + { + Thread[] threadArrayDec = new Thread[5]; + for (int i = 0; i < 5; i++) + { + Debug.WriteLine("Attempting to start dec thread " + i); + threadArrayDec[i] = new Thread(MonitoredThreadDecrementor); + threadArrayDec[i].Start(); + Thread.Sleep(1); + } + Thread.Sleep(10); + for (int i = 0; i < 5; i++) + { + threadArrayDec[i].Join(); + } + } + static public void MonitoredThreadIncrementor2Starter() + { + Thread[] threadArrayInc2 = new Thread[6]; + for (int i = 0; i < 6; i++) + { + Debug.WriteLine("Attempting to start inc2 thread " + i); + threadArrayInc2[i] = new Thread(MonitoredThreadIncrementor); + threadArrayInc2[i].Start(); + Thread.Sleep(1); + } + Thread.Sleep(10); + for (int i = 0; i < 6; i++) + { + threadArrayInc2[i].Join(); + } + } + + [TestMethod] + public void Monitor1_Basic_Test() + { + /// + /// 1. Starts 4 threads that run asynchronously + /// 2. Each thread increments or decrements while in a critical section + /// 3. Waits for execution and then verifies that all expected operations completed + /// + /// + + Debug.WriteLine("Starts several async threads that Enter and Exit critical sections."); + Debug.WriteLine("This may erroneously pass."); + Debug.WriteLine("This may erroneously fail for extremely slow devices."); + Debug.WriteLine("Starting the 4 threads"); + Thread incThread = new Thread(MonitoredThreadIncrementorStarter); + incThread.Start(); + Thread decThread = new Thread(MonitoredThreadDecrementorStarter); + decThread.Start(); + Thread inc2Thread = new Thread(MonitoredThreadIncrementor2Starter); + inc2Thread.Start(); + Thread lastThread = new Thread(MonitoredThreadDecrementor); + lastThread.Start(); + Thread.Sleep(1); + Debug.WriteLine("Joining All threads to main thread"); + incThread.Join(); + decThread.Join(); + inc2Thread.Join(); + lastThread.Join(); + Debug.WriteLine("Verifying all operations completed successfully"); + if (monCount != 4) + { + Debug.WriteLine("expected final result = '4' but got '" + monCount + "'"); + throw new Exception("expected final result = '4' but got '" + monCount + "'"); + } + } + + static object locker1 = new object(); + + [TestMethod] + public void Monitor2_SynchronizationLockException_Test() + { + /// + /// 1. Call Monitor.Exit without first calling Monitor.Enter on the same object + /// 2. Verify SynchronizationLockException exception is thrown + /// + /// + Debug.WriteLine("Verify SynchronizationLockException exception is thrown"); + Debug.WriteLine("This currently fails, see 20281"); + Debug.WriteLine("Calling Monitor.Exit without first calling Monitor.Enter should throw an exception"); + Assert.Trows(typeof(Exception), () => { Monitor.Exit(locker1); }); + } + + [TestMethod] + public void Monitor3_Enter_ArgumentNullException_Test() + { + /// + /// 1. Call Monitor.Enter passing null reference obj parameter + /// 2. verify ArgumentNullException exception is thrown + /// + /// + + Debug.WriteLine("verify ArgumentNullException exception is thrown "); + Debug.WriteLine("This is fixed, see 20730 for details"); + Debug.WriteLine("Calling Monitor.Enter passing null reference parameter should throw exception"); + Assert.Trows(typeof(ArgumentNullException), () => { Monitor.Enter(null); }); + + } + + [TestMethod] + public void Monitor4_Exit_ArgumentNullException_Test() + { + /// + /// 1. Call Monitor.Exit passing null reference obj parameter + /// 2. verify ArgumentNullException exception is thrown + /// + /// + Debug.WriteLine("verify ArgumentNullException exception is thrown "); + Debug.WriteLine("This is fixed, see 20731 for details"); + Debug.WriteLine("Calling Monitor.Exit passing null reference parameter should throw exception"); + Assert.Trows(typeof(ArgumentNullException), () => { Monitor.Exit(null); }); + } + + static ManualResetEvent flag = new ManualResetEvent(false); + static bool lockResult = false; + static object locker2 = new object(); + static void RepeatedLock() + { + Debug.WriteLine("T1 = " + DateTime.UtcNow); + Monitor.Enter(locker2); + try + { + lockResult = !lockResult; + Debug.WriteLine("I have the lock"); + Nest(); + Debug.WriteLine("I still have the lock"); + } + finally + { + if (flag.WaitOne(500, false)) + { + Monitor.Exit(locker2); + Debug.WriteLine("Here the lock is released"); + } + } + Debug.WriteLine("T4 = " + DateTime.UtcNow); + } + + static void Nest() + { + Debug.WriteLine("T2 = " + DateTime.UtcNow); + Monitor.Enter(locker2); + try + { + Debug.WriteLine("Inside Lock"); + } + finally + { + Monitor.Exit(locker2); + Debug.WriteLine("Released the lock? Not quite!"); + } + Debug.WriteLine("T3 = " + DateTime.UtcNow); + } + + [TestMethod] + public void Monitor5_Repeatedly_Lock_Unlock_Test() + { + Debug.WriteLine("Starts two Threads "); + Debug.WriteLine("Repeatedly locks an object by multiple calls to Monitor.Enter"); + Debug.WriteLine("Verifies the object is unlocked only by a corresponding number of Monitor.Exit"); + Thread newThread1 = new Thread(RepeatedLock); + Thread newThread2 = new Thread(RepeatedLock); + Debug.WriteLine("Starting two threads, repeatedly locking, waiting and verifying"); + newThread1.Start(); + newThread2.Start(); + Thread.Sleep(100); + if (!lockResult) + { + Debug.WriteLine("Failure : both threads passed lock"); + throw new Exception("Failure : both threads passed lock"); + } + Debug.WriteLine("unlocking the final lock and verifying the waiting thread continues"); + flag.Set(); + Thread.Sleep(500); + if (lockResult) + { + Debug.WriteLine("Failure : lock not released by equal number of unlocks"); + throw new Exception("Failure : lock not released by equal number of unlocks"); + } + if (newThread1.IsAlive) + newThread2.Abort(); + if (newThread2.IsAlive) + newThread2.Abort(); + } + + } +} diff --git a/Tests/NFUnitTestThread/UnitTestTimeTests.cs b/Tests/NFUnitTestThread/UnitTestTimeTests.cs new file mode 100644 index 00000000..5aa5b1ed --- /dev/null +++ b/Tests/NFUnitTestThread/UnitTestTimeTests.cs @@ -0,0 +1,573 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using System.Threading; + +namespace NFUnitTestThread +{ + [TestClass] + class UnitTestTimeTests + { + class StatusChecker + { + + public bool m_result = false; + public bool z_flag = false; + public bool c_flag = false; + public bool m_flag = false; + public int counter = 0; + public DateTime t2; + public DateTime t1; + public int m_invokeCount, m_maxCount; + public StatusChecker(int count) + { + m_invokeCount = 0; + m_maxCount = count; + } + + // This method is called by the timer delegate. + public void CheckStatus(Object stateInfo) + { + if (z_flag) + { + t2 = DateTime.UtcNow; + z_flag = false; + } + if (m_flag) + { + t1 = DateTime.UtcNow; + z_flag = true; + m_flag = false; + } + if (c_flag) + { + counter++; + } + AutoResetEvent autoEvent = (AutoResetEvent)stateInfo; + Debug.WriteLine("Checking status: " + + DateTime.UtcNow.ToString() + " " + + (++m_invokeCount).ToString()); + + if (m_invokeCount == m_maxCount) + { + Debug.WriteLine("Reset the counter and signal Main."); + m_invokeCount = 0; + autoEvent.Set(); + m_result = true; + } + } + } + + [TestMethod] + public void Timer_TimerCallback_Test1() + { + /// + /// 1. Creates a TimerCallback + /// 2. Creates a Timer that calls it at 1 sec and every quarter sec thereafter + /// 3. Verifies that the TimerCallback gets called + /// 4. Change period to half sec + /// 5. Disposes of the timer after it signals + /// 6. Verifies that the TimerCallback has been called + /// + /// + Debug.WriteLine("Tests the Timer and TimerCallback classes, "); + Debug.WriteLine("as well as the Change and Dispose methods"); + AutoResetEvent autoEvent = new AutoResetEvent(false); + StatusChecker statusChecker = new StatusChecker(15); + + Debug.WriteLine("Creating the TimerCallback"); + TimerCallback timerDelegate = + new TimerCallback(statusChecker.CheckStatus); + + Debug.WriteLine("Creating timer: " + + DateTime.UtcNow.ToString()); + Timer stateTimer = + new Timer(timerDelegate, autoEvent, 1000, 250); + + statusChecker.m_result = false; + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(5000, false); + if (!statusChecker.m_result) + { + Debug.WriteLine("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + throw new Exception("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + } + statusChecker.m_result = false; + Debug.WriteLine("Changing period to 500msec"); + stateTimer.Change(0, 500); + Debug.WriteLine("Waiting for 7500msec and verifying"); + autoEvent.WaitOne(7500, false); + stateTimer.Dispose(); + Debug.WriteLine("Destroying timer."); + if (!statusChecker.m_result) + { + Debug.WriteLine("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + throw new Exception("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + } + } + + [TestMethod] + public void Timer_TimerCallback_ZeroTest2() + { + /// + /// 1. Creates a TimerCallback + /// 2. Creates a Timer that calls it at 1 sec and every quarter sec thereafter + /// 3. Verifies that the TimerCallback gets called + /// 4. Change duetime to zero sec + /// 5. Disposes of the timer after it signals + /// 6. Verifies that the TimerCallback restarted immediately + /// + /// + + Debug.WriteLine("Tests the Timer and TimerCallback classes, "); + Debug.WriteLine("as well as the Change and Dispose methods"); + AutoResetEvent autoEvent = new AutoResetEvent(false); + StatusChecker statusChecker = new StatusChecker(15); + + Debug.WriteLine("Creating the TimerCallback"); + TimerCallback timerDelegate = + new TimerCallback(statusChecker.CheckStatus); + + Debug.WriteLine("Creating timer: " + + DateTime.UtcNow.ToString()); + Timer stateTimer = + new Timer(timerDelegate, autoEvent, 1000, 250); + + statusChecker.m_result = false; + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(5000, false); + if (!statusChecker.m_result) + { + Debug.WriteLine("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + throw new Exception("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + } + statusChecker.m_result = false; + statusChecker.z_flag = true; + Debug.WriteLine("Changing duetime to zero and Verifying the timer started Immediately."); + DateTime t1 = DateTime.UtcNow; + stateTimer.Change(0, 500); + Thread.Sleep(1); + TimeSpan time = DateTime.UtcNow - statusChecker.t2; + Debug.WriteLine("callback method called within " + time.ToString()); + if (time.CompareTo(new TimeSpan(0, 0, 0, 0, 100)) > 0) + { + Debug.WriteLine("The timer didn't start immediately, started after '" + time.ToString() + "'"); + throw new Exception("The timer didn't start immediately, started after '" + time.ToString() + "'"); + } + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(7500, false); + Debug.WriteLine("Destroying timer."); + stateTimer.Dispose(); + if (!statusChecker.m_result) + { + Debug.WriteLine("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + throw new Exception("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + } + } + + [TestMethod] + public void Timer_Disable_Periodic_Signaling_Test3() + { + /// + /// 1. Creates a TimerCallback + /// 2. Creates a Timer that calls it at 1 sec and every quarter sec thereafter + /// 3. Verifies that the TimerCallback gets called + /// 4. Changes period to zero (0) + /// 5. Verifies periodic signaling is disabled + /// 6. Changes period to Infinite + /// 7. Verifies periodic signaling is disabled + /// 8. Changes period to quarter sec + /// 9. Disposes the timer after it signals + /// 10. Verifies that the TimerCallback has been called + /// + /// + + Debug.WriteLine("Tests the Timer and TimerCallback classes, "); + Debug.WriteLine("as well as the Change and Dispose methods"); + AutoResetEvent autoEvent = new AutoResetEvent(false); + StatusChecker statusChecker = new StatusChecker(15); + + Debug.WriteLine("Creating the TimerCallback"); + TimerCallback timerDelegate = + new TimerCallback(statusChecker.CheckStatus); + + Debug.WriteLine("Creating timer: " + + DateTime.UtcNow.ToString()); + Timer stateTimer = + new Timer(timerDelegate, autoEvent, 1000, 250); + + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(5000, false); + if (!statusChecker.m_result) + { + Debug.WriteLine("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + throw new Exception("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + } + + statusChecker.m_result = false; + statusChecker.c_flag = true; + Debug.WriteLine("Changing period to zero (0) "); + stateTimer.Change(0, 0); + + Debug.WriteLine("Waiting and verifying the callback method is invoked once"); + autoEvent.WaitOne(5000, false); + if (statusChecker.counter != 1) + { + Debug.WriteLine("Failure : expected callback '1' times but got '" + statusChecker.counter + "'"); + throw new Exception("Failure : expected callback '1' times but got '" + statusChecker.counter + "'"); + } + + Debug.WriteLine("Reseting counter to zero"); + statusChecker.counter = 0; + Debug.WriteLine("Changing period to Timeout.Infinite"); + stateTimer.Change(0, Timeout.Infinite); + Debug.WriteLine("Waiting and verifying the callback method is invoked once"); + autoEvent.WaitOne(5000, false); + if (statusChecker.counter != 1) + { + Debug.WriteLine("Failure : expected callback '1' times but got '" + statusChecker.counter + "'"); + throw new Exception("Failure : expected callback '1' times but got '" + statusChecker.counter + "'"); + } + + Debug.WriteLine("Changing period to quarter sec "); + stateTimer.Change(0, 250); + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(5000, false); + Debug.WriteLine("Destroying timer."); + stateTimer.Dispose(); + if (!statusChecker.m_result) + { + Debug.WriteLine("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + throw new Exception("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + } + } + + [TestMethod] + public void Timer_TimerCallback_Duetime_Infinite_Test4() + { + /// + /// 1. Creates a TimerCallback + /// 2. Creates a Timer that calls it after infinite time + /// 3. Verifies the callback method is never invoked + /// + /// + + Debug.WriteLine("Tests the TimerCallback is never invoked if it's duetime is infinite "); + AutoResetEvent autoEvent = new AutoResetEvent(false); + StatusChecker statusChecker = new StatusChecker(15); + statusChecker.c_flag = true; + Debug.WriteLine("Creating the TimerCallback"); + TimerCallback timerDelegate = + new TimerCallback(statusChecker.CheckStatus); + + Debug.WriteLine("Creating timer: " + + DateTime.UtcNow.ToString()); + Timer stateTimer = + new Timer(timerDelegate, autoEvent, Timeout.Infinite, 250); + + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(5000, false); + Debug.WriteLine("Destroying timer."); + stateTimer.Dispose(); + if (statusChecker.counter != 0) + { + Debug.WriteLine("Failure : expected callback method never invoked" + + " but is invoked '" + statusChecker.counter + "' times"); + throw new Exception("Failure : expected callback method never invoked" + + " but is invoked '" + statusChecker.counter + "' times"); + } + } + + [TestMethod] + public void Timer_Dispose_Test5() + { + /// + /// 1. Creates a TimerCallback + /// 2. Creates a Timer that calls it at 1 sec and every quarter sec thereafter + /// 3. Immediately Disposes the timer + /// 4. Verifies that the Timer is disposed + /// + /// + + Debug.WriteLine("Tests the Timer and TimerCallback classes, "); + Debug.WriteLine("as well as the Change and Dispose methods"); + AutoResetEvent autoEvent = new AutoResetEvent(false); + StatusChecker statusChecker = new StatusChecker(15); + statusChecker.c_flag = true; + Debug.WriteLine("Creating the TimerCallback"); + TimerCallback timerDelegate = + new TimerCallback(statusChecker.CheckStatus); + + Debug.WriteLine("Creating timer: " + + DateTime.UtcNow.ToString()); + Timer stateTimer = + new Timer(timerDelegate, autoEvent, 1000, 250); + Debug.WriteLine("Immediately Destroying timer"); + stateTimer.Dispose(); + Debug.WriteLine("Waiting and verifying for Timer disposed"); + autoEvent.WaitOne(5000, false); + if (statusChecker.counter != 0) + { + Debug.WriteLine("Failure : expected timer destroyed immediately hence callback method" + + " never invoked but is invoked '" + statusChecker.counter + "' times"); + throw new Exception("Failure : expected timer destroyed immediately hence callback method" + + " never invoked but is invoked '" + statusChecker.counter + "' times"); + } + } + + [TestMethod] + public void Timer_Negative_Period_Test6() + { + + /// + /// 1. Creates a TimerCallback + /// 2. Creates a Timer that calls it at 1 sec and every quarter sec thereafter + /// 3. Verifies that the TimerCallback gets called + /// 4. Changes period to -2 (negative two) sec + /// 5. Verifies ArgumentOutOfRangeException exception is thrown + /// + /// + + Debug.WriteLine("Tests the Timer and TimerCallback classes, "); + Debug.WriteLine("as well as the Change and Dispose methods"); + AutoResetEvent autoEvent = new AutoResetEvent(false); + StatusChecker statusChecker = new StatusChecker(15); + + Debug.WriteLine("Creating the TimerCallback"); + TimerCallback timerDelegate = + new TimerCallback(statusChecker.CheckStatus); + + Debug.WriteLine("Creating timer: " + + DateTime.UtcNow.ToString()); + Timer stateTimer = + new Timer(timerDelegate, autoEvent, 1000, 250); + + statusChecker.m_result = false; + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(5000, false); + statusChecker.m_result = false; + Debug.WriteLine("Changing period to -ve"); + Debug.WriteLine("period is negative and is not equal to Infinite (or -1) should throw an exception"); + Assert.Trows(typeof(ArgumentOutOfRangeException), () => + { + stateTimer.Change(0, -2); + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(7500, false); + }); + Debug.WriteLine("Destroying timer."); + stateTimer.Dispose(); + } + + [TestMethod] + public void Timer_Negative_Duetime_Test7() + { + /// + /// 1. Creates a TimerCallback + /// 2. Creates a Timer that calls it at 1 sec and every quarter sec thereafter + /// 3. Verifies that the TimerCallback gets called + /// 4. Changes duetime to -2 (negative two) sec + /// 5. Verifies ArgumentOutOfRangeException exception is thrown + /// + /// + + Debug.WriteLine("Tests the Timer Change method for ArgumentOutOfRangeException"); + AutoResetEvent autoEvent = new AutoResetEvent(false); + StatusChecker statusChecker = new StatusChecker(15); + + Debug.WriteLine("Creating the TimerCallback"); + TimerCallback timerDelegate = + new TimerCallback(statusChecker.CheckStatus); + + Debug.WriteLine("Creating timer: " + + DateTime.UtcNow.ToString()); + Timer stateTimer = + new Timer(timerDelegate, autoEvent, 1000, 250); + + statusChecker.m_result = false; + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(5000, false); + statusChecker.m_result = false; + Debug.WriteLine("Changing period -ve"); + Debug.WriteLine("duetime is negative and is not equal to Infinite(or -1) should throw an exception"); + Assert.Trows(typeof(ArgumentOutOfRangeException), () => + { + stateTimer.Change(-2, 500); + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(7500, false); + }); + + Debug.WriteLine("Destroying timer."); + stateTimer.Dispose(); + } + + [TestMethod] + public void Timer_TimerCallback_Null_Test8() + { + /// + /// 1. Creates a Timer with callback parameter null + /// 2. Verifies ArgumentNullException exception is thrown + /// + /// + Debug.WriteLine("Tests the Timer for ArgumentNullException"); + + AutoResetEvent autoEvent = new AutoResetEvent(false); + StatusChecker statusChecker = new StatusChecker(15); + + Debug.WriteLine("Creating timer: " + + DateTime.UtcNow.ToString()); + Assert.Trows(typeof(Exception), () => + { + Debug.WriteLine("Passing callback parameter to a timer should throw exception"); + Timer stateTimer = new Timer(null, autoEvent, 1000, 250); + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(7500, false); + Debug.WriteLine("Destroying timer."); + stateTimer.Dispose(); + }); + } + + [TestMethod] + public void Timer_MaxInt_DueTime_Test9() + { + /// + /// 1. Creates a TimerCallback + /// 2. Creates a Timer that calls it at 1 sec and every quarter sec thereafter + /// 3. Verifies that the TimerCallback gets called + /// 4. Changes duetime to MaxInt (in this case MaxInt assumed to be 4 sec) + /// 5. Disposes of the timer after it signals + /// 6. Verifies that the TimerCallback starts after 4 sec + /// + /// + + Debug.WriteLine("Tests the Timer and TimerCallback classes, "); + Debug.WriteLine("as well as the Change and Dispose methods"); + AutoResetEvent autoEvent = new AutoResetEvent(false); + StatusChecker statusChecker = new StatusChecker(15); + + Debug.WriteLine("Creating the TimerCallback"); + TimerCallback timerDelegate = + new TimerCallback(statusChecker.CheckStatus); + + Debug.WriteLine("Creating timer: " + + DateTime.UtcNow.ToString()); + Timer stateTimer = + new Timer(timerDelegate, autoEvent, 1000, 250); + + statusChecker.m_result = false; + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(5000, false); + if (!statusChecker.m_result) + { + Debug.WriteLine("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + throw new Exception("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + } + statusChecker.m_result = false; + statusChecker.z_flag = true; + Debug.WriteLine("Changing duetime to 4 sec (Assumed MaxInt)"); + DateTime t1 = DateTime.UtcNow; + stateTimer.Change(4000, 250); + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(8000, false); + TimeSpan duration = statusChecker.t2 - t1; + Debug.WriteLine("Verifying callback method 1st invoked after 4000msec."); + if (duration.CompareTo(new TimeSpan(4000)) <= 0) + { + Debug.WriteLine("Failure : expected 1st callback happens more than" + + " '4000msec.' but happened after '" + duration.ToString() + "'"); + throw new Exception("Failure : expected 1st callback happens more than" + + " '4000msec.' but happened after '" + duration.ToString() + "'"); + } + if (!statusChecker.m_result) + { + Debug.WriteLine("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + throw new Exception("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + } + Debug.WriteLine("Destroying timer."); + stateTimer.Dispose(); + } + + [TestMethod] + public void Timer_MaxInt_Period_Test10() + { + /// + /// 1. Creates a TimerCallback + /// 2. Creates a Timer that calls it at 1 sec and every quarter sec thereafter + /// 3. Verifies that the TimerCallback gets called + /// 4. Changes period to MaxInt (in this case MaxInt assumed to be 4 sec) + /// 5. Disposes of the timer after it signals + /// 6. Verifies that the TimerCallback starts every 4 sec + /// + /// + + Debug.WriteLine("Tests the Timer and TimerCallback classes, "); + Debug.WriteLine("as well as the Change and Dispose methods"); + AutoResetEvent autoEvent = new AutoResetEvent(false); + StatusChecker statusChecker = new StatusChecker(15); + + Debug.WriteLine("Creating the TimerCallback"); + TimerCallback timerDelegate = + new TimerCallback(statusChecker.CheckStatus); + + Debug.WriteLine("Creating timer: " + + DateTime.UtcNow.ToString()); + Timer stateTimer = + new Timer(timerDelegate, autoEvent, 1000, 250); + + statusChecker.m_result = false; + Debug.WriteLine("Waiting and verifying"); + autoEvent.WaitOne(5000, false); + if (!statusChecker.m_result) + { + Debug.WriteLine("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + throw new Exception("Failure : expected callback '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + } + statusChecker.m_result = false; + statusChecker.m_flag = true; + Debug.WriteLine("Changing period to 4 sec (Assumed MaxInt)"); + stateTimer.Change(0, 4000); + Debug.WriteLine("Waiting and verifying callback method is invoked every 4 sec"); + autoEvent.WaitOne(60000, false); + if (!statusChecker.m_result) + { + Debug.WriteLine("Failure : after 60sec. expected callback invoked '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + throw new Exception("Failure : after 60sec. expected callback invoked '" + statusChecker.m_maxCount + + "' times but got '" + statusChecker.m_invokeCount + "'"); + } + Debug.WriteLine("Verifying time interval b/n callback invoke is atleast 4sec."); + TimeSpan duration = statusChecker.t2 - statusChecker.t1; + if (duration.CompareTo(new TimeSpan(4000)) < 0) + { + Debug.WriteLine("Failure : expected interval b/n callbacks at least '4sec' but got '" + duration.Seconds.ToString() + "sec'"); + throw new Exception("Failure : expected interval b/n callbacks at least '4sec' but got '" + duration.Seconds.ToString() + "sec'"); + } + Debug.WriteLine("Destroying timer."); + stateTimer.Dispose(); + } + + } +} diff --git a/Tests/NFUnitTestThread/UnitTestTimeoutTests.cs b/Tests/NFUnitTestThread/UnitTestTimeoutTests.cs new file mode 100644 index 00000000..40ee0be5 --- /dev/null +++ b/Tests/NFUnitTestThread/UnitTestTimeoutTests.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using System.Threading; + +namespace NFUnitTestThread +{ + [TestClass] + class UnitTestTimeoutTests + { + class Work + { + public void DoWorkInfinite() + { + Thread.Sleep(300); + Debug.WriteLine("Instance thread procedure DoWorkInfinite."); + Thread.Sleep(Timeout.Infinite); + } + public static void DoWorkInfiniteStatic() + { + Thread.Sleep(300); + Debug.WriteLine("Static thread procedure DoWorkInfiniteStatic."); + Thread.Sleep(Timeout.Infinite); + } + } + + [TestMethod] + public void Timeout1_Infinite_Test() + { + /// + /// 1. Starts two threads which have an Infinite execution time one static + /// 2. Calls Abort on the Infinite threads + /// 3. Verifies that the aborted threads stop immediately + /// + /// + + Debug.WriteLine("Starts two threads one infinitely long, aborts one and passes."); + Debug.WriteLine("This may erroneously fail for extremely slow devices."); + + Debug.WriteLine("Starting the two threads"); + Thread newThread1 = new Thread(Work.DoWorkInfiniteStatic); + newThread1.Start(); + Work w = new Work(); + Thread newThread2 = new Thread(w.DoWorkInfinite); + newThread2.Start(); + Thread.Sleep(1); + + Debug.WriteLine("Waiting for 1000msec and verifying both threads are alive"); + int slept = 0; + while ((newThread1.IsAlive || newThread2.IsAlive) && slept < 1000) + { + Thread.Sleep(100); + slept += 100; + } + if (!newThread1.IsAlive || !newThread2.IsAlive) + { + Debug.WriteLine("Failure : Both threads were suppose to be sleeping for Timeout.Infinite"); + Debug.WriteLine("IsAlive ? Thread1 = '" + newThread1.IsAlive + "' and Thread2 = '" + newThread2.IsAlive + "'"); + throw new Exception("IsAlive ? Thread1 = '" + newThread1.IsAlive + "' and Thread2 = '" + newThread2.IsAlive + "'"); + } + + Debug.WriteLine("Aborting both threds and Verifying abort."); + newThread2.Abort(); + newThread1.Abort(); + Thread.Sleep(10); + if (newThread1.IsAlive || newThread2.IsAlive) + { + Debug.WriteLine("Upon Abort both thread should be dead but"); + Debug.WriteLine("IsAlive ? Thread1 = '" + newThread1.IsAlive + "' and Thread2 = '" + newThread2.IsAlive + "'"); + throw new Exception("IsAlive ? Thread1 = '" + newThread1.IsAlive + "' and Thread2 = '" + newThread2.IsAlive + "'"); + } + } + + } +} diff --git a/Tests/NFUnitTestThread/UnitTestWaitHandleTests.cs b/Tests/NFUnitTestThread/UnitTestWaitHandleTests.cs new file mode 100644 index 00000000..5c26575e --- /dev/null +++ b/Tests/NFUnitTestThread/UnitTestWaitHandleTests.cs @@ -0,0 +1,160 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using System.Threading; + +namespace NFUnitTestThread +{ + [TestClass] + class UnitTestWaitHandleTests + { + static WaitHandle[] waitHandles = new WaitHandle[] + { + new AutoResetEvent(false), + new AutoResetEvent(false) + }; + + + static void DoTask1() + { + AutoResetEvent are = (AutoResetEvent)waitHandles[0]; + int time = 10000; + Thread.Sleep(time); + are.Set(); + } + + static void DoTask2() + { + AutoResetEvent are = (AutoResetEvent)waitHandles[1]; + int time = 500; + Thread.Sleep(time); + are.Set(); + } + + [TestMethod] + public void WaitHandle1_WaitAll_WaitAny_Test() + { + /// + /// 1. Starts two threads + /// 2. Calls WaitAll with respect to those threads + /// 3. Verifies that both threads have executed + /// 4. Restarts the threads + /// 5. Calls WaitAny with respect to those threads + /// 6. Verifies that only one threads has executed + /// + /// + Debug.WriteLine("This test may erroneously pass or fail due to machine speed"); + Debug.WriteLine("Tests the WaitAll method"); + + Debug.WriteLine("Create threads"); + Thread t1 = new Thread(DoTask1); + Thread t2 = new Thread(DoTask2); + t1.Start(); + t2.Start(); + Thread.Sleep(1); + + Debug.WriteLine("Waiting for all tasks to complete and verifying"); + if (!WaitHandle.WaitAll(waitHandles)) + { + Debug.WriteLine("Not all waithandles has received the signal"); + throw new Exception("Not all waithandles has received the signal"); + } + bool r = t1.IsAlive, s = t2.IsAlive; + if (r || s) + { + Debug.WriteLine("Not all threads are dead"); + if (r) + { + Debug.WriteLine("t1 is Alive"); + } + if (s) + { + Debug.WriteLine("t2 is Alive"); + } + throw new Exception("Not all threads are dead"); + } + + Debug.WriteLine("Re-create threads"); + t1 = new Thread(DoTask1); + t2 = new Thread(DoTask2); + t1.Start(); + t2.Start(); + Thread.Sleep(1); + + Debug.WriteLine("Waiting for either task to complete and verifying"); + Debug.WriteLine("The WaitHandle with index " + WaitHandle.WaitAny(waitHandles).ToString() + " satisfied the wait"); + Debug.WriteLine("Doing t1 XOR t2 to verify only one but not both are alive or dead"); + Debug.WriteLine("t1 XOR t2 = ~((p&q)||(~p & ~q))"); + bool p = t1.IsAlive, q = t2.IsAlive; + if ((p && q) || ((!p) && (!q))) + { + Debug.WriteLine("Not both but either one should have finished"); + throw new Exception("Not both but either one should have finished"); + } + Debug.WriteLine(p == true ? "t1 is Alive " : "t1 is Dead "); + Debug.WriteLine(q == true ? "t2 is Alive " : "t2 is Dead "); + + } + + static AutoResetEvent ready = new AutoResetEvent(false); + static AutoResetEvent go = new AutoResetEvent(false); + static int counter = 0; + + static void Work() + { + while (true) + { + ready.Set(); // Indicate that we're ready + go.WaitOne(); // Wait to be kicked off... + if (counter == 0) return; // Gracefully exit + Debug.WriteLine("Counter = " + counter); + } + } + + [TestMethod] + public void WaitHandle2_WatiOne_Test() + { + /// + /// 1. Starts a thread + /// 2. waits until the thread is ready, calling WaitOne + /// 3. when the thread signals it's ready, it continues executing + /// 4. worker thread waits on the other hand till it's signaled + /// 5. worker thread continues execution when signaled + /// 6. Verifies thread waits, and executes when signaled. + /// + /// + + Debug.WriteLine("This test verifies thread waits, and executes when signaled"); + Debug.WriteLine("Tests WaitOne method"); + Thread newThread1 = new Thread(Work); + newThread1.Start(); + + Debug.WriteLine("Signal the worker 5 times"); + for (int i = 1; i <= 5; i++) + { + Debug.WriteLine("First wait until worker is ready"); + ready.WaitOne(); + Debug.WriteLine("Doing task"); + counter++; + Debug.WriteLine("Tell worker to go!"); + go.Set(); + } + if (counter != 5) + { + Debug.WriteLine("expected signaling '5' but got '" + counter + "'"); + throw new Exception("expected signaling '5' but got '" + counter + "'"); + } + Debug.WriteLine("Tell the worker to end by reseting counter to 0(zero)"); + ready.WaitOne(); + counter = 0; + go.Set(); + } + + } +} diff --git a/Tests/NFUnitTestThread/nano.runsettings b/Tests/NFUnitTestThread/nano.runsettings index 38fae61f..637da150 100644 --- a/Tests/NFUnitTestThread/nano.runsettings +++ b/Tests/NFUnitTestThread/nano.runsettings @@ -4,7 +4,7 @@ 1 .\TestResults - 120000 + 300000 Framework40 diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 567c31d2..59b4bd82 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -25,6 +25,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestTypes", "Tests\NF EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestThread", "Tests\NFUnitTestThread\NFUnitTestThread.nfproj", "{BDBFD5E3-46C4-4ACD-B66C-60F00618FD91}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestSystemLib", "Tests\NFUnitTestSystemLib\NFUnitTestSystemLib.nfproj", "{E63A23A8-5335-4976-BA47-0AC7F1AEDD32}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -63,6 +65,12 @@ Global {BDBFD5E3-46C4-4ACD-B66C-60F00618FD91}.Release|Any CPU.ActiveCfg = Release|Any CPU {BDBFD5E3-46C4-4ACD-B66C-60F00618FD91}.Release|Any CPU.Build.0 = Release|Any CPU {BDBFD5E3-46C4-4ACD-B66C-60F00618FD91}.Release|Any CPU.Deploy.0 = Release|Any CPU + {E63A23A8-5335-4976-BA47-0AC7F1AEDD32}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E63A23A8-5335-4976-BA47-0AC7F1AEDD32}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E63A23A8-5335-4976-BA47-0AC7F1AEDD32}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {E63A23A8-5335-4976-BA47-0AC7F1AEDD32}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E63A23A8-5335-4976-BA47-0AC7F1AEDD32}.Release|Any CPU.Build.0 = Release|Any CPU + {E63A23A8-5335-4976-BA47-0AC7F1AEDD32}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -72,6 +80,7 @@ Global {6D93536D-2CFC-4BB8-B490-080EB11D40DD} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {05B18D3A-F70D-4104-8F78-FDC577E11081} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {BDBFD5E3-46C4-4ACD-B66C-60F00618FD91} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {E63A23A8-5335-4976-BA47-0AC7F1AEDD32} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From 70aaa3cc45f654c342e821a5c4536556330198b3 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Sun, 28 Feb 2021 22:14:56 +0300 Subject: [PATCH 23/55] Adding system lib --- .../NFUnitTestSystemLib.nfproj | 10 +- Tests/NFUnitTestSystemLib/UnitTestDateTime.cs | 1176 +++++++++++++++++ Tests/NFUnitTestSystemLib/UnitTestGuid.cs | 4 +- .../UnitTestInitLocalTests.cs | 212 +++ .../NFUnitTestSystemLib/UnitTestParseTests.cs | 873 ++++++++++++ Tests/NFUnitTestSystemLib/UnitTestTimeSpan.cs | 1146 ++++++++++++++++ Tests/NFUnitTestSystemLib/nano.runsettings | 3 +- Tests/NFUnitTestSystemLib/packages.config | 2 +- 8 files changed, 3419 insertions(+), 7 deletions(-) create mode 100644 Tests/NFUnitTestSystemLib/UnitTestDateTime.cs create mode 100644 Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs create mode 100644 Tests/NFUnitTestSystemLib/UnitTestParseTests.cs create mode 100644 Tests/NFUnitTestSystemLib/UnitTestTimeSpan.cs diff --git a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj index 795ef072..eea2e6a4 100644 --- a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj +++ b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj @@ -27,8 +27,12 @@ $(MSBuildProjectDirectory)\nano.runsettings + + + + @@ -36,13 +40,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestSystemLib/UnitTestDateTime.cs b/Tests/NFUnitTestSystemLib/UnitTestDateTime.cs new file mode 100644 index 00000000..d1f4dd44 --- /dev/null +++ b/Tests/NFUnitTestSystemLib/UnitTestDateTime.cs @@ -0,0 +1,1176 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestSystemLib +{ + [TestClass] + class UnitTestDateTime + { + [TestMethod] + public void DateTime_ConstructorTest1() + { + /// + /// 1. Creates a DateTime + /// 2. Verifies that the created object is a DateTime + /// + + Debug.WriteLine("Creating new DateTime Object"); + DateTime dt = new DateTime(); + Debug.WriteLine(dt.ToString()); + Type type = dt.GetType(); + Debug.WriteLine("Verifying its type"); + Assert.IsType(type, Type.GetType("System.DateTime")); + } + + [TestMethod] + public void DateTime_ConstructorTest2() + { + /// + /// 1. Creates a DateTime + /// 2. Verifies that the created object is a DateTime + /// + /// + + Debug.WriteLine("Generating 10 random DateTime and Verifying"); + for (int i = 0; i < 10; i++) + { + DateTime dt = GetRandomDateTime(); + if (dt.Year != year || dt.Month != month || dt.Day != day || + dt.Hour != hour || dt.Minute != minute || + dt.Second != second || dt.Millisecond != millisec) + { + throw new Exception("Expected DateTime '" + month + "/" + day + "/" + year + + " " + hour + ":" + minute + ":" + second + ":" + millisec + + "' but got '" + dt.Month + "/" + dt.Day + "/" + dt.Year + " " + + dt.Hour + ":" + dt.Minute + ":" + dt.Second + ":" + dt.Millisecond + "'"); + } + Type t = dt.GetType(); + Assert.IsType(t, Type.GetType("System.DateTime")); + } + } + + [TestMethod] + public void DateTime_ConstructorTest3() + { + /// + /// 1. Creates Minimum and Maximum DateTimes + /// 2. Verifies the DateTimes are equal to DateTime.MinValue, DateTime.MaxValue + /// + /// + Debug.WriteLine("Creating Minimum DateTime and verifying"); + DateTime minDT1 = DateTime.MinValue; + DateTime minDT2 = new DateTime(); + DateTime minDT3 = new DateTime(0); + DateTime minDT4 = new DateTime(1601, 1, 1, 0, 0, 0, 0); + + if ((DateTime.Compare(minDT1, minDT2) != 0) || + (DateTime.Compare(minDT2, minDT3) != 0) || + (DateTime.Compare(minDT3, minDT4) != 0)) + { + Debug.WriteLine("DateTime.MinValue = '" + minDT1.Ticks + "'ticks,"); + Debug.WriteLine(" new DateTime() = '" + minDT2.Ticks + "'ticks,"); + Debug.WriteLine("new DateTime(0) = '" + minDT3.Ticks + "'ticks."); + throw new Exception("Expected 'DateTime.MinValue' is equal to 'new DateTime()', " + + "equal to 'new DateTime(0)', equal to 'new DateTime(1, 1, 1, 0, 0, 0, 0)' but got "); + } + + Debug.WriteLine("Creating Maximum DateTime and verifying"); + DateTime maxDateTime = new DateTime(441796895990000000); + Assert.True(DateTime.MaxValue.Equals(maxDateTime)); + } + + [TestMethod] + public void DateTime_CompareToTest4() + { + /// + /// 1. Creates random DateTimes + /// 2. Verifies that they CompareTo each other + /// + /// + Debug.WriteLine("Generating random DateTimes b/n 1000 - 9000"); + Debug.WriteLine("comparing eachother with DateTime.CompareTo and verifying"); + DateTime dt1 = DateTime_btwn_1801_And_2801(); + DateTime dt2 = new DateTime(year, month, day, hour, minute, second, millisec); + Debug.WriteLine("Comparing two equal DateTimes"); + Assert.Equal(dt1.CompareTo(dt2), 0); + Debug.WriteLine("Comparing Unequal DateTimes and Verifying"); + dt2 = dt1.Add(new TimeSpan(1)); + Assert.False(dt1.CompareTo(dt2) >= 0); + Assert.False(dt2.CompareTo(dt1) <= 0); + } + + [TestMethod] + public void DateTime_EqualsTest5() + { + /// + /// 1. Creates two DateTimes + /// 2. Verifies that they Equals each other + /// + /// + Debug.WriteLine("Generating random DateTime"); + DateTime dt1 = GetRandomDateTime(); + DateTime dt2 = new DateTime(year, month, day, hour, minute, second, millisec); + Assert.True(dt1.Equals(dt2)); + } + + [TestMethod] + public void DateTime_ToStringTest6() + { + /// + /// 1. Creates a DateTime + /// 2. Verifies that it correctly returns a string from ToString + /// + /// + Debug.WriteLine("Generating random DateTime"); + DateTime dt = GetRandomDateTime(); + int[] intArr = new int[] { dt.Month, dt.Day, dt.Year, dt.Hour, dt.Minute, dt.Second }; + string[] strArr = new string[] { "", "", "", "", "", "" }; + for (int i = 0; i < intArr.Length; i++) + { + if (i == 2) + { + if (intArr[2] < 100) + strArr[2] += "00" + intArr[2]; + else if (intArr[2] < 1000) + strArr[2] += "0" + intArr[2]; + else + strArr[2] += intArr[2]; + } + else + { + if (intArr[i] < 10) + { + strArr[i] += "0" + intArr[i]; + } + else + strArr[i] += intArr[i]; + } + } + string str = strArr[0] + "/" + strArr[1] + "/" + strArr[2] + " " + strArr[3] + ":" + strArr[4] + ":" + strArr[5]; + Assert.Equal(dt.ToString(), str); + } + + //[TestMethod] + //public void DateTime_ToStringTest7() + //{ + // /// + // /// 1. Creates a DateTime + // /// 2. Verifies DateTime.ToString (String) returns correct String using a specified format + // /// + // Debug.WriteLine("Generating random DateTime"); + // DateTime dt = GetRandomDateTime(); + // Debug.WriteLine("DateTime.ToString(String) using Standard Formats and Verifying"); + // string[] standardFmts = { "d", "D", "f", "F", "g", "G", "m", "M", "o", "R", "r", "s", "t", "T", "u", "U", "Y", "y" }; + // foreach (string standardFmt in standardFmts) + // { + // try + // { + // if (dt.ToString(standardFmt).Length < 1) + // { + // Debug.WriteLine("Expected a String length greater than '0' but got '" + + // dt.ToString(standardFmt).Length + "'"); + // testResult = MFTestResults.Fail; + // } + // } + // catch (Exception ex) + // { + // Debug.WriteLine("This currently fails, DateTime.ToString(String)" + + // " throws ArgumentException for some string formats, see 22837 for details"); + // Debug.WriteLine("Caught " + ex.Message + " when Trying DateTime.ToString(" + standardFmt + ")"); + // testResult = MFTestResults.KnownFailure; + // } + // } + // Debug.WriteLine("DateTime.ToString(String) using Custom Formats and Verifying"); + // string[] customFmts = {"h:mm:ss.ff t", "d MMM yyyy", "HH:mm:ss.f","dd MMM HH:mm:ss", + // @"\Mon\t\h\: M", "MM/dd/yyyy", "dddd, dd MMMM yyyy", "MMMM dd", "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'", + // "yyyy'-'MM'-'dd'T'HH':'mm':'ss", "HH:mm", "yyyy'-'MM'-'dd HH':'mm':'ss'Z'", "yyyy MMMM"}; + // foreach (string customFmt in customFmts) + // { + // try + // { + // if (dt.ToString(customFmt).Length < 1) + // { + // Debug.WriteLine("Expected a String length greater than '0' but got '" + + // dt.ToString(customFmt).Length + "'"); + // testResult = MFTestResults.Fail; + // } + // } + // catch (Exception ex) + // { + // Debug.WriteLine("Caught " + ex.Message + " when Trying DateTime.ToString(" + customFmt + ")"); + // testResult = MFTestResults.KnownFailure; + // } + // } + //} + + [TestMethod] + public void DateTime_AddTest8() + { + /// + /// 1. Creates a DateTime + /// 2. Runs the Add function and verifies output + /// + /// + Debug.WriteLine("Generating random DateTimes "); + DateTime[] dt1Arr = Get_ArrayOfRandomDateTimes(); + TimeSpan ts; + Random random = new Random(); + for (int i = 0; i < dt1Arr.Length; i++) + { + DateTime dt1 = dt1Arr[i]; + if (i % 2 == 0) + { + ts = new TimeSpan(-random.Next(1000)); + } + else + { + ts = new TimeSpan(random.Next(1000)); + } + Debug.WriteLine("Adding '" + ts.ToString() + "' Timespan to '" + dt1.ToString() + "'"); + DateTime dt2 = dt1.Add(ts); + Assert.Equal(dt2.Ticks, (dt1.Ticks + ts.Ticks)); + } + } + + [TestMethod] + public void DateTime_AddDays_PositiveTest9() + { + /// + /// 1. Creates a DateTime + /// 2. Runs the AddDays function and verifies output + /// + /// + Debug.WriteLine("Generating random DateTime"); + DateTime[] dt1Arr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + Debug.WriteLine("Adding Random +ve Days and verifying"); + for (int i = 0; i < dt1Arr.Length; i++) + { + DateTime dt1 = dt1Arr[i]; + double dy = random.Next(1000) * rdmFraction[random.Next(rdmFraction.Length)]; + Debug.WriteLine("Adding '" + dy + "' days to '" + dt1.ToString() + "'"); + DateTime dt2 = dt1.AddDays(dy); + if (!CheckDeviation((long)(dt1.Ticks + (dy * TimeSpan.TicksPerDay)), dt2.Ticks)) + { + throw new Exception("After Adding +ve day = '" + dy + "' to a DateTime = '" + dt1 + + "', expected Ticks = '" + (long)(dt1.Ticks + (dy * TimeSpan.TicksPerDay)) + + "' but got Ticks = '" + dt2.Ticks + "'"); + } + } + } + + [TestMethod] + public void DateTime_AddDays_NegativeTest10() + { + /// + /// 1. Creates a DateTime + /// 2. Runs the AddDays function and verifies output + /// + /// + + Debug.WriteLine("This is fixed, DateTime.AddXXXX methods do not handle negative"); + Debug.WriteLine("values correctly on Device, see 22728 for details"); + Debug.WriteLine("Generating random DateTime"); + DateTime[] dt1Arr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + Debug.WriteLine("Adding Random -ve Days and verifying"); + for (int i = 0; i < dt1Arr.Length; i++) + { + DateTime dt1 = dt1Arr[i]; + double dy = -random.Next(1000) * rdmFraction[random.Next(rdmFraction.Length)]; + Debug.WriteLine("Adding '" + dy + "' days to '" + dt1.ToString() + "'"); + DateTime dt2 = dt1.AddDays(dy); + if (!CheckDeviation((long)(dt1.Ticks + (dy * TimeSpan.TicksPerDay)), dt2.Ticks)) + { + throw new Exception("After Adding -ve day = '" + dy + "' to a DateTime = '" + dt1 + + "', expected Ticks = '" + (long)(dt1.Ticks + (dy * TimeSpan.TicksPerDay)) + + "' but got Ticks = '" + dt2.Ticks + "'"); + } + } + } + + [TestMethod] + public void DateTime_AddHours_PositiveTest11() + { + /// + /// 1. Creates a DateTime + /// 2. Runs the AddHours function and verifies output + /// + /// + + Debug.WriteLine("Generating random DateTime"); + DateTime[] dt1Arr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + Debug.WriteLine("Adding Random +ve Hours and verifying"); + for (int i = 0; i < dt1Arr.Length; i++) + { + DateTime dt1 = dt1Arr[i]; + double hr = random.Next(1000) * rdmFraction[random.Next(rdmFraction.Length)]; + Debug.WriteLine("Adding '" + hr + "' hours to '" + dt1.ToString() + "'"); + DateTime dt2 = dt1.AddHours(hr); + if (!CheckDeviation((long)(dt1.Ticks + (hr * TimeSpan.TicksPerHour)), dt2.Ticks)) + { + throw new Exception("After Adding +ve hour = '" + hr + "' to a DateTime = '" + dt1 + + "', expected Ticks = '" + (long)(dt1.Ticks + (hr * TimeSpan.TicksPerHour)) + + "' but got Ticks = '" + dt2.Ticks + "'"); + } + } + } + + [TestMethod] + public void DateTime_AddHours_NegativeTest12() + { + /// + /// 1. Creates a DateTime + /// 2. Runs the AddHours function and verifies output + /// + /// + + Debug.WriteLine("This is fixed, DateTime.AddXXXX methods do not handle negative"); + Debug.WriteLine("values correctly on Device, see 22728 for details"); + Debug.WriteLine("Generating random DateTime"); + DateTime[] dt1Arr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + Debug.WriteLine("Adding Random -ve Hours and verifying"); + for (int i = 0; i < dt1Arr.Length; i++) + { + DateTime dt1 = dt1Arr[i]; + double hr = -random.Next(1000) * rdmFraction[random.Next(rdmFraction.Length)]; + Debug.WriteLine("Adding '" + hr + "' hours to '" + dt1.ToString() + "'"); + DateTime dt2 = dt1.AddHours(hr); + if (!CheckDeviation((long)(dt1.Ticks + (hr * TimeSpan.TicksPerHour)), dt2.Ticks)) + { + throw new Exception("After Adding -ve hour = '" + hr + "' to a DateTime = '" + dt1 + + "', expected Ticks = '" + (long)(dt1.Ticks + (hr * TimeSpan.TicksPerHour)) + + "' but got Ticks = '" + dt2.Ticks + "'"); + } + } + } + + [TestMethod] + public void DateTime_AddMilliseconds_PositiveTest13() + { + /// + /// 1. Creates a DateTime + /// 2. Runs the AddMilliseconds function and verifies output + /// + Debug.WriteLine("Generating random DateTime"); + DateTime[] dt1Arr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + Debug.WriteLine("Adding Random +ve Milliseconds and verifying"); + for (int i = 0; i < dt1Arr.Length; i++) + { + DateTime dt1 = dt1Arr[i]; + double msec = random.Next(1000) * rdmFraction[random.Next(rdmFraction.Length)]; + Debug.WriteLine("Adding '" + msec + "' milliseconds to '" + dt1.ToString() + "'"); + DateTime dt2 = dt1.AddMilliseconds(msec); + if (!CheckDeviation((long)(dt1.Ticks + (msec * TimeSpan.TicksPerMillisecond)), dt2.Ticks)) + { + throw new Exception("After Adding +ve milliseconds = '" + msec + "' to a DateTime = '" + dt1 + + "', expected Ticks = '" + (long)(dt1.Ticks + (msec * TimeSpan.TicksPerMillisecond)) + + "' but got Ticks = '" + dt2.Ticks + "'"); + } + } + } + + [TestMethod] + public void DateTime_AddMilliseconds_NegativeTest14() + { + /// + /// 1. Creates a DateTime + /// 2. Runs the AddMilliseconds function and verifies output + /// + Debug.WriteLine("This is fixed, DateTime.AddXXXX methods do not handle negative"); + Debug.WriteLine("values correctly on Device, see 22728 for details"); + Debug.WriteLine("Generating random DateTime"); + DateTime[] dt1Arr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + Debug.WriteLine("Adding Random -ve Milliseconds and verifying"); + for (int i = 0; i < dt1Arr.Length; i++) + { + DateTime dt1 = dt1Arr[i]; + double msec = -random.Next(1000) * rdmFraction[random.Next(rdmFraction.Length)]; + Debug.WriteLine("Adding '" + msec + "' milliseconds to '" + dt1.ToString() + "'"); + DateTime dt2 = dt1.AddMilliseconds(msec); + if (!CheckDeviation((long)(dt1.Ticks + (msec * TimeSpan.TicksPerMillisecond)), dt2.Ticks)) + { + throw new Exception("After Adding -ve milliseconds = '" + msec + "' to a DateTime = '" + dt1 + + "', expected Ticks = '" + (long)(dt1.Ticks + (msec * TimeSpan.TicksPerMillisecond)) + + "' but got Ticks = '" + dt2.Ticks + "'"); + } + } + } + + [TestMethod] + public void DateTime_AddMinutes_PositiveTest15() + { + /// + /// 1. Creates a DateTime + /// 2. Runs the AddMinutes function and verifies output + /// + Debug.WriteLine("Generating random DateTime"); + DateTime[] dt1Arr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + Debug.WriteLine("Adding Random +ve Minutes and verifying"); + for (int i = 0; i < dt1Arr.Length; i++) + { + DateTime dt1 = dt1Arr[i]; + double mnts = random.Next(1000) * rdmFraction[random.Next(rdmFraction.Length)]; + Debug.WriteLine("Adding '" + mnts + "' minutes to '" + dt1.ToString() + "'"); + DateTime dt2 = dt1.AddMinutes(mnts); + if (!CheckDeviation((long)(dt1.Ticks + (mnts * TimeSpan.TicksPerMinute)), dt2.Ticks)) + { + throw new Exception("After Adding +ve minute = '" + mnts + "' to a DateTime = '" + dt1 + + "', expected Ticks = '" + (long)(dt1.Ticks + (mnts * TimeSpan.TicksPerMinute)) + + "' but got Ticks = '" + dt2.Ticks + "'"); + } + } + } + + [TestMethod] + public void DateTime_AddMinutes_NegativeTest16() + { + /// + /// 1. Creates a DateTime + /// 2. Runs the AddMinutes function and verifies output + /// + Debug.WriteLine("This is fixed, DateTime.AddXXXX methods do not handle negative"); + Debug.WriteLine("values correctly on Device, see 22728 for details"); + Debug.WriteLine("Generating random DateTime"); + DateTime[] dt1Arr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + Debug.WriteLine("Adding Random -ve Minutes and verifying"); + for (int i = 0; i < dt1Arr.Length; i++) + { + DateTime dt1 = dt1Arr[i]; + double mnts = -random.Next(1000) * rdmFraction[random.Next(rdmFraction.Length)]; + Debug.WriteLine("Adding '" + mnts + "' minutes to '" + dt1.ToString() + "'"); + DateTime dt2 = dt1.AddMinutes(mnts); + if (!CheckDeviation((long)(dt1.Ticks + (mnts * TimeSpan.TicksPerMinute)), dt2.Ticks)) + { + throw new Exception("After Adding -ve minute = '" + mnts + "' to a DateTime = '" + dt1 + + "', expected Ticks = '" + (long)(dt1.Ticks + mnts * TimeSpan.TicksPerMinute) + + "' but got Ticks = '" + dt2.Ticks + "'"); + } + } + } + + [TestMethod] + public void DateTime_AddSeconds_PositiveTest18() + { + /// + /// 1. Creates a DateTime + /// 2. Runs the AddSeconds function and verifies output + /// + Debug.WriteLine("Generating random DateTime"); + DateTime[] dt1Arr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + Debug.WriteLine("Adding Random +ve Seconds and verifying"); + for (int i = 0; i < dt1Arr.Length; i++) + { + DateTime dt1 = dt1Arr[i]; + double sec = random.Next(1000) * rdmFraction[random.Next(rdmFraction.Length)]; + Debug.WriteLine("Adding '" + sec + "' seconds to '" + dt1.ToString() + "'"); + DateTime dt2 = dt1.AddSeconds(sec); + if (!CheckDeviation((long)(dt1.Ticks + (sec * TimeSpan.TicksPerSecond)), dt2.Ticks)) + { + throw new Exception("After Adding +ve seconds = '" + sec + "' to a DateTime = '" + dt1 + + "', expected Ticks = '" + (long)(dt1.Ticks + (sec * TimeSpan.TicksPerSecond)) + + "' but got Ticks = '" + dt2.Ticks + "'"); + } + } + } + + [TestMethod] + public void DateTime_AddSeconds_NegativeTest19() + { + /// + /// 1. Creates a DateTime + /// 2. Runs the AddSeconds function and verifies output + /// + Debug.WriteLine("This is fixed, DateTime.AddXXXX methods do not handle negative"); + Debug.WriteLine("values correctly on Device, see 22728 for details"); + Debug.WriteLine("Generating random DateTime"); + DateTime[] dt1Arr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + Debug.WriteLine("Adding Random -ve Seconds and verifying"); + for (int i = 0; i < dt1Arr.Length; i++) + { + DateTime dt1 = dt1Arr[i]; + double sec = -random.Next(1000) * rdmFraction[random.Next(rdmFraction.Length)]; + Debug.WriteLine("Adding '" + sec + "' seconds to '" + dt1.ToString() + "'"); + DateTime dt2 = dt1.AddSeconds(sec); + if (!CheckDeviation((long)(dt1.Ticks + (sec * TimeSpan.TicksPerSecond)), dt2.Ticks)) + { + throw new Exception("After Adding -ve seconds = '" + sec + "' to a DateTime = '" + dt1 + + "', expected Ticks = '" + (long)(dt1.Ticks + sec * TimeSpan.TicksPerSecond) + + "' but got Ticks = '" + dt2.Ticks + "'"); + } + } + } + + [TestMethod] + public void DateTime_AddTicks_PositiveTest20() + { + /// + /// 1. Creates a DateTime + /// 2. Runs the AddTicks function and verifies output + /// + Debug.WriteLine("Generating random DateTime"); + DateTime[] dt1Arr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + Debug.WriteLine("Adding Random +ve Ticks and verifying"); + for (int i = 0; i < dt1Arr.Length; i++) + { + DateTime dt1 = dt1Arr[i]; + long ticks = (long)random.Next(1000); + Debug.WriteLine("Adding '" + ticks + "' ticks to '" + dt1.ToString() + "'"); + DateTime dt2 = dt1.AddTicks(ticks); + Assert.Equal(dt2.Ticks, (dt1.Ticks + ticks)); + } + } + + [TestMethod] + public void DateTime_AddTicks_NegativeTest21() + { + /// + /// 1. Creates a DateTime + /// 2. Runs the AddTicks function and verifies output + /// + Debug.WriteLine("Generating random DateTime"); + DateTime[] dt1Arr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + Debug.WriteLine("Adding Random -ve Ticks and verifying"); + for (int i = 0; i < 10; i++) + { + DateTime dt1 = dt1Arr[i]; + long ticks = -(long)random.Next(1000); + Debug.WriteLine("Adding '" + ticks + "' ticks to '" + dt1.ToString() + "'"); + DateTime dt2 = dt1.AddTicks(ticks); + Assert.Equal(dt2.Ticks, (dt1.Ticks + ticks)); + } + } + + [TestMethod] + public void DateTime_Compare_Test23() + { + /// + /// 1. Creates two DateTimes + /// 2. Verifies that they Compare with each other + /// + Debug.WriteLine("Creating two Random but equal DateTime b/n 1000 - 9000"); + Debug.WriteLine("Comparing eachother with DateTime.Compare and Verifying"); + DateTime dt1 = DateTime_btwn_1801_And_2801(); + DateTime dt2 = new DateTime(year, month, day, hour, minute, second, millisec); + Debug.WriteLine("Comparing equal DateTimes and Verifying"); + if (DateTime.Compare(dt1, dt2) != 0) + { + throw new Exception("Expected DateTime.Compare(" + dt1.ToString() + ", " + dt2.ToString() + + ") returns '0' but got '" + DateTime.Compare(dt1, dt2) + "'"); + } + Debug.WriteLine("Comparing Unequal DateTimes and Verifying"); + dt2 = dt1.Add(new TimeSpan(1)); + if (DateTime.Compare(dt1, dt2) >= 0) + { + throw new Exception("Expected DateTime.Compare(" + dt1.ToString() + ", " + dt2.ToString() + + ") returns '-ve' value but got '" + DateTime.Compare(dt1, dt2) + "'"); + } + if (DateTime.Compare(dt2, dt1) <= 0) + { + throw new Exception("Expected DateTime.CompareTo(" + dt1.ToString() + ", " + dt2.ToString() + + ") returns '+ve' value but got '" + DateTime.Compare(dt1, dt2) + "'"); + } + } + + + [TestMethod] + public void DateTime_DaysInMonth_Test24() + { + /// + /// 1. Verifies the accuracy of the DaysInMonth method + /// + Debug.WriteLine("Generates a random year and month, and"); + Random random = new Random(); + Debug.WriteLine("Verifies the number of days in the specific month/year"); + for (int i = 0; i < 100; i++) + { + int yr = random.Next(9999) + 1; + int mnth = random.Next(12) + 1; + DaysInMonthTest(yr, mnth); + } + Debug.WriteLine("Verifying no. of days in Feb, for 20th and 21st centuries"); + for (int yr = 1900; yr < 2100; yr += 4) + { + DaysInMonthTest(yr, 2); + } + } + + [TestMethod] + public void DateTime_EqualsTest25() + { + Debug.WriteLine("Creating random-equal DateTimes"); + Debug.WriteLine("And Verifying they are equal"); + DateTime dt1 = DateTime_btwn_1801_And_2801(); + DateTime dt2 = new DateTime(year, month, day, hour, minute, second, millisec); + Assert.True(DateTime.Equals(dt1, dt2)); + object obj1 = (object)dt1, obj2 = (object)dt2; + Assert.True(object.Equals(obj1, obj2)); + Assert.True(dt1.Equals(obj2)); + } + + [TestMethod] + public void DateTime_Subtract_DateTimeTest26() + { + Debug.WriteLine("Creating two Random DateTimes,"); + Debug.WriteLine("dt1.Subtract(dt2) and verifying"); + DateTime dt1 = GetRandomDateTime(); + DateTime dt2 = GetRandomDateTime(); + TimeSpan ts1 = dt1.Subtract(dt2); + TimeSpan ts2 = new TimeSpan(dt1.Ticks - dt2.Ticks); + + Assert.True(ts1 == ts2); + } + + [TestMethod] + public void DateTime_Subtract_TimeSpanTest27() + { + Debug.WriteLine("Creating now DateTime"); + Debug.WriteLine("Subtracting random timespans and "); + DateTime[] dtArr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + TimeSpan ts; + for (int i = 0; i < dtArr.Length; i++) + { + DateTime dt1 = dtArr[i]; + if (i % 2 == 0) + { + ts = new TimeSpan(-random.Next(1000)); + } + else + { + ts = -new TimeSpan(random.Next(1000)); + } + + Debug.WriteLine(dt1.ToString()); + Debug.WriteLine(ts.ToString()); + DateTime dt2 = dt1.Subtract(ts); + Debug.WriteLine(dt2.ToString()); + DateTime dt3 = new DateTime(dt1.Ticks - ts.Ticks); + Debug.WriteLine(dt3.ToString()); + Assert.Equal(DateTime.Compare(dt2, dt3), 0); + } + } + + [TestMethod] + public void DateTime_op_AdditionTest30() + { + Debug.WriteLine("Creating Random DateTimes,"); + Debug.WriteLine("Adds a specified period of time and verifying"); + + DateTime[] dtArr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + TimeSpan ts; + for (int i = 0; i < dtArr.Length; i++) + { + DateTime dt1 = dtArr[i]; + if (i % 2 == 0) + { + ts = new TimeSpan(-random.Next(1000)); + } + else + { + ts = new TimeSpan(random.Next(1000)); + } + DateTime dt2 = dt1 + ts; + DateTime dt3 = new DateTime(dt1.Ticks + ts.Ticks); + Assert.Equal(DateTime.Compare(dt2, dt3), 0); + } + } + + [TestMethod] + public void DateTime_op_Subtraction_DateTimeTest31() + { + Debug.WriteLine("Creating Random DateTimes,"); + Debug.WriteLine("Subtracting one from the other and verifying"); + DateTime[] dtArr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + for (int i = 0; i < dtArr.Length; i++) + { + DateTime dt1 = dtArr[i]; + DateTime dt2 = new DateTime(random.Next(1000) + 1); + TimeSpan ts = dt1 - dt2; + Assert.Equal(ts.Ticks, (dt1.Ticks - dt2.Ticks)); + } + } + + [TestMethod] + public void DateTime_op_Subtraction_TimeSpanTest32() + { + Debug.WriteLine("Creating Random DateTime,"); + Debug.WriteLine("Subtracting random TimeSpan and verifying"); + DateTime[] dtArr = Get_ArrayOfRandomDateTimes(); + Random random = new Random(); + for (int i = 0; i < dtArr.Length; i++) + { + DateTime dt1 = dtArr[i]; + TimeSpan ts = new TimeSpan(random.Next(10000)); + DateTime dt2 = dt1 - ts; + + Assert.Equal(dt2.Ticks, (dt1.Ticks - ts.Ticks)); + } + } + + [TestMethod] + public void DateTime_op_EqualityTest33() + { + Debug.WriteLine("Creating Random DateTime,"); + Debug.WriteLine("Creating another DateTime equal to previous one"); + Debug.WriteLine("Verifying the two DateTimes are equal using '=='"); + DateTime dt1 = GetRandomDateTime(); + DateTime dt2 = new DateTime(year, month, day, hour, minute, second, millisec); + + if (!(dt1 == dt2)) + { + throw new Exception("Failure : expected the two DateTimes '" + dt1.ToString() + + "' and '" + dt2.ToString() + "' to be equal but are not"); + } + } + + [TestMethod] + public void DateTime_op_InequalityTest34() + { + Debug.WriteLine("Creating Random DateTime,"); + Debug.WriteLine("Creating another Different DateTime"); + Debug.WriteLine("Verifying the two DateTimes are not equal using '!='"); + DateTime dt1 = GetRandomDateTime(); + DateTime dt2 = new DateTime(year + 1, month, day, hour, minute, second, millisec); + + if (!(dt1 != dt2)) + { + throw new Exception("Failure : expected the two DateTimes '" + dt1.ToString() + + "' and '" + dt2.ToString() + "' not to be equal but are equal"); + } + } + + [TestMethod] + public void DateTime_op_LessThanTest35() + { + Debug.WriteLine("Creating Random DateTime,"); + Debug.WriteLine("Creating another Different DateTime greater than previous one"); + Debug.WriteLine("Verifying 1st DateTime is less than 2nd using '<'"); + DateTime dt1 = GetRandomDateTime(); + DateTime dt2 = new DateTime(year + 1, month, day, hour, minute, second, millisec); + + if (!(dt1 < dt2)) + { + throw new Exception("Failure : expected DateTime '" + dt1.ToString() + + "' less than '" + dt2.ToString() + "'"); + } + } + + [TestMethod] + public void DateTime_op_LessThanOrEqualTest36() + { + Debug.WriteLine("Creating Random DateTime, Creaing 2nd equal DateTime"); + Debug.WriteLine("Creating 3rd Different DateTime greater than previous two"); + Debug.WriteLine("Verifying 1st DateTime is less than or equal to 2nd DateTime using '<='"); + Debug.WriteLine("Verifying 1st DateTime is less than or equal to 3rd DateTime using '<='"); + DateTime dt1 = GetRandomDateTime(); + DateTime dt2 = new DateTime(year, month, day, hour, minute, second, millisec); + DateTime dt3 = new DateTime(year + 1, month, day, hour, minute, second, millisec); + if (!((dt1 <= dt2) || (dt2 <= dt1))) + { + throw new Exception("Failure : expected DateTime '" + dt1.ToString() + "' lessthan or equal to '" + + dt2.ToString() + "' (dt1 <= dt2) = '" + (dt1 <= dt2) + "' and (dt2<=dt1) = '" + (dt2 <= dt1) + "'"); + } + if (!(dt1 <= dt3)) + { + throw new Exception("Failure : expected DateTime '" + dt1.ToString() + + "' less than or equal to '" + dt2.ToString() + "'"); + } + } + + [TestMethod] + public void DateTime_op_GreaterThanTest37() + { + Debug.WriteLine("Creating Random DateTime,"); + Debug.WriteLine("Creating another Different DateTime greater than previous one"); + Debug.WriteLine("Verifying 2nd DateTime is greater than 1st using '>'"); + DateTime dt1 = GetRandomDateTime(); + DateTime dt2 = new DateTime(year + 1, month, day, hour, minute, second, millisec); + + if (!(dt2 > dt1)) + { + throw new Exception("Failure : expected DateTime '" + dt1.ToString() + + "' greater than '" + dt2.ToString() + "'"); + } + } + + [TestMethod] + public void DateTime_op_GreaterThanOrEqualTest38() + { + Debug.WriteLine("Creating Random DateTime, Creaing 2nd equal DateTime"); + Debug.WriteLine("Creating 3rd Different DateTime greater than previous two"); + Debug.WriteLine("Verifying 1st DateTime is greater than or equal to 2nd DateTime using '>='"); + Debug.WriteLine("Verifying 3rd DateTime is greater than or equal to 1st DateTime using '>='"); + DateTime dt1 = GetRandomDateTime(); + DateTime dt2 = new DateTime(year, month, day, hour, minute, second, millisec); + DateTime dt3 = new DateTime(year + 1, month, day, hour, minute, second, millisec); + if (!((dt1 >= dt2) || (dt2 >= dt1))) + { + throw new Exception("Failure : expected DateTime '" + dt1.ToString() + + "' lessthan or equal to '" + dt2.ToString() + "'"); + } + if (!(dt1 <= dt3)) + { + throw new Exception("Failure : expected DateTime '" + dt1.ToString() + + "' greater than or equal to '" + dt2.ToString() + "'"); + } + } + + [TestMethod] + public void DateTime_MinValueTest39() + { + /// + /// 1. Verifies the MinValue property + /// + Debug.WriteLine("Getting the Min. DateTime and Verifying"); + DateTime field = DateTime.MinValue; + Assert.Equal(field.Ticks, 0); + } + + [TestMethod] + public void DateTime_MaxValueTest40() + { + /// + /// 1. Verifies the MinValue property + /// + Debug.WriteLine("Getting the Max. DateTime and Verifying"); + DateTime field = DateTime.MaxValue; + Debug.WriteLine(field.Ticks.ToString()); + Assert.Equal(field.Ticks, 441796895990000000); + } + + [TestMethod] + public void DateTime_DateTest41() + { + /// + /// 1. Verifies the Date property + /// + Debug.WriteLine("Creating a DateTime, getting the Date and Verifying"); + DateTime dt = GetRandomDateTime(); + DateTime _date = dt.Date; + if ((_date.Year != dt.Year) || (_date.Month != dt.Month) || (_date.Day != dt.Day) || + (_date.Hour != 0) || (_date.Minute != 0) | (_date.Second != 0) || (_date.Millisecond != 0)) + { + throw new Exception("Failure : expected Date(mm/dd/yr/hr/mn/sec/msec) = '" + dt.Month + "/" + dt.Day + + "/" + dt.Year + "/0:0:0:0' but got '" + _date.Month + "/" + _date.Day + "/" + + _date.Year + "/" + _date.Hour + ":" + _date.Minute + ":" + _date.Second + ":" + _date.Millisecond + "'"); + } + } + + [TestMethod] + public void DateTime_DayTest42() + { + /// + /// 1. Verifies the Day property + /// + Debug.WriteLine("Creating a DateTime, getting the Day and Verifying"); + DateTime testDateTime = GetRandomDateTime(); + Int32 _day = testDateTime.Day; + Assert.Equal(_day, day); + } + + [TestMethod] + public void DateTime_DayOfWeekTest43() + { + /// + /// 1. Verifies the DayOfWeek property + /// + Debug.WriteLine("Creating a DateTime, getting the DayOfWeek and Verifying"); + DateTime testDateTime = new DateTime(2005, 1, 28); + DayOfWeek prop = testDateTime.DayOfWeek; + Assert.Equal((int)prop, (int)DayOfWeek.Friday); + } + + [TestMethod] + public void DateTime_DayOfYearTest44() + { + /// + /// 1. Verifies the DayOfYear property + /// + Debug.WriteLine("Creating a DateTime, getting the DayOfYear and Verifying"); + Debug.WriteLine("DateTime::DayOfYear - Normal "); + DateTime testDateTime = new DateTime(2005, 1, 1); + int _dayOfYear = testDateTime.DayOfYear; + Assert.Equal(_dayOfYear, 1); + } + + [TestMethod] + public void DateTime_HourTest45() + { + /// + /// 1. Verifies the Hour property + /// + Debug.WriteLine("Creating a DateTime, getting the Hour and Verifying"); + DateTime testDateTime = GetRandomDateTime(); + Int32 _hour = testDateTime.Hour; + Assert.Equal(_hour, hour); + } + + [TestMethod] + public void DateTime_MillisecondTest46() + { + /// + /// 1. Verifies the Millisecond property + /// + Debug.WriteLine("Creating a DateTime, getting the Milliseconds and Verifying"); + DateTime testDateTime = GetRandomDateTime(); + Int32 _mSec = testDateTime.Millisecond; + Assert.Equal(_mSec, millisec); + } + + [TestMethod] + public void DateTime_MinuteTest47() + { + /// + /// 1. Verifies the Minute property + /// + Debug.WriteLine("Creating a DateTime, getting the Minute and Verifying"); + DateTime testDateTime = GetRandomDateTime(); + Int32 _minute = testDateTime.Minute; + Assert.Equal(_minute, minute); + } + + [TestMethod] + public void DateTime_MonthTest48() + { + /// + /// 1. Verifies the Month property + /// + Debug.WriteLine("Creating a DateTime, getting the Month and Verifying"); + DateTime testDateTime = GetRandomDateTime(); + Int32 _month = testDateTime.Month; + Assert.Equal(_month, month); + } + + [TestMethod] + public void DateTime_NowTest49() + { + /// + /// 1. Creates 2 DateTimes + /// 2. Verifies they are equal in all but Seconds and Millisecond + /// + Debug.WriteLine("Creating 2 DateTimes and verifying they are equal in yy/mm/dd/hr/mn"); + DateTime test0 = DateTime.UtcNow; + DateTime test1 = DateTime.UtcNow; + Debug.WriteLine("Verifying"); + if ((test0.Year != test1.Year) || (test0.Month != test1.Month) || + (test0.Day != test1.Day) || (test0.Hour != test1.Hour) || + (test0.Minute != test1.Minute)) + { + throw new Exception("Failure : Expected the two DateTimes ('" + test0.ToString() + + "' and '" + test1.ToString() + "') are equal in all but seconds and milliseconds"); + } + } + + [TestMethod] + public void DateTime_SecondTest51() + { + /// + /// 1. Verifies the Second property + /// + Debug.WriteLine("Creating a DateTime, getting the Second and Verifying"); + DateTime testDateTime = GetRandomDateTime(); + Int32 _sec = testDateTime.Second; + Assert.Equal(_sec, second); + } + + [TestMethod] + public void DateTime_TicksTest52() + { + /// + /// 1. Verifies the Ticks property + /// + Debug.WriteLine("Creating a DateTime, getting the Ticks and Verifying"); + DateTime testDateTime = new System.DateTime(0); + long _ticks = testDateTime.Ticks; + Assert.Equal(_ticks, 0); + } + + [TestMethod] + public void DateTime_YearTest54() + { + /// + /// 1. Verifies the Year property + /// + Debug.WriteLine("Creating a DateTime.Today, getting the year and Verifying"); + DateTime testDateTime = GetRandomDateTime(); + Int32 _year = testDateTime.Year; + Assert.Equal(_year, year); + } + + //=================================================================================== + //The Following test are commented out because they throw Debug Assert in build Envt. + //Please see 23143 for details + //=================================================================================== + + [TestMethod] + public void DateTime_BelowMinDateTime_ArgumentOutOfRangeExceptionTest58() + { + Debug.WriteLine("Creating a DateTime with -ve Ticks and,"); + Debug.WriteLine("verifying ArgumentOutOfRangeException is thrown"); + Assert.Trows(typeof(ArgumentOutOfRangeException), () => { DateTime dt = new DateTime(-(new Random().Next(10) + 1)); }); + } + + [TestMethod] + public void DateTime_AboveMaxDatTime_ArgumentOutOfRangeExceptionTest59() + { + Debug.WriteLine("Creating a DateTime later than DateTime.MaxValue and,"); + Debug.WriteLine("verifying ArgumentOutOfRangeException is thrown"); + Assert.Trows(typeof(ArgumentOutOfRangeException), () => { DateTime dt1 = new DateTime(DateTime.MaxValue.Ticks + 1); }); + Assert.Trows(typeof(ArgumentOutOfRangeException), () => { DateTime dt2 = new DateTime(10000, 1, 1, 0, 0, 0, 0); }); + } + + static double[] rdmFraction = new double[] { 0.0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9 }; + + static int year, month, day, hour, minute, second, millisec; + + static int[] leapYear = new int[] {2000, 2004, 2008, 2012, 2016, 2020, 2024, 2028, 2032, 2036, 2040, 2044, 2048, + 2052, 2056, 2060, 2064, 2068, 2072, 2076, 2080, 2084, 2088, 2092, 2096}; + + private DateTime[] Get_ArrayOfRandomDateTimes() + { + Debug.WriteLine(DateTime_btwn_1801_And_2801().ToString()); + Debug.WriteLine(GetLeapYearDateTime().ToString()); + DateTime[] _dateTimeArr = new DateTime[] {DateTime.UtcNow, + DateTime_btwn_1801_And_2801(), DateTime_btwn_1801_And_2801(), DateTime_btwn_1801_And_2801(), + GetLeapYearDateTime(), GetLeapYearDateTime() , GetLeapYearDateTime(), + DateTime_btwn_1801_And_2801(), DateTime_btwn_1801_And_2801(), DateTime_btwn_1801_And_2801(), + GetLeapYearDateTime(), GetLeapYearDateTime(), GetLeapYearDateTime()}; + + return _dateTimeArr; + } + + private DateTime DateTime_btwn_1801_And_2801() + { + //Generates random DateTime b/n 1000 and 9000 + Random random = new Random(); + year = random.Next(999) + 1801; + month = random.Next(12) + 1; + if (month == 2 && IsLeapYear(year)) + day = random.Next(29) + 1; + else if (month == 2 && (!IsLeapYear(year))) + day = random.Next(28) + 1; + else if (((month <= 7) && ((month + 1) % 2 == 0)) || + ((month > 7) && ((month % 2) == 0))) + day = random.Next(31) + 1; + else + day = random.Next(30) + 1; + hour = random.Next(24); + minute = random.Next(60); + second = random.Next(60); + millisec = random.Next(1000); + + return new DateTime(year, month, day, hour, minute, second, millisec); + } + + private DateTime GetRandomDateTime() + { + //Generates random DateTime + Random random = new Random(); + year = random.Next(1399) + 1601; + month = random.Next(12) + 1; + if (month == 2 && IsLeapYear(year)) + day = random.Next(29) + 1; + else if (month == 2 && (!IsLeapYear(year))) + day = random.Next(28) + 1; + else if (((month <= 7) && ((month + 1) % 2 == 0)) || + ((month > 7) && ((month % 2) == 0))) + day = random.Next(31) + 1; + else + day = random.Next(30) + 1; + hour = random.Next(24); + minute = random.Next(60); + second = random.Next(60); + millisec = random.Next(1000); + + return new DateTime(year, month, day, hour, minute, second, millisec); + } + + private DateTime GetLeapYearDateTime() + { + Random random = new Random(); + year = leapYear[random.Next(leapYear.Length)]; + month = random.Next(12) + 1; + day = random.Next(29) + 1; + hour = random.Next(24); + minute = random.Next(60); + second = random.Next(60); + millisec = random.Next(1000); + Debug.WriteLine($"{year} {month} {day} {hour} {minute} {second} {millisec}"); + return new DateTime(year, month, day, hour, minute, second, millisec); + } + + private bool IsLeapYear(int yr) + { + if ((yr % 400 == 0) || ((yr % 100 != 0) && (yr % 4 == 0))) + return true; + else + return false; + } + + private bool CheckDeviation(long dTicks1, long dTicks2) + { + long diff = dTicks2 - dTicks1; + diff = diff < 0 ? -diff : diff; + //fail if deviates by more than 0.05ms (500 ticks) + if (diff > 500) + { + Debug.WriteLine("Difference ticks = '" + diff.ToString() + "'"); + return false; + } + return true; + } + + public void DaysInMonthTest(int yr, int mnth) + { + int daysInMonth = DateTime.DaysInMonth(yr, mnth); + Debug.WriteLine("Got " + daysInMonth + " number of days in " + mnth + "/" + yr + " mm/yr"); + if (mnth == 2) + { + if (IsLeapYear(yr)) + { + Debug.WriteLine("Year '" + yr + "' is a LeapYear, expected '29' days but got '" + + daysInMonth + "' in Month '" + mnth + "'"); + Assert.Equal(daysInMonth, 29); + } + else if (daysInMonth != 28) + { + throw new Exception("Year '" + yr + "' Month '" + mnth + + "', expected '28' days but got '" + daysInMonth + "'"); + } + } + else if (((mnth <= 7) && ((mnth + 1) % 2 == 0)) || + ((mnth > 7) && ((mnth % 2) == 0))) + { + Debug.WriteLine("Year '" + yr + "' Month '" + mnth + + "', expected '31' days but got '" + daysInMonth + "'"); + Assert.Equal(daysInMonth, 31); + } + else + { + Debug.WriteLine("Year '" + yr + "' Month '" + mnth + + "', expected '30' days but got '" + daysInMonth + "'"); + Assert.Equal(daysInMonth, 30); + } + } + } +} diff --git a/Tests/NFUnitTestSystemLib/UnitTestGuid.cs b/Tests/NFUnitTestSystemLib/UnitTestGuid.cs index 9a885e07..e2d59740 100644 --- a/Tests/NFUnitTestSystemLib/UnitTestGuid.cs +++ b/Tests/NFUnitTestSystemLib/UnitTestGuid.cs @@ -39,8 +39,8 @@ public void Guid_Test() Guid anotherGuid = Guid.NewGuid(); // must be the different - Assert.Equal(theGuid.CompareTo(anotherGuid), 0); - Assert.True(theGuid.Equals(anotherGuid)); + Assert.NotEqual(theGuid.CompareTo(anotherGuid), 0); + Assert.False(theGuid.Equals(anotherGuid)); } /// diff --git a/Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs b/Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs new file mode 100644 index 00000000..9ba4625a --- /dev/null +++ b/Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs @@ -0,0 +1,212 @@ +using nanoFramework.TestFramework; +using System; +using System.Collections; +using System.Diagnostics; +using System.Reflection; + +namespace NFUnitTestSystemLib +{ + [TestClass] + class UnitTestInitLocalTests + { + public interface IEmptyInterface + { + } + + class TestObj : IEmptyInterface + { + public int Field1; + public void Method1(int i) + { + } + public TestObj() + { + Field1 = 3; + } + + public TestObj(int field) + { + Field1 = field; + } + + private bool Method2(float f) + { + return true; + } + } + + [TestMethod] + public void SystemType1_GetType_Test() + { + Debug.WriteLine("Checking reflection types to assure that they are boxed when used as local variables"); + Debug.WriteLine("and when they are assigned to non-valuetype containers (which used to crash)"); + + ArrayList list = new ArrayList(); + int i = 0; + // First lets check all reflection types (Type, AppDomain, Assembly, FieldInfo, MethodInfo, + // ConstructorInfo) + // NOTE: We add the reflection items to the ArrayList to assure that they can be properly + // assigned to a object container (this used to lead to a access violation) + Type type = typeof(int); + list.Add(type); + string name = ((Type)list[i]).Name; + Assert.Equal(name, "Int32"); + i++; + + // No ApDomain in nano + //AppDomain domain = AppDomain.CurrentDomain; + //list.Add(domain); + //name = ((AppDomain)list[i]).FriendlyName; + //fRes &= name.ToLower() == "default"; + //i++; + + //Assembly asm = domain.GetAssemblies()[0]; + //list.Add(asm); + //name = ((Assembly)list[i]).GetName().Name; + //fRes &= name.ToLower() == "mscorlib"; + //i++; + + type = Type.GetType("NFUnitTestSystemLib.UnitTestInitLocalTests.TestObj"); + list.Add(type); + name = ((Type)list[i]).Name; + Assert.Equal(name, "TestObj"); + i++; + + Type iface = type.GetInterfaces()[0]; + list.Add(iface); + name = ((Type)list[i]).Name; + Assert.Equal(name, "IEmptyInterface"); + Assert.Equal(iface.Name, "IEmptyInterface"); + i++; + + FieldInfo fi = type.GetField("Field1"); + list.Add(fi); + name = ((FieldInfo)list[i]).Name; + Assert.Equal(name, "Field1"); + Assert.Equal(fi.Name, "Field1"); + i++; + + MethodInfo mi = type.GetMethod("Method1"); + list.Add(mi); + name = ((MethodInfo)list[i]).Name; + Assert.Equal(name, "Method1"); + Assert.Equal(mi.Name, "Method1"); + i++; + + ConstructorInfo ci = type.GetConstructor(new Type[] { }); + list.Add(ci); + name = ((ConstructorInfo)list[i]).Name; + Assert.Equal(name, ".ctor"); + Assert.Equal(ci.Name, ".ctor"); + i++; + + // + // Now test arrays of reflection types + // + Type[] types = new Type[] { typeof(int), typeof(bool), Type.GetType("NFUnitTestSystemLib.UnitTestInitLocalTests.TestObj") }; + list.Add(types[2]); + name = ((Type)list[i]).Name; + Assert.Equal(name, "TestObj"); + Assert.Equal(types[2].Name, "TestObj"); + i++; + + //AppDomain[] domains = new AppDomain[] { AppDomain.CurrentDomain, AppDomain.CreateDomain("blah") }; + //list.Add(domains[1]); + //name = ((AppDomain)list[i]).FriendlyName; + //fRes &= name == "blah"; + //fRes &= domains[1].FriendlyName == "blah"; + //AppDomain.Unload(domains[1]); + //i++; + + //Assembly[] asms = new Assembly[] { typeof(UnitTestInitLocalTests).Assembly, domains[0].GetAssemblies()[0] }; + //list.Add(asms[0]); + //name = ((Assembly)list[i]).GetName().Name; + //fRes &= name == "Microsoft.SPOT.Platform.Tests.Systemlib2"; + //fRes &= asms[0].GetName().Name == "Microsoft.SPOT.Platform.Tests.Systemlib2"; + //i++; + + FieldInfo[] fis = new FieldInfo[] { types[2].GetField("Field1"), type.GetFields()[0] }; + list.Add(fis[0]); + name = ((FieldInfo)list[i]).Name; + Assert.Equal(name, "Field1"); + Assert.Equal(fis[0].Name, "Field1"); + i++; + + MethodInfo[] mis = new MethodInfo[] { type.GetMethods()[2], types[2].GetMethod("Method2", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public) }; + list.Add(mis[1]); + name = ((MethodInfo)list[i]).Name; + Assert.Equal(name, "Method2"); + Assert.Equal(mis[1].Name, "Method2"); + i++; + + ConstructorInfo[] cis = new ConstructorInfo[] { types[2].GetConstructor(new Type[] { }), typeof(TestObj).GetConstructor(new Type[] { typeof(int) }) }; + list.Add(cis[0]); + name = ((ConstructorInfo)list[i]).Name; + Assert.Equal(name, ".ctor"); + Assert.Equal(cis[0].Name, ".ctor"); + i++; + + Array ar = Array.CreateInstance(typeof(Type), 3); + ((IList)ar)[0] = typeof(Type); + ((IList)ar)[1] = Type.GetType("System.Collections.ArrayList"); + + list.Add(ar.GetValue(1)); + name = ((Type)list[i]).Name; + Assert.Equal(name, "ArrayList"); + Assert.Equal(((Type)((IList)ar)[0]).Name, "Type"); + Assert.Equal(((Type)ar.GetValue(1)).Name, "ArrayList"); + i++; + + list.Clear(); + } + + [TestMethod] + public void SystemType1_StructValueTypeReturn_Test() + { + Guid g = ReturnGuid(); + } + + [TestMethod] + public void SystemType1_StructArrayInit_Test() + { + Guid[] data = new Guid[] { new Guid() }; + foreach (Guid g2 in data) + { + // test to make sure boxing (to call struct method) + // still works properly + Assert.True(Guid.Empty.Equals(g2)); + } + + data = new Guid[] { ReturnGuid(), Guid.NewGuid(), new Guid(344, 45, 24, 24, 4, 42, 42, 4, 44, 22, 4) }; + foreach (Guid g2 in data) + { + Assert.False(Guid.Empty.Equals(g2)); + } + } + + [TestMethod] + public void SystemType1_ArrayListToArrayForStruct_Test() + { + // make sure boxing of struct value type (Guid) is handled properly + // this test was a result of a bug found by a customer. + Guid ret = new Guid(); + ArrayList guidList = new ArrayList(); + guidList.Add(Guid.NewGuid()); + guidList.Add(Guid.NewGuid()); + Guid[] guidArray = (Guid[])guidList.ToArray(typeof(Guid)); + + foreach (Guid g in guidArray) + { + ret = g; + } + } + + //--- internal test methods ---// + + Guid ReturnGuid() + { + return Guid.NewGuid(); + } + + } +} diff --git a/Tests/NFUnitTestSystemLib/UnitTestParseTests.cs b/Tests/NFUnitTestSystemLib/UnitTestParseTests.cs new file mode 100644 index 00000000..6f0ddca3 --- /dev/null +++ b/Tests/NFUnitTestSystemLib/UnitTestParseTests.cs @@ -0,0 +1,873 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestSystemLib +{ + [TestClass] + class UnitTestParseTests + { + public static int[] intArr = null; + public String[] GetRandomStringArray(int max, bool signed) + { + Random random = new Random(); + String[] arr1 = new String[] { "0", "-0","+0", + "00000 ", " -00000"," +00000 ", + " 0 ", " -00000 ", + "+123", " +123 ", " +123", "+123 " }; + String[] arr2 = new String[10]; + intArr = new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 123, 123, 123, 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + for (int i = 0; i < arr2.Length; i++) + { + if (signed && ((i % 2) == 0)) + { + intArr[i + 12] = -(random.Next(max)); + arr2[i] = (intArr[i + 12].ToString()); + } + else + { + intArr[i + 12] = random.Next(max); + arr2[i] = intArr[i + 12].ToString(); + } + } + String[] arr = new String[22]; + Array.Copy(arr1, arr, arr1.Length); + Array.Copy(arr2, 0, arr, arr1.Length, arr2.Length); + return arr; + } + + [TestMethod] + public void ParseSByte_Test_1() + { + Debug.WriteLine("SByte MinValue = " + SByte.MinValue.ToString()); + Debug.WriteLine("SByte MaxValue = " + SByte.MaxValue.ToString()); + + String[] strArr = GetRandomStringArray(SByte.MaxValue, true); + SByte[] _sByte = new SByte[intArr.Length]; + for (int i = 0; i < _sByte.Length; i++) + { + _sByte[i] = (SByte)intArr[i]; + } + + SByte temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = SByte.Parse(strArr[i]); + Assert.Equal(temp, _sByte[i]); + } + } + + [TestMethod] + public void ParseByte_Test_2() + { + Debug.WriteLine("Byte MinValue = " + Byte.MinValue.ToString()); + Debug.WriteLine("Byte MaxValue = " + Byte.MaxValue.ToString()); + //Debug.WriteLine("This currently fails, see 21634 for details"); + + String[] strArr = GetRandomStringArray(Byte.MaxValue, false); + Byte[] _byte = new Byte[intArr.Length]; + for (int i = 0; i < _byte.Length; i++) + { + _byte[i] = (Byte)intArr[i]; + } + + Byte temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = Byte.Parse(strArr[i]); + Assert.Equal(temp, _byte[i]); + } + } + + [TestMethod] + public void ParseInt16_Test_3() + { + Debug.WriteLine("Int16 MinValue = " + Int16.MinValue.ToString()); + Debug.WriteLine("Int16 MaxValue = " + Int16.MaxValue.ToString()); + + String[] strArr = GetRandomStringArray(Int16.MaxValue, true); + Int16[] _int16 = new Int16[intArr.Length]; + for (int i = 0; i < _int16.Length; i++) + { + _int16[i] = (Int16)intArr[i]; + } + int counter = 0; + Int16 temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = Int16.Parse(strArr[i]); + Assert.Equal(temp, _int16[i]); + } + } + + [TestMethod] + public void ParseUInt16_Test_4() + { + Debug.WriteLine("UInt16 MinValue = " + UInt16.MinValue.ToString()); + Debug.WriteLine("UInt16 MaxValue = " + UInt16.MaxValue.ToString()); + //Debug.WriteLine("This currently fails, see 21634 for details"); + + + String[] strArr = GetRandomStringArray(UInt16.MaxValue, false); + UInt16[] _uInt16 = new UInt16[intArr.Length]; + for (int i = 0; i < _uInt16.Length; i++) + { + _uInt16[i] = (UInt16)intArr[i]; + } + + UInt16 temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = UInt16.Parse(strArr[i]); + Assert.Equal(temp, _uInt16[i]); + } + } + + [TestMethod] + public void ParseInt32_Test_5() + { + Debug.WriteLine("Int32 MinValue = " + Int32.MinValue.ToString()); + Debug.WriteLine("Int32 MaxValue = " + Int32.MaxValue.ToString()); + //Debug.WriteLine("This currently Fails, See 21626 for details"); + + + String[] strArr = GetRandomStringArray(Int32.MaxValue, true); + Int32[] _int32 = new Int32[intArr.Length]; + for (int i = 0; i < _int32.Length; i++) + { + _int32[i] = (Int32)intArr[i]; + } + + Int32 temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = Int32.Parse(strArr[i]); + Assert.Equal(temp, _int32[i]); + } + } + + // ========================================================================== + + public static double Pow(double num, int power) + { + double val = 1; + for (int pow = 0; pow < power; pow++) + { + val = val * num; + } + + return val; + } + + [TestMethod] + public void ParseUInt32_Test_6() + { + Debug.WriteLine("UInt32 MinValue = " + UInt32.MinValue.ToString()); + Debug.WriteLine("UInt32 MaxValue = " + UInt32.MaxValue.ToString()); + //Debug.WriteLine("This currently fails, see 21634 for details"); + + Random random = new Random(); + String[] strArr = new String[] { "0", "-0","+0", + "00000 ", " -00000"," +00000 ", + " 0 ", " -00000 ", + "+123", " +123 ", " +123", "+123 ", + "","","","","","","","","",""}; + UInt32[] _uInt32 = new UInt32[] { 0, 0, 0, 0, 0, 0, 0, 0, 123, 123, 123, 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + for (int i = 12; i < _uInt32.Length; i++) + { + int power = random.Next(33); + _uInt32[i] = (uint)(Pow(2, power) - 1); + strArr[i] = _uInt32[i].ToString(); + } + + UInt32 temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = UInt32.Parse(strArr[i]); + Assert.Equal(temp, _uInt32[i]); + } + } + + [TestMethod] + public void ParseInt64_Test_7() + { + Debug.WriteLine("Int64 MinValue = " + Int64.MinValue.ToString()); + Debug.WriteLine("Int64 MaxValue = " + Int64.MaxValue.ToString()); + + Random random = new Random(); + String[] strArr = new String[] { "0", "-0","+0", + "00000 ", " -00000"," +00000 ", + " 0 ", " -00000 ", + "+123", " +123 ", " +123", "+123 ", + "","","","","","","","","",""}; + Int64[] _int64 = new Int64[] { 0, 0, 0, 0, 0, 0, 0, 0, 123, 123, 123, 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + for (int i = 12; i < _int64.Length; i++) + { + int power = random.Next(64); + if (i % 2 == 0) + { + _int64[i] = (Int64)(-Pow(2, power) - 1); + } + else + { + _int64[i] = (Int64)(Pow(2, power) - 1); + } + strArr[i] = _int64[i].ToString(); + } + + Int64 temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + + temp = Int64.Parse(strArr[i]); + Assert.Equal(temp, _int64[i]); + } + + //Int32: -2147483648 --> 2147483647 + CheckValues(Int32.MinValue); + CheckValues(Int32.MaxValue); + + //UInt32: 0 ---> 4294967295 + CheckValues(UInt32.MinValue); + CheckValues(UInt32.MaxValue); + + //Int64: -9223372036854775808 --> 9223372036854775807 + CheckValues(Int64.MinValue); + CheckValues(Int64.MaxValue); + + //Uint64: 0 --> 18446744073709551615 + CheckValues((Int64)UInt64.MinValue); + } + + + private void CheckValues(Int64 start) + { + Int64 newVal = 0; + string temp; + for (Int64 i = start - 10; i < start + 10; i++) + { + temp = i.ToString(); + newVal = Int64.Parse(temp); + Assert.Equal(i, newVal); + } + } + + [TestMethod] + public void ParseUInt64_Test_8() + { + Debug.WriteLine("UInt64 MinValue = " + UInt64.MinValue.ToString()); + Debug.WriteLine("UInt64 MaxValue = " + UInt64.MaxValue.ToString()); + //Debug.WriteLine("This currently fails, see 21634 for details"); + + Random random = new Random(); + String[] strArr = new String[] { "0", "-0","+0", + "00000 ", " -00000"," +00000 ", + " 0 ", " -00000 ", + "+123", " +123 ", " +123", "+123 ", + "","","","","","","","","",""}; + UInt64[] _uInt64 = new UInt64[] { 0, 0, 0, 0, 0, 0, 0, 0, 123, 123, 123, 123, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + + for (int i = 12; i < _uInt64.Length; i++) + { + int power = random.Next(65); + _uInt64[i] = (UInt64)(Pow(2, power) - 1); + strArr[i] = _uInt64[i].ToString(); + } + + UInt64 temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + + temp = UInt64.Parse(strArr[i]); + Assert.Equal(temp, _uInt64[i]); + } + + //Int32: -2147483648 --> 2147483647 + CheckUValues(Int32.MaxValue); + + //UInt32: 0 ---> 4294967295 + CheckUValues(UInt32.MinValue); + CheckUValues(UInt32.MaxValue); + + //Int64: -9223372036854775808 --> 9223372036854775807 + CheckUValues(UInt64.MaxValue); + + //Uint64: 0 --> 18446744073709551615 + CheckUValues(UInt64.MinValue); + CheckUValues(UInt64.MaxValue); + } + + [TestMethod] + public void ParseDouble_Test_x() + { + Debug.WriteLine("double MinValue = " + double.MinValue.ToString()); + Debug.WriteLine("double MaxValue = " + double.MaxValue.ToString()); + //Debug.WriteLine("This currently fails, see 21634 for details"); + + Random random = new Random(); + String[] strArr = new String[] { "0", "-0","+0", + "00000 ", " -00000"," +00000 ", + " 0 ", " -00000 ", + "+123", " +123 ", " +123", "+123 "}; + double[] _double = new double[] { 0, 0, 0, 0, 0, 0, 0, 0, 123, 123, 123, 123 }; + + double temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = double.Parse(strArr[i]); + Assert.Equal(temp, _double[i]); + } + + double d = double.Parse("-0.1"); + Assert.Equal(d, -0.1); + + d = double.Parse("0.1"); + Assert.Equal(d, 0.1); + + d = double.Parse(" -1.1"); + Assert.Equal(d, -1.1); + + d = double.Parse(" -0.0001"); + Assert.Equal(d, -0.0001); + + d = double.Parse(" -10.0001"); + Assert.Equal(d, -10.0001); + + d = double.Parse("-0.01e-10"); + Assert.Equal(d, -0.01e-10); + + d = double.Parse(" "); + Assert.Equal(d, 0.0); + + string t = double.MinValue.ToString(); + Assert.Equal(double.MinValue, double.Parse(t)); + + t = double.MaxValue.ToString(); + Assert.Equal(double.MaxValue, double.Parse(t)); + + t = float.MinValue.ToString(); + Assert.Equal(float.MinValue, (float)double.Parse(t)); + + t = float.MaxValue.ToString(); + Assert.Equal(float.MaxValue, (float)double.Parse(t)); + + } + + private void CheckUValues(UInt64 start) + { + UInt64 newVal = 0; + string temp; + for (UInt64 i = start - 10; i < start + 10; i++) + { + temp = i.ToString(); + newVal = UInt64.Parse(temp); + Assert.Equal(i, newVal); + } + } + + //========================================================================================= + // BoundaryTests + + + [TestMethod] + public void SByte_Boundary_Test_9() + { + + String[] strArr = new String[] { SByte.MaxValue.ToString(), "127", SByte.MinValue.ToString(), "-128" }; + SByte[] _SByte = new SByte[] { 127, 127, -128, -128 }; + SByte temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = SByte.Parse(strArr[i]); + Assert.Equal(temp, _SByte[i]); + } + } + + [TestMethod] + public void Byte_Boundary_Test_10() + { + + String[] strArr = new String[] { Byte.MaxValue.ToString(), "255", Byte.MinValue.ToString(), "0" }; + Byte[] _byte = new Byte[] { 255, 255, 0, 0 }; + Byte temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = Byte.Parse(strArr[i]); + Assert.Equal(temp, _byte[i]); + } + } + + [TestMethod] + public void Int16_Boundary_Test_11() + { + String[] strArr = new String[] { Int16.MaxValue.ToString(), "32767", Int16.MinValue.ToString(), "-32768" }; + Int16[] _int16 = new Int16[] { 32767, 32767, -32768, -32768 }; + Int16 temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = Int16.Parse(strArr[i]); + Assert.Equal(temp, _int16[i]); + } + } + + [TestMethod] + public void UInt16_Boundary_Test_12() + { + String[] strArr = new String[] { UInt16.MaxValue.ToString(), "65535", UInt16.MinValue.ToString(), "0" }; + UInt16[] _uInt16 = new UInt16[] { 65535, 65535, 0, 0 }; + UInt16 temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + + temp = UInt16.Parse(strArr[i]); + Assert.Equal(temp, _uInt16[i]); + } + } + + [TestMethod] + public void Int32_Boundary_Test_13() + { + String[] strArr = new String[] { Int32.MaxValue.ToString(), "2147483647", Int32.MinValue.ToString(), "-2147483648" }; + Int32[] _int32 = new Int32[] { 2147483647, 2147483647, -2147483648, -2147483648 }; + Int32 temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = Int32.Parse(strArr[i]); + Assert.Equal(temp, _int32[i]); + } + } + + [TestMethod] + public void UInt32_Boundary_Test_14() + { + String[] strArr = new String[] { UInt32.MaxValue.ToString(), "4294967295", UInt32.MinValue.ToString(), "0" }; + UInt32[] _uInt32 = new UInt32[] { 4294967295, 4294967295, 0, 0 }; + UInt32 temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = UInt32.Parse(strArr[i]); + Assert.Equal(temp, _uInt32[i]); + } + } + + [TestMethod] + public void Int64_Boundary_Test_15() + { + String[] strArr = new String[] { Int64.MaxValue.ToString(), "9223372036854775807", Int64.MinValue.ToString(), "-9223372036854775808" }; + Int64[] _int64 = new Int64[] { 9223372036854775807, 9223372036854775807, -9223372036854775808, -9223372036854775808 }; + Int64 temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = Int64.Parse(strArr[i]); + Assert.Equal(temp, _int64[i]); + } + } + + [TestMethod] + public void UInt64_Boundary_Test_16() + { + String[] strArr = new String[] { UInt64.MaxValue.ToString(), "18446744073709551615", UInt64.MinValue.ToString(), "0" }; + UInt64[] _uInt64 = new UInt64[] { 18446744073709551615, 18446744073709551615, 0, 0 }; + UInt64 temp = 0; + for (int i = 0; i < strArr.Length; i++) + { + temp = UInt64.Parse(strArr[i]); + Assert.Equal(temp, _uInt64[i]); + } + } + + //============================================================================ + // ArgumentNullException tests + + public static string str = null; + + [TestMethod] + public void SByte_ArgumentNullException_Test_17() + { + Assert.Trows(typeof(ArgumentNullException), () => { SByte.Parse(str); }); + } + + [TestMethod] + public void Byte_ArgumentNullException_Test_18() + { + Assert.Trows(typeof(ArgumentNullException), () => { Byte.Parse(str); }); + } + + [TestMethod] + public void Int16_ArgumentNullException_Test_19() + { + Assert.Trows(typeof(ArgumentNullException), () => { Int16.Parse(str); }); + } + + [TestMethod] + public void UInt16_ArgumentNullException_Test_20() + { + Assert.Trows(typeof(ArgumentNullException), () => { UInt16.Parse(str); }); + } + + [TestMethod] + public void Int32_ArgumentNullException_Test_21() + { + Assert.Trows(typeof(ArgumentNullException), () => { Int32.Parse(str); }); + } + + [TestMethod] + public void UInt32_ArgumentNullException_Test_22() + { + Assert.Trows(typeof(ArgumentNullException), () => { UInt32.Parse(str); }); + } + + [TestMethod] + public void Int64_ArgumentNullException_Test_23() + { + Assert.Trows(typeof(ArgumentNullException), () => { Int64.Parse(str); }); + } + + [TestMethod] + public void UInt64_ArgumentNullException_Test_24() + { + Assert.Trows(typeof(ArgumentNullException), () => { UInt64.Parse(str); }); + } + + /// + /// Used to generate random string of specified length and type + /// + /// An integer specifying the length on the random string + /// A RandomType enum specifying random string type + /// random string + private static string GetRandomString() + { + // Negative numbers indicate a random string length of 10-20 is desired. + Random s_random = new Random(); + int length = 10 + s_random.Next(11); + + char[] chars = new char[length]; + for (int i = 0; i < length; i++) + { + switch (s_random.Next(3)) + { + case 0: + // Get a random char between ascii 65 and 90 (upper case alphabets). + chars[i] = (char)(65 + s_random.Next(26)); + break; + case 1: + // Get a random char between ascii 97 and 122 (lower case alphabets). + chars[i] = (char)(97 + s_random.Next(26)); + break; + case 2: + // Get a random number 0 - 9 + chars[i] = (char)('0' + s_random.Next(10)); + break; + } + break; + } + + return new string(chars); + } + + //============================================================================ + // FormatException tests + + [TestMethod] + public void ParseSByte_FormatException_Test_25() + { + String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { SByte.Parse(strArr[i]); }); + } + for (int i = 0; i < 5; i++) + { + String rdmString = GetRandomString(); + Assert.Trows(typeof(Exception), () => { SByte.Parse(rdmString); }); + } + } + + [TestMethod] + public void ParseByte_FormatException_Test_26() + { + String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { Byte.Parse(strArr[i]); }); + } + for (int i = 0; i < 5; i++) + { + String rdmString = GetRandomString(); + Assert.Trows(typeof(Exception), () => { Byte.Parse(rdmString); }); + } + } + + [TestMethod] + public void ParseInt16_FormatException_Test_27() + { + String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { Int16.Parse(strArr[i]); }); + } + for (int i = 0; i < 5; i++) + { + String rdmString = GetRandomString(); + Assert.Trows(typeof(Exception), () => { Int16.Parse(rdmString); }); + } + } + + [TestMethod] + public void ParseUInt16_FormatException_Test_28() + { + String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { UInt16.Parse(strArr[i]); }); + } + for (int i = 0; i < 5; i++) + { + String rdmString = GetRandomString(); + Assert.Trows(typeof(Exception), () => { UInt16.Parse(rdmString); }); + } + } + + [TestMethod] + public void ParseInt32_FormatException_Test_29() + { + String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { Int32.Parse(strArr[i]); }); + } + for (int i = 0; i < 5; i++) + { + String rdmString = GetRandomString(); + Assert.Trows(typeof(Exception), () => { Int32.Parse(rdmString); }); + } + } + + [TestMethod] + public void ParseUInt32_FormatException_Test_30() + { + String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { UInt32.Parse(strArr[i]); }); + } + for (int i = 0; i < 5; i++) + { + String rdmString = GetRandomString(); + Assert.Trows(typeof(Exception), () => { UInt32.Parse(rdmString); }); + } + } + + [TestMethod] + public void ParseInt64_FormatException_Test_31() + { + String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { Int64.Parse(strArr[i]); }); + } + for (int i = 0; i < 5; i++) + { + String rdmString = GetRandomString(); + Assert.Trows(typeof(Exception), () => { Int64.Parse(rdmString); }); + } + } + + [TestMethod] + public void ParseUInt64_FormatException_Test_32() + { + String[] strArr = new String[] { "", "1,234", "123e5", "a", "3.14159265358979" }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { UInt64.Parse(strArr[i]); }); + } + for (int i = 0; i < 5; i++) + { + String rdmString = GetRandomString(); + Assert.Trows(typeof(Exception), () => { UInt64.Parse(rdmString); }); + } + } + + + //============================================================================ + // OverflowException tests + + + [TestMethod] + public void ParseSByte_OverflowException_Test_33() + { + String[] strArr = new String[] { ((Int64)SByte.MinValue - 1).ToString(), ((Int64)SByte.MinValue - 100).ToString(), + ((Int64)SByte.MaxValue + 1).ToString(), ((Int64)SByte.MaxValue + 100).ToString() }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { SByte.Parse(strArr[i]); }); + } + } + + [TestMethod] + public void ParseByte_OverflowException_Test_34() + { + String[] strArr = new String[] { ((Int64)Byte.MinValue - 1).ToString(), ((Int64)Byte.MinValue - 100).ToString(), + ((Int64)Byte.MaxValue + 1).ToString(), ((Int64)Byte.MaxValue + 100).ToString() }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { Byte.Parse(strArr[i]); }); + } + } + + [TestMethod] + public void ParseInt16_OverflowException_Test_35() + { + String[] strArr = new String[] { ((Int64)Int16.MinValue - 1).ToString(), ((Int64)Int16.MinValue - 100).ToString(), + ((Int64)Int16.MaxValue + 1).ToString(), ((Int64)Int16.MaxValue + 100).ToString() }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { Int16.Parse(strArr[i]); }); + } + } + + [TestMethod] + public void ParseUInt16_OverflowException_Test_36() + { + String[] strArr = new String[] { ((Int64)UInt16.MinValue - 1).ToString(), ((Int64)UInt16.MinValue - 100).ToString(), + ((Int64)UInt16.MaxValue + 1).ToString(), ((Int64)UInt16.MaxValue + 100).ToString() }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { UInt16.Parse(strArr[i]); }); + } + } + + [TestMethod] + public void ParseInt32_OverflowException_Test_37() + { + String[] strArr = new String[] { ((Int64)Int32.MinValue - 1).ToString(), ((Int64)Int32.MinValue - 100).ToString(), + ((Int64)Int32.MaxValue + 1).ToString(), ((Int64)Int32.MaxValue + 100).ToString() }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { Int32.Parse(strArr[i]); }); + } + } + + [TestMethod] + public void ParseUInt32_OverflowException_Test_38() + { + String[] strArr = new String[] { ((Int64)UInt32.MinValue - 1).ToString(), ((Int64)UInt32.MinValue - 100).ToString(), + ((Int64)UInt32.MaxValue + 1).ToString(), ((Int64)UInt32.MaxValue + 100).ToString() }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { UInt32.Parse(strArr[i]); }); + } + } + + [TestMethod] + public void ParseInt64_OverflowException_Test_39() + { + Debug.WriteLine("This currently fails, see 21641 for details"); + string[] strArr = new string[] { "-9223372036854775809", "-9223372036854775900", + "9223372036854775808", "9223372036854775900" }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { Int64.Parse(strArr[i]); }); + } + } + + [TestMethod] + public void ParseUInt64_OverflowException_Test_40() + { + string[] strArr = new string[] { "-1", "-100", "18446744073709551616", "18446744073709551700" }; + for (int i = 0; i < strArr.Length; i++) + { + Assert.Trows(typeof(Exception), () => { UInt64.Parse(strArr[i]); }); + } + } + + + [TestMethod] + public void Cast_Double_to_int64_Test_40() + { + double dbVal = new Random().Next(); + + // Convert to int and uint should keep the value + long l_val = (long)dbVal; + Assert.Equal(l_val, dbVal); + + ulong ul_val = (ulong)dbVal; + Assert.Equal(ul_val, dbVal); + + // Change sign to negative + dbVal = -dbVal; + + l_val = (long)dbVal; + Assert.Equal(l_val, dbVal); + + ul_val = (ulong)dbVal; + long ul_val_cast = (long)ul_val; + Assert.Equal(ul_val_cast, dbVal); + } + + + public enum MyEnum : short { Value = 25 } + public enum MyEnum1 { Value = 24 } + public enum MyEnum2 : short { Value = 23 } + + class CastTestClass + { + + } + + + [TestMethod] + public void box_unbox_Test_1() + { + // Creates objects for testing of different casts. + object o_enum = MyEnum.Value; + object o_enum1 = MyEnum1.Value; + object o_long = 24L; + object o_class = new CastTestClass(); + object o_guid = Guid.NewGuid(); + + // Try casts that shoud succeed. Any exception here means failure. + // First we try casts that should succeed. + // Casts between enums with the same basic type + MyEnum2 e2 = (MyEnum2)o_enum; // line 2 + // Cast from enum to primitive type that enum is based on + short sv = (short)o_enum; + Assert.Equal(sv, (short)MyEnum.Value); + + // Cast from enum to primitive type that enum is based on + int iv = (int)o_enum1; + Assert.Equal(iv, (short)MyEnum1.Value); + + int i_long = (int)(long)o_long; + CastTestClass cls = (CastTestClass)o_class; + Guid guid = (Guid)o_guid; + + // Now casts that should throw exception. Any cast that does not throw - means error. + Assert.Trows(typeof(InvalidCastException), () => { + MyEnum1 e1 = (MyEnum1)o_enum; + }); + + // Now casts that should throw exception. Any cast that does not throw - means error. + Assert.Trows(typeof(InvalidCastException), () => { + int i = (int)o_long; + }); + + // Now casts that should throw exception. Any cast that does not throw - means error. + Assert.Trows(typeof(InvalidCastException), () => { + int i = (int)o_class; + }); + + // Now casts that should throw exception. Any cast that does not throw - means error. + Assert.Trows(typeof(InvalidCastException), () => { + int i = (int)o_enum; + }); + + // Now casts that should throw exception. Any cast that does not throw - means error. + Assert.Trows(typeof(InvalidCastException), () => { + int i = (int)o_guid; + }); + } + + } +} diff --git a/Tests/NFUnitTestSystemLib/UnitTestTimeSpan.cs b/Tests/NFUnitTestSystemLib/UnitTestTimeSpan.cs new file mode 100644 index 00000000..f06558ed --- /dev/null +++ b/Tests/NFUnitTestSystemLib/UnitTestTimeSpan.cs @@ -0,0 +1,1146 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestSystemLib +{ + [TestClass] + class UnitTestTimeSpan + { + //TimeSpan Test methods + const long m_TicksPerDay = 864000000000; + const long m_TicksPerHour = 36000000000; + const long m_TicksPerMinute = 600000000; + const long m_TicksPerSecond = 10000000; + const long m_TicksPerMillisecond = 10000; + + public bool CCtorHelper(ref TimeSpan ts) + { + bool testResult = true; + try + { + ts = new TimeSpan(); + testResult &= ts.Ticks == 0; + testResult &= ts.Days == 0; + testResult &= ts.Hours == 0; + testResult &= ts.Minutes == 0; + testResult &= ts.Seconds == 0; + testResult &= ts.Milliseconds == 0; + if (!testResult) + Debug.WriteLine(ts.ToString()); + } + catch + { + Debug.WriteLine("Exception Caught"); + testResult = false; + } + Debug.WriteLine((testResult ? "PASS" : "FAIL")); + return testResult; + } + + [TestMethod] + public void CCtor_Test() + { + /// + /// 1. Test copy constructor + /// + /// + Debug.WriteLine("Copy Constructor test"); + TimeSpan ts = new TimeSpan(); + Debug.WriteLine(ts.ToString()); + Assert.True(CCtorHelper(ref ts)); + ts = TimeSpan.MaxValue; + ts = new TimeSpan(); + Debug.WriteLine(ts.ToString()); + Assert.True(CCtorHelper(ref ts)); + ts = TimeSpan.MinValue; + Assert.True(CCtorHelper(ref ts)); + int mxd = 24000; + int mx = 1000; + + Random random = new Random(); + for (int i = 0; i < 5; i++) + { + int id = (random.Next(1) == 0 ? -1 : 1) * + random.Next(mxd); + int ih = (random.Next(1) == 0 ? -1 : 1) * + random.Next(mx); + int im = (random.Next(1) == 0 ? -1 : 1) * + random.Next(mx); + int ise = (random.Next(1) == 0 ? -1 : 1) * + random.Next(mx); + int ims = (random.Next(1) == 0 ? -1 : 1) * + random.Next(mx); + ts = new TimeSpan(id, ih, im, ise, ims); + Assert.True(CCtorHelper(ref ts)); + } + } + + public void Ctor64Helper(Int64 i64) + { + /// + /// 1. Test constructor + /// + /// + Debug.WriteLine("Constructor test"); + + TimeSpan ts = new TimeSpan(i64); + long days = i64 / m_TicksPerDay; + long hours = (i64 - ts.Days * m_TicksPerDay) / m_TicksPerHour; + long minutes = (i64 - ts.Days * m_TicksPerDay - ts.Hours * + m_TicksPerHour) / m_TicksPerMinute; + long seconds = (i64 - ts.Days * m_TicksPerDay - ts.Hours * + m_TicksPerHour - ts.Minutes * m_TicksPerMinute) / m_TicksPerSecond; + long milliseconds = (i64 - ts.Days * m_TicksPerDay - ts.Hours * + m_TicksPerHour - ts.Minutes * m_TicksPerMinute - ts.Seconds * m_TicksPerSecond) / + m_TicksPerMillisecond; + Assert.Equal(ts.Days, days); + Assert.Equal(ts.Hours, hours); + Assert.Equal(ts.Minutes, minutes); + Assert.Equal(ts.Seconds, seconds); + Assert.Equal(ts.Milliseconds, milliseconds); + Debug.WriteLine(ts.ToString()); + + } + + [TestMethod] + public void Ctor_Test() + { + /// + /// 1. Test constructor with Int64 + /// + /// + Debug.WriteLine("Constructor test for 64 bit int"); + + Int64 i64 = 0; + Debug.WriteLine("Normal"); + Random random = new Random(); + + for (int i = 0; i < 5; i++) + { + i64 = random.Next(int.MaxValue); + i64 *= random.Next(10000); + Ctor64Helper(i64); + } + + Debug.WriteLine("Max and Min values"); + i64 = 0x7fffffffffffffff; + Ctor64Helper(i64); + Ctor64Helper(TimeSpan.MaxValue.Ticks); + i64 = 0; + Ctor64Helper(i64); + i64 = -9223372036854775808; + Ctor64Helper(i64); + Debug.WriteLine("MAX VALUES: " + TimeSpan.MaxValue.Ticks.ToString() + " AND " + + Int64.MaxValue); + Ctor64Helper(Int64.MaxValue); + Ctor64Helper(TimeSpan.MinValue.Ticks); + } + + public void CtorHelper(int[] vals) + { + TimeSpan ts = new TimeSpan(0); + Int64 i64 = 0; + + string str = ""; + if (vals.Length == 3) + str = "0 : "; + for (int i = 0; i < vals.Length; i++) + str += vals[i].ToString() + " : "; + for (int i = vals.Length; i < 5; i++) + str += "0 : "; + Debug.WriteLine(str); + + switch (vals.Length) + { + case 3: + ts = new TimeSpan(vals[0], vals[1], vals[2]); + i64 = vals[0] * m_TicksPerHour + vals[1] * m_TicksPerMinute + vals[2] * + m_TicksPerSecond; + break; + case 4: + ts = new TimeSpan(vals[0], vals[1], vals[2], vals[3]); + i64 = vals[0] * m_TicksPerDay + vals[1] * m_TicksPerHour + vals[2] * + m_TicksPerMinute + vals[3] * m_TicksPerSecond; + break; + case 5: + ts = new TimeSpan(vals[0], vals[1], vals[2], vals[3], vals[4]); + i64 = vals[0] * m_TicksPerDay + vals[1] * m_TicksPerHour + vals[2] * + m_TicksPerMinute + vals[3] * m_TicksPerSecond + vals[4] * m_TicksPerMillisecond; + break; + default: + Debug.WriteLine("Invalid parameter!"); + throw new Exception("Invalid parameter!"); + break; + } + Assert.Equal(ts.Days, i64 / m_TicksPerDay); + Assert.Equal(ts.Hours, (i64 - ts.Days * m_TicksPerDay) / m_TicksPerHour); + Assert.Equal(ts.Minutes, (i64 - ts.Days * m_TicksPerDay - ts.Hours * + m_TicksPerHour) / m_TicksPerMinute); + Assert.Equal(ts.Seconds, (i64 - ts.Days * m_TicksPerDay - ts.Hours * + m_TicksPerHour - ts.Minutes * m_TicksPerMinute) / m_TicksPerSecond); + Assert.Equal(ts.Milliseconds, (i64 - ts.Days * m_TicksPerDay - ts.Hours * + m_TicksPerHour - ts.Minutes * m_TicksPerMinute - ts.Seconds * m_TicksPerSecond) / m_TicksPerMillisecond); + + Debug.WriteLine(ts.Days.ToString() + " : " + + ts.Hours.ToString() + " : " + + ts.Minutes.ToString() + " : " + + ts.Seconds.ToString() + " : " + + ts.Milliseconds.ToString()); + } + + [TestMethod] + public void Ctor_Test1() + { + /// + /// 1. Test constructor with Hour Minute Second + /// + /// + Debug.WriteLine("Constructor test H:M:S"); + + + Debug.WriteLine(m_TicksPerDay.ToString() + " == " + TimeSpan.TicksPerDay.ToString()); + Debug.WriteLine(m_TicksPerHour.ToString() + " == " + TimeSpan.TicksPerHour.ToString()); + Debug.WriteLine(m_TicksPerMinute.ToString() + " == " + + TimeSpan.TicksPerMinute.ToString()); + Debug.WriteLine(m_TicksPerSecond.ToString() + " == " + + TimeSpan.TicksPerSecond.ToString()); + Debug.WriteLine(m_TicksPerMillisecond.ToString() + " == " + + TimeSpan.TicksPerMillisecond.ToString()); + + int[] vals = new int[3]; + Random random = new Random(); + + for (int i = 0; i < 5; i++) + { + vals[0] = random.Next(23); //hours + vals[1] = random.Next(59); //min + vals[2] = random.Next(59); //sec + CtorHelper(vals); + } + } + + [TestMethod] + public void Ctor_Test2() + { + /// + /// 1. Test constructor with Day Hour Minute Second + /// + /// + Debug.WriteLine("Constructor test D:H:M:S"); + int[] vals = new int[4]; + Random random = new Random(); + + for (int i = 0; i < 5; i++) + { + vals[0] = random.Next(10 * 365) + 1; //days + vals[1] = random.Next(23); //hours + vals[2] = random.Next(59); //minutes + vals[3] = random.Next(59); //seconds + CtorHelper(vals); + } + } + + [TestMethod] + public void Ctor_Test3() + { + /// + /// 1. Test constructor with Day Hour Minute Second Millisecond + /// + /// + Debug.WriteLine("Constructor test D:H:M:S:MS"); + + Debug.WriteLine("TimeSpan::Ctor - Normal "); + + int[] vals = new int[5]; + Random random = new Random(); + + for (int i = 0; i < 5; i++) + { + vals[0] = random.Next(10 * 365) + 1; //days + vals[1] = random.Next(23); //hours + vals[2] = random.Next(59); //minutes + vals[3] = random.Next(59); //seconds + vals[4] = random.Next(999); //milliseconds + CtorHelper(vals); + } + } + + [TestMethod] + public void CompareTo_Test4() + { + /// + /// 1. Construct 2 Timespans + /// 2. Test the CompareTo method + /// + /// + Debug.WriteLine("Testing the CompareTo method"); + + Random random = new Random(); + Debug.WriteLine("Creating TimeSpan"); + int day = random.Next(10 * 365) + 1; //days + int hour = random.Next(23); //hours + int minute = random.Next(59); //minutes + int second = random.Next(59); //seconds + int msec = random.Next(999); //milliseconds + TimeSpan ts1 = new TimeSpan(day, hour, minute, second, msec); + + Debug.WriteLine("Testing CompareTo"); + Assert.Equal(-1, ts1.CompareTo(new TimeSpan(day + 1, hour, minute, second, msec))); + Debug.WriteLine(ts1.CompareTo(new TimeSpan(day + 1, hour, minute, second, msec)).ToString()); + Assert.Equal(1, ts1.CompareTo(new TimeSpan(day, hour - 1, minute, second, msec))); + Debug.WriteLine(ts1.CompareTo(new TimeSpan(day, hour - 1, minute, second, msec)).ToString()); + Assert.Equal(0, ts1.CompareTo(new TimeSpan(day, hour, minute, second, msec))); + Debug.WriteLine(ts1.CompareTo(new TimeSpan(day, hour, minute, second, msec)).ToString()); + } + + [TestMethod] + public void GetHashCode_Test5() + { + /// + /// 1. Test that GetHashCode returns the same for the same TimeSpan + /// 2. Test that GetHashCode returns differently for different TimeSpans + /// + /// + Debug.WriteLine("Testing the GetHashCode method"); + + Random random = new Random(); + Debug.WriteLine("Test that GetHashCode returns the same for the same TimeSpan"); + for (int i = 0; i < 30; i++) + { + int hours = random.Next(23); + int minutes = random.Next(59); + int seconds = random.Next(59); + TimeSpan ts01 = new TimeSpan(hours, minutes, seconds); + TimeSpan ts02 = new TimeSpan(hours, minutes, seconds); + Debug.WriteLine(ts01.GetHashCode().ToString() + " == " + + ts02.GetHashCode().ToString()); + Assert.Equal(ts01.GetHashCode(), ts02.GetHashCode()); + } + + TimeSpan ts1 = new TimeSpan(1, 1, 1); + Debug.WriteLine("Test that GetHashCode returns differently for different TimeSpans"); + Debug.WriteLine("This may fail erroneously."); + Debug.WriteLine("From the docs two different TimeSpans may have same hashcode"); + Debug.WriteLine("But, for the most part the values should be different."); + for (int i = 0; i < 5; i++) + { + TimeSpan ts2 = new TimeSpan(random.Next(23), + random.Next(59), random.Next(59)); + Debug.WriteLine(ts1.GetHashCode().ToString() + " Does Not Equal " + + ts2.GetHashCode().ToString()); + if (ts1 != ts2) + { + Assert.NotEqual(ts1.GetHashCode(), ts2.GetHashCode()); + } + else + { + Assert.Equal(ts1.GetHashCode(), ts2.GetHashCode()); + } + } + } + + [TestMethod] + public void Equals_Test6() + { + /// + /// 1. Test the Equals method + /// + /// + Debug.WriteLine("Testing the Equals method"); + Random random = new Random(); + // verify same timespan computes to same hash + for (int i = 0; i < 5; i++) + { + int hours = random.Next(23); + int minutes = random.Next(59); + int seconds = random.Next(59); + TimeSpan ts01 = new TimeSpan(hours, minutes, seconds); + TimeSpan ts02 = new TimeSpan(hours, minutes, seconds); + Debug.WriteLine(ts01.ToString() + " == " + ts02.ToString()); + Debug.WriteLine("Expected true"); + Assert.True(ts01.Equals(ts02)); + TimeSpan ts03 = new TimeSpan(hours, minutes, seconds); + TimeSpan ts04 = new TimeSpan(hours + 1, minutes - 1, seconds + 1); + Debug.WriteLine("Expected false"); + Assert.False(ts03.Equals(ts04)); + } + } + + [TestMethod] + public void ToString_Test7() + { + /// + /// 1. Test the ToString method + /// + /// + Debug.WriteLine("Testing ToString method"); + Random random = new Random(); + for (int i = 0; i < 5; i++) + { + bool b = true; + int hours = random.Next(23); + int minutes = random.Next(59); + int seconds = random.Next(59); + TimeSpan ts01 = new TimeSpan(hours, minutes, seconds); + string str = + (hours < 10 ? "0" : "") + hours.ToString() + ":" + + (minutes < 10 ? "0" : "") + minutes.ToString() + ":" + + (seconds < 10 ? "0" : "") + seconds.ToString(); + Assert.Equal(str, ts01.ToString()); + Debug.WriteLine(str + " == " + ts01.ToString()); + } + } + + bool CompareTimeSpan(TimeSpan ts1, TimeSpan ts2) + { + bool testResult = true; + testResult &= ts1.Days == ts2.Days; + testResult &= ts1.Hours == ts2.Hours; + testResult &= ts1.Minutes == ts2.Minutes; + testResult &= ts1.Seconds == ts2.Seconds; + testResult &= ts1.Milliseconds == ts2.Milliseconds; + return testResult; + } + + [TestMethod] + public void Add_Test8() + { + /// + /// 1. Test the binary + operator + /// + /// + Debug.WriteLine("Testing the + operator"); + + Debug.WriteLine("TimeSpan::Add - Normal "); + Random random = new Random(); + for (int i = 0; i < 5; i++) + { + bool b = true; + TimeSpan ts01 = new TimeSpan(random.Next(12), + random.Next(29), random.Next(29)); + int hours = random.Next(11); + int minutes = random.Next(30); + int seconds = random.Next(30); + TimeSpan ts02 = new TimeSpan(hours, minutes, seconds); + TimeSpan ts03 = ts01.Add(ts02); + Assert.True(ts01 != ts03); + Assert.False(CompareTimeSpan(ts01, ts03)); + Assert.True(CompareTimeSpan(ts03, ts01 + ts02)); + Assert.True(ts03.Days == (ts01.Days + ts02.Days)); + Assert.True(ts03.Hours == (ts01.Hours + hours)); + Assert.True(ts03.Minutes == (ts01.Minutes + minutes)); + Assert.True(ts03.Seconds == (ts01.Seconds + seconds)); + Assert.True(ts03.Milliseconds == (ts01.Milliseconds + ts02.Milliseconds)); + Debug.WriteLine(b.ToString()); + } + TimeSpan ts1 = new TimeSpan(2, 2, 2, 2, 2); + TimeSpan ts2 = new TimeSpan(0, 0, 0, 0, 999); + TimeSpan ts3 = ts1.Add(ts2); + Assert.Equal(ts3.Milliseconds, 1); + Assert.Equal(ts3.Seconds, 3); + Assert.Equal(ts3.Minutes, 2); + Assert.Equal(ts3.Hours, 2); + Assert.Equal(ts3.Days, 2); + + ts2 = new TimeSpan(0, 0, 0, 58, 0); + ts3 = ts1.Add(ts2); + Assert.Equal(ts3.Milliseconds, 2); + Assert.Equal(ts3.Seconds, 0); + Assert.Equal(ts3.Minutes, 3); + Assert.Equal(ts3.Hours, 2); + Assert.Equal(ts3.Days, 2); + + ts2 = new TimeSpan(0, 0, 59, 0, 0); + ts3 = ts1.Add(ts2); + Assert.Equal(ts3.Milliseconds, 2); + Assert.Equal(ts3.Seconds, 2); + Assert.Equal(ts3.Minutes, 1); + Assert.Equal(ts3.Hours, 3); + Assert.Equal(ts3.Days, 2); + + ts2 = new TimeSpan(0, 22, 0, 0, 0); + ts3 = ts1.Add(ts2); + Assert.Equal(ts3.Milliseconds, 2); + Assert.Equal(ts3.Seconds, 2); + Assert.Equal(ts3.Minutes, 2); + Assert.Equal(ts3.Hours, 0); + Assert.Equal(ts3.Days, 3); + } + + [TestMethod] + public void Compare_Test9() + { + /// + /// 1. Test the Compare method + /// + /// + + Debug.WriteLine("Testing the Compare method"); + + Random random = new Random(); + int day = random.Next(10 * 365) + 1; //days + int hour = random.Next(23); //hours + int minute = random.Next(59); //minutes + int second = random.Next(59); //seconds + int msec = random.Next(999); //milliseconds + TimeSpan ts1 = new TimeSpan(day, hour, minute, second, msec); + + Assert.Equal(-1, TimeSpan.Compare(ts1, new TimeSpan + (day, hour, minute, second + 1, msec))); + Debug.WriteLine(TimeSpan.Compare(ts1, new TimeSpan + (day, hour, minute, second + 1, msec)).ToString()); + + Assert.Equal(1, TimeSpan.Compare(ts1, new TimeSpan + (day, hour, minute, second, msec - 1))); + Debug.WriteLine(TimeSpan.Compare(ts1, new TimeSpan + (day, hour, minute, second, msec - 1)).ToString()); + + Assert.Equal(0, TimeSpan.Compare(ts1, new TimeSpan + (day, hour, minute, second, msec))); + Debug.WriteLine(TimeSpan.Compare(ts1, new TimeSpan + (day, hour, minute, second, msec)).ToString()); + } + + [TestMethod] + public void Duration_Test10() + { + /// + /// 1. Test the Duration property with several random TimeSpans + /// + /// + Debug.WriteLine("Testing Duration property"); + Random random = new Random(); + for (int i = 0; i < 5; i++) + { + bool b = true; + int hours = random.Next(23); + int minutes = random.Next(59); + int seconds = random.Next(59); + TimeSpan ts = new TimeSpan(-hours, -minutes, -seconds); + Assert.True(ts.Duration() == new TimeSpan(hours, minutes, seconds)); + ts = new TimeSpan(hours, minutes, seconds); + Assert.True(ts.Duration() == new TimeSpan(hours, minutes, seconds)); + } + } + + [TestMethod] + public void Negate_Test12() + { + /// + /// 1. Test the Negate method + /// + /// + Debug.WriteLine("Testing the Negate method"); + Random random = new Random(); + for (int i = 0; i < 5; i++) + { + bool b = true; + int hours = random.Next(23); + int minutes = random.Next(59); + int seconds = random.Next(59); + TimeSpan tsN = new TimeSpan(-hours, -minutes, -seconds); + TimeSpan tsP = new TimeSpan(hours, minutes, seconds); + Assert.True(tsN.Negate() == tsP); + Assert.True(tsP.Negate() == tsN); + Assert.True(tsN.Negate().Negate() == tsN); + Assert.True(tsP.Negate().Negate() == tsP); + } + } + + [TestMethod] + public void Subtract_Test13() + { + /// + /// 1. Test subtraction, the binary - operator + /// + /// + Debug.WriteLine("Testing the binary - operator"); + + Random random = new Random(); + for (int i = 0; i < 5; i++) + { + bool b = true; + TimeSpan ts01 = new TimeSpan(23, 59, 59); + int hours = random.Next(23); + int minutes = random.Next(59); + int seconds = random.Next(59); + TimeSpan ts02 = new TimeSpan(hours, minutes, seconds); + TimeSpan ts03 = ts01.Subtract(ts02); + Assert.True((ts01 != ts03) || (ts02.Ticks == 0)); + Assert.False(CompareTimeSpan(ts01, ts03)); + Assert.True(CompareTimeSpan(ts03, ts01 - ts02)); + Assert.True(ts03.Days == (ts01.Days - ts02.Days)); + Assert.True(ts03.Hours == (ts01.Hours - hours)); + Assert.True(ts03.Minutes == (ts01.Minutes - minutes)); + Assert.True(ts03.Seconds == (ts01.Seconds - seconds)); + Assert.True(ts03.Milliseconds == (ts01.Milliseconds - ts02.Milliseconds)); + } + TimeSpan ts1 = new TimeSpan(2, 2, 2, 2, 2); + TimeSpan ts2 = new TimeSpan(0, 0, 0, 0, 3); + TimeSpan ts3 = ts1.Subtract(ts2); + Assert.Equal(ts3.Milliseconds, 999); + Assert.Equal(ts3.Seconds, 1); + Assert.Equal(ts3.Minutes, 2); + Assert.Equal(ts3.Hours, 2); + Assert.Equal(ts3.Days, 2); + + ts2 = new TimeSpan(0, 0, 0, 3, 0); + ts3 = ts1.Subtract(ts2); + Assert.Equal(ts3.Milliseconds, 2); + Assert.Equal(ts3.Seconds, 59); + Assert.Equal(ts3.Minutes, 1); + Assert.Equal(ts3.Hours, 2); + Assert.Equal(ts3.Days, 2); + + ts2 = new TimeSpan(0, 0, 3, 0, 0); + ts3 = ts1.Subtract(ts2); + Assert.Equal(ts3.Milliseconds, 2); + Assert.Equal(ts3.Seconds, 2); + Assert.Equal(ts3.Minutes, 59); + Assert.Equal(ts3.Hours, 1); + Assert.Equal(ts3.Days, 2); + + ts2 = new TimeSpan(0, 3, 0, 0, 0); + ts3 = ts1.Subtract(ts2); + Assert.Equal(ts3.Milliseconds, 2); + Assert.Equal(ts3.Seconds, 2); + Assert.Equal(ts3.Minutes, 2); + Assert.Equal(ts3.Hours, 23); + Assert.Equal(ts3.Days, 1); + + ts2 = new TimeSpan(3, 0, 0, 0, 0); + ts3 = ts1.Subtract(ts2); + Assert.Equal(ts3.Milliseconds, -998); + Assert.Equal(ts3.Seconds, -57); + Assert.Equal(ts3.Minutes, -57); + Assert.Equal(ts3.Hours, -21); + Assert.Equal(ts3.Days, 0); + } + + private void FromTicksHelper(int days, int hours, int mins, int secs, int ms) + { + long ticks = + m_TicksPerDay * days + + m_TicksPerHour * hours + + m_TicksPerMinute * mins + + m_TicksPerSecond * secs + + m_TicksPerMillisecond * ms; + TimeSpan ts = TimeSpan.FromTicks(ticks); + + int dys = (int)(ticks / m_TicksPerDay); + Debug.WriteLine(dys.ToString()); + Assert.Equal(ts.Days, dys); + + int hrs = (int)(ticks / m_TicksPerHour) % 24; + Debug.WriteLine(hrs.ToString()); + Assert.Equal(ts.Hours, hrs); + + int mns = (int)(ticks / m_TicksPerMinute) % 60; + Debug.WriteLine(mns.ToString()); + Assert.Equal(ts.Minutes, mns); + + int scs = (int)(ticks / m_TicksPerSecond) % 60; + Debug.WriteLine(scs.ToString()); + Assert.Equal(ts.Seconds, scs); + + int mss = (int)ms % 1000; + Debug.WriteLine("MS: " + mss.ToString()); + Assert.Equal(ts.Milliseconds, mss); + + Debug.WriteLine("Days= " + days + " Hours= " + hours + + " Minutes= " + mins + " Secs= " + secs + " ms= " + ms); + Debug.WriteLine(ts.ToString()); + } + + [TestMethod] + public void FromTicks_Test14() + { + /// + /// 1. Testing the use of ticks in constructors + /// + /// + Debug.WriteLine("Testing the use of ticks, ticks per increment specified in this file"); + Debug.WriteLine("TimeSpan::FromTicks - Normal "); + Random random = new Random(); + int max = 5000; + int maxOthers = 200; + for (int i = 0; i < 5; i++) + { + FromTicksHelper(random.Next(max), + random.Next(maxOthers), random.Next(maxOthers), + random.Next(maxOthers), random.Next(1000)); + } + } + + private void UnaryHelper(int days, int hours, int mins, int secs, int ms, bool neg) + { + long ticks = + m_TicksPerDay * days + + m_TicksPerHour * hours + + m_TicksPerMinute * mins + + m_TicksPerSecond * secs + + m_TicksPerMillisecond * ms; + + TimeSpan ts = new TimeSpan(days, hours, mins, secs, ms); + TimeSpan nts = (neg ? -ts : +ts); + int d = (int)(ticks / m_TicksPerDay); + int h = (int)((ticks % m_TicksPerDay) / m_TicksPerHour); + int m = (int)((ticks % m_TicksPerDay % m_TicksPerHour) / m_TicksPerMinute); + int s = (int)((ticks % m_TicksPerDay % m_TicksPerHour % m_TicksPerMinute) + / m_TicksPerSecond); + int m_s = (int)((ticks % m_TicksPerDay % m_TicksPerHour % m_TicksPerMinute + % m_TicksPerSecond) / m_TicksPerMillisecond); + + Assert.Equal(nts.Days, (neg ? -d : +d)); + Debug.WriteLine(nts.Days.ToString() + " == " + (neg ? -d : +d).ToString()); + + Assert.Equal(nts.Hours, (neg ? -h : +h)); + Debug.WriteLine(nts.Hours.ToString() + " == " + ((neg ? -h : +h)).ToString()); + + Assert.Equal(nts.Minutes, (neg ? -m : +m)); + Debug.WriteLine(nts.Minutes.ToString() + " == " + ((neg ? -m : +m)).ToString()); + + Assert.Equal(nts.Seconds, (neg ? -s : +s)); + Debug.WriteLine(nts.Seconds.ToString() + " == " + ((neg ? -s : +s)).ToString()); + + Assert.Equal(nts.Milliseconds, (neg ? -m_s : +m_s)); + Debug.WriteLine(nts.Milliseconds.ToString() + " == " + ((neg ? -m_s : +m_s)).ToString()); + + Debug.WriteLine(ts.ToString()); + Debug.WriteLine(nts.ToString()); + } + + [TestMethod] + public void op_UnaryNegation_Test15() + { + /// + /// 1. Test negation, the unary - operator + /// + /// + Debug.WriteLine("Testing the unary - operator"); + + Random random = new Random(); + int mxd = 24000; + int mx = 10000; + for (int i = 0; i < 5; i++) + { + int id = (random.Next(1) == 0 ? -1 : 1); + int ih = (random.Next(1) == 0 ? -1 : 1); + int im = (random.Next(1) == 0 ? -1 : 1); + int ise = (random.Next(1) == 0 ? -1 : 1); + int ims = (random.Next(1) == 0 ? -1 : 1); + UnaryHelper(id * random.Next(mxd), + ih * random.Next(mx), im * random.Next(mx), + ise * random.Next(mx), ims * random.Next(mx), true); + } + } + + private void OSubAddHelper(int days1, int hours1, int mins1, int secs1, + int ms1, int days2, int hours2, int mins2, int secs2, int ms2, bool add) + { + long ticks1 = + m_TicksPerDay * days1 + + m_TicksPerHour * hours1 + + m_TicksPerMinute * mins1 + + m_TicksPerSecond * secs1 + + m_TicksPerMillisecond * ms1; + long ticks2 = + m_TicksPerDay * days2 + + m_TicksPerHour * hours2 + + m_TicksPerMinute * mins2 + + m_TicksPerSecond * secs2 + + m_TicksPerMillisecond * ms2; + long ticks3 = (add ? (ticks1 + ticks2) : (ticks1 - ticks2)); + + int d1 = (int)(ticks3 / m_TicksPerDay); + int h1 = (int)((ticks3 % m_TicksPerDay) / m_TicksPerHour); + int m1 = (int)((ticks3 % m_TicksPerDay % m_TicksPerHour) / m_TicksPerMinute); + int s1 = (int)((ticks3 % m_TicksPerDay % m_TicksPerHour % m_TicksPerMinute) + / m_TicksPerSecond); + int m_s1 = (int)((ticks3 % m_TicksPerDay % m_TicksPerHour % m_TicksPerMinute + % m_TicksPerSecond) / m_TicksPerMillisecond); + + TimeSpan ts1 = new TimeSpan(days1, hours1, mins1, secs1, ms1); + TimeSpan ts2 = new TimeSpan(days2, hours2, mins2, secs2, ms2); + TimeSpan ts3 = (add ? (ts1 + ts2) : (ts1 - ts2)); + + Assert.Equal(ts3.Days, d1); + Debug.WriteLine(ts3.Days.ToString() + " == " + d1.ToString()); + + Assert.Equal(ts3.Hours, h1); + Debug.WriteLine(ts3.Hours.ToString() + " == " + h1.ToString()); + + Assert.Equal(ts3.Minutes, m1); + Debug.WriteLine(ts3.Minutes.ToString() + " == " + m1.ToString()); + + Assert.Equal(ts3.Seconds, s1); + Debug.WriteLine(ts3.Seconds.ToString() + " == " + s1.ToString()); + + Assert.Equal(ts3.Milliseconds, m_s1); + Debug.WriteLine(ts3.Milliseconds.ToString() + " == " + m_s1.ToString()); + + Debug.WriteLine(ts1.ToString()); + Debug.WriteLine(ts2.ToString()); + } + + [TestMethod] + public void op_Subtraction_Test16() + { + /// + /// 1. Test subtraction, the binary - operator with non TimeSpan args + /// + /// + Debug.WriteLine("Testing the binary - operator with non TimeSpan args"); + Random random = new Random(); + int mxd = 24000; + int mx = 10000; + for (int i = 0; i < 5; i++) + { + int id = (random.Next(1) == 0 ? -1 : 1); + int ih = (random.Next(1) == 0 ? -1 : 1); + int im = (random.Next(1) == 0 ? -1 : 1); + int ise = (random.Next(1) == 0 ? -1 : 1); + int ims = (random.Next(1) == 0 ? -1 : 1); + OSubAddHelper(id * random.Next(mxd), + ih * random.Next(mx), im * random.Next(mx), + ise * random.Next(mx), ims * random.Next(mx), + id * random.Next(mxd), ih * random.Next(mx), + im * random.Next(mx), ise * random.Next(mx), + ims * random.Next(mx), false); + } + } + + [TestMethod] + public void op_UnaryPlus_Test17() + { + /// + /// 1. Test the unary + operator + /// + /// + Debug.WriteLine("Testing the unary + operator"); + Random random = new Random(); + int mxd = 24000; + int mx = 10000; + for (int i = 0; i < 5; i++) + { + int id = (random.Next(1) == 0 ? -1 : 1); + int ih = (random.Next(1) == 0 ? -1 : 1); + int im = (random.Next(1) == 0 ? -1 : 1); + int ise = (random.Next(1) == 0 ? -1 : 1); + int ims = (random.Next(1) == 0 ? -1 : 1); + UnaryHelper(id * random.Next(mxd), + ih * random.Next(mx), im * random.Next(mx), + ise * random.Next(mx), ims * random.Next(mx), + false); + } + } + + [TestMethod] + public void op_Addition_Test18() + { + /// + /// 1. Test the binary + operator with non-TimeSpan args + /// + /// + Debug.WriteLine("Testing the binary + operator with non-TimeSpan args"); + Random random = new Random(); + int mxd = 24000; + int mx = 10000; + for (int i = 0; i < 5; i++) + { + int id = (random.Next(1) == 0 ? -1 : 1); + int ih = (random.Next(1) == 0 ? -1 : 1); + int im = (random.Next(1) == 0 ? -1 : 1); + int ise = (random.Next(1) == 0 ? -1 : 1); + int ims = (random.Next(1) == 0 ? -1 : 1); + OSubAddHelper(id * random.Next(mxd), + ih * random.Next(mx), im * random.Next(mx), + ise * random.Next(mx), ims * random.Next(mx), + id * random.Next(mxd), ih * random.Next(mx), + im * random.Next(mx), ise * random.Next(mx), + ims * random.Next(mx), true); + } + } + + private void EqualityHelper(int days1, int hours1, int mins1, int secs1, int ms1, + int days2, int hours2, int mins2, int secs2, int ms2, bool expected, bool ineq) + { + + TimeSpan ts1 = new TimeSpan(days1, hours1, mins1, secs1, ms1); + TimeSpan ts2 = new TimeSpan(days2, hours2, mins2, secs2, ms2); + Assert.True((ts1 == ts2) == expected); + } + + [TestMethod] + public void op_Equality_Test19() + { + /// + /// 1. Test equality, the binary == operator + /// + /// + Debug.WriteLine("Testing the == operator"); + Random random = new Random(); + int mxd = 24000; + int mx = 10000; + for (int i = 0; i < 5; i++) + { + int id = (random.Next(1) == 0 ? -1 : 1) * random.Next(mxd); + int ih = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int im = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int ise = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int ims = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + EqualityHelper(id, ih, im, ise, ims, id, ih, im, ise, ims, + true, false); + EqualityHelper(id, ih, im, ise, ims, id + 1, ih, im, ise, ims, + false, false); + EqualityHelper(id, ih, im, ise, ims, id, ih + 1, im, ise, ims, + false, false); + EqualityHelper(id, ih, im, ise, ims, id, ih, im + 1, ise, ims, + false, false); + EqualityHelper(id, ih, im, ise, ims, id, ih, im, ise + 1, ims, + false, false); + EqualityHelper(id, ih, im, ise, ims, id, ih, im, ise, ims + 1, + false, false); + } + } + + private void InequalityHelper(int days1, int hours1, int mins1, int secs1, int ms1, int days2, int hours2, int mins2, int secs2, int ms2, bool expected, bool ineq) + { + TimeSpan ts1 = new TimeSpan(days1, hours1, mins1, secs1, ms1); + TimeSpan ts2 = new TimeSpan(days2, hours2, mins2, secs2, ms2); + Assert.True((ts1 != ts2) == expected); + + } + + [TestMethod] + public void op_Inequality_Test20() + { + /// + /// 1. Test inequality, the binary != operator + /// + /// + Debug.WriteLine("Testing the != operator"); + Random random = new Random(); + int mxd = 24000; + int mx = 10000; + for (int i = 0; i < 5; i++) + { + int id = (random.Next(1) == 0 ? -1 : 1) * random.Next(mxd); + int ih = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int im = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int ise = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int ims = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + InequalityHelper(id, ih, im, ise, ims, id, ih, im, ise, ims, + false, false); + InequalityHelper(id, ih, im, ise, ims, id + 1, ih, im, ise, ims, + true, false); + InequalityHelper(id, ih, im, ise, ims, id, ih + 1, im, ise, ims, + true, false); + InequalityHelper(id, ih, im, ise, ims, id, ih, im + 1, ise, ims, + true, false); + InequalityHelper(id, ih, im, ise, ims, id, ih, im, ise + 1, ims, + true, false); + InequalityHelper(id, ih, im, ise, ims, id, ih, im, ise, ims + 1, + true, false); + } + } + + private bool LTGTHelper(int days1, int hours1, int mins1, int secs1, int ms1, int days2, int hours2, int mins2, int secs2, int ms2, bool expected, int opcode) + { + bool testResult = true; + try + { + TimeSpan ts1 = new TimeSpan(days1, hours1, mins1, secs1, ms1); + TimeSpan ts2 = new TimeSpan(days2, hours2, mins2, secs2, ms2); + if (opcode == 0) + testResult &= ((ts1 < ts2) == expected); + else if (opcode == 1) + testResult &= ((ts1 <= ts2) == expected); + else if (opcode == 2) + testResult &= ((ts1 > ts2) == expected); + else if (opcode == 3) + testResult &= ((ts1 >= ts2) == expected); + else + { + Debug.WriteLine("Test Error: Invalid opcode"); + testResult = false; + } + } + catch + { + Debug.WriteLine("Exception Caught"); + testResult = false; + } + return testResult; + } + + [TestMethod] + public void op_LessThan_Test21() + { + /// + /// 1. Testing the binary Less Than operator + /// + /// + Debug.WriteLine("Testing the Less Than operator"); + Random random = new Random(); + int mxd = 24000; + int mx = 10000; + for (int i = 0; i < 5; i++) + { + int id = (random.Next(1) == 0 ? -1 : 1) * random.Next(mxd); + int ih = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int im = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int ise = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int ims = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im, ise, ims, false, 0)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id + 1, ih, im, ise, ims, true, 0)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih + 1, im, ise, ims, true, 0)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im + 1, ise, ims, true, 0)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im, ise + 1, ims, true, 0)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im, ise, ims + 1, true, 0)); + Assert.True(LTGTHelper(id + 1, ih, im, ise, ims, id, ih, im, ise, ims, false, 0)); + Assert.True(LTGTHelper(id, ih + 1, im, ise, ims, id, ih, im, ise, ims, false, 0)); + Assert.True(LTGTHelper(id, ih, im + 1, ise, ims, id, ih, im, ise, ims, false, 0)); + Assert.True(LTGTHelper(id, ih, im, ise + 1, ims, id, ih, im, ise, ims, false, 0)); + Assert.True(LTGTHelper(id, ih, im, ise, ims + 1, id, ih, im, ise, ims, false, 0)); + } + } + + [TestMethod] + public void op_LessThanOrEqual_Test22() + { + /// + /// 1. Test the binary Less Than Equals operator + /// + /// + Debug.WriteLine("Testing the Less Than Equals operator"); + Random random = new Random(); + int mxd = 24000; + int mx = 10000; + for (int i = 0; i < 5; i++) + { + int id = (random.Next(1) == 0 ? -1 : 1) * random.Next(mxd); + int ih = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int im = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int ise = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int ims = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im, ise, ims, true, 1)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id + 1, ih, im, ise, ims, true, 1)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih + 1, im, ise, ims, true, 1)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im + 1, ise, ims, true, 1)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im, ise + 1, ims, true, 1)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im, ise, ims + 1, true, 1)); + Assert.True(LTGTHelper(id + 1, ih, im, ise, ims, id, ih, im, ise, ims, false, 1)); + Assert.True(LTGTHelper(id, ih + 1, im, ise, ims, id, ih, im, ise, ims, false, 1)); + Assert.True(LTGTHelper(id, ih, im + 1, ise, ims, id, ih, im, ise, ims, false, 1)); + Assert.True(LTGTHelper(id, ih, im, ise + 1, ims, id, ih, im, ise, ims, false, 1)); + Assert.True(LTGTHelper(id, ih, im, ise, ims + 1, id, ih, im, ise, ims, false, 1)); + } + } + + [TestMethod] + public void op_GreaterThan_Test23() + { + /// + /// 1. Test the binary Greater Than operator + /// + /// + Debug.WriteLine("Testing the Greater Than operator"); + Random random = new Random(); + int mxd = 24000; + int mx = 10000; + for (int i = 0; i < 5; i++) + { + int id = (random.Next(1) == 0 ? -1 : 1) * random.Next(mxd); + int ih = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int im = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int ise = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int ims = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im, ise, ims, false, 2)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id + 1, ih, im, ise, ims, false, 2)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih + 1, im, ise, ims, false, 2)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im + 1, ise, ims, false, 2)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im, ise + 1, ims, false, 2)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im, ise, ims + 1, false, 2)); + Assert.True(LTGTHelper(id + 1, ih, im, ise, ims, id, ih, im, ise, ims, true, 2)); + Assert.True(LTGTHelper(id, ih + 1, im, ise, ims, id, ih, im, ise, ims, true, 2)); + Assert.True(LTGTHelper(id, ih, im + 1, ise, ims, id, ih, im, ise, ims, true, 2)); + Assert.True(LTGTHelper(id, ih, im, ise + 1, ims, id, ih, im, ise, ims, true, 2)); + Assert.True(LTGTHelper(id, ih, im, ise, ims + 1, id, ih, im, ise, ims, true, 2)); + } + } + + [TestMethod] + public void op_GreaterThanOrEqual_Test24() + { + /// + /// 1. Test the binary Greater Than Equals operator + /// + /// + Debug.WriteLine("Testing the Greater Than Equals operator"); + Random random = new Random(); + int mxd = 24000; + int mx = 10000; + for (int i = 0; i < 5; i++) + { + int id = (random.Next(1) == 0 ? -1 : 1) * random.Next(mxd); + int ih = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int im = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int ise = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + int ims = (random.Next(1) == 0 ? -1 : 1) * random.Next(mx); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im, ise, ims, true, 3)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id + 1, ih, im, ise, ims, false, 3)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih + 1, im, ise, ims, false, 3)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im + 1, ise, ims, false, 3)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im, ise + 1, ims, false, 3)); + Assert.True(LTGTHelper(id, ih, im, ise, ims, id, ih, im, ise, ims + 1, false, 3)); + Assert.True(LTGTHelper(id + 1, ih, im, ise, ims, id, ih, im, ise, ims, true, 3)); + Assert.True(LTGTHelper(id, ih + 1, im, ise, ims, id, ih, im, ise, ims, true, 3)); + Assert.True(LTGTHelper(id, ih, im + 1, ise, ims, id, ih, im, ise, ims, true, 3)); + Assert.True(LTGTHelper(id, ih, im, ise + 1, ims, id, ih, im, ise, ims, true, 3)); + Assert.True(LTGTHelper(id, ih, im, ise, ims + 1, id, ih, im, ise, ims, true, 3)); + } + } + + private void TicksHelper(int days, int hours, int mins, int secs, int ms) + { + TimeSpan ts = new TimeSpan(days, hours, mins, secs, ms); + long ticks = + days * m_TicksPerDay + + hours * m_TicksPerHour + + mins * m_TicksPerMinute + + secs * m_TicksPerSecond + + ms * m_TicksPerMillisecond; + Assert.Equal(ts.Ticks, ticks); + Debug.WriteLine(ts.Ticks.ToString() + " == " + ticks.ToString()); + } + [TestMethod] + public void Ticks_Test28() + { + /// + /// 1. Test the Ticks Property + /// + /// + Debug.WriteLine("Testing the Ticks Property"); + + Debug.WriteLine("TimeSpan::Ticks - Normal "); + Random random = new Random(); + int max = 24000; + int maxOthers = 10000; + for (int i = 0; i < 5; i++) + { + TicksHelper(random.Next(max), + random.Next(maxOthers), random.Next(maxOthers), + random.Next(maxOthers), random.Next(maxOthers)); + } + } + + } +} diff --git a/Tests/NFUnitTestSystemLib/nano.runsettings b/Tests/NFUnitTestSystemLib/nano.runsettings index 62f0a008..38fae61f 100644 --- a/Tests/NFUnitTestSystemLib/nano.runsettings +++ b/Tests/NFUnitTestSystemLib/nano.runsettings @@ -8,6 +8,7 @@ Framework40 - None + None + True \ No newline at end of file diff --git a/Tests/NFUnitTestSystemLib/packages.config b/Tests/NFUnitTestSystemLib/packages.config index dcab08b1..1adb9284 100644 --- a/Tests/NFUnitTestSystemLib/packages.config +++ b/Tests/NFUnitTestSystemLib/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file From 7d53e0b9fe6c6bac679ade9e4e9f2a824fabb98d Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Sun, 28 Feb 2021 23:45:26 +0300 Subject: [PATCH 24/55] Adding more tests on reflection --- .../NFUnitTestSystemLib.nfproj | 4 + Tests/NFUnitTestSystemLib/UnitTestGCTest.cs | 169 ++++++++++ .../UnitTestReflectionAssemblyTest.cs | 92 ++++++ .../UnitTestReflectionMemberTest.cs | 292 ++++++++++++++++++ .../UnitTestReflectionTypeTest.cs | 213 +++++++++++++ 5 files changed, 770 insertions(+) create mode 100644 Tests/NFUnitTestSystemLib/UnitTestGCTest.cs create mode 100644 Tests/NFUnitTestSystemLib/UnitTestReflectionAssemblyTest.cs create mode 100644 Tests/NFUnitTestSystemLib/UnitTestReflectionMemberTest.cs create mode 100644 Tests/NFUnitTestSystemLib/UnitTestReflectionTypeTest.cs diff --git a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj index eea2e6a4..7543dcc9 100644 --- a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj +++ b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj @@ -28,10 +28,14 @@ + + + + diff --git a/Tests/NFUnitTestSystemLib/UnitTestGCTest.cs b/Tests/NFUnitTestSystemLib/UnitTestGCTest.cs new file mode 100644 index 00000000..36e77f1e --- /dev/null +++ b/Tests/NFUnitTestSystemLib/UnitTestGCTest.cs @@ -0,0 +1,169 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestSystemLib +{ + [TestClass] + class UnitTestGCTest + { + class FinalizeObject + { + public static FinalizeObject m_currentInstance = null; + + ~FinalizeObject() + { + if (m_hasFinalized1 == false) + { + Debug.WriteLine("First finalization"); + + // Put this object back into a root by creating + // a reference to it. + FinalizeObject.m_currentInstance = this; + + // Indicate that this instance has finalized once. + m_hasFinalized1 = true; + + // Place a reference to this object back in the + // finalization queue. + GC.ReRegisterForFinalize(this); + } + else + { + Debug.WriteLine("Second finalization"); + m_hasFinalized2 = true; + } + } + } + + static bool m_hasFinalized1 = false; + static bool m_hasFinalized2 = false; + static bool m_Test1Result = false; + + //[TestMethod] + //public void SystemGC1_Test() + //{ + // /// + // /// 1. Create a FinalizeObject. + // /// 2. Release the reference + // /// 3. Allow for GC + // /// 4. Run ReRegisterForFinalize + // /// 5. Allow for GC + // /// 6. Verify that object has been collected + // /// + // /// + // Debug.WriteLine("Tests ReRegisterForFinalize"); + // Debug.WriteLine("Create a FinalizeObject."); + // FinalizeObject mfo = new FinalizeObject(); + // m_hasFinalized1 = false; + // m_hasFinalized2 = false; + + // Debug.WriteLine("Release reference"); + // mfo = null; + + // Debug.WriteLine("Allow GC"); + // GC.WaitForPendingFinalizers(); + // int sleepTime = 1000; + // int slept = 0; + // while (m_hasFinalized1 == false && slept < sleepTime) + // { + // System.Threading.Thread.Sleep(10); + // slept += 10; + // } + // Debug.WriteLine("GC took " + slept); + + // // At this point mfo will have gone through the first Finalize. + // // There should now be a reference to mfo in the static + // // FinalizeObject.m_currentInstance field. Setting this value + // // to null and forcing another garbage collection will now + // // cause the object to Finalize permanently. + // Debug.WriteLine("Reregister and allow for GC"); + // FinalizeObject.m_currentInstance = null; + // GC.WaitForPendingFinalizers(); + // sleepTime = 1000; + // slept = 0; + // while (m_hasFinalized2 == false && slept < sleepTime) + // { + // System.Threading.Thread.Sleep(10); + // slept += 10; + // } + // Debug.WriteLine("GC took " + slept); + + // m_Test1Result = m_hasFinalized2; + // Assert.True(m_hasFinalized2); + //} + + //[TestMethod] + //public void SystemGC2_Test() + //{ + // /// + // /// 1. Create a FinalizeObject. + // /// 2. Release the reference + // /// 3. SupressFinalize + // /// 3. Allow for GC + // /// 6. Verify that object has not been collected + // /// + // /// + // Debug.WriteLine("Tests SuppressFinalize"); + // Debug.WriteLine("Create a FinalizeObject."); + // FinalizeObject mfo = new FinalizeObject(); + // m_hasFinalized1 = false; + // m_hasFinalized2 = false; + + // Debug.WriteLine("Releasing"); + // System.GC.SuppressFinalize(mfo); + // mfo = null; + + // Debug.WriteLine("Allow GC"); + // GC.WaitForPendingFinalizers(); + // int sleepTime = 1000; + // int slept = 0; + // while (m_hasFinalized1 == false && slept < sleepTime) + // { + // System.Threading.Thread.Sleep(10); + // slept += 10; + // } + // Debug.WriteLine("GC took " + slept); + + // Assert.False(m_hasFinalized1); + //} + + //[TestMethod] + //public void SystemGC3_Test() + //{ + // /// + // /// 1. Create a FinalizeObject. + // /// 2. Release the reference + // /// 3. SupressFinalize + // /// 3. Allow for GC + // /// 6. Verify that object has not been collected + // /// + // /// + // Debug.WriteLine("Tests WaitForPendingFinalizers, dependant on test 1"); + // Debug.WriteLine("will auto-fail if test 1 fails."); + // Assert.True(m_Test1Result); + + // Debug.WriteLine("Create a FinalizeObject."); + // FinalizeObject mfo = new FinalizeObject(); + // m_hasFinalized1 = false; + // m_hasFinalized2 = false; + + // Debug.WriteLine("Releasing"); + // mfo = null; + + // Debug.WriteLine("Wait for GC"); + // GC.WaitForPendingFinalizers(); + // System.GC.WaitForPendingFinalizers(); + + // Debug.WriteLine("Releasing again"); + // FinalizeObject.m_currentInstance = null; + + // Debug.WriteLine("Wait for GC"); + // GC.WaitForPendingFinalizers(); + // System.GC.WaitForPendingFinalizers(); + + // Assert.True(m_hasFinalized2); + //} + + } +} diff --git a/Tests/NFUnitTestSystemLib/UnitTestReflectionAssemblyTest.cs b/Tests/NFUnitTestSystemLib/UnitTestReflectionAssemblyTest.cs new file mode 100644 index 00000000..10d090e4 --- /dev/null +++ b/Tests/NFUnitTestSystemLib/UnitTestReflectionAssemblyTest.cs @@ -0,0 +1,92 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using System.Reflection; + +namespace NFUnitTestSystemLib +{ + [TestClass] + class UnitTestReflectionAssemblyTest + { + [TestMethod] + public void AssemblyName_Test1() + { + + Assembly assm = Assembly.GetExecutingAssembly(); + + // we will check that the Name and FullName from the AssemblyName class do go along + string name = assm.GetName().Name; + Debug.WriteLine("Assembly name from AssemblyName type is: \"" + name + "\""); + string fullNameFromAssemblyName = assm.GetName().FullName; + Debug.WriteLine("Assembly FullNme from AssemblyName type is: \"" + fullNameFromAssemblyName + "\""); + + string nameParsedFromFullName = fullNameFromAssemblyName.Substring(0, fullNameFromAssemblyName.IndexOf(',')); + Assert.Equal(nameParsedFromFullName, name); + + // we will check that the FullName from Assembly and FullName from the AssemblyName class do match + string fullName = assm.FullName; + Debug.WriteLine("Assembly FullName from Assembly type: \"" + fullName + "\""); + + Assert.Equal(fullName, (name + ", Version=" + assm.GetName().Version.ToString())); + } + + [TestMethod] + public void AssemblyVersion_Test2() + { + // get the version + Version ver = Assembly.GetExecutingAssembly().GetName().Version; + Assert.NotNull(ver); + } + + [TestMethod] + public void AssemblyVersion_Test3() + { + Type myType3 = Type.GetType("System.Int32"); + + // get the version + Assembly assm = Assembly.Load("mscorlib"); + Assert.NotNull(assm); + + string v = assm.GetName().Version.ToString(); + + Assembly assm1 = Assembly.Load("mscorlib, Version=" + v); + Assert.NotNull(assm1); + + Assert.Trows(typeof(ArgumentException), () => { Assembly assm2 = Assembly.Load("mscorlib, ,Version=" + v); }); + + // Test for extra parameters after assembly version. The assembly version parser needs to handle this + // because the VS debugger will identify in CultureInfo and PublicKeyToken when debugging. + assm = Assembly.Load("mscorlib, Version=" + v + ", CultureInfo=en, PublicKeyToken=null"); + Assert.NotNull(assm); + } + + [TestMethod] + public void Assembly_GetAssemblies_Satellite_Test4() + { + Assembly asm = typeof(int).Assembly; + + // Make sure satellite assembly can be retrieved + Assembly res = asm.GetSatelliteAssembly(new System.Globalization.CultureInfo("en")); + Assert.NotNull(res); + + // Make sure we can get a known type from the target assembly + Type t = asm.GetType("System.Int32"); + Assert.True(t.IsValueType); + + // make sure all types from the assembly have proper + // assembly property + Type[] ts = asm.GetTypes(); + for (int i = 0; i < ts.Length; i++) + { + Assert.Equal(ts[i].Assembly.FullName, asm.FullName); + } + } + + } +} diff --git a/Tests/NFUnitTestSystemLib/UnitTestReflectionMemberTest.cs b/Tests/NFUnitTestSystemLib/UnitTestReflectionMemberTest.cs new file mode 100644 index 00000000..36434cb6 --- /dev/null +++ b/Tests/NFUnitTestSystemLib/UnitTestReflectionMemberTest.cs @@ -0,0 +1,292 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Reflection; + +namespace NFUnitTestSystemLib +{ + [TestClass] + class UnitTestReflectionMemberTest + { + [TestMethod] + public void SystemReflectionMemberTests_Properties_Test0() + { + TestClass tst = new TestClass(); + + /// + /// Test the PropertyInfo class members + /// + MethodInfo mi = typeof(TestClass).GetMethod("BaseInternalProtectedMethod", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + Assert.False(mi.IsAbstract); + Assert.False(mi.IsFinal); + Assert.False(mi.IsPublic); + Assert.False(mi.IsStatic); + Assert.False(mi.IsVirtual); + Assert.IsType(mi.ReturnType, typeof(object)); + Assert.True(mi.Invoke(tst, new object[] { 3 }) == null); + Assert.IsType(mi.DeclaringType, typeof(AbsTestClass)); + + mi = typeof(AbsTestClass).GetMethod("AbstractPublicMethod", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + Assert.True(mi.IsAbstract); + Assert.False(mi.IsFinal); + Assert.True(mi.IsPublic); + Assert.False(mi.IsStatic); + Assert.True(mi.IsVirtual); + Assert.IsType(mi.ReturnType, typeof(float)); + Assert.True((float)mi.Invoke(tst, new object[] { 3 }) == 38.4f); + Assert.IsType(mi.DeclaringType, typeof(AbsTestClass)); + + mi = typeof(TestClass).GetMethod("VirtualInternalMethod", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + Assert.False(mi.IsAbstract); + Assert.False(mi.IsFinal); + Assert.False(mi.IsPublic); + Assert.False(mi.IsStatic); + Assert.True(mi.IsVirtual); + Assert.IsType(mi.ReturnType, typeof(int)); + Assert.True((int)mi.Invoke(tst, new object[] { true }) == 34); + Assert.IsType(mi.DeclaringType, typeof(TestClass)); + + mi = typeof(TestClass).GetMethod("SealedPublicMethod", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); + Assert.False(mi.IsAbstract); + Assert.True(mi.IsFinal); + Assert.True(mi.IsPublic); + Assert.False(mi.IsStatic); + Assert.True(mi.IsVirtual); + Assert.IsType(mi.ReturnType, typeof(bool)); + Assert.True((bool)mi.Invoke(tst, new object[] { })); + Assert.IsType(mi.DeclaringType, typeof(TestClass)); + + mi = typeof(TestClass).GetMethod("StaticPrivateAbsMethod", BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); + Assert.False(mi.IsAbstract); + Assert.False(mi.IsFinal); + Assert.False(mi.IsPublic); + Assert.True(mi.IsStatic); + Assert.False(mi.IsVirtual); + Assert.IsType(mi.ReturnType, typeof(void)); + TestClass.s_WasStaticMethodCalled = false; + mi.Invoke(tst, new object[] { }); + Assert.True(TestClass.s_WasStaticMethodCalled); + Assert.IsType(mi.DeclaringType, typeof(AbsTestClass)); + + mi = typeof(TestClass).GetMethod("PublicMethod", BindingFlags.Instance | BindingFlags.Public); + Assert.False(mi.IsAbstract); + Assert.True(mi.IsFinal); + Assert.True(mi.IsPublic); + Assert.False(mi.IsStatic); + Assert.True(mi.IsVirtual); + Assert.IsType(mi.ReturnType, typeof(void)); + mi.Invoke(tst, new object[] { }); + Assert.IsType(mi.DeclaringType, typeof(TestClass)); + + mi = typeof(TestClass).GetMethod("InternalMethod", BindingFlags.Instance | BindingFlags.NonPublic); + Assert.False(mi.IsAbstract); + Assert.False(mi.IsFinal); + Assert.False(mi.IsPublic); + Assert.False(mi.IsStatic); + Assert.False(mi.IsVirtual); + Assert.IsType(mi.ReturnType, typeof(int)); + Assert.True(1 == (int)mi.Invoke(tst, new object[] { 90.3f })); + Assert.IsType(mi.DeclaringType, typeof(TestClass)); + + mi = typeof(TestClass).GetMethod("PrivateMethod", BindingFlags.Instance | BindingFlags.NonPublic); + Assert.False(mi.IsAbstract); + Assert.False(mi.IsFinal); + Assert.False(mi.IsPublic); + Assert.False(mi.IsStatic); + Assert.False(mi.IsVirtual); + Assert.IsType(mi.ReturnType, typeof(float)); + Assert.True(3.3f == (float)mi.Invoke(tst, new object[] { 92 })); + Assert.IsType(mi.DeclaringType, typeof(TestClass)); + } + + [TestMethod] + public void SystemReflectionMemberTests_DelegateMethod_Test1() + { + /// + /// Test the MethodInfo returned from the Delegate.Method property + /// + + Delegate del = new MyDelegate(MyDelegateImpl); + MethodInfo mi = del.Method; + + Assert.False(mi.IsPublic); + Assert.True(mi.IsStatic); + Assert.False(mi.IsVirtual); + Assert.False(mi.IsAbstract); + Assert.False(mi.IsFinal); + Assert.Equal(mi.Name, "MyDelegateImpl"); + Assert.IsType(mi.ReturnType, typeof(bool)); + Assert.True((bool)mi.Invoke(null, new object[] { 1, 3.3f })); + Assert.IsType(mi.DeclaringType, typeof(UnitTestReflectionMemberTest)); + } + + [TestMethod] + public void SystemReflectionMemberTests_ConstructorInfo_Test2() + { + /// + /// Test the ConstructorInfo class members + /// + Type t = typeof(TestClass); + + ConstructorInfo ci = t.GetConstructor(new Type[] { }); + Assert.True(ci.IsPublic); + Assert.False(ci.IsStatic); + Assert.True(ci.Invoke(new object[] { }) is TestClass); + + ci = typeof(AbsTestClass).GetConstructor(new Type[] { typeof(float) }); + Assert.False(ci.IsPublic); + Assert.False(ci.IsStatic); + Assert.IsType(ci.DeclaringType, typeof(AbsTestClass)); + AbsTestClass tst = ci.Invoke(new object[] { 1.2f }) as AbsTestClass; + Assert.NotNull(tst); + + ci = t.GetConstructor(new Type[] { typeof(int) }); + Assert.False(ci.IsStatic); + Assert.False(ci.IsPublic); + Assert.True(ci.Invoke(new object[] { 3 }) is TestClass); + + ci = t.GetConstructor(new Type[] { typeof(bool) }); + Assert.False(ci.IsStatic); + Assert.False(ci.IsPublic); + Assert.True(ci.Invoke(new object[] { true }) is TestClass); + } + + [TestMethod] + public void SystemReflectionMemberTests_FieldInfo_Test3() + { + /// + /// Test the FieldInfo class members + /// + + Type t = typeof(TestClass); + FieldInfo fi = t.GetField("AbsPrivateField", BindingFlags.Instance | BindingFlags.NonPublic); + Assert.IsType(fi.FieldType, typeof(int)); + Assert.IsType(fi.DeclaringType, typeof(AbsTestClass)); + + fi = t.GetField("PublicField"); + Assert.IsType(fi.FieldType, typeof(int)); + Assert.IsType(fi.DeclaringType, typeof(TestClass)); + + fi = t.GetField("IntProtectedField", BindingFlags.Instance | BindingFlags.NonPublic); + Assert.IsType(fi.FieldType, typeof(float)); + Assert.IsType(fi.DeclaringType, t); + + fi = t.GetField("BoolPrivateField", BindingFlags.Static | BindingFlags.NonPublic); + Assert.IsType(fi.FieldType, typeof(bool)); + Assert.IsType(fi.DeclaringType, t); + + } + + //--------------------Classes/Interfaces/Delegates used by this test class----------------------// + + #region INTERNAL_TEST_CLASSES + private static bool MyDelegateImpl(int i, float f) + { + return true; + } + + public delegate bool MyDelegate(int i, float f); + + abstract class AbsTestClass + { + int AbsPrivateField; + + public static bool s_WasStaticMethodCalled; + + static AbsTestClass() + { + s_WasStaticMethodCalled = false; + } + protected AbsTestClass(float f) + { + AbsPrivateField = (int)f; + } + + internal protected object BaseInternalProtectedMethod(int i) + { + return null; + } + + public abstract float AbstractPublicMethod(int i); + + internal virtual int VirtualInternalMethod(bool b) + { + return 0; + } + + public virtual bool SealedPublicMethod() + { + return false; + } + + private static void StaticPrivateAbsMethod() + { + s_WasStaticMethodCalled = true; + } + } + + interface IBaseInterface + { + void PublicMethod(); + } + + private class TestClass : AbsTestClass, IBaseInterface + { + public int PublicField; + internal protected float IntProtectedField; + private static bool BoolPrivateField; + + public TestClass() : base(3.4f) + { + PublicField = 0; + } + + internal TestClass(int i) : base(45.6f) + { + IntProtectedField = i; + } + + private TestClass(bool b) : base(2.2f) + { + BoolPrivateField = b; + } + + public void PublicMethod() + { + } + public sealed override bool SealedPublicMethod() + { + return true; + } + + internal int InternalMethod(float f) + { + return 1; + } + protected bool ProtectedMethod(bool b) + { + return true; + } + private float PrivateMethod(int i) + { + return 3.3f; + } + public override float AbstractPublicMethod(int i) + { + return 38.4f; + } + + internal override int VirtualInternalMethod(bool b) + { + return 34; + } + } + #endregion + + } +} diff --git a/Tests/NFUnitTestSystemLib/UnitTestReflectionTypeTest.cs b/Tests/NFUnitTestSystemLib/UnitTestReflectionTypeTest.cs new file mode 100644 index 00000000..6df314f0 --- /dev/null +++ b/Tests/NFUnitTestSystemLib/UnitTestReflectionTypeTest.cs @@ -0,0 +1,213 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Collections; +using System.Diagnostics; +using System.Reflection; + +namespace NFUnitTestSystemLib +{ + [TestClass] + class UnitTestReflectionTypeTest + { + delegate bool MyDelegate(int i); + + [TestMethod] + public void SystemReflectionType_ObjectGetType_Test0() + { + object o = (object)1; + Assert.IsType(o.GetType(), typeof(int)); + + o = (object)typeof(Type); + Assert.IsType(o.GetType(), typeof(Type).GetType()); + + //o = AppDomain.CurrentDomain.GetAssemblies(); + //fRes &= o.GetType() == typeof(Assembly[]); + + o = new TestClass(); + Assert.IsType(o.GetType(), typeof(TestClass)); + + o = new TestStruct(); + Assert.IsType(o.GetType(), typeof(TestStruct)); + + o = new MyDelegate(MyDelegateImpl); + Assert.IsType(o.GetType(), typeof(MyDelegate)); + + o = (new MyDelegate(MyDelegateImpl)).Method; + + MethodInfo mi = typeof(UnitTestReflectionTypeTest).GetMethod("MyDelegateImpl", BindingFlags.Static | BindingFlags.NonPublic); + Assert.IsType(o.GetType(), mi.GetType()); + } + + + [TestMethod] + public void SystemReflectionType_RuntimeType_Test1() + { + ArrayList list = new ArrayList(); + int i = 0; + + /// + /// Test the RuntimeType class members + /// + TestClass cls = new TestClass(); + + // Test Type members for a class type + Type t = cls.GetType(); + Assembly asm = t.Assembly; + list.Add(asm); + Assert.Equal(((Assembly)list[i]).GetName().Name, "NFUnitTest"); + Assert.Equal(asm.GetName().Name, "NFUnitTest"); + Assert.Equal(t.Name, "TestClass"); + Assert.Equal(t.FullName, "NFUnitTestSystemLib.UnitTestReflectionTypeTest+TestClass"); + Assert.IsType(t.BaseType, typeof(object)); + Assert.Null(t.GetElementType()); + + MethodInfo[] mis = t.GetMethods(); + Assert.Equal(mis[0].Name, "Method1"); + mis = t.GetMethods(BindingFlags.Instance | BindingFlags.NonPublic); + Assert.Equal(mis[0].Name, "Method2"); + Assert.NotNull(t.GetMethod("Method1")); + Assert.NotNull(t.GetMethod("Method2", BindingFlags.Instance | BindingFlags.NonPublic)); + + FieldInfo[] fis = t.GetFields(); + Assert.Equal(fis[0].Name, "m_Field1"); + fis = t.GetFields(BindingFlags.Instance | BindingFlags.NonPublic); + Assert.Equal(fis[0].Name, "m_Field2"); + Assert.NotNull(t.GetField("m_Field1")); + Assert.NotNull(t.GetField("m_Field2", BindingFlags.NonPublic | BindingFlags.Instance)); + Assert.NotNull(t.GetConstructor(new Type[] { })); + + Type[] ifaces = t.GetInterfaces(); + Assert.Equal(ifaces.Length, 2); + Assert.Equal(ifaces[0].Name, "IInterface1"); + Assert.Equal(ifaces[1].Name, "IInterface2"); + Assert.True(t.IsSubclassOf(typeof(object))); + i++; + + // test Type members for a struct valuetype + TestStruct str = new TestStruct(); + t = str.GetType(); + asm = t.Assembly; + list.Add(asm); + Assert.Equal(((Assembly)list[i]).GetName().Name, "NFUnitTest"); + Assert.Equal(asm.GetName().Name, "NFUnitTest"); + Assert.Equal(t.Name, "TestStruct"); + Assert.Equal(t.FullName, "NFUnitTestSystemLib.UnitTestReflectionTypeTest+TestStruct"); + Assert.IsType(t.BaseType, typeof(ValueType)); + Assert.Equal(t.GetInterfaces().Length, 0); + Assert.Null(t.GetElementType()); + i++; + + // test Type members for an Assembly reflection type + //Assembly asmObj = typeof(TestClass).Assembly; + //t = asmObj.GetType(); + //asm = t.Assembly; + //list.Add(asm); + //Assert.Equal(((Assembly)list[i]).GetName().Name, "mscorlib"); + //Assert.Equal(asm.GetName().Name, "mscorlib"); + //Assert.Equal(t.Name, "Assembly"); + //Assert.Equal(t.FullName, "System.Reflection.Assembly"); + //Assert.IsType(t.BaseType, typeof(Object)); + //Assert.Equal(t.GetInterfaces().Length, 0); + //Assert.Null(t.GetElementType()); + + mis = typeof(TestClass).GetMethods(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public); + t = mis.GetType(); + Assert.Equal(t.Name, "RuntimeMethodInfo[]"); + Assert.Equal(t.FullName, "System.Reflection.RuntimeMethodInfo[]"); + Assert.IsType(t.BaseType, typeof(Array)); + Assert.True(t.GetInterfaces().Length > 0); + Assert.Equal(t.GetElementType().Name, "RuntimeMethodInfo"); + + // test Type members for a delegate + Delegate del = new MyDelegate(MyDelegateImpl); + t = del.GetType(); + Assert.NotNull(t.DeclaringType); + Assert.Equal(t.Name, "MyDelegate"); + Assert.IsType(t.BaseType, typeof(MulticastDelegate)); + + // test Type members for an enum + TestEnum en = TestEnum.Item1; + t = en.GetType(); + Assert.IsType(t.DeclaringType, typeof(UnitTestReflectionTypeTest)); + Assert.True( t.IsEnum); + Assert.False(t.IsAbstract); + Assert.False(t.IsClass); + Assert.False(t.IsPublic); + Assert.True(t.IsValueType); + } + + [TestMethod] + public void SystemReflectionType_SystemType_Test2() + { + int[] blah = new int[3]; + + Assert.True(typeof(Array).IsInstanceOfType(blah)); + Assert.True(typeof(TestStruct[]).IsArray); + Assert.False(typeof(Array).IsValueType); + Assert.True(typeof(TestStruct).IsValueType); + Assert.True(typeof(Type).IsSubclassOf(typeof(MemberInfo))); + Assert.Equal(typeof(Type).GetInterfaces()[0].Name , "IReflect"); + Assert.True(typeof(MyDelegate).IsInstanceOfType(new MyDelegate(MyDelegateImpl))); + + // Get known type from assembly qualified type name Culture and PublicKeyToken are used by debugger to identify types + // so we must be able to parse them (even if we through out the culture/key). + // Type t = Type.GetType("System.Int32, mscorlib, version=4.1.0.0, CultureInfo=enu, PublicKeyToken=null"); + // Assert.NotNull(t); + } + + //------------------- Classes/interfaces/structs used by this test class ---------------------------// + + #region INTERNAL_TEST_CLASSES + + enum TestEnum + { + Item1, + Item2, + Item3 + }; + + private static bool MyDelegateImpl(int i) + { + return true; + } + + public struct TestStruct + { + public int Field1; + public bool Field2; + } + + interface IInterface1 + { + } + interface IInterface2 + { + } + + class TestClass : IInterface1, IInterface2 + { + public int m_Field1; + private float m_Field2; + + public int Method1(bool b) + { + m_Field1 = 3; + return m_Field1; + } + + private bool Method2(int i) + { + m_Field2 = (float)i; + return true; + } + } + #endregion + + } +} From 0ca26653d33555f42265f7eda2acc5f96c30f3d8 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 10:21:58 +0300 Subject: [PATCH 25/55] Adding more system lib tests --- .../NFUnitTestSystemLib.nfproj | 3 + .../UnitTestStringTests.cs | 326 ++++++++++++++ .../NFUnitTestSystemLib/UnitTestTypeTests.cs | 425 ++++++++++++++++++ .../UnitTestWeakReferenceTests.cs | 93 ++++ 4 files changed, 847 insertions(+) create mode 100644 Tests/NFUnitTestSystemLib/UnitTestStringTests.cs create mode 100644 Tests/NFUnitTestSystemLib/UnitTestTypeTests.cs create mode 100644 Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs diff --git a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj index 7543dcc9..c839d9a9 100644 --- a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj +++ b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj @@ -36,7 +36,10 @@ + + + diff --git a/Tests/NFUnitTestSystemLib/UnitTestStringTests.cs b/Tests/NFUnitTestSystemLib/UnitTestStringTests.cs new file mode 100644 index 00000000..9b011333 --- /dev/null +++ b/Tests/NFUnitTestSystemLib/UnitTestStringTests.cs @@ -0,0 +1,326 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestSystemLib +{ + [TestClass] + class UnitTestStringTests + { + //String Test methods + [TestMethod] + public void Ctor_Test() + { + Debug.WriteLine("Test of the standard constructor"); + char[] car = new Char[] { 'a', 'b', 'c', 'd' }; + + Debug.WriteLine("Char [], start, number"); + string str = new string(car, 1, 2); + Assert.Equal(str, "bc"); + + str = new string(car, 0, 4); + Assert.Equal(str, "abcd"); + + Debug.WriteLine("Char []"); + str = new string(car); + Assert.Equal(str, "abcd"); + + Debug.WriteLine("Char, number"); + str = new string('\n', 33); + Assert.Equal(str.Length, 33); + for (int i = 0; i < str.Length; i++) + { + Assert.Equal(str[i], '\n'); + } + + Debug.WriteLine("Char, string terminator known failure. "); + char[] car2 = new char[] { (char)0, (char)65 }; + string s = new string(car2); + Assert.Equal(s, "\0A"); + Debug.WriteLine("This was previously bug 20620"); + + Debug.WriteLine("new char[0]"); + str = new string(new char[0]); + Assert.Equal(str, string.Empty); + + Debug.WriteLine("null"); + str = new string(null); + Assert.Equal(str, string.Empty); + } + + [TestMethod] + public void CompareTo_Test3() + { + Debug.WriteLine("Test of the CompareTo method"); + string str = "hello"; + object ob = "Hello"; + Debug.WriteLine("NormalCompareTo"); + Assert.Equal(str.CompareTo((object)"hello"), 0); + Assert.True(str.CompareTo(ob) > 0); + Assert.True(str.CompareTo((object)"zello") < 0); + Debug.WriteLine("CompareTo null"); + Assert.True(str.CompareTo((object)null) > 0); + } + + [TestMethod] + public void GetHashCode_Test4() + { + Debug.WriteLine("Test of the GetHashCode method"); + string[] strs = new string[] { "abcd", "bcda", "cdab", "dabc" }; + + for (int i = 0; i < 4; i++) + { + for (int j = 0; j < 4; j++) + { + Debug.WriteLine(strs[i].GetHashCode().ToString() + " - " + + strs[j].GetHashCode().ToString()); + if (i == j) + { + Assert.Equal(strs[i].GetHashCode(), strs[j].GetHashCode()); + } + else + { + Assert.NotEqual(strs[i].GetHashCode(), strs[j].GetHashCode()); + } + } + } + } + + [TestMethod] + public void Equals_Test5() + { + Debug.WriteLine("This verifies the String.Equals functionality."); + Debug.WriteLine("It compares the string value using the Equals function"); + Debug.WriteLine("to valid and invalid values as well as casted object values."); + + string str = "abcd"; + object ob2 = "bcd"; + object ob = str as object; + + Assert.True(str.Equals(ob)); + Assert.False(str.Equals((object)123)); + Assert.True(str.Equals((object)"abcd")); + Assert.False(str.Equals((object)"bcd")); + Assert.False(str.Equals(ob2)); + string str1 = "abc\n"; + string str2 = "abcd"; + string str3 = "abc\n"; + Assert.True(str1.Equals(str3)); + Assert.False(str1.Equals(str2)); + Assert.True(str3.Equals(str1)); + Assert.True(str3.Equals("abc" + "\n")); + Assert.True(str2.Equals("a" + "b" + 'c' + "d")); + } + + [TestMethod] + public void ToString_Test6() + { + Debug.WriteLine("Test of the ToString method"); + string str = "abc"; + Assert.Equal(str, str.ToString()); + Assert.Equal(str, str.ToString().ToString().ToString()); + Assert.Equal(str.ToString(), "abc"); + } + + [TestMethod] + public void ToCharArray_Test13() + { + Debug.WriteLine("Test of the ToCharArray method"); + + char[] car1 = new Char[] { 'a', 'b', 'c', 'd' }; + char[] car2 = new Char[] { }; + + string str1 = "abcd"; + string str2 = "abcde"; + string str3 = "ABCD"; + + Debug.WriteLine("With 0 args"); + Assert.Equal(str1.ToCharArray(), car1); + Assert.NotEqual(str2.ToCharArray(), car1); + Assert.NotEqual(str3.ToCharArray(), car1); + Assert.NotEqual(str1.ToCharArray(), car2); + + Debug.WriteLine("With 1 args"); + Assert.NotEqual(str1.ToCharArray(0, 3), car1); + Assert.Equal(str2.ToCharArray(0, 4), car1); + Assert.NotEqual(str3.ToCharArray(0, 3), car1); + Assert.NotEqual(str1.ToCharArray(1, 3), car2); + } + + [TestMethod] + public void Split_Test15() + { + Debug.WriteLine("Testing the Split method"); + char[] car1 = new Char[] { '@', 'q' }; + char[] car2 = new Char[] { }; + string str1 = "ab@cd"; + string str2 = "abcd@"; + + Assert.Equal(str1.Split(car1)[0], "ab"); + Assert.Equal(str1.Split(car1)[1], "cd"); + Assert.Equal(str2.Split(car1)[0], "abcd"); + Assert.Equal(str2.Split(car1)[1], ""); + Assert.Equal(str1.Split(car2)[0], "ab@cd"); + + Debug.WriteLine("Verify split with a count"); + Debug.WriteLine("This is currently a known issue"); + Debug.WriteLine("20659 String.Split with a count parameter always returns the whole string."); + string[] oneTwoThree = "1 2 3".Split(new char[] { ' ' }, 1); + Assert.True(oneTwoThree.Length <= 1); + } + + [TestMethod] + public void Substring_Test17() + { + Debug.WriteLine("Testing the Substring method"); + string str1 = "abcde"; + + Assert.Equal(str1.Substring(0), str1); + Assert.Equal(str1.Substring(0, 5), str1); + Assert.Equal(str1.Substring(2), "cde"); + Assert.Equal(str1.Substring(2, 1), "c"); + } + + [TestMethod] + public void Trim_Test19() + { + Debug.WriteLine("Testing the Trim method"); + + char[] car1 = new Char[] { '@', 'q' }; + string str1 = " abc@de "; + string str2 = "@abc @ de@"; + Assert.Equal(str1.Trim(), "abc@de"); + Assert.Equal(str1.Trim(car1), " abc@de "); + Assert.Equal(str2.Trim(), "@abc @ de@"); + Assert.Equal(str2.Trim(car1), "abc @ de"); + } + + [TestMethod] + public void TrimStart_Test20() + { + Debug.WriteLine("Testing the TrimStart method"); + + char[] car1 = new Char[] { '@', 'q' }; + string str1 = " abc@de "; + string str2 = "@abc @ de@"; + Assert.Equal(str1.TrimStart(), "abc@de "); + Assert.Equal(str1.TrimStart(car1), " abc@de "); + Assert.Equal(str2.TrimStart(), "@abc @ de@"); + Assert.Equal(str2.TrimStart(car1), "abc @ de@"); + } + + [TestMethod] + public void TrimEnd_Test21() + { + Debug.WriteLine("Testing the TrimEnd method"); + + char[] car1 = new Char[] { '@', 'q' }; + string str1 = " abc@de "; + string str2 = "@abc @ de@"; + Assert.Equal(str1.TrimEnd(), " abc@de"); + Assert.Equal(str1.TrimEnd(car1), " abc@de "); + Assert.Equal(str2.TrimEnd(), "@abc @ de@"); + Assert.Equal(str2.TrimEnd(car1), "@abc @ de"); + } + + [TestMethod] + public void IndexOf_Test28() + { + Debug.WriteLine("Testing the IndexOf method"); + + string str1 = "@ abc@de "; + Assert.Equal(str1.IndexOf('@'), 0); + Assert.Equal(str1.IndexOf("abc"), 2); + Assert.Equal(str1.IndexOf('@', 1), 5); + Assert.Equal(str1.IndexOf('@', 1, 1), -1); + Assert.Equal(str1.IndexOf("abc", 2), 2); + Assert.Equal(str1.IndexOf("abc", 1, 1), -1); + } + + [TestMethod] + public void IndexOfAny_Test31() + { + Debug.WriteLine("Testing the IndexOfAny method"); + + string str1 = "@ abc@de "; + char[] car1 = new Char[] { '@', 'b' }; + + Assert.Equal(str1.IndexOfAny(car1), 0); + Assert.Equal(str1.IndexOfAny(car1, 1), 3); + } + + [TestMethod] + public void LastIndexOf_Test37() + { + Debug.WriteLine("Testing the LastIndexOf method"); + + string str1 = "@ abc@de "; + Assert.Equal(str1.LastIndexOf('@'), 5); + Assert.Equal(str1.LastIndexOf("abc"), 2); + Assert.Equal(str1.LastIndexOf('@', 1), 5); + Assert.Equal(str1.LastIndexOf('@', 1, 1), -1); + Assert.Equal(str1.LastIndexOf("abc", 2), 2); + Assert.Equal(str1.LastIndexOf("@", 6, 1), -1); + } + + [TestMethod] + public void LastIndexOfAny_Test40() + { + Debug.WriteLine("Testing the LastIndexOfAny method"); + + string str1 = "@ abc@de "; + char[] car1 = new Char[] { '@', 'b' }; + + Assert.Equal(str1.LastIndexOfAny(car1), 5); + Assert.Equal(str1.LastIndexOfAny(car1, 1), 5); + Assert.Equal(str1.LastIndexOfAny(car1, 4, 1), -1); + } + + [TestMethod] + public void ToLower_Test51() + { + Debug.WriteLine("Testing the ToLower method"); + + string str1 = "@ ABC@de "; + Assert.Equal(str1.ToLower(), "@ abc@de "); + } + + [TestMethod] + public void ToUpper_Test52() + { + Debug.WriteLine("Testing the ToUpper method"); ; + + string str1 = "@ ABC@de "; + Assert.Equal(str1.ToUpper(), "@ ABC@DE "); + } + + [TestMethod] + public void Length_Test71() + { + Debug.WriteLine("Testing the Length property"); ; + + string str1 = "@ ABC@de "; + Assert.Equal(str1.Length, 9); + } + + [TestMethod] + public void Concat_Test1() + { + string str = "a" + 1 + "b" + new ToStringReturnsNull(); + Assert.Equal(str, "a1b"); + } + } + + /// + /// A class whose ToString method return null + /// + public class ToStringReturnsNull + { + public override string ToString() + { + return null; + } + } + +} + diff --git a/Tests/NFUnitTestSystemLib/UnitTestTypeTests.cs b/Tests/NFUnitTestSystemLib/UnitTestTypeTests.cs new file mode 100644 index 00000000..7d5abbb3 --- /dev/null +++ b/Tests/NFUnitTestSystemLib/UnitTestTypeTests.cs @@ -0,0 +1,425 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using System.Reflection; + +namespace NFUnitTestSystemLib +{ + [TestClass] + class UnitTestTypeTests + { + //SystemType Test methods + interface iEmpty { } + + class TestObject1 { } + + class TestObject2 : iEmpty + { + public TestObject2(Int32 i) + { + m_data = (int)i; + } + public int m_data; + class m_subTestObject + { + + } + public void Method1() + { + + } + public Int32 Method2(Int32 I) + { + return I; + } + } + + [TestMethod] + public void Number_ToString_Test() + { + // if the negative number can not be truncated to the range specified it + // will display its full hex value + Assert.Equal("FE", ((sbyte)-2).ToString("x02")); + Assert.Equal("36", ((byte)0x36).ToString("x02")); + Assert.Equal("FF", ((byte)255).ToString("X2")); + Assert.Equal("FFFD", ((short)-3).ToString("x04")); + Assert.Equal("3049", ((ushort)0x3049).ToString("x4")); + Assert.Equal("FC00", ((short)-1024).ToString("x02")); + Assert.Equal("FFFFFFFC", ((int)-4).ToString("x8")); + Assert.Equal("00004494", ((uint)0x4494).ToString("x8")); + Assert.Equal("FFFFFFFC", ((int)-4).ToString("x04")); + Assert.Equal("FFFFFFFFFFFFFFFB", ((long)-5).ToString("x016")); + Assert.Equal("1234567890123456", ((ulong)0x1234567890123456).ToString("x16")); + // you should not be able to truncate the value only leading zeros + Assert.Equal("1234567890123456", ((ulong)0x1234567890123456).ToString("x06")); + Assert.Equal("34567890123456", ((ulong)0x0034567890123456).ToString("x14")); + + string tst = 3210.ToString("D"); + Assert.Equal("3210", tst); + + tst = (-3210).ToString("d"); + Assert.Equal("-3210", tst); + + tst = 3210.ToString("d06"); + Assert.Equal("003210", tst); + + tst = (-3210).ToString("d06"); + Assert.Equal("-003210", tst); + + tst = 3210.ToString("d1"); + Assert.Equal("3210", tst); + + tst = (-3210).ToString("d1"); + Assert.Equal("-3210", tst); + + tst = 3210.ToString("g"); + Assert.Equal("3210", tst); + + tst = (-3210).ToString("g"); + Assert.Equal("-3210", tst); + + Assert.Equal("NaN", ((float)0f / 0f).ToString()); + Assert.Equal("Infinity", ((float)1f / 0f).ToString()); + Assert.Equal("-Infinity", ((float)-1f / 0f).ToString()); + + Assert.Equal("NaN", ((double)0f / 0f).ToString()); + Assert.Equal("Infinity", ((double)1f / 0f).ToString()); + Assert.Equal("-Infinity", ((double)-1f / 0f).ToString()); + } + + [TestMethod] + public void SystemType1_GetTypeNew_Test() + { + Int32 testInt32 = 0; + + Assembly Int32Assm = Assembly.Load("mscorlib"); + + Debug.WriteLine("This tests the Assembly.GetType(String) by passing \"Namespace.Class\""); + Type myType0 = Int32Assm.GetType("System.Int32"); + Debug.WriteLine("The full name is " + myType0.FullName); + Assert.IsType(myType0, testInt32.GetType()); + + Debug.WriteLine("This tests the Type.GetType(String) by passing \"Namespace.Class\""); + Type myType1 = Type.GetType("System.Int32"); + Debug.WriteLine("The full name is " + myType1.FullName); + Assert.IsType(myType1, testInt32.GetType()); + + Debug.WriteLine("This tests the Type.GetType(String) by passing \"Namespace.Class, assembly\""); + Type myType2 = Type.GetType("System.Int32, mscorlib"); + Debug.WriteLine("The full name is " + myType2.FullName); + Assert.IsType(myType2, testInt32.GetType()); + + Debug.WriteLine("This tests the Type.GetType(String) by passing \"Namespace.Class, assembly, Version=\"a.b.c.d\"\""); + string typeName3 = "System.Int32, mscorlib, Version=" + Int32Assm.GetName().Version.ToString(); + Type myType3 = Type.GetType(typeName3); + Debug.WriteLine("The full name is " + myType3.FullName); + Assert.IsType(myType3, testInt32.GetType()); + + + Debug.WriteLine("This tests the Type.GetType() method for nested classes"); + TestObject1 testTestObject1 = new TestObject1(); + Type myType4 = testTestObject1.GetType(); + Debug.WriteLine("The full name is " + myType4.FullName); + Assert.IsType(myType4, Type.GetType("NFUnitTestSystemLib.UnitTestTypeTests+TestObject1")); + + + Debug.WriteLine("Since NoneSuch does not exist in this assembly, "); + Debug.WriteLine("GetType throws a TypeLoadException."); + Assert.Trows(typeof(NullReferenceException), () => + { + Type myType5 = Type.GetType("NoneSuch"); + Debug.WriteLine("The full name is " + myType5.FullName); + }); + } + + [TestMethod] + public void SystemType1_Type_Names_Test() + { + Assembly Int32Assm = Assembly.Load("mscorlib"); + + // types must be the same whereexver they come from + Type myType0 = Int32Assm.GetType("System.Int32"); + Type myType1 = Type.GetType("System.Int32"); + + Assert.IsType(myType0, myType1); + + // names must be compatible and composable + Assert.Equal(myType0.Name, myType1.Name); + + // names must be compatible and composable + Assert.Equal(myType0.FullName, myType1.FullName); + + // assembly must be the same + Assert.True(myType0.Assembly == myType1.Assembly); + + // type must come from assembly it is supposed to come from + Assert.True(Int32Assm == myType0.Assembly); + + // verify that the long name is corrent + string fullAssmName = Int32Assm.FullName; + + Assert.Equal(myType0.AssemblyQualifiedName, (myType0.FullName + ", " + fullAssmName)); + } + + [TestMethod] + public void SystemType2_Assembly_Test() + { + Debug.WriteLine("This tests the Assembly property"); + + //Assigned and manipulated to avoid compiler warning + Int32 testInt32 = -1; + testInt32++; + + Type myType1 = Type.GetType("System.Int32"); + Debug.WriteLine("The full name is " + myType1.Assembly.FullName); + Assert.Equal(myType1.Assembly.FullName, "mscorlib, Version=" + myType1.Assembly.GetName().Version.ToString()); + + TestObject1 testTestObject1 = new TestObject1(); + Type myType2 = testTestObject1.GetType(); + Debug.WriteLine("The full name is " + myType2.Assembly.FullName); + Assert.Equal(myType2.Assembly.FullName, "NFUnitTest, Version=" + myType2.Assembly.GetName().Version.ToString()); + } + + [TestMethod] + public void SystemType3_BaseType_Test() + { + Debug.WriteLine("This tests the BaseType() method"); + + //Assigned and manipulated to avoid compiler warning + Int32 testInt32 = -1; + testInt32++; + Type myType1 = Type.GetType("System.Int32"); + Debug.WriteLine("The full name is " + myType1.FullName); + Assert.IsType(myType1.BaseType, Type.GetType("System.ValueType")); + + TestObject1 testTestObject1 = new TestObject1(); + Type myType2 = testTestObject1.GetType(); + Debug.WriteLine("The full name is " + myType2.FullName); + Assert.IsType(myType2.BaseType, Type.GetType("System.Object")); + } + + [TestMethod] + public void SystemType4_DeclaringType_Test() + { + Debug.WriteLine("This tests the DeclaringType property"); + + //Assigned and manipulated to avoid compiler warning + Int32 testInt32 = -1; + testInt32++; + + Type myType1 = Type.GetType("System.Int32"); + Debug.WriteLine("The full name is " + myType1.FullName); + Assert.True(myType1.DeclaringType == null); + + // As there is no instance of this, the test will fail, commenting it. + //TestObject1 testTestObject1 = new TestObject1(); + //Type myType2 = testTestObject1.GetType(); + //Debug.WriteLine("The full name is " + myType2.FullName); + //Type myType3 = this.GetType(); + //Assert.IsType(myType2.DeclaringType , myType3); + } + + [TestMethod] + public void SystemType5_GetConstructor_Test() + { + Debug.WriteLine("This tests the GetConstructor(Type[]) method"); + TestObject2 testTestObject2 = new TestObject2(5); + Type myType2 = testTestObject2.GetType(); + Debug.WriteLine("The full name is " + myType2.FullName); + Type[] typeOfInt32Arr = new Type[] { Type.GetType("System.Int32") }; + object[] value5Arr = new object[] { 5 }; + TestObject2 testTestObject3 = + (TestObject2)myType2.GetConstructor(typeOfInt32Arr).Invoke(value5Arr); + Assert.Equal(testTestObject2.m_data, testTestObject3.m_data); + } + + [TestMethod] + public void SystemType6_GetElementType_Test() + { + Debug.WriteLine("This tests the GetElementType() method"); + + //Assigned and manipulated to avoid compiler warning + Int32 testInt32 = -1; + testInt32++; + + Type myType1 = Type.GetType("System.Int32"); + Debug.WriteLine("The full name is " + myType1.FullName); + Int32[] int32Arr = new Int32[] { }; + Type int32ArrType = int32Arr.GetType(); + Assert.IsType(myType1, int32ArrType.GetElementType()); + + Assert.True(myType1.GetElementType() == null); + } + + [TestMethod] + public void SystemType7_GetField_Test() + { + Debug.WriteLine("This tests the GetField(String) "); + Debug.WriteLine("and the GetField(String,BindingFlags) methods)"); + Debug.WriteLine("Currently this test fails, see 17246 for more details."); + + Type myType1 = Type.GetType("System.Int32"); + Debug.WriteLine("The full name is " + myType1.FullName); + Assert.True(myType1.GetField("m_data") == null); + + Debug.WriteLine(" TestObject2 type has one data member \"m_data\" of type Int32."); + TestObject2 testTestObject2 = new TestObject2(5); + Type myType2 = testTestObject2.GetType(); + Debug.WriteLine("The full name is " + myType2.FullName); + + Debug.WriteLine(" Check that type of m_data is Int32"); + Assert.IsType(myType2.GetField("m_data", BindingFlags.GetField | + BindingFlags.Public | BindingFlags.Instance).FieldType, myType1); + + Debug.WriteLine(" Check that value in m_data is 5 ( becuase we called new TestObject2(5))"); + Assert.Equal((int)myType2.GetField("m_data", BindingFlags.IgnoreCase | + BindingFlags.GetField | BindingFlags.Public | + BindingFlags.Instance).GetValue(testTestObject2), 5); + + Debug.WriteLine(" Check that m_data is a field"); + Assert.True(myType2.GetField("m_data").MemberType == MemberTypes.Field); + + Debug.WriteLine(" Check that field m_data has Name \"m_data\""); + Assert.Equal(myType2.GetField("m_data").Name, "m_data"); + + Debug.WriteLine(" Check that misspelling of m_data return NULL."); + Assert.True(null == myType2.GetField("data")); + + Debug.WriteLine(" Checks that case misspelling of m_data return NULL if flag BindingFlags.IgnoreCase not specified."); + Assert.True(null == myType2.GetField("m_Data")); + + Debug.WriteLine("Check retrieval with BindingFlags.IgnoreCase. If flag BindingFlags.IgnoreCase is ised, then the case should be ignored. We should get the same type information."); + FieldInfo fInfo_m_Data = myType2.GetField("m_Data", BindingFlags.IgnoreCase | BindingFlags.GetField | BindingFlags.Public | BindingFlags.Instance); + FieldInfo fInfo_m_data = myType2.GetField("m_data"); + Assert.NotNull(fInfo_m_Data); + Assert.NotNull(fInfo_m_data); + Assert.True(fInfo_m_Data.Name.Equals(fInfo_m_data.Name)); + + Debug.WriteLine(" Indirectly set m_data in testTestObject2 to 6 and then check it."); + myType2.GetField("m_data").SetValue(testTestObject2, 6); + Assert.Equal((int)myType2.GetField("m_data").GetValue(testTestObject2), 6); + Assert.Equal(testTestObject2.m_data, 6); + } + + [TestMethod] + public void SystemType8_GetFields_Test() + { + + Debug.WriteLine("This tests the GetFields(String) method"); + Debug.WriteLine("This test must be re-written once BindingFlags is working, "); + Debug.WriteLine("see 17246 for more details."); + + Type myType1 = Type.GetType("System.Int32"); + Debug.WriteLine("The full name is " + myType1.FullName); + Assert.Null(myType1.GetField("m_data")); + TestObject2 testTestObject2 = new TestObject2(5); + Type myType2 = testTestObject2.GetType(); + Debug.WriteLine("The full name is " + myType2.FullName); + Assert.IsType(myType2.GetField("m_data").FieldType, myType1); + Assert.Equal((int)myType2.GetField("m_data").GetValue(testTestObject2), 5); + Assert.True(myType2.GetField("m_data").MemberType == MemberTypes.Field); + Assert.Equal(myType2.GetField("m_data").Name, "m_data"); + myType2.GetField("m_data").SetValue(testTestObject2, 6); + Assert.Equal((int)myType2.GetField("m_data").GetValue(testTestObject2), 6); + } + + [TestMethod] + public void SystemType9_GetInterfaces_Test() + { + Debug.WriteLine("This tests the GetInterfaces() method"); + Debug.WriteLine("This test must be re-written once BindingFlags is working, "); + Debug.WriteLine("see 17246 for more details."); + + Type myType1 = Type.GetType("System.Int32"); + Debug.WriteLine("The full name is " + myType1.FullName); + Assert.Equal(myType1.GetInterfaces().Length, 0); + TestObject2 testTestObject2 = new TestObject2(5); + Type myType2 = testTestObject2.GetType(); + Debug.WriteLine("The full name is " + myType2.FullName); + Type myType3 = + Type.GetType("NFUnitTestSystemLib.UnitTestTypeTests+iEmpty"); + Assert.IsType(myType2.GetInterfaces()[0], myType3); + } + + [TestMethod] + public void SystemType10_GetMethod_Test() + { + Debug.WriteLine("This tests the GetMethod(String) method"); + Debug.WriteLine("This test must be re-written once BindingFlags is working, "); + Debug.WriteLine("see 17246 for more details."); + + Int32 I = 0; + I++; + TestObject2 testTestObject2 = new TestObject2(5); + Type myType2 = testTestObject2.GetType(); + Debug.WriteLine("The full name is " + myType2.FullName); + MethodInfo methodInfo1 = myType2.GetMethod("Method2"); + Assert.Equal(methodInfo1.IsAbstract, false); + Assert.Equal(methodInfo1.IsFinal, false); + Assert.Equal(methodInfo1.IsPublic, true); + Assert.Equal(methodInfo1.IsStatic, false); + Assert.Equal(methodInfo1.IsVirtual, false); + Assert.True(methodInfo1.MemberType == MemberTypes.Method); + Assert.Equal(methodInfo1.Name, "Method2"); + Assert.IsType(methodInfo1.ReturnType, I.GetType()); + Assert.IsType(methodInfo1.DeclaringType, myType2); + Assert.Equal((int)(methodInfo1.Invoke(testTestObject2, new object[] { 1 })), 1); + } + + [TestMethod] + public void SystemType11_GetMethods_Test() + { + Debug.WriteLine("This tests the GetMethods() method"); + Debug.WriteLine("This test must be re-written once BindingFlags is working, "); + Debug.WriteLine("see 17246 for more details."); + + //Assigned and manipulated to avoid compiler warning + Int32 I = 0; + I++; + + TestObject2 testTestObject2 = new TestObject2(5); + Type myType2 = testTestObject2.GetType(); + Debug.WriteLine("The full name is " + myType2.FullName); + MethodInfo[] methodInfoArr1 = myType2.GetMethods(); + MethodInfo methodInfo1 = null; + if (methodInfoArr1[0].Name == "Method2") + { + methodInfo1 = methodInfoArr1[0]; + Debug.WriteLine("Method2 found in position 0"); + } + else if (methodInfoArr1[1].Name == "Method2") + { + methodInfo1 = methodInfoArr1[1]; + Debug.WriteLine("Method2 found in position 1"); + } + Assert.Equal(methodInfo1.IsAbstract, false); + Assert.Equal(methodInfo1.IsFinal, false); + Assert.Equal(methodInfo1.IsPublic, true); + Assert.Equal(methodInfo1.IsStatic, false); + Assert.Equal(methodInfo1.IsVirtual, false); + Assert.True(methodInfo1.MemberType == MemberTypes.Method); + Assert.Equal(methodInfo1.Name, "Method2"); + Assert.IsType(methodInfo1.ReturnType, I.GetType()); + Assert.IsType(methodInfo1.DeclaringType, myType2); + Assert.Equal((int)(methodInfo1.Invoke(testTestObject2, new object[] { 1 })), 1); + } + + [TestMethod] + public void SystemType12_InvokeMember_Test() + { + Debug.WriteLine("This tests the InvokeMember(String,BindingFlags) method"); + Debug.WriteLine("This test must be re-written once BindingFlags is working, "); + Debug.WriteLine("see 17246 for more details."); + //Assigned and manipulated to avoid compiler warning + Int32 I = 0; + I++; + TestObject2 testTestObject2 = new TestObject2(5); + Type myType2 = testTestObject2.GetType(); + Debug.WriteLine("The full name is " + myType2.FullName); + Assert.Equal((int)myType2.InvokeMember("Method2", BindingFlags.Default + | BindingFlags.InvokeMethod, null, testTestObject2, + new object[] { -6 }), -6); + } + + } +} diff --git a/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs b/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs new file mode 100644 index 00000000..255ebf9b --- /dev/null +++ b/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs @@ -0,0 +1,93 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestSystemLib +{ + [TestClass] + class UnitTestWeakReferenceTests + { + //WeakRef Test methods + static bool hasFinalized1 = false; + public class WeakRefClass + { + public int data = 5; + public WeakRefClass() { } + ~WeakRefClass() + { + Debug.WriteLine("Finalized."); + hasFinalized1 = true; + } + void MakeSomeGarbage() + { + // Create objects and release them + // to fill up memory with unused objects. + object junk; + for (int i = 0; i < 10000; i++) + { + junk = new object(); + } + } + } + + [TestMethod] + public void WeakRef1_Test() + { + // 1. Create an object with strong ref + // 2. Create a short weak ref to the onject + // 3. Allow for GC + // 4. Verify & Remove Strong reference + // 5. Allow for GC + // 6. If weak ref surivived verify its data + Debug.WriteLine("Create an object with strong ref"); + WeakRefClass WRC1 = new WeakRefClass(); + + Debug.WriteLine("Create a short weak ref to the onject"); + WeakReference wr = new WeakReference(WRC1); + wr.Target = WRC1; + + Debug.WriteLine("Allow for GC"); + GC.WaitForPendingFinalizers(); + int sleepTime = 1000; + int slept = 0; + while (!hasFinalized1 && slept < sleepTime) + { + System.Threading.Thread.Sleep(10); + slept += 10; + } + Debug.WriteLine("GC took " + slept); + + Assert.False(hasFinalized1); + + Debug.WriteLine("Verify & Remove Strong reference"); + Assert.Equal(((WeakRefClass)wr.Target).data, 5); + WRC1 = null; + Assert.Null(WRC1); + + Debug.WriteLine("Allow for GC"); + // We should force the finalizer somehow + GC.WaitForPendingFinalizers(); + sleepTime = 1000; + slept = 0; + while (!hasFinalized1 && slept < sleepTime) + { + System.Threading.Thread.Sleep(10); + slept += 10; + } + Debug.WriteLine("GC took " + slept); + Assert.True(hasFinalized1); + Assert.Null(WRC1 ); + + if (wr.IsAlive) + { + Assert.Equal(((WeakRefClass)wr.Target).data, 5); + Debug.WriteLine("Weak Reference survived."); + } + else + { + Debug.WriteLine("Weak Reference has been collected"); + } + } + + } +} From 2a1b7d39d7b26bac3ec985cb2f3fe35a4e7de7dd Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 11:13:11 +0300 Subject: [PATCH 26/55] Adding struct tests --- .../NFUnitTestStruct/NFUnitTestStruct.nfproj | 60 + .../Properties/AssemblyInfo.cs | 33 + Tests/NFUnitTestStruct/UnitTestStructs.cs | 1030 +++++++++++++++++ Tests/NFUnitTestStruct/nano.runsettings | 14 + Tests/NFUnitTestStruct/packages.config | 5 + nanoFramework.CoreLibrary.sln | 9 + 6 files changed, 1151 insertions(+) create mode 100644 Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj create mode 100644 Tests/NFUnitTestStruct/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestStruct/UnitTestStructs.cs create mode 100644 Tests/NFUnitTestStruct/nano.runsettings create mode 100644 Tests/NFUnitTestStruct/packages.config diff --git a/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj b/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj new file mode 100644 index 00000000..386ab873 --- /dev/null +++ b/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj @@ -0,0 +1,60 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 77d55d0b-a50f-4caf-8cc5-f15063d9a41e + Library + Properties + 512 + NFUnitTestStruct + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestStruct/Properties/AssemblyInfo.cs b/Tests/NFUnitTestStruct/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestStruct/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestStruct/UnitTestStructs.cs b/Tests/NFUnitTestStruct/UnitTestStructs.cs new file mode 100644 index 00000000..b4cdd633 --- /dev/null +++ b/Tests/NFUnitTestStruct/UnitTestStructs.cs @@ -0,0 +1,1030 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestStruct +{ + [TestClass] + public class UnitTestStructs + { + [TestMethod] + public void Structs01_Test() + { + StructsTestClass_01_Notes.Note(); + Assert.True(StructsTestClass_01.testMethod()); + } + [TestMethod] + public void Structs04_Test() + { + StructsTestClass_04_Notes.Note(); + Assert.True(StructsTestClass_04.testMethod()); + } + [TestMethod] + public void Structs11_Test() + { + StructsTestClass_11_Notes.Note(); + Assert.True(StructsTestClass_11.testMethod()); + } + [TestMethod] + public void Structs12_Test() + { + StructsTestClass_12_Notes.Note(); + Assert.True(StructsTestClass_12.testMethod()); + } + [TestMethod] + public void Structs13_Test() + { + Debug.WriteLine("Expected failure, see 16852 for more details"); + + StructsTestClass_13_Notes.Note(); + Assert.True(StructsTestClass_13.testMethod()); + } + [TestMethod] + public void Structs14_Test() + { + StructsTestClass_14_Notes.Note(); + Assert.True(StructsTestClass_14.testMethod()); + } + [TestMethod] + public void Structs15_Test() + { + StructsTestClass_15_Notes.Note(); + Assert.True(StructsTestClass_15.testMethod()); + } + [TestMethod] + public void Structs19_Test() + { + StructsTestClass_19_Notes.Note(); + Assert.True(StructsTestClass_19.testMethod()); + } + [TestMethod] + public void Structs21_Test() + { + StructsTestClass_21_Notes.Note(); + Assert.True(StructsTestClass_21.testMethod()); + } + [TestMethod] + public void Structs23_Test() + { + StructsTestClass_23_Notes.Note(); + Assert.True(StructsTestClass_23.testMethod()); + } + [TestMethod] + public void Structs24_Test() + { + StructsTestClass_24_Notes.Note(); + Assert.True(StructsTestClass_24.testMethod()); + } + [TestMethod] + public void Structs26_Test() + { + StructsTestClass_26_Notes.Note(); + Assert.True(StructsTestClass_26.testMethod()); + } + [TestMethod] + public void Structs28_Test() + { + StructsTestClass_28_Notes.Note(); + Assert.True(StructsTestClass_28.testMethod()); + } + [TestMethod] + public void Structs29_Test() + { + StructsTestClass_29_Notes.Note(); + Assert.True(StructsTestClass_29.testMethod()); + } + [TestMethod] + public void Structs32_Test() + { + StructsTestClass_32_Notes.Note(); + Assert.True(StructsTestClass_32.testMethod()); + } + [TestMethod] + public void Structs33_Test() + { + StructsTestClass_33_Notes.Note(); + Assert.True(StructsTestClass_33.testMethod()); + } + [TestMethod] + public void Structs34_Test() + { + StructsTestClass_34_Notes.Note(); + Assert.True(StructsTestClass_34.testMethod()); + } + [TestMethod] + public void Structs35_Test() + { + StructsTestClass_35_Notes.Note(); + Assert.True(StructsTestClass_35.testMethod()); + } + [TestMethod] + public void Structs36_Test() + { + StructsTestClass_36_Notes.Note(); + Assert.True(StructsTestClass_36.testMethod()); + } + [TestMethod] + public void Structs37_Test() + { + StructsTestClass_37_Notes.Note(); + Assert.True(StructsTestClass_37.testMethod()); + } + [TestMethod] + public void Structs38_Test() + { + StructsTestClass_38_Notes.Note(); + Assert.True(StructsTestClass_38.testMethod()); + } + [TestMethod] + public void Structs40_Test() + { + StructsTestClass_40_Notes.Note(); + Assert.True(StructsTestClass_40.testMethod()); + } + [TestMethod] + public void Structs41_Test() + { + StructsTestClass_41_Notes.Note(); + Assert.True(StructsTestClass_41.testMethod()); + } + [TestMethod] + public void Structs42_Test() + { + StructsTestClass_42_Notes.Note(); + Assert.True(StructsTestClass_42.testMethod()); + } + [TestMethod] + public void Structs43_Test() + { + StructsTestClass_43_Notes.Note(); + Assert.True(StructsTestClass_43.testMethod()); + } + [TestMethod] + public void Structs44_Test() + { + StructsTestClass_44_Notes.Note(); + Assert.True(StructsTestClass_44.testMethod()); + } + [TestMethod] + public void Structs55_Test() + { + StructsTestClass_55_Notes.Note(); + Assert.True(StructsTestClass_55.testMethod()); + } + + + //Compiled Test Cases + class StructsTestClass_01_Notes + { + public static void Note() + { + Debug.WriteLine(" Declaring a struct with and without a trailing semicolon. "); + } + } + struct StructsTestClass_01_Struct1 + { + public int i; + } + struct StructsTestClass_01_Struct2 + { + public int i; + }; + public class StructsTestClass_01 + { + public static bool testMethod() + { + StructsTestClass_01_Struct1 s1; + StructsTestClass_01_Struct2 s2; + s1.i = 1; + s2.i = 1; + return (0 == (s1.i - s2.i)); + } + + } + class StructsTestClass_04_Notes + { + public static void Note() + { + Debug.WriteLine(" Verify all valid protection levels for members and methods"); + } + } + struct StructsTestClass_04_Struct1 + { + public int pub; + private int priv; + internal int intern; + public int StructsTestClass_04PubPriv() + { + return StructsTestClass_04Priv(); + } + private int StructsTestClass_04Priv() + { + pub = 1; + priv = 2; + return (pub + priv); + } + internal int StructsTestClass_04Intern() + { + intern = 3; + return (intern); + } + public int GetPrivate() + { + return (priv); + } + } + public class StructsTestClass_04 + { + public static bool testMethod() + { + StructsTestClass_04_Struct1 s1 = new StructsTestClass_04_Struct1(); + int result; + result = s1.StructsTestClass_04PubPriv(); + result += s1.StructsTestClass_04Intern(); + result -= s1.intern; + result -= s1.pub; + result -= s1.GetPrivate(); + return (result == 0); + } + + } + class StructsTestClass_11_Notes + { + public static void Note() + { + Debug.WriteLine(" Verify struct can implement an interface."); + } + } + interface Inter1 + { + int Return42(); + } + struct StructsTestClass_11_Struct1 : Inter1 + { + public int Return42() { return (42); } + } + public class StructsTestClass_11 + { + public static bool testMethod() + { + Inter1 i1 = new StructsTestClass_11_Struct1(); + return (0 == (i1.Return42() - 42)); + } + + } + class StructsTestClass_12_Notes + { + public static void Note() + { + Debug.WriteLine(" Verify struct can implement multiple interfaces."); + } + } + interface StructsTestClass_12_Inter1 + { + int Return42(); + } + interface StructsTestClass_12_Inter2 + { + int Return20(); + } + interface StructsTestClass_12_Inter3 + { + int Return22(); + } + struct StructsTestClass_12_Struct1 : StructsTestClass_12_Inter1, StructsTestClass_12_Inter2, StructsTestClass_12_Inter3 + { + public int Return42() { return (42); } + public int Return20() { return (20); } + public int Return22() { return (22); } + } + public class StructsTestClass_12 + { + public static bool testMethod() + { + StructsTestClass_12_Inter1 i1 = new StructsTestClass_12_Struct1(); + return (0 == (i1.Return42() - ((StructsTestClass_12_Inter2)i1).Return20() - ((StructsTestClass_12_Inter3)i1).Return22())); + } + + } + class StructsTestClass_13_Notes + { + public static void Note() + { + Debug.WriteLine(" Verify struct can implement multiple interfaces that contain methods with identical signatures."); + } + } + interface StructsTestClass_13_Inter1 + { + int Return42(); + } + interface StructsTestClass_13_Inter2 + { + int Return42(); + } + interface StructsTestClass_13_Inter3 + { + int Return0(); + } + struct StructsTestClass_13_Struct1 : StructsTestClass_13_Inter1, StructsTestClass_13_Inter2, StructsTestClass_13_Inter3 + { + int StructsTestClass_13_Inter1.Return42() { return (42); } + int StructsTestClass_13_Inter2.Return42() { return (42); } + int StructsTestClass_13_Inter3.Return0() { return (0); } + } + public class StructsTestClass_13 + { + public static int Main_old() + { + StructsTestClass_13_Inter1 i1 = new StructsTestClass_13_Struct1(); + return (i1.Return42() - ((StructsTestClass_13_Inter2)i1).Return42() - ((StructsTestClass_13_Inter3)i1).Return0()); + } + public static bool testMethod() + { + try + { + return (Main_old() == 0); + } + catch + { + return false; + } + } + } + class StructsTestClass_14_Notes + { + public static void Note() + { + Debug.WriteLine(" Verify that a struct can contain a class"); + } + } + class StructsTestClass_14_Class1 + { + }; + struct StructsTestClass_14_Struct1 + { + public StructsTestClass_14_Class1 c; + } + public class StructsTestClass_14 + { + public static int Main_old() + { + StructsTestClass_14_Struct1 s1 = new StructsTestClass_14_Struct1(); + int result = s1.c == null ? 0 : 1; + return (result); + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class StructsTestClass_15_Notes + { + public static void Note() + { + Debug.WriteLine(" Verify that a struct can contain another sruct"); + } + } + struct StructsTestClass_15_Struct1 + { + public int i; + }; + struct StructsTestClass_15_Struct2 + { + public StructsTestClass_15_Struct1 s; + public int i; + } + public class StructsTestClass_15 + { + public static int Main_old() + { + StructsTestClass_15_Struct2 s2 = new StructsTestClass_15_Struct2(); + return (s2.s.i); + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class StructsTestClass_19_Notes + { + public static void Note() + { + Debug.WriteLine("Attempt to use an empty StructsTestClass_19_Struct"); + } + } + struct StructsTestClass_19_Struct1 + { + } + public class StructsTestClass_19 + { + public static int Main_old() + { + StructsTestClass_19_Struct1 s = new StructsTestClass_19_Struct1(); + return (0); + } + public static bool testMethod() + { + return (Main_old() == 0); + } + + } + + class StructsTestClass_21_Notes + { + public static void Note() + { + Debug.WriteLine("attempt to return a struct"); + } + } + public struct StructsTestClass_21_Struct1 + { + int a; + public void Set(int val) { a = val; } + public int Get() { return (a); } + } + public class StructsTestClass_21 + { + public static int Main_old() + { + if (callQuick().Get() != 0) + return (1); + return (call().Get() - 42); + } + public static bool testMethod() + { + return (Main_old() == 0); + } + public static StructsTestClass_21_Struct1 callQuick() + { + return (new StructsTestClass_21_Struct1()); + } + public static StructsTestClass_21_Struct1 call() + { + StructsTestClass_21_Struct1 s = new StructsTestClass_21_Struct1(); + s.Set(42); + return (s); + } + } + class StructsTestClass_23_Notes + { + public static void Note() + { + Debug.WriteLine("struct like an object"); + } + } + struct StructsTestClass_23_Struct1 + { + public int i; + } + public class StructsTestClass_23 + { + public static int Main_old() + { + StructsTestClass_23_Struct1 s = new StructsTestClass_23_Struct1(); + s.i = 42; + return (0); + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + class StructsTestClass_24_Notes + { + public static void Note() + { + Debug.WriteLine(" struct values aren't changed when boxed and passed as interfaces."); + } + } + public interface Interface1 + { + void SetInt(int val); + int GetInt(); + }; + public struct StructsTestClass_24_Struct1 : Interface1 + { + public int i; + public void SetInt(int val) { i = val; } + public int GetInt() { return (i); } + } + public class StructsTestClass_24 + { + public static int Main_old() + { + StructsTestClass_24_Struct1 s = new StructsTestClass_24_Struct1(); + s.i = 42; + Call(s); + return (s.i == 42 ? 0 : 1); + } + public static void Call(Interface1 iface) + { + if (iface.GetInt() != 42) + { + throw new System.Exception(); + throw new System.Exception("expected i == 42"); + } + iface.SetInt(99); + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + class StructsTestClass_26_Notes + { + public static void Note() + { + Debug.WriteLine(" StructsTestClass_26_A ttempt to make a parameterized conStructsTestClass_26_Structor for a StructsTestClass_?_Struct."); + } + } + struct StructsTestClass_26_Struct1 + { + public StructsTestClass_26_Struct1(int j) { i = j; } + public int i; + } + public class StructsTestClass_26 + { + public static int Main_old() + { + StructsTestClass_26_Struct1 s = new StructsTestClass_26_Struct1(42); + return (s.i - 42); + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class StructsTestClass_28_Notes + { + public static void Note() + { + Debug.WriteLine(" Explicit test of object boxing conversions to and from a StructsTestClass_28_Struct."); + } + } + struct StructsTestClass_28_Struct1 + { + public int i; + } + public class StructsTestClass_28 + { + static public int Main_old() + { + StructsTestClass_28_Struct1 s1 = new StructsTestClass_28_Struct1(); + Object converter = s1; + StructsTestClass_28_Struct1 s2 = (StructsTestClass_28_Struct1)converter; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class StructsTestClass_29_Notes + { + public static void Note() + { + Debug.WriteLine(" StructsTestClass_29 conStructsTestClass_29_Structor forwarding works for StructsTestClass_?_Structs"); + } + } + struct Foo + { + public Foo(int x) : this(5, 6) + { + } + public Foo(int x, int y) + { + m_x = x; + m_y = y; + } + public int m_x; + public int m_y; + } + public class StructsTestClass_29 + { + static public int Main_old() + { + Foo s1 = new Foo(1); + if (s1.m_x != 5) + return (1); + if (s1.m_y != 6) + return (1); + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class StructsTestClass_32_Notes + { + public static void Note() + { + Debug.WriteLine(" nested struct should work"); + } + } + public struct StructsTestClass_32_Struct + { + public struct Nested + { + public int i; + } + public Nested n; + } + public class StructsTestClass_32 + { + public static bool testMethod() + { + StructsTestClass_32_Struct s = new StructsTestClass_32_Struct(); + StructsTestClass_32_Struct.Nested nn = new StructsTestClass_32_Struct.Nested(); + nn.i = 10; + s.n = nn; //value copy + + if (s.n.i == nn.i) + return true; + else + return false; + } + } + class StructsTestClass_33_Notes + { + public static void Note() + { + Debug.WriteLine(" nested class inside struct should work"); + } + } + public struct StructsTestClass_33_Struct + { + public class Nested + { + public int i; + } + public Nested n; + } + public class StructsTestClass_33 + { + public static bool testMethod() + { + StructsTestClass_33_Struct s = new StructsTestClass_33_Struct(); + StructsTestClass_33_Struct.Nested nn = new StructsTestClass_33_Struct.Nested(); + nn.i = 10; + s.n = nn; //value copy + + if (s.n.i == nn.i) + return true; + else + return false; + } + } + class StructsTestClass_34_Notes + { + public static void Note() + { + Debug.WriteLine(" nested struct should work"); + } + } + public struct StructsTestClass_34_Struct + { + public struct Nested + { + public struct NestedNested + { + public int i; + } + public int i; //in different scope + } + public Nested n; + } + public class StructsTestClass_34 + { + public static bool testMethod() + { + StructsTestClass_34_Struct s = new StructsTestClass_34_Struct(); + StructsTestClass_34_Struct.Nested nn = new StructsTestClass_34_Struct.Nested(); + nn.i = 10; + s.n = nn; //value copy + + StructsTestClass_34_Struct.Nested.NestedNested nnn = new StructsTestClass_34_Struct.Nested.NestedNested(); + + if (s.n.i != nn.i) + return false; + nnn.i = 20; + s.n.i = nnn.i; + if (nn.i == 10 && s.n.i == nnn.i)//check nn.i did not changed + return true; + else + return false; + } + } + class StructsTestClass_35_Notes + { + public static void Note() + { + Debug.WriteLine(" cast struct to inherited interface type"); + } + } + public interface StructsTestClass_35_Interface + { + int foo(); + } + public struct StructsTestClass_35_A : StructsTestClass_35_Interface + { + public int foo() + { + return 10; + } + } + public class StructsTestClass_35 + { + public static bool testMethod() + { + StructsTestClass_35_Interface a = new StructsTestClass_35_A(); + + if (a.foo() != 10) + return false; + else + return true; + } + } + class StructsTestClass_36_Notes + { + public static void Note() + { + Debug.WriteLine(" cast struct to inherited interface type"); + } + } + public interface StructsTestClass_36_Interface + { + int foo(); + } + public struct StructsTestClass_36_A : StructsTestClass_36_Interface + { + public int foo() + { + return 10; + } + } + public class StructsTestClass_36 + { + public static bool testMethod() + { + StructsTestClass_36_Interface a = new StructsTestClass_36_A(); + + if (a.foo() != 10) + return false; + else + return true; + } + } + class StructsTestClass_37_Notes + { + public static void Note() + { + Debug.WriteLine(" cast struct to inherited interface type"); + } + } + public interface StructsTestClass_37_Interface + { + int foo(); + } + public struct StructsTestClass_37_A : StructsTestClass_37_Interface + { + public int foo() + { + return 10; + } + } + public class StructsTestClass_37 + { + public static bool testMethod() + { + StructsTestClass_37_A a = new StructsTestClass_37_A(); + object o = a; //boxing + bool b = o is StructsTestClass_37_Interface; + + if (!b) + return false; + if ((a as StructsTestClass_37_Interface) == null) + return false; + if (a.foo() != 10) + return false; + else + return true; + } + } + class StructsTestClass_38_Notes + { + public static void Note() + { + Debug.WriteLine(" cast struct to inherited interface type through function"); + } + } + public interface StructsTestClass_38_Interface + { + int foo(); + } + public struct StructsTestClass_38_A : StructsTestClass_38_Interface + { + public StructsTestClass_38_Interface GetI() + { + this.i = 10; + return this; + } + public int foo() + { + return i; + } + public int i; + } + public class StructsTestClass_38 + { + public static bool testMethod() + { + StructsTestClass_38_A a = new StructsTestClass_38_A(); + object o = a; //boxing + bool b = o is StructsTestClass_38_Interface; + + if (!b) + return false; + if ((a as StructsTestClass_38_Interface) == null) + return false; + if (a.GetI().foo() != 10) + return false; + else + return true; + } + } + class StructsTestClass_40_Notes + { + public static void Note() + { + Debug.WriteLine(" property in struct"); + } + } + public struct StructsTestClass_40_Struct + { + public int Foo + { + get + { + return 10; + } + } + } + public class StructsTestClass_40 + { + public static bool testMethod() + { + StructsTestClass_40_Struct a = new StructsTestClass_40_Struct(); + if (a.Foo == 10) + return true; + else + return false; + } + } + class StructsTestClass_41_Notes + { + public static void Note() + { + Debug.WriteLine(" indexer in struct"); + } + } + public struct StructsTestClass_41_Struct + { + public int this[int index] + { + get + { + return index; + } + } + } + public class StructsTestClass_41 + { + public static bool testMethod() + { + StructsTestClass_41_Struct a = new StructsTestClass_41_Struct(); + if (a[10] == 10) + return true; + else + return false; + } + } + class StructsTestClass_42_Notes + { + public static void Note() + { + Debug.WriteLine(" interface indexer in StructsTestClass_42_Struct"); + } + } + public interface StructsTestClass_42_Interface + { + int this[int index] { get; } + } + public struct StructsTestClass_42_A : StructsTestClass_42_Interface + { + public int this[int index] + { + get + { + return index; + } + } + } + public class StructsTestClass_42 + { + public static bool testMethod() + { + StructsTestClass_42_Interface a = new StructsTestClass_42_A(); + if (a[10] == 10) + return true; + else + return false; + } + } + class StructsTestClass_43_Notes + { + public static void Note() + { + Debug.WriteLine(" delegate in struct"); + } + } + public struct StructsTestClass_43_Struct + { + public delegate int foo(); + public int boo() + { + return 10; + } + } + public class StructsTestClass_43 + { + public static bool testMethod() + { + StructsTestClass_43_Struct a = new StructsTestClass_43_Struct(); + StructsTestClass_43_Struct.foo d = new StructsTestClass_43_Struct.foo(a.boo); + if (d() == 10) + return true; + else + return false; + } + } + class StructsTestClass_44_Notes + { + public static void Note() + { + Debug.WriteLine(" delegate in struct assing interface as a delegate argument"); + } + } + public interface StructsTestClass_44_Interface + { + int boo(); + } + public struct StructsTestClass_44_A : StructsTestClass_44_Interface + { + public delegate int foo(); + public int boo() + { + return 10; + } + } + public class StructsTestClass_44 + { + public static bool testMethod() + { + StructsTestClass_44_Interface a = new StructsTestClass_44_A(); + StructsTestClass_44_A.foo d = new StructsTestClass_44_A.foo(a.boo); + if (d() == 10) + return true; + else + return false; + } + } + class StructsTestClass_55_Notes + { + public static void Note() + { + Debug.WriteLine("The this object cannot be used before all of its fields are assigned to"); + } + } + public struct StructsTestClass_55 + { + public int i; + static void foo() { } + StructsTestClass_55(int i) + { + this.i = i; + foo(); + } + + public static bool testMethod() + { + StructsTestClass_55 s = new StructsTestClass_55(101); + return (0 == s.i - 101); + } + } + + + } +} diff --git a/Tests/NFUnitTestStruct/nano.runsettings b/Tests/NFUnitTestStruct/nano.runsettings new file mode 100644 index 00000000..fa881e3a --- /dev/null +++ b/Tests/NFUnitTestStruct/nano.runsettings @@ -0,0 +1,14 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + False + + \ No newline at end of file diff --git a/Tests/NFUnitTestStruct/packages.config b/Tests/NFUnitTestStruct/packages.config new file mode 100644 index 00000000..1adb9284 --- /dev/null +++ b/Tests/NFUnitTestStruct/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 59b4bd82..14b99158 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -27,6 +27,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestThread", "Tests\N EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestSystemLib", "Tests\NFUnitTestSystemLib\NFUnitTestSystemLib.nfproj", "{E63A23A8-5335-4976-BA47-0AC7F1AEDD32}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestStruct", "Tests\NFUnitTestStruct\NFUnitTestStruct.nfproj", "{77D55D0B-A50F-4CAF-8CC5-F15063D9A41E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -71,6 +73,12 @@ Global {E63A23A8-5335-4976-BA47-0AC7F1AEDD32}.Release|Any CPU.ActiveCfg = Release|Any CPU {E63A23A8-5335-4976-BA47-0AC7F1AEDD32}.Release|Any CPU.Build.0 = Release|Any CPU {E63A23A8-5335-4976-BA47-0AC7F1AEDD32}.Release|Any CPU.Deploy.0 = Release|Any CPU + {77D55D0B-A50F-4CAF-8CC5-F15063D9A41E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {77D55D0B-A50F-4CAF-8CC5-F15063D9A41E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {77D55D0B-A50F-4CAF-8CC5-F15063D9A41E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {77D55D0B-A50F-4CAF-8CC5-F15063D9A41E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {77D55D0B-A50F-4CAF-8CC5-F15063D9A41E}.Release|Any CPU.Build.0 = Release|Any CPU + {77D55D0B-A50F-4CAF-8CC5-F15063D9A41E}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -81,6 +89,7 @@ Global {05B18D3A-F70D-4104-8F78-FDC577E11081} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {BDBFD5E3-46C4-4ACD-B66C-60F00618FD91} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {E63A23A8-5335-4976-BA47-0AC7F1AEDD32} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {77D55D0B-A50F-4CAF-8CC5-F15063D9A41E} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From 680e14b4198167f7db6de9f64faa6caee5da75ff Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 11:56:08 +0300 Subject: [PATCH 27/55] Adding statements --- .../NFUnitTestStatementsTests.nfproj | 60 + .../Properties/AssemblyInfo.cs | 33 + .../UnitTestStatementTests.cs | 5062 +++++++++++++++++ .../nano.runsettings | 13 + .../NFUnitTestStatementsTests/packages.config | 5 + nanoFramework.CoreLibrary.sln | 9 + 6 files changed, 5182 insertions(+) create mode 100644 Tests/NFUnitTestStatementsTests/NFUnitTestStatementsTests.nfproj create mode 100644 Tests/NFUnitTestStatementsTests/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestStatementsTests/UnitTestStatementTests.cs create mode 100644 Tests/NFUnitTestStatementsTests/nano.runsettings create mode 100644 Tests/NFUnitTestStatementsTests/packages.config diff --git a/Tests/NFUnitTestStatementsTests/NFUnitTestStatementsTests.nfproj b/Tests/NFUnitTestStatementsTests/NFUnitTestStatementsTests.nfproj new file mode 100644 index 00000000..d27feeda --- /dev/null +++ b/Tests/NFUnitTestStatementsTests/NFUnitTestStatementsTests.nfproj @@ -0,0 +1,60 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 222d8571-6646-47e4-95a5-8aed732dcb70 + Library + Properties + 512 + NFUnitTestStatementsTests + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/Properties/AssemblyInfo.cs b/Tests/NFUnitTestStatementsTests/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestStatementsTests/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestStatementsTests/UnitTestStatementTests.cs b/Tests/NFUnitTestStatementsTests/UnitTestStatementTests.cs new file mode 100644 index 00000000..e7091b15 --- /dev/null +++ b/Tests/NFUnitTestStatementsTests/UnitTestStatementTests.cs @@ -0,0 +1,5062 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestStatementsTests +{ + [TestClass] + public class UnitTestStatementTests + { + [TestMethod] + public void Statements_Label_001_Test() + { + Debug.WriteLine("Label_001.sc"); + Debug.WriteLine("Make sure labels can be declared"); + Assert.True(Statements_TestClass_Label_001.testMethod()); + } + + [TestMethod] + public void Statements_Label_002_Test() + { + Debug.WriteLine("Label_002.sc"); + Debug.WriteLine("Make sure labels can be referenced. Assumes 'goto'"); + Assert.True(Statements_TestClass_Label_002.testMethod()); + } + + [TestMethod] + public void Statements_Label_004_Test() + { + Debug.WriteLine("Label_004.sc"); + Debug.WriteLine("Make sure labels can be associated with an empty statement"); + Assert.True(Statements_TestClass_Label_004.testMethod()); + } + + [TestMethod] + public void Statements_Decl_001_Test() + { + Debug.WriteLine("Decl_001.sc"); + Debug.WriteLine("Declare a local variable of an intrinsic type"); + Assert.True(Statements_TestClass_Decl_001.testMethod()); + } + + [TestMethod] + public void Statements_Decl_002_Test() + { + Debug.WriteLine("Decl_002.sc"); + Debug.WriteLine("Declare a local variable of an intrinsic type and initialize it"); + Assert.True(Statements_TestClass_Decl_002.testMethod()); + } + + [TestMethod] + public void Statements_Decl_003_Test() + { + Debug.WriteLine("Decl_003.sc"); + Debug.WriteLine("Declare a local variable of an intrinsic type and initialize it"); + Debug.WriteLine("with an expression."); + Assert.True(Statements_TestClass_Decl_003.testMethod()); + } + + [TestMethod] + public void Statements_Decl_004_Test() + { + Debug.WriteLine("Decl_004.sc"); + Debug.WriteLine("Declare a local variable of an external object type"); + Assert.True(Statements_TestClass_Decl_004.testMethod()); + } + + [TestMethod] + public void Statements_Decl_007_Test() + { + Debug.WriteLine("Decl_007.sc"); + Debug.WriteLine("Declare a series of local variables of an intrinsic type with commas"); + Assert.True(Statements_TestClass_Decl_007.testMethod()); + } + + [TestMethod] + public void Statements_Decl_009_Test() + { + Debug.WriteLine("Decl_009.sc"); + Debug.WriteLine("Declare a series of local variables of an intrinsic type with commas and"); + Debug.WriteLine("initial assignments."); + Assert.True(Statements_TestClass_Decl_009.testMethod()); + } + + [TestMethod] + public void Statements_Decl_010_Test() + { + Debug.WriteLine("Decl_010.sc"); + Debug.WriteLine("Declare a local variable of an intrinsic type as an array"); + Assert.True(Statements_TestClass_Decl_010.testMethod()); + } + + [TestMethod] + public void Statements_Decl_012_Test() + { + Debug.WriteLine("Decl_012.sc"); + Debug.WriteLine("Declare a local variable of an intrinsic type as an array, allocate and reference it."); + Assert.True(Statements_TestClass_Decl_012.testMethod()); + } + + [TestMethod] + public void Statements_Decl_014_Test() + { + Debug.WriteLine("Decl_014.sc"); + Debug.WriteLine("Declare a local variable of an intrinsic type as an initialized array"); + Assert.True(Statements_TestClass_Decl_014.testMethod()); + } + + [TestMethod] + public void Statements_Decl_016_Test() + { + Debug.WriteLine("Decl_016.sc"); + Debug.WriteLine("Correctly declare a local variable of a type that has no default constructor"); + Debug.WriteLine("as an array."); + Assert.True(Statements_TestClass_Decl_016.testMethod()); + } + + [TestMethod] + public void Statements_Block_001_Test() + { + Debug.WriteLine("Block_001.sc"); + Debug.WriteLine("Statements_TestClass_? Several types of statement blocks. Statement blocks"); + Debug.WriteLine("are so fundamental, that most can be tested in one pass."); + Debug.WriteLine("Note that by the nature of this code, many warnings"); + Debug.WriteLine("could/should be generated about items that are never reached."); + Assert.True(Statements_TestClass_Block_001.testMethod()); + } + + [TestMethod] + public void Statements_Empty_001_Test() + { + Debug.WriteLine("Empty_001.sc"); + Debug.WriteLine("Statements_TestClass_? Several scenarios for empty statement. Emtpy statements"); + Debug.WriteLine("are so fundamental, that most can be tested in one pass."); + Debug.WriteLine("Note that by the nature of this code, many warnings"); + Debug.WriteLine("could/should be generated about items that are never reached."); + Assert.True(Statements_TestClass_Empty_001.testMethod()); + } + + [TestMethod] + public void Statements_Expr_002_Test() + { + Debug.WriteLine("Expr_002.sc"); + Debug.WriteLine("Use an expression with side effects."); + Assert.True(Statements_TestClass_Expr_002.testMethod()); + } + + [TestMethod] + public void Statements_Expr_003_Test() + { + Debug.WriteLine("Expr_003.sc"); + Debug.WriteLine("Use an expression with side effects and multiple l-values."); + Assert.True(Statements_TestClass_Expr_003.testMethod()); + } + + [TestMethod] + public void Statements_Expr_004_Test() + { + Debug.WriteLine("Expr_004.sc"); + Debug.WriteLine("Run a quick test of common operator/assignment combos"); + Assert.True(Statements_TestClass_Expr_004.testMethod()); + } + + [TestMethod] + public void Statements_Expr_006_Test() + { + Debug.WriteLine(" complex assignment"); + Assert.True(Statements_TestClass_Expr_006.testMethod()); + } + + [TestMethod] + public void Statements_if_001_Test() + { + Debug.WriteLine("if_001.sc"); + Debug.WriteLine("Simple boolean if with a single statement"); + Assert.True(Statements_TestClass_if_001.testMethod()); + } + + [TestMethod] + public void Statements_if_003_Test() + { + Debug.WriteLine("if_003.sc"); + Debug.WriteLine("Simple boolean if with a block statement"); + Assert.True(Statements_TestClass_if_003.testMethod()); + } + + [TestMethod] + public void Statements_if_005_Test() + { + Debug.WriteLine("if_005.sc"); + Debug.WriteLine("Simple boolean if with a single statement and else"); + Assert.True(Statements_TestClass_if_005.testMethod()); + } + + [TestMethod] + public void Statements_if_007_Test() + { + Debug.WriteLine("if_007.sc"); + Debug.WriteLine("Simple boolean if with a block statement"); + Assert.True(Statements_TestClass_if_007.testMethod()); + } + + [TestMethod] + public void Statements_if_009_Test() + { + Debug.WriteLine("if_009.sc"); + Debug.WriteLine("Nest ifs with elses without blocks. Statements_TestClass_? that the 'else' ambiguity from"); + Debug.WriteLine("C/C++ is handled the same way (else bound to closest if)"); + Assert.True(Statements_TestClass_if_009.testMethod()); + } + + [TestMethod] + public void Statements_switch_001_Test() + { + Debug.WriteLine("switch_001.sc"); + Debug.WriteLine("Empty switch"); + Assert.True(Statements_TestClass_switch_001.testMethod()); + } + + [TestMethod] + public void Statements_switch_002_Test() + { + Debug.WriteLine("switch_002.sc"); + Debug.WriteLine("Default only switch"); + Assert.True(Statements_TestClass_switch_002.testMethod()); + } + + [TestMethod] + public void Statements_switch_003_Test() + { + Debug.WriteLine("switch_003.sc"); + Debug.WriteLine("Switch with single case without break - no default"); + Assert.True(Statements_TestClass_switch_003.testMethod()); + } + + [TestMethod] + public void Statements_switch_004_Test() + { + Debug.WriteLine("switch_004.sc"); + Debug.WriteLine("Switch with one case, using break"); + Assert.True(Statements_TestClass_switch_004.testMethod()); + } + + [TestMethod] + public void Statements_switch_005_Test() + { + Debug.WriteLine("switch_005.sc"); + Debug.WriteLine("Switch with two cases, using break"); + Assert.True(Statements_TestClass_switch_005.testMethod()); + } + + [TestMethod] + public void Statements_switch_006_Test() + { + Debug.WriteLine("switch_006.sc"); + Debug.WriteLine("Switch with one case and a default"); + Assert.True(Statements_TestClass_switch_006.testMethod()); + } + + [TestMethod] + public void Statements_switch_007_Test() + { + Debug.WriteLine("switch_007.sc"); + Debug.WriteLine("Switch with two cases and a default"); + Assert.True(Statements_TestClass_switch_007.testMethod()); + } + + [TestMethod] + public void Statements_switch_010_Test() + { + Debug.WriteLine("switch_010.sc"); + Debug.WriteLine("Switch with a const variable in a case"); + Assert.True(Statements_TestClass_switch_010.testMethod()); + } + + [TestMethod] + public void Statements_switch_012_Test() + { + Debug.WriteLine("switch_012.sc"); + Debug.WriteLine("Multiple case labels"); + Assert.True(Statements_TestClass_switch_012.testMethod()); + } + + [TestMethod] + public void Statements_switch_013_Test() + { + Debug.WriteLine("switch_013.sc"); + Debug.WriteLine("test goto all over"); + Debug.WriteLine("Expected Output"); + Assert.True(Statements_TestClass_switch_013.testMethod()); + } + + [TestMethod] + public void Statements_switch_015_Test() + { + Debug.WriteLine("switch_015.sc"); + Debug.WriteLine("Run a switch over a specific type: byte"); + Assert.True(Statements_TestClass_switch_015.testMethod()); + } + + [TestMethod] + public void Statements_switch_016_Test() + { + Debug.WriteLine("switch_016.sc"); + Debug.WriteLine("Run a switch over a specific type: char"); + Assert.True(Statements_TestClass_switch_016.testMethod()); + } + + [TestMethod] + public void Statements_switch_017_Test() + { + Debug.WriteLine("switch_017.sc"); + Debug.WriteLine("Run a switch over a specific type: short"); + Assert.True(Statements_TestClass_switch_017.testMethod()); + } + + [TestMethod] + public void Statements_switch_018_Test() + { + Debug.WriteLine("switch_018.sc"); + Debug.WriteLine("Run a switch over a specific type: int"); + Assert.True(Statements_TestClass_switch_018.testMethod()); + } + + [TestMethod] + public void Statements_switch_019_Test() + { + Debug.WriteLine("switch_019.sc"); + Debug.WriteLine("Run a switch over a specific type: long"); + Assert.True(Statements_TestClass_switch_019.testMethod()); + } + + [TestMethod] + public void Statements_switch_023_Test() + { + Debug.WriteLine("switch_023.sc"); + Debug.WriteLine("Run a switch over a specific type: enum"); + Assert.True(Statements_TestClass_switch_023.testMethod()); + } + + [TestMethod] + public void Statements_switch_030_Test() + { + Debug.WriteLine(" switch on int variable, float case"); + Assert.True(Statements_TestClass_switch_030.testMethod()); + } + + [TestMethod] + public void Statements_switch_031_Test() + { + Debug.WriteLine(" switch with holes in range"); + Assert.True(Statements_TestClass_switch_031.testMethod()); + } + + [TestMethod] + public void Statements_switch_032_Test() + { + Debug.WriteLine(" switch: default case at top"); + Assert.True(Statements_TestClass_switch_032.testMethod()); + } + + [TestMethod] + public void Statements_switch_033_Test() + { + Debug.WriteLine(" switch: default case in middle"); + Assert.True(Statements_TestClass_switch_033.testMethod()); + } + + [TestMethod] + public void Statements_switch_034_Test() + { + Debug.WriteLine(" switch: default case in middle"); + Assert.True(Statements_TestClass_switch_034.testMethod()); + } + + [TestMethod] + public void Statements_switch_035_Test() + { + Debug.WriteLine("Otherwise, exactly one user-defined implicit conversion (�6.4) must exist from the type of "); + Debug.WriteLine("the switch expression to one of the following possible governing types: sbyte, byte, short,"); + Debug.WriteLine("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if "); + Debug.WriteLine("more than one such implicit conversion exists, a compile-time error occurs."); + Assert.True(Statements_TestClass_switch_035.testMethod()); + } + + [TestMethod] + public void Statements_switch_036_Test() + { + Debug.WriteLine("Otherwise, exactly one user-defined implicit conversion (�6.4) must exist from the type of "); + Debug.WriteLine("the switch expression to one of the following possible governing types: sbyte, byte, short,"); + Debug.WriteLine("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if "); + Debug.WriteLine("more than one such implicit conversion exists, a compile-time error occurs."); + Assert.True(Statements_TestClass_switch_036.testMethod()); + } + + [TestMethod] + public void Statements_switch_037_Test() + { + Debug.WriteLine("Otherwise, exactly one user-defined implicit conversion (�6.4) must exist from the type of "); + Debug.WriteLine("the switch expression to one of the following possible governing types: sbyte, byte, short,"); + Debug.WriteLine("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if "); + Debug.WriteLine("more than one such implicit conversion exists, a compile-time error occurs."); + Assert.True(Statements_TestClass_switch_037.testMethod()); + } + + [TestMethod] + public void Statements_switch_038_Test() + { + Debug.WriteLine("Otherwise, exactly one user-defined implicit conversion (�6.4) must exist from the type of "); + Debug.WriteLine("the switch expression to one of the following possible governing types: sbyte, byte, short,"); + Debug.WriteLine("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if "); + Debug.WriteLine("more than one such implicit conversion exists, a compile-time error occurs."); + Assert.True(Statements_TestClass_switch_038.testMethod()); + } + + [TestMethod] + public void Statements_switch_039_Test() + { + Debug.WriteLine("Otherwise, exactly one user-defined implicit conversion (�6.4) must exist from the type of "); + Debug.WriteLine("the switch expression to one of the following possible governing types: sbyte, byte, short,"); + Debug.WriteLine("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if "); + Debug.WriteLine("more than one such implicit conversion exists, a compile-time error occurs."); + Assert.True(Statements_TestClass_switch_039.testMethod()); + } + + [TestMethod] + public void Statements_switch_040_Test() + { + Debug.WriteLine("Otherwise, exactly one user-defined implicit conversion (�6.4) must exist from the type of "); + Debug.WriteLine("the switch expression to one of the following possible governing types: sbyte, byte, short,"); + Debug.WriteLine("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if "); + Debug.WriteLine("more than one such implicit conversion exists, a compile-time error occurs."); + Assert.True(Statements_TestClass_switch_040.testMethod()); + } + + [TestMethod] + public void Statements_switch_041_Test() + { + Debug.WriteLine("Otherwise, exactly one user-defined implicit conversion (�6.4) must exist from the type of "); + Debug.WriteLine("the switch expression to one of the following possible governing types: sbyte, byte, short,"); + Debug.WriteLine("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if "); + Debug.WriteLine("more than one such implicit conversion exists, a compile-time error occurs."); + Assert.True(Statements_TestClass_switch_041.testMethod()); + } + + [TestMethod] + public void Statements_switch_042_Test() + { + Debug.WriteLine("Otherwise, exactly one user-defined implicit conversion (�6.4) must exist from the type of "); + Debug.WriteLine("the switch expression to one of the following possible governing types: sbyte, byte, short,"); + Debug.WriteLine("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if "); + Debug.WriteLine("more than one such implicit conversion exists, a compile-time error occurs."); + Assert.True(Statements_TestClass_switch_042.testMethod()); + } + + [TestMethod] + public void Statements_switch_044_Test() + { + Debug.WriteLine("Otherwise, exactly one user-defined implicit conversion (�6.4) must exist from the type of "); + Debug.WriteLine("the switch expression to one of the following possible governing types: sbyte, byte, short,"); + Debug.WriteLine("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if "); + Debug.WriteLine("more than one such implicit conversion exists, a compile-time error occurs."); + Assert.True(Statements_TestClass_switch_044.testMethod()); + } + + [TestMethod] + public void Statements_switch_047_Test() + { + Debug.WriteLine("Otherwise, exactly one user-defined implicit conversion (�6.4) must exist from the type of "); + Debug.WriteLine("the switch expression to one of the following possible governing types: sbyte, byte, short,"); + Debug.WriteLine("ushort, int, uint, long, ulong, char, string. If no such implicit conversion exists, or if "); + Debug.WriteLine("more than one such implicit conversion exists, a compile-time error occurs."); + Debug.WriteLine("Ensure error is emmited on when more than one implicit conversion to an acceptable governing type is defined"); + Assert.True(Statements_TestClass_switch_047.testMethod()); + } + + [TestMethod] + public void Statements_switch_049_Test() + { + Debug.WriteLine("warning CS1522: Empty switch block"); + Assert.True(Statements_TestClass_switch_049.testMethod()); + } + + [TestMethod] + public void Statements_switch_string_001_Test() + { + Debug.WriteLine(" switch on string: null"); + Assert.True(Statements_TestClass_switch_string_001.testMethod()); + } + + [TestMethod] + public void Statements_dowhile_001_Test() + { + Debug.WriteLine("dowhile_001.sc"); + Debug.WriteLine("do/while with a single statement"); + Assert.True(Statements_TestClass_dowhile_001.testMethod()); + } + + [TestMethod] + public void Statements_dowhile_002_Test() + { + Debug.WriteLine("dowhile_002.sc"); + Debug.WriteLine("do/while with a compound statement"); + Assert.True(Statements_TestClass_dowhile_002.testMethod()); + } + + [TestMethod] + public void Statements_dowhile_003_Test() + { + Debug.WriteLine("dowhile_003.sc"); + Debug.WriteLine("verify known false condition executes only once with single statement"); + Assert.True(Statements_TestClass_dowhile_003.testMethod()); + } + + [TestMethod] + public void Statements_dowhile_004_Test() + { + Debug.WriteLine("dowhile_004.sc"); + Debug.WriteLine("verify known true condition executes with single statement"); + Assert.True(Statements_TestClass_dowhile_004.testMethod()); + } + + [TestMethod] + public void Statements_dowhile_005_Test() + { + Debug.WriteLine("dowhile_005.sc"); + Debug.WriteLine("verify known false condition executes once with compound statements"); + Assert.True(Statements_TestClass_dowhile_005.testMethod()); + } + + [TestMethod] + public void Statements_dowhile_006_Test() + { + Debug.WriteLine("dowhile_006.sc"); + Debug.WriteLine("verify known true condition executes with compound statements"); + Assert.True(Statements_TestClass_dowhile_006.testMethod()); + } + + [TestMethod] + public void Statements_for_001_Test() + { + Debug.WriteLine("for_001.sc"); + Debug.WriteLine("empty for loop"); + Assert.True(Statements_TestClass_for_001.testMethod()); + } + + [TestMethod] + public void Statements_for_003_Test() + { + Debug.WriteLine("for_003.sc"); + Debug.WriteLine("empty initializer in for loop"); + Assert.True(Statements_TestClass_for_003.testMethod()); + } + + [TestMethod] + public void Statements_for_004_Test() + { + Debug.WriteLine("for_004.sc"); + Debug.WriteLine("empty iterator in for loop"); + Assert.True(Statements_TestClass_for_004.testMethod()); + } + + [TestMethod] + public void Statements_for_006_Test() + { + Debug.WriteLine("for_006.sc"); + Debug.WriteLine("Full normal for loop"); + Assert.True(Statements_TestClass_for_006.testMethod()); + } + + [TestMethod] + public void Statements_for_007_Test() + { + Debug.WriteLine("for_007.sc"); + Debug.WriteLine("Full normal for loop with a compound statement"); + Assert.True(Statements_TestClass_for_007.testMethod()); + } + + [TestMethod] + public void Statements_for_008_Test() + { + Debug.WriteLine("for_008.sc"); + Debug.WriteLine("Multiple declarations in initializer"); + Assert.True(Statements_TestClass_for_008.testMethod()); + } + + [TestMethod] + public void Statements_for_009_Test() + { + Debug.WriteLine("for_009.sc"); + Debug.WriteLine("Statements_TestClass_? statement expression lists in for initializer"); + Assert.True(Statements_TestClass_for_009.testMethod()); + } + + [TestMethod] + public void Statements_for_010_Test() + { + Debug.WriteLine("for_010.sc"); + Debug.WriteLine("Statements_TestClass_? statement expression lists in for iterator"); + Assert.True(Statements_TestClass_for_010.testMethod()); + } + + [TestMethod] + public void Statements_for_011_Test() + { + Debug.WriteLine("for_011.sc"); + Debug.WriteLine("Statements_TestClass_? statement expression lists in for initializer and iterator"); + Assert.True(Statements_TestClass_for_011.testMethod()); + } + + [TestMethod] + public void Statements_for_013_Test() + { + Debug.WriteLine("for_013.sc"); + Debug.WriteLine("Verify conditional evaluates before iterator"); + Assert.True(Statements_TestClass_for_013.testMethod()); + } + + [TestMethod] + public void Statements_for_014_Test() + { + Debug.WriteLine("for_014.sc"); + Debug.WriteLine("Verify method calls work ok in all for loop areas"); + Assert.True(Statements_TestClass_for_014.testMethod()); + } + + [TestMethod] + public void Statements_char_in_string_s01_Test() + { + Debug.WriteLine("Optimization to foreach (char c in String) by treating String as a char array"); + Assert.True(Statements_TestClass_char_in_string_s01.testMethod()); + } + + [TestMethod] + public void Statements_char_in_string_ex01_Test() + { + Debug.WriteLine("Optimization to foreach (char c in String) by treating String as a char array"); + Assert.True(Statements_TestClass_char_in_string_ex01.testMethod()); + } + + [TestMethod] + public void Statements_while_001_Test() + { + Debug.WriteLine("while_001.sc"); + Debug.WriteLine("while with a single statement"); + Assert.True(Statements_TestClass_while_001.testMethod()); + } + + [TestMethod] + public void Statements_while_002_Test() + { + Debug.WriteLine("while_002.sc"); + Debug.WriteLine("while with a compound statement"); + Assert.True(Statements_TestClass_while_002.testMethod()); + } + + [TestMethod] + public void Statements_while_003_Test() + { + Debug.WriteLine("while_003.sc"); + Debug.WriteLine("verify known false condition doesn't execute with single statement"); + Assert.True(Statements_TestClass_while_003.testMethod()); + } + + [TestMethod] + public void Statements_while_004_Test() + { + Debug.WriteLine("while_004.sc"); + Debug.WriteLine("verify known true condition executes with single statement"); + Assert.True(Statements_TestClass_while_004.testMethod()); + } + + [TestMethod] + public void Statements_while_005_Test() + { + Debug.WriteLine("while_005.sc"); + Debug.WriteLine("verify known false condition doesn't execute with compound statements"); + Assert.True(Statements_TestClass_while_005.testMethod()); + } + + [TestMethod] + public void Statements_while_006_Test() + { + Debug.WriteLine("while_006.sc"); + Debug.WriteLine("verify known true condition executes with compound statements"); + Assert.True(Statements_TestClass_while_006.testMethod()); + } + + [TestMethod] + public void Statements_break_001_Test() + { + Debug.WriteLine("break_001.sc"); + Debug.WriteLine("Make sure break works in all basic single statement loops"); + Assert.True(Statements_TestClass_break_001.testMethod()); + } + + [TestMethod] + public void Statements_break_002_Test() + { + Debug.WriteLine("break_002.sc"); + Debug.WriteLine("Make sure break works in all basic compound statement loops"); + Assert.True(Statements_TestClass_break_002.testMethod()); + } + + [TestMethod] + public void Statements_break_003_Test() + { + Debug.WriteLine("break_003.sc"); + Debug.WriteLine("Make sure break optional on end of switch"); + Assert.True(Statements_TestClass_break_003.testMethod()); + } + + [TestMethod] + public void Statements_break_006_Test() + { + Debug.WriteLine("break_006.sc"); + Debug.WriteLine("break in an if successfully breaks loop"); + Assert.True(Statements_TestClass_break_006.testMethod()); + } + + [TestMethod] + public void Statements_break_007_Test() + { + Debug.WriteLine("break_007.sc"); + Debug.WriteLine("break in a blocked if successfully breaks loop"); + Assert.True(Statements_TestClass_break_007.testMethod()); + } + + [TestMethod] + public void Statements_break_010_Test() + { + Debug.WriteLine("break_010.sc"); + Debug.WriteLine("Make sure break correctly when nested"); + Assert.True(Statements_TestClass_break_010.testMethod()); + } + + [TestMethod] + public void Statements_continue_001_Test() + { + Debug.WriteLine("continue_001.sc"); + Debug.WriteLine("Make sure continue works in all basic single statement loops"); + Assert.True(Statements_TestClass_continue_001.testMethod()); + } + + [TestMethod] + public void Statements_continue_002_Test() + { + Debug.WriteLine("continue_002.sc"); + Debug.WriteLine("Make sure continue works in all basic compound statement loops"); + Debug.WriteLine("Expected Output"); + Assert.True(Statements_TestClass_continue_002.testMethod()); + } + + [TestMethod] + public void Statements_continue_006_Test() + { + Debug.WriteLine("continue_006.sc"); + Debug.WriteLine("continue in an if successfully continues loop"); + Assert.True(Statements_TestClass_continue_006.testMethod()); + } + + [TestMethod] + public void Statements_continue_007_Test() + { + Debug.WriteLine("continue_007.sc"); + Debug.WriteLine("continue in a block if successfully continues loop"); + Assert.True(Statements_TestClass_continue_007.testMethod()); + } + + [TestMethod] + public void Statements_continue_010_Test() + { + Debug.WriteLine("continue_010.sc"); + Debug.WriteLine("Make sure continue works correctly when nested"); + Assert.True(Statements_TestClass_continue_010.testMethod()); + } + + [TestMethod] + public void Statements_goto_001_Test() + { + Debug.WriteLine("goto_001.sc"); + Debug.WriteLine("simple goto to adjust flow control"); + Assert.True(Statements_TestClass_goto_001.testMethod()); + } + + [TestMethod] + public void Statements_goto_008_Test() + { + Debug.WriteLine("goto_008.sc"); + Debug.WriteLine("goto currect case"); + Assert.True(Statements_TestClass_goto_008.testMethod()); + } + + [TestMethod] + public void Statements_goto_009_Test() + { + Debug.WriteLine("goto_009.sc"); + Debug.WriteLine("goto a different case"); + Debug.WriteLine("Expected Output"); + Assert.True(Statements_TestClass_goto_009.testMethod()); + } + + [TestMethod] + public void Statements_goto_010_Test() + { + Debug.WriteLine("goto_010.sc"); + Debug.WriteLine("goto default correctly"); + Assert.True(Statements_TestClass_goto_010.testMethod()); + } + + [TestMethod] + public void Statements_goto_014_Test() + { + Debug.WriteLine("goto_014.sc"); + Debug.WriteLine("simple gotos to test jumping to parent process."); + Assert.True(Statements_TestClass_goto_014.testMethod()); + } + + [TestMethod] + public void Statements_goto_017_Test() + { + Debug.WriteLine(" some gotos"); + Assert.True(Statements_TestClass_goto_017.testMethod()); + } + + [TestMethod] + public void Statements_goto_018_Test() + { + Debug.WriteLine(" try/catch/finally with goto"); + Assert.True(Statements_TestClass_goto_018.testMethod()); + } + + [TestMethod] + public void Statements_return_001_Test() + { + Debug.WriteLine("return_001.sc"); + Debug.WriteLine("simple void return on a void method"); + Assert.True(Statements_TestClass_return_001.testMethod()); + } + + [TestMethod] + public void Statements_return_004_Test() + { + Debug.WriteLine("return_004.sc"); + Debug.WriteLine("simple return a normal type, assigning, and ignoring return value"); + Assert.True(Statements_TestClass_return_004.testMethod()); + } + + [TestMethod] + public void Statements_return_006_Test() + { + Debug.WriteLine("return_006.sc"); + Debug.WriteLine("simple return a type mismatch that has an implicit conversion"); + Assert.True(Statements_TestClass_return_006.testMethod()); + } + + [TestMethod] + public void Statements_return_008_Test() + { + Debug.WriteLine("return_008.sc"); + Debug.WriteLine("simple return a type mismatch that has an explicit convertion conversion,"); + Debug.WriteLine("applying the cast"); + Assert.True(Statements_TestClass_return_008.testMethod()); + } + + [TestMethod] + public void Statements_return_009_Test() + { + Debug.WriteLine("return_009.sc"); + Debug.WriteLine("return of a struct"); + Assert.True(Statements_TestClass_return_009.testMethod()); + } + + [TestMethod] + public void Statements_return_010_Test() + { + Debug.WriteLine("return_010.sc"); + Debug.WriteLine("return of a class"); + Assert.True(Statements_TestClass_return_010.testMethod()); + } + + [TestMethod] + public void Statements_return_013_Test() + { + Debug.WriteLine("return_013.sc"); + Debug.WriteLine("simple falloff on a void method"); + Assert.True(Statements_TestClass_return_013.testMethod()); + } + + [TestMethod] + public void Statements_return_014_Test() + { + Debug.WriteLine("return_014.sc"); + Debug.WriteLine("verify that a 'throw' is adequate for flow control analysis of return type"); + Assert.True(Statements_TestClass_return_014.testMethod()); + } + + [TestMethod] + public void Statements_throw_001_Test() + { + Debug.WriteLine("throw_001.sc"); + Debug.WriteLine("simple throw"); + Assert.True(Statements_TestClass_throw_001.testMethod()); + } + + [TestMethod] + public void Statements_throw_005_Test() + { + Debug.WriteLine("throw_005.sc"); + Debug.WriteLine("simple throw with output"); + Assert.True(Statements_TestClass_throw_005.testMethod()); + } + + [TestMethod] + public void Statements_trycatch_001_Test() + { + Debug.WriteLine("trycatch_001.sc"); + Debug.WriteLine("simple throw"); + Assert.True(Statements_TestClass_trycatch_001.testMethod()); + } + + [TestMethod] + public void Statements_trycatch_006_Test() + { + Debug.WriteLine("trycatch_006.sc"); + Debug.WriteLine("simple system generated System.Exception"); + Assert.True(Statements_TestClass_trycatch_006.testMethod()); + } + + [TestMethod] + public void Statements_trycatch_007_Test() + { + Debug.WriteLine("trycatch_007.sc"); + Debug.WriteLine("simple re-throw"); + Assert.True(Statements_TestClass_trycatch_007.testMethod()); + } + + [TestMethod] + public void Statements_tryfinally_001_Test() + { + Debug.WriteLine("tryfinally_001.sc"); + Debug.WriteLine("simple finally"); + Assert.True(Statements_TestClass_tryfinally_001.testMethod()); + } + + [TestMethod] + public void Statements_tryfinally_002_Test() + { + Debug.WriteLine("tryfinally_002.sc"); + Debug.WriteLine("simple finally inside try/catch"); + Assert.True(Statements_TestClass_tryfinally_002.testMethod()); + } + + [TestMethod] + public void Statements_tryfinally_003_Test() + { + Debug.WriteLine("tryfinally_003.sc"); + Debug.WriteLine("simple finally outside try/catch"); + Assert.True(Statements_TestClass_tryfinally_003.testMethod()); + } + + [TestMethod] + public void Statements_tryfinally_004_Test() + { + Debug.WriteLine("tryfinally_004.sc"); + Debug.WriteLine("simple finally passed 'over' by a goto"); + Assert.True(Statements_TestClass_tryfinally_004.testMethod()); + } + + [TestMethod] + public void Statements_tryfinally_006_Test() + { + Debug.WriteLine("tryfinally_006.sc"); + Debug.WriteLine("simple finally exited by throw"); + Assert.True(Statements_TestClass_tryfinally_006.testMethod()); + } + + [TestMethod] + public void Statements_tryfinally_007_Test() + { + Debug.WriteLine("tryfinally_007.sc"); + Debug.WriteLine("simple finally exited by throw in a called method"); + Assert.True(Statements_TestClass_tryfinally_007.testMethod()); + } + + [TestMethod] + public void Statements_tryfinally_008_Test() + { + Debug.WriteLine("tryfinally_008.sc"); + Debug.WriteLine("simple finally exited by return"); + Assert.True(Statements_TestClass_tryfinally_008.testMethod()); + } + + [TestMethod] + public void Statements_tryfinally_009_Test() + { + Debug.WriteLine("tryfinally_009.sc"); + Debug.WriteLine("simple finally exited by continue"); + Assert.True(Statements_TestClass_tryfinally_009.testMethod()); + } + + [TestMethod] + public void Statements_tryfinally_010_Test() + { + Debug.WriteLine("tryfinally_010.sc"); + Debug.WriteLine("simple finally exited by break"); + Assert.True(Statements_TestClass_tryfinally_010.testMethod()); + } + + [TestMethod] + public void Statements_tryfinally_011_Test() + { + Debug.WriteLine("tryfinally_011.sc"); + Debug.WriteLine("simple finally exited by break (where break is outside try)"); + Assert.True(Statements_TestClass_tryfinally_011.testMethod()); + } + + [TestMethod] + public void Statements_tryfinally_012_Test() + { + Debug.WriteLine("tryfinally_012.sc"); + Debug.WriteLine("simple finally exited by system System.Exception"); + Assert.True(Statements_TestClass_tryfinally_012.testMethod()); + } + + [TestMethod] + public void Statements_tryfinally_013_Test() + { + Assert.True(Statements_TestClass_tryfinally_013.testMethod()); + } + + [TestMethod] + public void Statements_Using_001_Test() + { + Debug.WriteLine("using_001.cs"); + Debug.WriteLine("Statements_TestClass_? the using statement."); + Debug.WriteLine("Cast a class to IDisposable explicitly, use that in the using statement. (1.a)"); + Assert.True(Statements_TestClass_Using_001.testMethod()); + } + + [TestMethod] + public void Statements_Using_002_Test() + { + Debug.WriteLine("using_002.cs"); + Debug.WriteLine("Statements_TestClass_? the using statement."); + Debug.WriteLine("Use a class directly in using (1.b)"); + Assert.True(Statements_TestClass_Using_002.testMethod()); + } + + [TestMethod] + public void Statements_Using_003_Test() + { + Debug.WriteLine("using_003.cs"); + Debug.WriteLine("Statements_TestClass_? the using statement."); + Debug.WriteLine("Creation of class as part of using statement (1.c)"); + Assert.True(Statements_TestClass_Using_003.testMethod()); + } + + [TestMethod] + public void Statements_Using_005_Test() + { + Debug.WriteLine("using_005.cs"); + Debug.WriteLine("Statements_TestClass_? the using statement."); + Debug.WriteLine("A class that explicitly implements IDisposable. (1.e)"); + Assert.True(Statements_TestClass_Using_005.testMethod()); + } + + [TestMethod] + public void Statements_Using_009_Test() + { + Debug.WriteLine("using_009.cs"); + Debug.WriteLine("Statements_TestClass_? the using statement."); + Debug.WriteLine("Statements_TestClass_? the behavior if the used variable is nulled-out in the using block (4)"); + Assert.True(Statements_TestClass_Using_009.testMethod()); + } + + [TestMethod] + public void Statements_Using_010_Test() + { + Debug.WriteLine("using_010.cs"); + Debug.WriteLine("Statements_TestClass_? the using statement."); + Debug.WriteLine("Dispose() called during normal exit (5.a)"); + Assert.True(Statements_TestClass_Using_010.testMethod()); + } + + [TestMethod] + public void Statements_Using_011_Test() + { + Debug.WriteLine("using_011.cs"); + Debug.WriteLine("Statements_TestClass_? the using statement."); + Debug.WriteLine("Dispose() called after throw (5.b)"); + Debug.WriteLine("Expected Output"); + Assert.True(Statements_TestClass_Using_011.testMethod()); + } + + [TestMethod] + public void Statements_Using_012_Test() + { + Debug.WriteLine("using_012.cs"); + Debug.WriteLine("Statements_TestClass_? the using statement."); + Debug.WriteLine("Dispose() called for two objects during normal exit. (5.c)"); + Assert.True(Statements_TestClass_Using_012.testMethod()); + } + + [TestMethod] + public void Statements_Using_013_Test() + { + Debug.WriteLine("using_013.cs"); + Debug.WriteLine("Statements_TestClass_? the using statement."); + Debug.WriteLine("Dispose() called for first objects with System.Exception thrown before second block. (5.d)"); + Assert.True(Statements_TestClass_Using_013.testMethod()); + } + + [TestMethod] + public void Statements_Using_014_Test() + { + Debug.WriteLine("using_014.cs"); + Debug.WriteLine("Statements_TestClass_? the using statement."); + Debug.WriteLine("Dispose() called for first objects with System.Exception thrown after second block. (5.e)"); + Assert.True(Statements_TestClass_Using_014.testMethod()); + } + + [TestMethod] + public void Statements_Using_015_Test() + { + Debug.WriteLine("using_015.cs"); + Debug.WriteLine("Statements_TestClass_? the using statement."); + Debug.WriteLine("Dispose() called for both objects when System.Exception thrown inside second block. (5.f)"); + Assert.True(Statements_TestClass_Using_015.testMethod()); + } + + [TestMethod] + public void Statements_Using_017_Test() + { + Debug.WriteLine("using_017.cs"); + Debug.WriteLine("Statements_TestClass_? the using statement."); + Debug.WriteLine("Dispose() called for both objects when System.Exception thrown in compound case (5.h)"); + Assert.True(Statements_TestClass_Using_017.testMethod()); + } + + [TestMethod] + public void Statements_Using_018_Test() + { + Debug.WriteLine("using_018.cs"); + Debug.WriteLine("Statements_TestClass_? the using statement."); + Debug.WriteLine("Dispose() called for both objects in compound using. (5.g)"); + Assert.True(Statements_TestClass_Using_018.testMethod()); + } + + [TestMethod] + public void Statements_lock001_Test() + { + Debug.WriteLine("The expression of a lock statement must denote a value of a reference-type"); + Assert.True(Statements_TestClass_lock001.testMethod()); + } + + [TestMethod] + public void Statements_lock003_Test() + { + Debug.WriteLine("The System.Type object of a class can conveniently be used as the mutual-exclusion lock for static methods of the class"); + Assert.True(Statements_TestClass_lock003.testMethod()); + } + + [TestMethod] + public void Statements_lock004_Test() + { + Debug.WriteLine("possible mistaken null statement when semi-column appears directly after lock()"); + Assert.True(Statements_TestClass_lock004.testMethod()); + } + + [TestMethod] + public void Statements_lock005_Test() + { + Debug.WriteLine("this as the lock expression in a reference type"); + Assert.True(Statements_TestClass_lock005.testMethod()); + } + + [TestMethod] + public void Statements_lock007_Test() + { + Debug.WriteLine("nested lock statements"); + Assert.True(Statements_TestClass_lock007.testMethod()); + } + + [TestMethod] + public void Statements_enum_002_Test() + { + Debug.WriteLine(" enum: comparing constant casted to an enum type to a variable"); + Assert.True(Statements_TestClass_enum_002.testMethod()); + } + + public class Res1 : IDisposable + { + public void Dispose() + { + Debug.WriteLine("Res1.Dispose()"); + } + public void Func() + { + Debug.WriteLine("Res1.Func()"); + } + public void Throw() + { + throw (new System.Exception("Res1")); + } + } + + public class Res2 : IDisposable + { + public void Dispose() + { + Debug.WriteLine("Res2.Dispose()"); + } + public void Func() + { + Debug.WriteLine("Res2.Func()"); + } + public void Throw() + { + throw (new System.Exception("Res2")); + } + } + + // IDispose implemented explicitly + public class ResExplicit : IDisposable + { + void IDisposable.Dispose() + { + Debug.WriteLine("ResExplicit.Dispose()"); + } + public void Func() + { + Debug.WriteLine("ResExplicit.Func()"); + } + public void Throw() + { + throw (new System.Exception("ResExplicit")); + } + } + + // A class that doesn't implement IDisposable. + public class NonRes1 + { + public void GarbageDisposal() + { + Debug.WriteLine("NonRes1.GarbageDisposal()"); + } + public void Func() + { + Debug.WriteLine("NonRes1.Func()"); + } + public void Throw() + { + throw (new System.Exception("NonRes1")); + } + } + + // Doesn't implement IDisposable, but has a Dispose() function... + public class NonRes2 + { + public void Dispose() + { + Debug.WriteLine("NonRes2.Dispose()"); + } + public void Func() + { + Debug.WriteLine("NonRes2.Func()"); + } + public void Throw() + { + throw (new System.Exception("NonRes2")); + } + } + + //Compiled Test Cases + public class Statements_TestClass_Label_001 + { + public static int Main_old(string[] args) + { + Label: + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Label_002 + { + public static int Main_old(string[] args) + { + goto Label; + return (1); + Label: + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Label_004 + { + public static int Main_old(string[] args) + { + Method(); + return (0); + } + public static void Method() + { + goto Label; + Label:; + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Decl_001 + { + public static int Main_old(string[] args) + { + int i; + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Decl_002 + { + public static int Main_old(string[] args) + { + int i = 99; + if (i != 99) + return (1); + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Decl_003 + { + public static int Main_old(string[] args) + { + int i = 99; + int j = i + 1; + if (i != 99) + return (1); + if (j != 100) + return (1); + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Decl_004 + { + public static int Main_old(string[] args) + { + System.Exception r; + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Decl_007 + { + public static int Main_old(string[] args) + { + int i, j, k; + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Decl_009 + { + public static int Main_old(string[] args) + { + int i = 1, j = i + 1, k = i + j + 3; + if ((i != 1) || (j != 2) || (k != 6)) + return (1); + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Decl_010 + { + public static int Main_old(string[] args) + { + int[] i; + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Decl_012 + { + public static int Main_old(string[] args) + { + int[] i = new int[30]; + int j = i[23]; + if (j != 0) + { + return (1); + } + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Decl_014 + { + public static int Main_old(string[] args) + { + int[] i = new int[] { 0, 1, 2, 3, 4 }; + int j = i[2]; + if (j != 2) + { + return (1); + } + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Foo + { + public Foo(int i) + { + m_i = i; + } + + public int GetInt() { return (m_i); } + int m_i; + } + public class Statements_TestClass_Decl_016 + { + public static int Main_old(string[] args) + { + Foo[] f = new Foo[30]; // 30 null'd foos + Foo foo = f[23]; + for (int i = 0; i < f.Length; i++) + { + foo = f[i]; + if (foo != null) + return (1); + f[i] = foo = new Foo(i); + if (foo.GetInt() != i) + { + Debug.WriteLine("new Foo() didn't take"); + return (1); + } + if (f[i].GetInt() != i) + { + Debug.WriteLine("Array didn't get updated"); + return (1); + } + if (f[i] != foo) + { + Debug.WriteLine("Array element and foo are different"); + return (i); + } + } + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Block_001 + { + public static int Main_old(string[] args) + { + int status = 0; + // arbitrary nesting + { + int i; + i = 0; + i++; + } + // empty nesting + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + { + int i; + i = 0; + i++; + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + // empty hanging clause + if (true) + { + } + else + { + status = 1; + } + while (false) + { + } + do + { + } while (false); + + switch (status) + { + } + for (; false;) + { + } + Label: { } + return (status); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Empty_001 + { + public static int Main_old(string[] args) + { + int status = 0; + // empty series + ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; + int i; + i = 0; + i++; + ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; ; + // empty hanging clause + if (true) + ; + else + { + status = 1; + } + while (false) + ; + do; while (false); + + switch (status) + { + default: break; + } + for (; false;) + ; + Label:; + return (status); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Expr_002 + { + public static int Main_old(string[] args) + { + bool b = false; + b = true || false || b; + if (!b) + return (1); + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Expr_003 + { + public static int Main_old(string[] args) + { + bool b = false; + bool b1; + bool b2; + b = b1 = b2 = true || false || b; + if (!b || !b1 || !b2) + return (1); + return (false ? 1 : 0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Expr_004 + { + public static int Main_old(string[] args) + { + int i = 0; + Debug.WriteLine("Adding 5"); + i += 5; // i == 5 + if (i != 5) return (1); + Debug.WriteLine("Subtracting 3"); + i -= 3; // i == 2 + if (i != 2) return (1); + Debug.WriteLine("Multiplying by 4"); + i *= 4; // i == 8 + if (i != 8) return (1); + Debug.WriteLine("Dividing by 2"); + i /= 2; // i == 4 + if (i != 4) return (1); + Debug.WriteLine("Left Shifting 3"); + i <<= 3; // i == 32 + if (i != 32) return (1); + Debug.WriteLine("Right Shifting 2"); + i >>= 2; // i == 8 + if (i != 8) return (1); + Debug.WriteLine("ANDing against logical not"); + i &= ~i; // i = 0 + if (i != 0) return (1); + Debug.WriteLine("ORing by 0xBeaf"); + i |= 48815; // i = 0xBeaf + if (i != 0xBeaf) return (1); + return (true ? 0 : 1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_Expr_006 + { + public static int Main_old(string[] args) + { + int b, c, d, e; + e = 1; + int a = b = c = d = e++ + 1; + b = a = d + e * 2; + if ((a == 6) && (a == b) && (c == 2) && (c == d) && (d == e)) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_if_001 + { + public static int Main_old(string[] args) + { + if (true) + return (0); + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_if_003 + { + public static int Main_old(string[] args) + { + if (true) + { + int i = 0; + return (i); + } + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_if_005 + { + public static int Main_old(string[] args) + { + int ret = 0; + if (true) + ret = ret; + else + ret = 1; + if (false) + ret = 1; + else + ret = ret; + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_if_007 + { + public static int Main_old(string[] args) + { + int ret = 0; + if (true) + { + int i = ret; + ret = i; + } + else + { + int i = 1; + ret = i; + } + if (false) + { + int i = 1; + ret = i; + } + else + { + int i = ret; + ret = i; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_if_009 + { + public static int Main_old(string[] args) + { + int ret = 1; // default to fail + if (true) + if (false) + return (1); + else // if this else if associated with the 1st if, it won't execute. + ret = 0; + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_001 + { + public static int Main_old(string[] args) + { + switch (true) + { + } + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_002 + { + public static int Main_old(string[] args) + { + int ret = 1; + switch (true) + { + default: + ret = 0; + break; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_003 + { + public static int Main_old(string[] args) + { + int ret = 1; + switch (true) + { + case true: + ret = 0; + break; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_004 + { + public static int Main_old(string[] args) + { + int ret = 1; + switch (true) + { + case true: + ret = 0; + break; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_005 + { + public static int Main_old(string[] args) + { + int ret = 1; + switch (true) + { + case true: + ret = 0; + break; + case false: + ret = 1; + break; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_006 + { + public static int Main_old(string[] args) + { + int ret = 1; + switch (false) + { + default: + ret = 0; + break; + case true: + ret = 1; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_007 + { + public static int Main_old(string[] args) + { + int ret = 1; + switch (23) + { + default: + ret = 0; + break; + case 1: + ret = 1; + break; + case -2: + ret = 1; + break; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_010 + { + public static int Main_old(string[] args) + { + int ret = 1; + int value = 23; + switch (value) + { + case kValue: + ret = 0; + break; + default: + ret = 1; + break; + } + return (ret); + } + const int kValue = 23; + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_012 + { + public static int Main_old(string[] args) + { + int ret = 3; + for (int i = 0; i < 3; i++) + { + switch (i) + { + case 1: + case 0: + case 2: + ret--; + break; + default: + return (1); + } + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_013 + { + public static int Main_old(string[] args) + { + int ret = 6; + switch (ret) + { + case 0: + ret--; // 2 + Debug.WriteLine("case 0: "); + Debug.WriteLine(ret.ToString()); + goto case 9999; + case 2: + ret--; // 4 + Debug.WriteLine("case 2: "); + Debug.WriteLine(ret.ToString()); + goto case 255; + case 6: // start here + ret--; // 5 + Debug.WriteLine("case 5: "); + Debug.WriteLine(ret.ToString()); + goto case 2; + case 9999: + ret--; // 1 + Debug.WriteLine("case 9999: "); + Debug.WriteLine(ret.ToString()); + goto default; + case 0xff: + ret--; // 3 + Debug.WriteLine("case 0xff: "); + Debug.WriteLine(ret.ToString()); + goto case 0; + default: + ret--; + Debug.WriteLine("Default: "); + Debug.WriteLine(ret.ToString()); + if (ret > 0) + { + goto case -1; + } + break; + case -1: + ret = 999; + Debug.WriteLine("case -1: "); + Debug.WriteLine(ret.ToString()); + break; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_015 + { + public static int Main_old(string[] args) + { + int ret = 0; + ret = DoByte(); + return (ret); + } + private static int DoByte() + { + int ret = 2; + byte b = 2; + switch (b) + { + case 1: + case 2: + ret--; + break; + case 3: + break; + default: + break; + } + switch (b) + { + case 1: + case 3: + break; + default: + ret--; + break; + } + if (ret > 0) + Debug.WriteLine("byte failed"); + return (ret); + } + + + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_016 + { + public static int Main_old(string[] args) + { + int ret = 0; + ret = DoChar(); + return (ret); + } + private static int DoChar() + { + int ret = 2; + char c = '2'; + switch (c) + { + case '1': + case '2': + ret--; + break; + case '3': + break; + default: + break; + } + switch (c) + { + case '1': + case '3': + break; + default: + ret--; + break; + } + if (ret > 0) + Debug.WriteLine("char failed"); + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_017 + { + public static int Main_old(string[] args) + { + int ret = 0; + ret = DoShort(); + return (ret); + } + private static int DoShort() + { + int ret = 2; + short s = 0x7fff; + switch (s) + { + case 1: + case 32767: + ret--; + break; + case -1: + break; + default: + break; + } + switch (s) + { + case 1: + case -1: + break; + default: + ret--; + break; + } + if (ret > 0) + Debug.WriteLine("short failed"); + return (ret); + } + + + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_018 + { + public static int Main_old(string[] args) + { + int ret = 0; + ret = DoInt(); + return (ret); + } + private static int DoInt() + { + int ret = 2; + int i = 0x7fffffff; + switch (i) + { + case 1: + case 2147483647: + ret--; + break; + case -1: + break; + default: + break; + } + switch (i) + { + case 1: + case -1: + break; + default: + ret--; + break; + } + if (ret > 0) + Debug.WriteLine("int failed"); + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_019 + { + public static int Main_old(string[] args) + { + int ret = 0; + ret = DoLong(); + return (ret); + } + private static int DoLong() + { + int ret = 2; + long l = 0x7fffffffffffffffL; + switch (l) + { + case 1L: + case 9223372036854775807L: + ret--; + break; + case -1L: + break; + default: + break; + } + switch (l) + { + case 1L: + case -1L: + break; + default: + ret--; + break; + } + if (ret > 0) + Debug.WriteLine("long failed"); + return (ret); + } + + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_023 + { + enum eTypes + { + kFirst, + kSecond, + kThird, + }; + public static int Main_old(string[] args) + { + int ret = 0; + ret = DoEnum(); + return (ret); + } + + private static int DoEnum() + { + int ret = 2; + eTypes e = eTypes.kSecond; + switch (e) + { + case eTypes.kThird: + case eTypes.kSecond: + ret--; + break; + case (eTypes)(-1): + break; + default: + break; + } + switch (e) + { + case (eTypes)100: + case (eTypes)(-1): + break; + default: + ret--; + break; + } + if (ret > 0) + Debug.WriteLine("enum failed"); + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_030 + { + public static int Main_old(string[] args) + { + int i = 5; + switch (i) + { + case (int)5.0f: + return 0; + default: + return 1; + } + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_031 + { + public static int Main_old(string[] args) + { + int i = 5; + switch (i) + { + case 1: + case 2: + case 3: + return 1; + case 1001: + case 1002: + case 1003: + return 2; + } + return 0; + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_032 + { + public static int Main_old(string[] args) + { + string s = "hello"; + switch (s) + { + default: + return 1; + case null: + return 1; + case "hello": + return 0; + } + return 1; + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_033 + { + public static int Main_old(string[] args) + { + string s = "hello"; + switch (s) + { + case null: + return 1; + default: + return 1; + case "hello": + return 0; + } + return 1; + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_switch_034 + { + public static implicit operator int(Statements_TestClass_switch_034 val) + { + return 1; + } + public static implicit operator float(Statements_TestClass_switch_034 val) + { + return 2.1f; + } + public static int Main_old(string[] args) + { + Statements_TestClass_switch_034 t = new Statements_TestClass_switch_034(); + switch (t) + { + case 1: + Debug.WriteLine("a"); + return 0; + default: + return 1; + } + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + class Statements_TestClass_switch_035 + { + public sbyte x; + + public Statements_TestClass_switch_035(sbyte i) + { + x = i; + } + public static implicit operator sbyte(Statements_TestClass_switch_035 C) + { + return C.x; + } + + public static int Main_old() + { + Statements_TestClass_switch_035 C = new Statements_TestClass_switch_035(12); + switch (C) + { + case 12: return 0; + default: return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Statements_TestClass_switch_036 + { + public byte x; + + public Statements_TestClass_switch_036(byte i) + { + x = i; + } + public static implicit operator byte(Statements_TestClass_switch_036 C) + { + return C.x; + } + + public static int Main_old() + { + Statements_TestClass_switch_036 C = new Statements_TestClass_switch_036(12); + switch (C) + { + case 12: return 0; + default: return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Statements_TestClass_switch_037 + { + public short x; + + public Statements_TestClass_switch_037(short i) + { + x = i; + } + public static implicit operator short(Statements_TestClass_switch_037 C) + { + return C.x; + } + + public static int Main_old() + { + Statements_TestClass_switch_037 C = new Statements_TestClass_switch_037(12); + switch (C) + { + case 12: return 0; + default: return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Statements_TestClass_switch_038 + { + public ushort x; + + public Statements_TestClass_switch_038(ushort i) + { + x = i; + } + public static implicit operator ushort(Statements_TestClass_switch_038 C) + { + return C.x; + } + + public static int Main_old() + { + Statements_TestClass_switch_038 C = new Statements_TestClass_switch_038(12); + switch (C) + { + case 12: return 0; + default: return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Statements_TestClass_switch_039 + { + public int x; + + public Statements_TestClass_switch_039(int i) + { + x = i; + } + public static implicit operator int(Statements_TestClass_switch_039 C) + { + return C.x; + } + + public static int Main_old() + { + Statements_TestClass_switch_039 C = new Statements_TestClass_switch_039(12); + switch (C) + { + case 12: return 0; + default: return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Statements_TestClass_switch_040 + { + public uint x; + + public Statements_TestClass_switch_040(uint i) + { + x = i; + } + public static implicit operator uint(Statements_TestClass_switch_040 C) + { + return C.x; + } + + public static int Main_old() + { + Statements_TestClass_switch_040 C = new Statements_TestClass_switch_040(12); + switch (C) + { + case 12: return 0; + default: return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Statements_TestClass_switch_041 + { + public long x; + + public Statements_TestClass_switch_041(long i) + { + x = i; + } + public static implicit operator long(Statements_TestClass_switch_041 C) + { + return C.x; + } + + public static int Main_old() + { + Statements_TestClass_switch_041 C = new Statements_TestClass_switch_041(12); + switch (C) + { + case 12: return 0; + default: return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Statements_TestClass_switch_042 + { + public ulong x; + + public Statements_TestClass_switch_042(ulong i) + { + x = i; + } + public static implicit operator ulong(Statements_TestClass_switch_042 C) + { + return C.x; + } + + public static int Main_old() + { + Statements_TestClass_switch_042 C = new Statements_TestClass_switch_042(12); + switch (C) + { + case 12: return 0; + default: return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Statements_TestClass_switch_044 + { + public static implicit operator string(Statements_TestClass_switch_044 C) + { + return "true"; + } + + public static int Main_old() + { + Statements_TestClass_switch_044 C = new Statements_TestClass_switch_044(); + switch (C) + { + case "true": return 0; + default: return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class X { } + class Statements_TestClass_switch_047 + { + + public static implicit operator int(Statements_TestClass_switch_047 C) + { + return 1; + } + + public static implicit operator X(Statements_TestClass_switch_047 C) + { + return new X(); + } + + public static int Main_old() + { + Statements_TestClass_switch_047 C = new Statements_TestClass_switch_047(); + switch (C) + { + case 1: return 0; + default: return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Statements_TestClass_switch_049 + { + public static int Main_old() + { + int i = 6; + switch (i) { } // CS1522 + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Statements_TestClass_switch_string_001 + { + public static int Main_old(string[] args) + { + string s = null; + switch (s) + { + case null: + Debug.WriteLine("null"); + return 0; + default: + return 1; + } + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_dowhile_001 + { + public static int Main_old(string[] args) + { + int i = 0; + int j = 10; + // post decrement test as well + do + i++; + while (--j > 0); + if (i == 10) + return (0); + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_dowhile_002 + { + public static int Main_old(string[] args) + { + int i = 0; + int j = 10; + // post decrement test as well + do + { + j--; + i++; + } while (j > 0); + if (i == 10) + return (0); + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_dowhile_003 + { + public static int Main_old(string[] args) + { + bool bFalse = false; + int ret = 1; + do + ret--; + while (bFalse); + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_dowhile_004 + { + public static int Main_old(string[] args) + { + bool bTrue = true; + do + return (0); + while (bTrue); + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_dowhile_005 + { + public static int Main_old(string[] args) + { + bool bFalse = false; + int ret = 1; + do + { + Debug.WriteLine("Hello World"); + ret--; + } while (bFalse); + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_dowhile_006 + { + public static int Main_old(string[] args) + { + bool bTrue = true; + do + { + Debug.WriteLine("Hello World"); + return (0); + } while (bTrue); + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_for_001 + { + public static int Main_old(string[] args) + { + for (; ; ) + return (0); + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_for_003 + { + public static int Main_old(string[] args) + { + int i = 0; + int ret = 10; + for (; i < 10; i++) + ret--; + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_for_004 + { + public static int Main_old(string[] args) + { + for (int i = 0; i < 10;) + i++; + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_for_006 + { + public static int Main_old(string[] args) + { + int ret = 10; + for (int i = 0; i < 10; i++) + ret--; + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_for_007 + { + public static int Main_old(string[] args) + { + int ret1 = 10; + int ret2 = -10; + for (int i = 0; i < 10; i++) + { + ret1--; + ret2++; + } + return (ret1 | ret2); // bit or + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_for_008 + { + public static int Main_old(string[] args) + { + int ret1 = 10; + int ret2 = 0; + for (int i = 0, j = -10; i < 10; i++) + { + ret1--; + j++; + ret2 = j; + } + return (ret1 | ret2); // bit or + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_for_009 + { + public static int Main_old(string[] args) + { + int ret = 10; + int i, j, k; + for (i = 0, j = i + 1, k = j + 1; i < 10; i++) + { + ret--; + k++; + j++; + } + if (i + 1 != j) + { + Debug.WriteLine("Failure: i + 1 != j"); + return (1); + } + if (j + 1 != k) + { + Debug.WriteLine("Failure: j + 1 != k"); + return (1); + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_for_010 + { + public static int Main_old(string[] args) + { + int ret = 10; + int i, j = 1, k = 2; + for (i = 0; i < 10; i++, j++, k++) + { + ret--; + } + if (i + 1 != j) + { + Debug.WriteLine("Failure: i + 1 != j"); + return (1); + } + if (j + 1 != k) + { + Debug.WriteLine("Failure: j + 1 != k"); + return (1); + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_for_011 + { + public static int Main_old(string[] args) + { + int ret = 10; + int i, j, k = 2; + for (i = 0, j = i + 1; i < 10; i++, k++) + { + ret--; + j++; + } + if (i + 1 != j) + { + Debug.WriteLine("Failure: i + 1 != j"); + return (1); + } + if (j + 1 != k) + { + Debug.WriteLine("Failure: j + 1 != k"); + return (1); + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_for_013 + { + public static int Main_old(string[] args) + { + int ret = 0; + for (; false; ret++) + ; + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_for_014 + { + public static int Main_old(string[] args) + { + int ret = 10; + for (Initializer(); Conditional(); Iterator()) + ret = Body(ret); + return (ret); + } + public static int Initializer() + { + m_i = 0; + return (0); + } + public static bool Conditional() + { + return (m_i < 10); + } + public static void Iterator() + { + m_i++; + } + public static int Body(int ret) + { + return (--ret); + } + private static int m_i; + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_char_in_string_s01 + { + public static int Main_old() + { + String Str = new String('\0', 1024); + int i = 0; + foreach (char C in Str) + { + i++; + if (C != '\0') + return 1; + + } + + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Statements_TestClass_char_in_string_ex01 + { + public static int Main_old() + { + String Str = null; + try + { + foreach (char C in Str) + { + return 1; + Debug.WriteLine("Fail"); + } + } + catch (System.Exception) + { + return 0; + } + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + + public class Statements_TestClass_while_001 + { + public static int Main_old(string[] args) + { + int i = 0; + int j = 10; + // post decrement test as well + while (j-- > 0) + i++; + if (i == 10) + return (0); + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_while_002 + { + public static int Main_old(string[] args) + { + int i = 0; + int j = 10; + // post decrement test as well + while (j > 0) + { + j--; + i++; + } + if (i == 10) + return (0); + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_while_003 + { + public static int Main_old(string[] args) + { + bool bFalse = false; + while (bFalse) + return (1); + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_while_004 + { + public static int Main_old(string[] args) + { + bool bTrue = true; + while (bTrue) + return (0); + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_while_005 + { + public static int Main_old(string[] args) + { + bool bFalse = false; + while (bFalse) + { + Debug.WriteLine("Hello World"); + return (1); + } + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_while_006 + { + public static int Main_old(string[] args) + { + bool bTrue = true; + while (bTrue) + { + Debug.WriteLine("Hello World"); + return (0); + } + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_break_001 + { + public static int Main_old(string[] args) + { + while (true) + break; + do + break; + while (true); + for (; true;) + break; + int[] iArr = new int[20]; + foreach (int i in iArr) + break; + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_break_002 + { + public static int Main_old(string[] args) + { + int ret = 0; + while (true) + { + break; + ret++; + } + do + { + break; + ret++; + } while (true); + for (; true;) + { + break; + ret++; + } + int[] iArr = new int[20]; + foreach (int i in iArr) + { + break; + ret++; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_break_003 + { + public static int Main_old(string[] args) + { + int ret = 1; + switch (ret) + { + case 1: + ret = 0; + break; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_break_006 + { + public static int Main_old(string[] args) + { + int ret = 0; + while (true) + { + if (ret == 0) + break; + ret = 1; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_break_007 + { + public static int Main_old(string[] args) + { + int ret = 0; + while (true) + { + if (ret == 0) + { + break; + ret = 1; + } + ret = 1; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_break_010 + { + public static int Main_old(string[] args) + { + int ret = 3; + while (true) + { + do + { + for (ret--; true; ret--) + { + break; + } + ret--; + break; + } while (true); + ret--; + break; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_continue_001 + { + public static int Main_old(string[] args) + { + int i = 5; + int ret = 0; + Debug.WriteLine("Doing while"); + while (--i != 0) + continue; + if (i != 0) + return (1); + Debug.WriteLine("Doing do/while"); + i = 5; + do + continue; + while (--i != 0); + if (i != 0) + return (1); + Debug.WriteLine("Doing for"); + for (i = 5; i != 0; i--) + continue; + int[] iArr = new int[20]; + foreach (int i2 in iArr) + continue; + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_continue_002 + { + public static int Main_old(string[] args) + { + int i = 1; + int ret = 6; + Debug.WriteLine(ret.ToString()); + while (i-- > 0) + { + ret--; + continue; + ret--; + } + Debug.WriteLine(ret.ToString()); + i = 1; + do + { + ret--; + continue; + ret--; + } while (--i > 0); + Debug.WriteLine(ret.ToString()); + for (i = 1; i > 0; i--) + { + ret--; + continue; + ret--; + } + int[] iArr = new int[3]; + i = 0; + Debug.WriteLine(ret.ToString()); + foreach (int i2 in iArr) + { + ret--; + continue; + ret--; + } + Debug.WriteLine(ret.ToString()); + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_continue_006 + { + public static int Main_old(string[] args) + { + int ret = 10; + while (ret > 0) + { + if (--ret >= 0) + continue; + return (1); + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_continue_007 + { + public static int Main_old(string[] args) + { + int ret = 1; + while (ret != 0) + { + if (ret == 1) + { + ret = 0; + continue; + ret = 1; + } + ret = 1; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_continue_010 + { + public static int Main_old(string[] args) + { + int ret = 125; + int iWhile = 5, iDo = 5, iFor = 6; + while (iWhile-- > 0) + { + if (iDo != 5) + return (1); + do + { + if (iFor != 6) + return (1); + for (iFor--; iFor > 0; iFor--) + { + ret--; + continue; + return (1); + } + iFor = 6; + iDo--; + continue; + return (1); + } while (iDo > 0); + iDo = 5; + continue; + return (1); + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_goto_001 + { + public static int Main_old(string[] args) + { + goto Label2; // jump ahead + return (1); + Label1: + goto Label3; // end it + return (1); + Label2: + goto Label1; // jump backwards + return (1); + Label3: + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_goto_008 + { + public static int Main_old(string[] args) + { + int s = 23; + int ret = 5; + switch (s) + { + case 21: + break; + case 23: + if (--ret > 0) + goto case 23; + break; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_goto_009 + { + public static int Main_old(string[] args) + { + int ret = 6; + switch (32) + { + case 1: + if (--ret > 0) + { + Debug.WriteLine("Case 1:" + ret.ToString()); + goto case 32; + } + break; + case 32: + if (--ret > 0) + { + Debug.WriteLine("Case 32:" + ret.ToString()); + goto case 1; + } + break; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_goto_010 + { + public static int Main_old(string[] args) + { + int s = 23; + int ret = 5; + switch (s) + { + case 21: + break; + default: + if (--ret > 0) + goto default; + break; + case 23: + goto default; + } + return (ret); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_goto_014 + { + public static int Main_old(string[] args) + { + bool bLoopOnce = true; + int i = 0; + Top: + for (i = 0; i < 10; i++) + { + if (i > 5) + return (1); + if (i == 5) + goto LeaveFor; + } + LeaveFor: + i = 0; + do + { + if (++i > 5) + return (1); + if (i == 5) + { + goto LeaveDo; + } + } while (i < 10); + LeaveDo: + i = 0; + while (i < 10) + { + if (++i > 5) + return (1); + if (i == 5) + goto LeaveWhile; + } + LeaveWhile: + if (bLoopOnce) + { + bLoopOnce = !bLoopOnce; + + while (true) + { + do + { + for (; ; ) + { + goto Top; + } + } while (true); + } + } + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_goto_017 + { + public static int Main_old(string[] args) + { + string target = "label1"; + label1: + label2: + if (target == "label1") + { + target = "label2"; + goto label1; + } + else if (target == "label2") + { + target = "exit"; + goto label2; + } + return 0; + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_goto_018 + { + public static int Main_old(string[] args) + { + string target = "label1"; + label1: + try + { + if (target == "label1") + { + target = "exit"; + goto label1; + } + } + catch + { + } + finally + { + } + return 0; + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_return_001 + { + public static int Main_old(string[] args) + { + Statements_TestClass_return_001.sMethod(); + Statements_TestClass_return_001 t = new Statements_TestClass_return_001(); + t.Method(); + return (0); + } + private static void sMethod() + { + return; + } + private void Method() + { + return; + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_return_004 + { + public static int Main_old(string[] args) + { + int i; + i = Statements_TestClass_return_004.sMethod(); + Statements_TestClass_return_004.sMethod(); + Statements_TestClass_return_004 t = new Statements_TestClass_return_004(); + i = t.Method(); + t.Method(); + return (i == 0 ? 0 : 1); + } + private static int sMethod() + { + return (1); + } + private int Method() + { + return (0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_return_006 + { + public static int Main_old(string[] args) + { + int i; + i = Statements_TestClass_return_006.sMethod(); + if (i != 0) + return (1); + Statements_TestClass_return_006 t = new Statements_TestClass_return_006(); + i = t.Method(); + return (i == 0 ? 0 : 1); + } + private static int sMethod() + { + short s = 0; + return (s); + } + private int Method() + { + short s = 0; + return (s); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_return_008 + { + public static int Main_old(string[] args) + { + short s; + s = Statements_TestClass_return_008.sMethod(); + if (s != 0) + return (1); + Statements_TestClass_return_008 t = new Statements_TestClass_return_008(); + s = t.Method(); + return (s == 0 ? 0 : 1); + } + private static short sMethod() + { + int i = 0; + return ((short)i); + } + private short Method() + { + int i = 0; + return ((short)i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + struct S + { + public int i; + public string s; + } + public class Statements_TestClass_return_009 + { + public static int Main_old(string[] args) + { + S s; + s = Statements_TestClass_return_009.sMethod(); + if (s.i.ToString().CompareTo(s.s) != 0) + { + return (1); + } + Statements_TestClass_return_009.sMethod(); + Statements_TestClass_return_009 t = new Statements_TestClass_return_009(); + s = t.Method(); + t.Method(); + if (s.i.ToString().CompareTo(s.s) != 0) + { + return (1); + } + return (s.i == 0 ? 0 : 1); + } + private static S sMethod() + { + S s; + s.i = 1; + s.s = s.i.ToString(); + return (s); + } + private S Method() + { + S s; + s.i = 0; + s.s = s.i.ToString(); + return (s); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + class C + { + public int i; + public string s; + } + public class Statements_TestClass_return_010 + { + public static int Main_old(string[] args) + { + C c; + c = Statements_TestClass_return_010.sMethod(); + if (c.i.ToString().CompareTo(c.s) != 0) + { + return (1); + } + Statements_TestClass_return_010.sMethod(); + Statements_TestClass_return_010 t = new Statements_TestClass_return_010(); + c = t.Method(); + t.Method(); + if (c.i.ToString().CompareTo(c.s) != 0) + { + return (1); + } + return (c.i == 0 ? 0 : 1); + } + private static C sMethod() + { + C c = new C(); + c.i = 1; + c.s = c.i.ToString(); + return (c); + } + private C Method() + { + C c = new C(); + c.i = 0; + c.s = c.i.ToString(); + return (c); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_return_013 + { + public static int Main_old(string[] args) + { + Statements_TestClass_return_013.sMethod(); + Statements_TestClass_return_013 t = new Statements_TestClass_return_013(); + t.Method(); + return (0); + } + private static void sMethod() + { + } + private void Method() + { + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_return_014 + { + public static int Main_old(string[] args) + { + int i; + i = Statements_TestClass_return_014.sMethod(1); + Statements_TestClass_return_014.sMethod(2); + Statements_TestClass_return_014 t = new Statements_TestClass_return_014(); + i = t.Method(3); + t.Method(4); + return (i == 0 ? 0 : 1); + } + private static int sMethod(int i) + { + if (i > 0) + return (1); + throw new System.Exception(); + } + private int Method(int i) + { + if (i == 0) + { + return (0); + } + else + { + if (i > 0) + { + switch (i) + { + case 1: + return (0); + case 3: + while (i > 0) + { + return (0); + } + for (; i < 0;) + { + return (1); + } + throw new System.Exception(); + default: + return (0); + } + } + else + { + return (0); + } + } + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_throw_001 + { + public static int Main_old(string[] args) + { + int i; + i = Statements_TestClass_throw_001.sMethod(); + if (i > 0) + return (1); + Statements_TestClass_throw_001.sMethod(); + Statements_TestClass_throw_001 t = new Statements_TestClass_throw_001(); + i = t.Method(); + t.Method(); + return (i == 0 ? 0 : 1); + } + private static int sMethod() + { + try + { + throw new System.Exception(); + } + catch (System.Exception e) + { + return (0); + } + return (1); + } + private int Method() + { + try + { + throw new System.Exception(); + } + catch (System.Exception e) + { + return (0); + } + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_throw_005 + { + public static int Main_old(string[] args) + { + int i; + i = Statements_TestClass_throw_005.sMethod(); + return (i == 0 ? 0 : 1); + } + private static int sMethod() + { + int i = 1; + try + { + System.Exception e = new System.Exception(); + throw (e); + } + catch (System.Exception e) + { + Debug.WriteLine(e.ToString()); + return (0); + } + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_trycatch_001 + { + public static int Main_old(string[] args) + { + int i; + Statements_TestClass_trycatch_001 t = new Statements_TestClass_trycatch_001(); + i = t.Method(); + return (i == 0 ? 0 : 1); + } + private int Method() + { + try + { + throw new System.Exception(); + } + catch (System.Exception e) + { + return (0); + } + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_trycatch_006 + { + public static int Main_old(string[] args) + { + int i; + Statements_TestClass_trycatch_006 t = new Statements_TestClass_trycatch_006(); + i = t.Method(0); + return (i == 0 ? 0 : 1); + } + private int Method(int i) + { + try + { + int x = 1 / i; + Debug.WriteLine(x.ToString()); // prevent it being optimized away + } + catch (System.Exception e) + { + return (0); + } + return (1); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_trycatch_007 + { + public static int Main_old(string[] args) + { + int i; + Statements_TestClass_trycatch_007 t = new Statements_TestClass_trycatch_007(); + i = t.Method(); + int tt = i == 0 ? 0 : 1; + Debug.WriteLine("Value is" + tt); + return (i == 0 ? 0 : 1); + } + private int Method() + { + try + { + try + { + Thrower(); + //throw new System.Exception(); + } + catch (System.Exception e) + { + Debug.WriteLine("Rethrow"); + throw; + } + } + catch (System.Exception e) + { + Debug.WriteLine("Recatch"); + return (0); + } + return (1); + } + private void Thrower() + { + throw new System.Exception(); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_tryfinally_001 + { + public static int Main_old(string[] args) + { + int i; + Statements_TestClass_tryfinally_001 t = new Statements_TestClass_tryfinally_001(); + i = t.Method(2); + return (i == 0 ? 0 : 1); + } + private int Method(int i) + { + try + { + i--; + } + finally + { + i--; + } + + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_tryfinally_002 + { + public static int Main_old(string[] args) + { + int i; + Statements_TestClass_tryfinally_002 t = new Statements_TestClass_tryfinally_002(); + i = t.Method(1); + return (i == 0 ? 0 : 1); + } + private int Method(int i) + { + try + { + try + { + throw new System.Exception(); + } + finally + { + i--; + } + } + catch + { + + } + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_tryfinally_003 + { + public static int Main_old(string[] args) + { + int i; + Statements_TestClass_tryfinally_003 t = new Statements_TestClass_tryfinally_003(); + i = t.Method(1); + return (i == 0 ? 0 : 1); + } + private int Method(int i) + { + try + { + try + { + throw new System.Exception(); + } + catch + { + } + } + finally + { + i--; + } + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_tryfinally_004 + { + public static int Main_old(string[] args) + { + int i; + Statements_TestClass_tryfinally_004 t = new Statements_TestClass_tryfinally_004(); + i = t.Method(1); + return (i == 0 ? 0 : 1); + } + private int Method(int i) + { + try + { + goto TheEnd; + } + finally + { + i--; + } + TheEnd: + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_tryfinally_006 + { + public static int Main_old(string[] args) + { + int i = 0; + Statements_TestClass_tryfinally_006 t = new Statements_TestClass_tryfinally_006(); + try + { + i = t.Method(1); + } + catch { } + return (i == 0 ? 0 : 1); + } + private int Method(int i) + { + try + { + throw new System.Exception(); + } + finally + { + i--; + } + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_tryfinally_007 + { + public static int Main_old(string[] args) + { + int i = 0; + Statements_TestClass_tryfinally_007 t = new Statements_TestClass_tryfinally_007(); + try + { + i = t.Method(1); + } + catch { } + return (i == 0 ? 0 : 1); + } + private int Method(int i) + { + try + { + DeepMethod(i); + } + finally + { + i--; + } + return (i); + } + private int DeepMethod(int i) + { + throw new System.Exception(); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_tryfinally_008 + { + public static int Main_old(string[] args) + { + int i = 1; + Statements_TestClass_tryfinally_008 t = new Statements_TestClass_tryfinally_008(); + try + { + i = t.Method(0); + } + catch { } + return (i == 0 ? 0 : 1); + } + private int Method(int i) + { + try + { + return (i); + } + finally + { + i++; + } + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_tryfinally_009 + { + public static int Main_old(string[] args) + { + int i = 1; + Statements_TestClass_tryfinally_009 t = new Statements_TestClass_tryfinally_009(); + try + { + i = t.Method(1); + } + catch { } + return (i == 0 ? 0 : 1); + } + private int Method(int i) + { + bool b = true; + while (b) + { + try + { + b = false; + continue; + } + finally + { + i--; + } + } + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_tryfinally_010 + { + public static int Main_old(string[] args) + { + int i = 1; + Statements_TestClass_tryfinally_010 t = new Statements_TestClass_tryfinally_010(); + try + { + i = t.Method(1); + } + catch { } + return (i == 0 ? 0 : 1); + } + private int Method(int i) + { + while (true) + { + try + { + break; + } + finally + { + i--; + } + } + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_tryfinally_011 + { + public static int Main_old(string[] args) + { + int i = 1; + Statements_TestClass_tryfinally_011 t = new Statements_TestClass_tryfinally_011(); + try + { + i = t.Method(0); + } + catch { } + return (i == 0 ? 0 : 1); + } + private int Method(int i) + { + while (true) + { + break; + try + { + break; + } + finally + { + i++; + } + } + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public class Statements_TestClass_tryfinally_012 + { + public static int Main_old(string[] args) + { + int i = 0; + bool bCatch = false; + Statements_TestClass_tryfinally_012 t = new Statements_TestClass_tryfinally_012(); + try + { + i = t.Method(1); + } + catch { bCatch = true; } + if (!bCatch) + i = 1; + return (i == 0 ? 0 : 1); + } + private int Method(int i) + { + try + { + Debug.WriteLine((10 / (i - 1)).ToString()); + } + finally + { + i--; + } + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + class Statements_TestClass_tryfinally_013 + { + static void Main_old(string[] args) + { + before_try: + try + { + } + catch (Exception) + { + goto before_try; + } + finally + { + + before_inner_try: + try + { + } + catch (Exception) + { + goto before_inner_try; + } + finally + { + } + } + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + // two normal classes... + public class Statements_TestClass_Using_001 + { + public static void Main_old() + { + Res1 res1 = new Res1(); + IDisposable id = (IDisposable)res1; + using (id) + { + res1.Func(); + } + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + // two normal classes... + public class Statements_TestClass_Using_002 + { + public static void Main_old() + { + Res1 res1 = new Res1(); + using (res1) + { + res1.Func(); + } + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + // two normal classes... + public class Statements_TestClass_Using_003 + { + public static void Main_old() + { + using (Res1 res1 = new Res1()) + { + res1.Func(); + } + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + // two normal classes... + public class Statements_TestClass_Using_005 + { + public static void Main_old() + { + using (ResExplicit resExplicit = new ResExplicit()) + { + resExplicit.Func(); + } + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + // two normal classes... + public class Statements_TestClass_Using_009 + { + public static void Main_old() + { + Res1 res1 = new Res1(); + using (res1) + { + res1.Func(); + res1 = null; + } + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + // two normal classes... + public class Statements_TestClass_Using_010 + { + public static void Main_old() + { + using (Res1 res1 = new Res1()) + { + res1.Func(); + } + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + // two normal classes... + public class Statements_TestClass_Using_011 + { + public static void Main_old() + { + try + { + using (Res1 res1 = new Res1()) + { + res1.Throw(); + } + } + catch + { + Debug.WriteLine("System.Exception caught"); + } + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + // two normal classes... + public class Statements_TestClass_Using_012 + { + public static void Main_old() + { + using (Res1 res1 = new Res1()) + { + res1.Func(); + using (Res2 res2 = new Res2()) + { + res2.Func(); + } + } + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + // two normal classes... + public class Statements_TestClass_Using_013 + { + public static void Main_old() + { + try + { + using (Res1 res1 = new Res1()) + { + res1.Func(); + res1.Throw(); + using (Res2 res2 = new Res2()) + { + res2.Func(); + } + } + } + catch + { + Debug.WriteLine("System.Exception caught"); + } + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + // two normal classes... + public class Statements_TestClass_Using_014 + { + public static void Main_old() + { + try + { + using (Res1 res1 = new Res1()) + { + res1.Func(); + using (Res2 res2 = new Res2()) + { + res2.Func(); + } + res1.Throw(); + } + } + catch + { + Debug.WriteLine("System.Exception caught"); + } + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + // two normal classes... + public class Statements_TestClass_Using_015 + { + public static void Main_old() + { + try + { + using (Res1 res1 = new Res1()) + { + res1.Func(); + using (Res2 res2 = new Res2()) + { + res2.Func(); + res1.Throw(); + } + } + } + catch + { + Debug.WriteLine("System.Exception caught"); + } + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + // two normal classes... + public class Statements_TestClass_Using_017 + { + public static void Main_old() + { + try + { + using (Res1 res1 = new Res1(), + res1a = new Res1()) + { + res1.Func(); + res1.Func(); + res1.Throw(); + } + } + catch + { + Debug.WriteLine("System.Exception caught"); + } + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + // two normal classes... + public class Statements_TestClass_Using_018 + { + public static void Main_old() + { + using (Res1 res1 = new Res1(), + res1a = new Res1()) + { + res1.Func(); + res1a.Func(); + } + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Statements_TestClass_lock001 + { + public static int Main_old() + { + Statements_TestClass_lock001 C = new Statements_TestClass_lock001(); + lock (C) + { + return 0; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Statements_TestClass_lock003 + { + public static int Main_old() + { + lock (typeof(Statements_TestClass_lock003)) + { + return 0; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Statements_TestClass_lock004 + { + public static int Main_old() + { + lock (typeof(Statements_TestClass_lock004)) ; + { + return 0; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Statements_TestClass_lock005 + { + + public void TryMe() + { + lock (this) { } + } + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Statements_TestClass_lock007 + { + public static int Main_old() + { + lock (typeof(Statements_TestClass_lock007)) + { + Statements_TestClass_lock007 C = new Statements_TestClass_lock007(); + lock (C) + { + return 0; + } + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Statements_TestClass_enum_002 + { + private const int CONST = 2; + public static int Main_old(string[] args) + { + int i = 2; + if (i < (int)(MyEnum)CONST) + return 1; + if (i == (int)(MyEnum)0) + return 1; + return 0; + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + + } + public enum MyEnum + { + aaa, + bbb, + ccc + } + + } +} diff --git a/Tests/NFUnitTestStatementsTests/nano.runsettings b/Tests/NFUnitTestStatementsTests/nano.runsettings new file mode 100644 index 00000000..62f0a008 --- /dev/null +++ b/Tests/NFUnitTestStatementsTests/nano.runsettings @@ -0,0 +1,13 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + + \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/packages.config b/Tests/NFUnitTestStatementsTests/packages.config new file mode 100644 index 00000000..dcab08b1 --- /dev/null +++ b/Tests/NFUnitTestStatementsTests/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 14b99158..4e170aab 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -29,6 +29,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestSystemLib", "Test EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestStruct", "Tests\NFUnitTestStruct\NFUnitTestStruct.nfproj", "{77D55D0B-A50F-4CAF-8CC5-F15063D9A41E}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestStatementsTests", "Tests\NFUnitTestStatementsTests\NFUnitTestStatementsTests.nfproj", "{222D8571-6646-47E4-95A5-8AED732DCB70}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -79,6 +81,12 @@ Global {77D55D0B-A50F-4CAF-8CC5-F15063D9A41E}.Release|Any CPU.ActiveCfg = Release|Any CPU {77D55D0B-A50F-4CAF-8CC5-F15063D9A41E}.Release|Any CPU.Build.0 = Release|Any CPU {77D55D0B-A50F-4CAF-8CC5-F15063D9A41E}.Release|Any CPU.Deploy.0 = Release|Any CPU + {222D8571-6646-47E4-95A5-8AED732DCB70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {222D8571-6646-47E4-95A5-8AED732DCB70}.Debug|Any CPU.Build.0 = Debug|Any CPU + {222D8571-6646-47E4-95A5-8AED732DCB70}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {222D8571-6646-47E4-95A5-8AED732DCB70}.Release|Any CPU.ActiveCfg = Release|Any CPU + {222D8571-6646-47E4-95A5-8AED732DCB70}.Release|Any CPU.Build.0 = Release|Any CPU + {222D8571-6646-47E4-95A5-8AED732DCB70}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -90,6 +98,7 @@ Global {BDBFD5E3-46C4-4ACD-B66C-60F00618FD91} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {E63A23A8-5335-4976-BA47-0AC7F1AEDD32} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {77D55D0B-A50F-4CAF-8CC5-F15063D9A41E} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {222D8571-6646-47E4-95A5-8AED732DCB70} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From d8572f37771670db4146afebd9d7b34758f5c7e2 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 12:17:22 +0300 Subject: [PATCH 28/55] Adding namespacce tests, fixing headers and names --- .../NFUnitTestNamespace.nfproj | 70 + Tests/NFUnitTestNamespace/NS_attribute_01.cs | 26 + Tests/NFUnitTestNamespace/NS_attribute_02.cs | 26 + Tests/NFUnitTestNamespace/NS_compunit_01A.cs | 15 + Tests/NFUnitTestNamespace/NS_compunit_01B.cs | 15 + Tests/NFUnitTestNamespace/NS_compunit_03A.cs | 21 + Tests/NFUnitTestNamespace/NS_compunit_03B.cs | 20 + Tests/NFUnitTestNamespace/NS_compunit_04A.cs | 21 + Tests/NFUnitTestNamespace/NS_compunit_04B.cs | 20 + Tests/NFUnitTestNamespace/NS_decl_14.cs | 13 + Tests/NFUnitTestNamespace/NS_decl_15.cs | 13 + .../Properties/AssemblyInfo.cs | 33 + .../UnitTestNamespaceTests.cs | 1643 +++++++++++++++++ Tests/NFUnitTestNamespace/nano.runsettings | 14 + Tests/NFUnitTestNamespace/packages.config | 5 + ...sts.nfproj => NFUnitTestStatements.nfproj} | 0 Tests/NFUnitTestStruct/UnitTestStructs.cs | 6 + Tests/NFUnitTestSystemLib/UnitTestGCTest.cs | 8 +- .../UnitTestInitLocalTests.cs | 8 +- .../NFUnitTestSystemLib/UnitTestParseTests.cs | 8 +- .../UnitTestStringTests.cs | 8 +- .../NFUnitTestSystemLib/UnitTestTypeTests.cs | 8 +- .../UnitTestWeakReferenceTests.cs | 8 +- nanoFramework.CoreLibrary.sln | 11 +- 24 files changed, 2013 insertions(+), 7 deletions(-) create mode 100644 Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj create mode 100644 Tests/NFUnitTestNamespace/NS_attribute_01.cs create mode 100644 Tests/NFUnitTestNamespace/NS_attribute_02.cs create mode 100644 Tests/NFUnitTestNamespace/NS_compunit_01A.cs create mode 100644 Tests/NFUnitTestNamespace/NS_compunit_01B.cs create mode 100644 Tests/NFUnitTestNamespace/NS_compunit_03A.cs create mode 100644 Tests/NFUnitTestNamespace/NS_compunit_03B.cs create mode 100644 Tests/NFUnitTestNamespace/NS_compunit_04A.cs create mode 100644 Tests/NFUnitTestNamespace/NS_compunit_04B.cs create mode 100644 Tests/NFUnitTestNamespace/NS_decl_14.cs create mode 100644 Tests/NFUnitTestNamespace/NS_decl_15.cs create mode 100644 Tests/NFUnitTestNamespace/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestNamespace/UnitTestNamespaceTests.cs create mode 100644 Tests/NFUnitTestNamespace/nano.runsettings create mode 100644 Tests/NFUnitTestNamespace/packages.config rename Tests/NFUnitTestStatementsTests/{NFUnitTestStatementsTests.nfproj => NFUnitTestStatements.nfproj} (100%) diff --git a/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj b/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj new file mode 100644 index 00000000..052c269d --- /dev/null +++ b/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj @@ -0,0 +1,70 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 9b5efd66-ccdc-4d00-960c-993296c56f3b + Library + Properties + 512 + NFUnitTestNamespace + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + + + + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/NS_attribute_01.cs b/Tests/NFUnitTestNamespace/NS_attribute_01.cs new file mode 100644 index 00000000..69015bb1 --- /dev/null +++ b/Tests/NFUnitTestNamespace/NS_attribute_01.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using System; +using System.Diagnostics; + +[assembly:CLSCompliant(true)] + +class NS_TestClass_attribute_01 +{ + public void printClassName() + { + Debug.WriteLine("Class A"); + } + + static void Main_old() {} + + public static bool testMethod() + { + Main_old(); + return true; + } +} \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/NS_attribute_02.cs b/Tests/NFUnitTestNamespace/NS_attribute_02.cs new file mode 100644 index 00000000..ce0f8245 --- /dev/null +++ b/Tests/NFUnitTestNamespace/NS_attribute_02.cs @@ -0,0 +1,26 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using System; +using System.Diagnostics; + +[module: CLSCompliant(true)] + +class NS_TestClass_attribute_02 +{ + public void printClassName() + { + Debug.WriteLine("Class A"); + } + + static void Main_old() { } + + public static bool testMethod() + { + Main_old(); + return true; + } +} \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/NS_compunit_01A.cs b/Tests/NFUnitTestNamespace/NS_compunit_01A.cs new file mode 100644 index 00000000..e9b72104 --- /dev/null +++ b/Tests/NFUnitTestNamespace/NS_compunit_01A.cs @@ -0,0 +1,15 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using System.Diagnostics; + +class NS_TestClass_compunit_01A +{ + public void printClassName() + { + Debug.WriteLine("Class A"); + } +} \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/NS_compunit_01B.cs b/Tests/NFUnitTestNamespace/NS_compunit_01B.cs new file mode 100644 index 00000000..081ddb72 --- /dev/null +++ b/Tests/NFUnitTestNamespace/NS_compunit_01B.cs @@ -0,0 +1,15 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using System.Diagnostics; + +class NS_TestClass_compunit_01B +{ + public void printClassName() + { + Debug.WriteLine("Class B"); + } +} \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/NS_compunit_03A.cs b/Tests/NFUnitTestNamespace/NS_compunit_03A.cs new file mode 100644 index 00000000..715c1103 --- /dev/null +++ b/Tests/NFUnitTestNamespace/NS_compunit_03A.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using System.Diagnostics; + +class NS_TestClass_compunit_03A +{ + public void printClassName() + { + NS_TestClass_compunit_03B cB = new NS_TestClass_compunit_03B(); + cB.showName(); + } + + public void showName() + { + Debug.WriteLine("Class A"); + } +} \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/NS_compunit_03B.cs b/Tests/NFUnitTestNamespace/NS_compunit_03B.cs new file mode 100644 index 00000000..2cf49767 --- /dev/null +++ b/Tests/NFUnitTestNamespace/NS_compunit_03B.cs @@ -0,0 +1,20 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// +using System.Diagnostics; + +class NS_TestClass_compunit_03B +{ + public void printClassName() + { + NS_TestClass_compunit_03 cC = new NS_TestClass_compunit_03(); + cC.showName(); + } + + public void showName() + { + Debug.WriteLine("Class B"); + } +} diff --git a/Tests/NFUnitTestNamespace/NS_compunit_04A.cs b/Tests/NFUnitTestNamespace/NS_compunit_04A.cs new file mode 100644 index 00000000..584c4762 --- /dev/null +++ b/Tests/NFUnitTestNamespace/NS_compunit_04A.cs @@ -0,0 +1,21 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +namespace NS_TestClass_compunit_04_first +{ + + using System; + using System.Diagnostics; + + class NS_TestClass_compunit_04A + { + public void printClassName() + { + Debug.WriteLine("Class A"); + } + } + +} \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/NS_compunit_04B.cs b/Tests/NFUnitTestNamespace/NS_compunit_04B.cs new file mode 100644 index 00000000..f8270efc --- /dev/null +++ b/Tests/NFUnitTestNamespace/NS_compunit_04B.cs @@ -0,0 +1,20 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using System.Diagnostics; + +namespace NS_TestClass_compunit_04_second +{ + using System; + + class NS_TestClass_compunit_04A + { + public void printClassName() + { + Debug.WriteLine("Class B"); + } + } +} diff --git a/Tests/NFUnitTestNamespace/NS_decl_14.cs b/Tests/NFUnitTestNamespace/NS_decl_14.cs new file mode 100644 index 00000000..06891922 --- /dev/null +++ b/Tests/NFUnitTestNamespace/NS_decl_14.cs @@ -0,0 +1,13 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +namespace NS_TestClass_decl_14_one.NS_TestClass_decl_14_two.NS_TestClass_decl_14_three +{ + class C + { + public int j; + } +} \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/NS_decl_15.cs b/Tests/NFUnitTestNamespace/NS_decl_15.cs new file mode 100644 index 00000000..f53ef60a --- /dev/null +++ b/Tests/NFUnitTestNamespace/NS_decl_15.cs @@ -0,0 +1,13 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +namespace NS_TestClass_decl_15_one.NS_TestClass_decl_15_two.NS_TestClass_decl_15_three +{ + class C + { + public int j; + } +} \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/Properties/AssemblyInfo.cs b/Tests/NFUnitTestNamespace/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestNamespace/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestNamespace/UnitTestNamespaceTests.cs b/Tests/NFUnitTestNamespace/UnitTestNamespaceTests.cs new file mode 100644 index 00000000..7be2e77e --- /dev/null +++ b/Tests/NFUnitTestNamespace/UnitTestNamespaceTests.cs @@ -0,0 +1,1643 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +using NS_TestClass_alias_10_F = NS_TestClass_alias_10_Foo.Bar; + +namespace NFUnitTestNamespace +{ + [CLSCompliant(false)] + [TestClass] + public class UnitTestNamespaceTests + { + [TestMethod] + public void NS_attribute_01_Test() + { + Debug.WriteLine("Section 9.1 Compilation Units"); + Debug.WriteLine("Verify that the CLSCompliant attribute is allowed at the assembly level in a comp. unit"); + Assert.True(NS_TestClass_attribute_01.testMethod()); + } + + [TestMethod] + public void NS_attribute_02_Test() + { + Debug.WriteLine("Section 9.1 Compilation Units"); + Debug.WriteLine("Verify that the CLSCompliant attribute is allowed at the module level in a comp. unit (cause a warning)"); + Assert.True(NS_TestClass_attribute_02.testMethod()) ; + } + + [TestMethod] + public void NS_compunit_01_Test() + { + Debug.WriteLine("Section 9.1 Compilation Units"); + Debug.WriteLine("Verify that a program with multiple files depending on each other works"); + Assert.True(NS_TestClass_compunit_01.testMethod()) ; + } + + [TestMethod] + public void NS_compunit_03_Test() + { + Debug.WriteLine("Section 9.1 Compilation Units"); + Debug.WriteLine("Verify three source files all requiring each other in circular fashion compiles/runs successfully"); + Assert.True(NS_TestClass_compunit_03.testMethod()); + } + + [TestMethod] + public void NS_compunit_04_Test() + { + Debug.WriteLine("Section 9.1 Compilation Units"); + Debug.WriteLine("Two source files with their own namespaces, each have a class named A, and can be used successfully by a third file"); + Assert.True(NS_TestClass_compunit_04.testMethod()); + } + + [TestMethod] + public void NS_decl_01_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Declare the simplest namespace possible (without semi-colon at the end)"); + Assert.True(NS_TestClass_decl_01.A.testMethod()); + } + + [TestMethod] + public void NS_decl_02_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Declare the simplest namespace possible (with semi-colon at the end)"); + Assert.True(NS_TestClass_decl_02.A.testMethod()); + } + + [TestMethod] + public void NS_decl_03_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Declare a namespace inside another namespace"); + Assert.True(NS_TestClass_decl_03.A.testMethod()); + } + + [TestMethod] + public void NS_decl_04_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Declare a namespace inside another namespace (with semicolon at end of nested ns decl)"); + Assert.True(NS_TestClass_decl_04.A.testMethod()); + } + + [TestMethod] + public void NS_decl_05_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Two separately declared namespaces in one compilation unit (file)"); + Assert.True(NS_TestClass_decl_05.A.testMethod()); + } + + [TestMethod] + public void NS_decl_06_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Two separately declared namespaces in one compilation unit (file)"); + Assert.True(NS_TestClass_decl_06.A.testMethod()); + } + + [TestMethod] + public void NS_decl_08_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Access class member declared in external namespace directly when adding a Using"); + Assert.True(NS_TestClass_decl_08.A.testMethod()); + } + + [TestMethod] + public void NS_decl_10_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Namespace identifier with . in it"); + Assert.True(NS_TestClass_decl_10.foo.A.testMethod()); + } + + [TestMethod] + public void NS_decl_11_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Namespace identifier with .'s in it and underscores, etc."); + Assert.True(NS_TestClass_decl_11.foo.A.testMethod()); + } + + [TestMethod] + public void NS_decl_12_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Two separate namespace declarations contribute to same declaration space (with using)"); + Assert.True(NS_TestClass_decl_12.foo.A.testMethod()); + } + + [TestMethod] + public void NS_decl_13_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Two separate namespace declarations contribute to same declaration space (direct referencing)"); + Assert.True(NS_TestClass_decl_13.foo.A.testMethod()); + } + + [TestMethod] + public void NS_decl_14_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Two separate namespace declarations contribute to same declaration space (direct referencing)"); + Debug.WriteLine(" namespace declarations are in two different compilation units (files)"); + Assert.True(NS_TestClass_decl_14.foo.A.testMethod()); + } + + [TestMethod] + public void NS_decl_15_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Two separate namespace declarations contribute to same declaration space (with using)"); + Debug.WriteLine(" namespace declarations are in two different compilation units (files)"); + Assert.True(NS_TestClass_decl_15.foo.A.testMethod()); + } + + [TestMethod] + public void NS_decl_17_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Declare a namespace called _Foo"); + Assert.True(NS_TestClass_decl_17.main.testMethod()); + } + + [TestMethod] + public void NS_decl_20_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Declare an empty namespace"); + Assert.True(NS_TestClass_decl_20.main.testMethod()); + } + + [TestMethod] + public void NS_decl_21_Test() + { + Debug.WriteLine("Section 9.2 Namespace Declarations"); + Debug.WriteLine("Declare ten empty nested namespaces (with and without semi-colons)"); + Assert.True(NS_TestClass_decl_21.main.testMethod()); + } + + [TestMethod] + public void NS_alias_01_Test() + { + Debug.WriteLine("Section 9.3.1 Using alias directives "); + Debug.WriteLine("Verify simplest form of alias reference to a namespace"); + Assert.True(NS_TestClass_alias_01.A.testMethod()); + } + + [TestMethod] + public void NS_alias_02_Test() + { + Debug.WriteLine("Section 9.3.1 Using alias directives "); + Debug.WriteLine("Verify simplest form of alias reference to a namespace with .'s"); + Assert.True(NS_TestClass_alias_02.A.testMethod()); + } + + [TestMethod] + public void NS_alias_03_Test() + { + Debug.WriteLine("Section 9.3.1 Using alias directives "); + Debug.WriteLine("Verify simplest form of alias reference to a specific type in a namespace"); + Assert.True(NS_TestClass_alias_03.A.testMethod()); + } + + [TestMethod] + public void NS_alias_04_Test() + { + Debug.WriteLine("Section 9.3.1 Using alias directives "); + Debug.WriteLine("Verify simplest form of alias reference to a specific type in a namespace"); + Assert.True(NS_TestClass_alias_04.B.testMethod()); + } + + [TestMethod] + public void NS_alias_10_Test() + { + Debug.WriteLine("Section 9.3.1 Using alias directives "); + Debug.WriteLine("Third code example in 9.3.1 - unique alias identifiers"); + Assert.True(NS_TestClass_alias_10.main.testMethod()); + } + + [TestMethod] + public void NS_alias_13_Test() + { + Debug.WriteLine("Section 9.3.1 Using alias directives "); + Debug.WriteLine("A using-alias-directive can create an alias for the namespace in which it appears"); + Assert.True(NS_TestClass_alias_13.main.testMethod()); + } + + [TestMethod] + public void NS_alias_14_Test() + { + Debug.WriteLine("Section 9.3.1 Using namespace directives "); + Debug.WriteLine("A using-alias-directive can create an alias for a type declared within the ns in which it appears "); + Assert.True(NS_TestClass_alias_14.main.testMethod()); + } + + [TestMethod] + public void NS_direct_01_Test() + { + Debug.WriteLine("Section 9.3.2 Using namespace directives "); + Debug.WriteLine("The members of a namespace can be accessed directly post using "); + Assert.True(NS_TestClass_direct_01.main.testMethod()); + } + + [TestMethod] + public void NS_direct_02_Test() + { + Debug.WriteLine("Section 9.3.2 Using namespace directives "); + Debug.WriteLine("A newly declared class will hide a class (with the same name) brought in with a using directive"); + Assert.True(NS_TestClass_direct_02.main.testMethod()); + } + + [TestMethod] + public void NS_direct_03_Test() + { + Debug.WriteLine("Section 9.3.2 Using namespace directives "); + Debug.WriteLine("Names imported by using-namespace-directive are hidden by same-named members "); + Assert.True(NS_TestClass_direct_03.main.testMethod()); + } + + [TestMethod] + public void NS_direct_05_Test() + { + Debug.WriteLine("Section 9.3.2 Using namespace directives "); + Debug.WriteLine("Ambiguous reference is overridden by using alias statement"); + Assert.True(NS_TestClass_direct_05.main.testMethod()); + } + + [TestMethod] + public void NS_typedecl_01_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Ambiguous reference is overridden by using alias statement"); + Assert.True(NS_TestClass_typedecl_01.testMethod()); + } + + [TestMethod] + public void NS_typedecl_06_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Declaring a class member as public is okay"); + Assert.True(NS_TestClass_typedecl_06.testMethod()); + } + + [TestMethod] + public void NS_typedecl_07_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Declaring a class member as protected internal is okay"); + Assert.True(NS_TestClass_typedecl_07.testMethod()); + } + + [TestMethod] + public void NS_typedecl_08_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Declaring a class member as protected is okay"); + Assert.True(NS_TestClass_typedecl_08.testMethod()); + } + + [TestMethod] + public void NS_typedecl_09_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Declaring a class member as internal is okay"); + Assert.True(NS_TestClass_typedecl_09.testMethod()); + } + + [TestMethod] + public void NS_typedecl_10_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Declaring a class member as private is okay"); + Assert.True(NS_TestClass_typedecl_10.testMethod()); + } + + [TestMethod] + public void NS_typedecl_11_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Declaring a struct member as public is okay"); + Assert.True(NS_TestClass_typedecl_11.testMethod()); + } + + [TestMethod] + public void NS_typedecl_12_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Declaring a struct member as internal is okay"); + Assert.True(NS_TestClass_typedecl_12.testMethod()); + } + + [TestMethod] + public void NS_typedecl_13_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Declaring a struct member as private is okay"); + Assert.True(NS_TestClass_typedecl_13.testMethod()); + } + + [TestMethod] + public void NS_validaccess_01_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Verify all valid accessibility levels for class declarations are allowed"); + Assert.True(NS_TestClass_validaccess_01.testMethod()); + } + + [TestMethod] + public void NS_validaccess_02_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Verify all valid accessibility levels for struct declarations are allowed"); + Assert.True(NS_TestClass_validaccess_02.testMethod()); + } + + [TestMethod] + public void NS_validaccess_03_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Verify all valid accessibility levels for interface declarations are allowed"); + Assert.True(NS_TestClass_validaccess_03.testMethod()); + } + + [TestMethod] + public void NS_validaccess_04_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Verify all valid accessibility levels for enum declarations are allowed"); + Assert.True(NS_TestClass_validaccess_04.testMethod()); + } + + [TestMethod] + public void NS_validaccess_05_Test() + { + Debug.WriteLine("Section 9.5 Type declarations "); + Debug.WriteLine("Verify all valid accessibility levels for delegate declarations are allowed"); + Assert.True(NS_TestClass_validaccess_05.testMethod()); + } + + [TestMethod] + public void NS_contexts_025_Test() + { + Debug.WriteLine("Verify that you can use the qualifier in a cref attribute of xml docs tag"); + Assert.True(NS_TestClass_contexts_025.Test.testMethod()); + } + + + class NS_TestClass_compunit_01 + { + public static void Main_old(String[] args) + { + NS_TestClass_compunit_01A cA = new NS_TestClass_compunit_01A(); + NS_TestClass_compunit_01B cB = new NS_TestClass_compunit_01B(); + + cA.printClassName(); + cB.printClassName(); + Debug.WriteLine("Class C"); + } + + public static bool testMethod() + { + Main_old(null); + return true; + } + } + + + + + + class NS_TestClass_compunit_04 + { + public static void Main_old(String[] args) + { + NS_TestClass_compunit_04_first.NS_TestClass_compunit_04A cA = new NS_TestClass_compunit_04_first.NS_TestClass_compunit_04A(); + NS_TestClass_compunit_04_second.NS_TestClass_compunit_04A cB = new NS_TestClass_compunit_04_second.NS_TestClass_compunit_04A(); + + cA.printClassName(); + cB.printClassName(); + Debug.WriteLine("Class C"); + } + + public static bool testMethod() + { + Main_old(null); + return true; + } + } + //Compiled Test Cases + public class NS_TestClass_typedecl_01_A { } + internal class B { } + class NS_TestClass_typedecl_01 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class NS_TestClass_typedecl_06_A + { + public int a; + } + class NS_TestClass_typedecl_06 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class NS_TestClass_typedecl_07_A + { + protected internal int a; + } + class NS_TestClass_typedecl_07 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class NS_TestClass_typedecl_08_A + { + protected int a; + } + class NS_TestClass_typedecl_08 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class NS_TestClass_typedecl_09_A + { + internal int a; + } + class NS_TestClass_typedecl_09 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class NS_TestClass_typedecl_10_A + { + private int a; + public void TheMethod() + { + // This code is here basically to avoid any "not using a" compiler warnings + a = 5; + if (a == 5) + a++; + } + } + class NS_TestClass_typedecl_10 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + struct NS_TestClass_typedecl_11_A + { + public int a; + } + class NS_TestClass_typedecl_11 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + struct NS_TestClass_typedecl_12_A + { + internal int a; + } + class NS_TestClass_typedecl_12 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + struct NS_TestClass_typedecl_13_A + { + private int a; + public void MyMethod() + { + // This code is here to avoid the "a not used" compiler warning + a = 5; + if (a == 5) + a++; + } + } + class NS_TestClass_typedecl_13 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + + } +} + +class NS_TestClass_compunit_03 +{ + public void printClassName() + { + NS_TestClass_compunit_03A cA = new NS_TestClass_compunit_03A(); + cA.showName(); + } + + public void showName() + { + Debug.WriteLine("Class C"); + } + + public static void Main_old(String[] args) + { + NS_TestClass_compunit_03A mainA = new NS_TestClass_compunit_03A(); + NS_TestClass_compunit_03B mainB = new NS_TestClass_compunit_03B(); + NS_TestClass_compunit_03 mainC = new NS_TestClass_compunit_03(); + + mainA.printClassName(); + mainB.printClassName(); + mainC.printClassName(); + } + + public static bool testMethod() + { + Main_old(null); + return true; + } +} + +namespace NS_TestClass_decl_01 +{ + using System; + class A + { + public static void Main_old(String[] args) + { + Debug.WriteLine("This worked!"); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} +namespace NS_TestClass_decl_02 +{ + using System; + class A + { + public static void Main_old(String[] args) + { + Debug.WriteLine("This worked!"); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} +namespace NS_TestClass_decl_03 +{ + using System; + namespace innertest + { + class B + { + public int i; + } + } + class A + { + public static void Main_old(String[] args) + { + innertest.B b = new innertest.B(); + b.i = 3; + + Debug.WriteLine((b.i).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} +namespace NS_TestClass_decl_04 +{ + using System; + namespace innertest + { + class B + { + public int i; + } + }; + class A + { + public static void Main_old(String[] args) + { + innertest.B b = new innertest.B(); + b.i = 3; + + Debug.WriteLine((b.i).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} +namespace NS_TestClass_decl_05_other +{ + class B + { + public int i; + } +} +namespace NS_TestClass_decl_05 +{ + using System; + class A + { + public static void Main_old(String[] args) + { + NS_TestClass_decl_05_other.B b = new NS_TestClass_decl_05_other.B(); + b.i = 500; + Debug.WriteLine((b.i).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} +namespace NS_TestClass_decl_06_other +{ + namespace inothertest + { + class B + { + public int i; + } + } +} +namespace NS_TestClass_decl_06 +{ + using System; + class A + { + public static void Main_old(String[] args) + { + NS_TestClass_decl_06_other.inothertest.B b = new NS_TestClass_decl_06_other.inothertest.B(); + b.i = 500; + Debug.WriteLine((b.i).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} +namespace other +{ + class B + { + public int i; + } +} +namespace NS_TestClass_decl_08 +{ + using System; + using other; + class A + { + public static void Main_old(String[] args) + { + B b = new B(); + b.i = 3; + Debug.WriteLine((b.i).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} +namespace NS_TestClass_decl_10_one.NS_TestClass_decl_10_two.NS_TestClass_decl_10_three +{ + class B + { + public int i; + } +} +namespace NS_TestClass_decl_10.foo +{ + using System; + class A + { + public static void Main_old(String[] args) + { + NS_TestClass_decl_10_one.NS_TestClass_decl_10_two.NS_TestClass_decl_10_three.B b = new NS_TestClass_decl_10_one.NS_TestClass_decl_10_two.NS_TestClass_decl_10_three.B(); + b.i = 500; + + Debug.WriteLine((b.i).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} +namespace NS_TestClass_decl_11_one._two._three_ +{ + class B + { + public int i; + } +} +namespace ___space.word_ +{ + class C + { + public int j; + } +} +namespace NS_TestClass_decl_11.foo +{ + using System; + using ___space.word_; + class A + { + public static void Main_old(String[] args) + { + NS_TestClass_decl_11_one._two._three_.B b = new NS_TestClass_decl_11_one._two._three_.B(); + C c = new C(); + + b.i = 500; + c.j = 300; + Debug.WriteLine((b.i).ToString()); + Debug.WriteLine((c.j).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} +namespace NS_TestClass_decl_12_one.NS_TestClass_decl_12_two.NS_TestClass_decl_12_three +{ + class B + { + public int i; + } +} +namespace NS_TestClass_decl_12_one.NS_TestClass_decl_12_two.NS_TestClass_decl_12_three +{ + class C + { + public int j; + } +} +namespace NS_TestClass_decl_12.foo +{ + using System; + using NS_TestClass_decl_12_one.NS_TestClass_decl_12_two.NS_TestClass_decl_12_three; + class A + { + public static void Main_old(String[] args) + { + B b = new B(); + C c = new C(); + + b.i = 500; + c.j = 300; + Debug.WriteLine((b.i).ToString()); + Debug.WriteLine((c.j).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} +namespace NS_TestClass_decl_13_one.NS_TestClass_decl_13_two.NS_TestClass_decl_13_three +{ + class B + { + public int i; + } +} +namespace NS_TestClass_decl_13_one.NS_TestClass_decl_13_two.NS_TestClass_decl_13_three +{ + class C + { + public int j; + } +} +namespace NS_TestClass_decl_13.foo +{ + using System; + class A + { + public static void Main_old(String[] args) + { + NS_TestClass_decl_13_one.NS_TestClass_decl_13_two.NS_TestClass_decl_13_three.B b = new NS_TestClass_decl_13_one.NS_TestClass_decl_13_two.NS_TestClass_decl_13_three.B(); + NS_TestClass_decl_13_one.NS_TestClass_decl_13_two.NS_TestClass_decl_13_three.C c = new NS_TestClass_decl_13_one.NS_TestClass_decl_13_two.NS_TestClass_decl_13_three.C(); + + b.i = 500; + c.j = 300; + Debug.WriteLine((b.i).ToString()); + Debug.WriteLine((c.j).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} +namespace NS_TestClass_decl_14_one.NS_TestClass_decl_14_two.NS_TestClass_decl_14_three +{ + class B + { + public int i; + } +} + +namespace NS_TestClass_decl_14.foo +{ + using System; + + class A + { + public static void Main_old(String[] args) + { + NS_TestClass_decl_14_one.NS_TestClass_decl_14_two.NS_TestClass_decl_14_three.B b = new NS_TestClass_decl_14_one.NS_TestClass_decl_14_two.NS_TestClass_decl_14_three.B(); + NS_TestClass_decl_14_one.NS_TestClass_decl_14_two.NS_TestClass_decl_14_three.C c = new NS_TestClass_decl_14_one.NS_TestClass_decl_14_two.NS_TestClass_decl_14_three.C(); + + b.i = 500; + c.j = 300; + Debug.WriteLine((b.i).ToString()); + Debug.WriteLine((c.j).ToString()); + } + + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} + +namespace NS_TestClass_decl_15_one.NS_TestClass_decl_15_two.NS_TestClass_decl_15_three +{ + class B + { + public int i; + } +} + +namespace NS_TestClass_decl_15.foo +{ + using System; + using NS_TestClass_decl_15_one.NS_TestClass_decl_15_two.NS_TestClass_decl_15_three; + + class A + { + public static void Main_old(String[] args) + { + B b = new B(); + C c = new C(); + + b.i = 500; + c.j = 300; + Debug.WriteLine((b.i).ToString()); + Debug.WriteLine((c.j).ToString()); + } + + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} + + +namespace NS_TestClass_decl_17_Foo +{ + class A + { + public void print() + { + Debug.WriteLine("Test"); + } + } +} +namespace NS_TestClass_decl_17 +{ + class main + { + public static void Main_old() + { + NS_TestClass_decl_17_Foo.A a = new NS_TestClass_decl_17_Foo.A(); + a.print(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } +} +namespace NS_TestClass_decl_20_test +{ +} +namespace NS_TestClass_decl_20 +{ + class main + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } +} +namespace NS_TestClass_decl_21_test +{ + namespace test2 + { + namespace test3 + { + namespace test4 + { + namespace test5 + { + namespace test6 + { + namespace test7 + { + namespace test8 + { + namespace test9 + { + namespace test10 + { + class TheClass + { + public void SayHello() + { + Debug.WriteLine("Hello"); + } + } + } + }; + }; + } + } + }; + }; + } + }; +} +namespace NS_TestClass_decl_21 +{ + class main + { + public static void Main_old() + { + NS_TestClass_decl_21_test.test2.test3.test4.test5.test6.test7.test8.test9.test10.TheClass tc; + tc = new NS_TestClass_decl_21_test.test2.test3.test4.test5.test6.test7.test8.test9.test10.TheClass(); + tc.SayHello(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } +} + +namespace NS_TestClass_alias_01_externalnamespace +{ + class B + { + public int i; + } +} + +namespace NS_TestClass_alias_01 +{ + using System; + using en = NS_TestClass_alias_01_externalnamespace; + + class A + { + + public static void Main_old(String[] args) + { + en.B b = new en.B(); + b.i = 3; + + Debug.WriteLine((b.i).ToString()); + } + + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} + +namespace NS_TestClass_alias_02_test.nspace +{ + class B + { + public int i; + } +} + +namespace NS_TestClass_alias_02 +{ + using System; + using tn = NS_TestClass_alias_02_test.nspace; + + class A + { + + public static void Main_old(String[] args) + { + tn.B b = new tn.B(); + b.i = 3; + + Debug.WriteLine((b.i).ToString()); + } + + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} +namespace NS_TestClass_alias_03_test.nspace +{ + class B + { + public int i; + } +} + +namespace NS_TestClass_alias_03 +{ + using System; + using tn = NS_TestClass_alias_03_test.nspace.B; + + class A + { + + public static void Main_old(String[] args) + { + tn b = new tn(); + b.i = 3; + + Debug.WriteLine((b.i).ToString()); + } + + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} + +namespace NS_TestClass_alias_04_Foo.Bar +{ + class A { } +} + +namespace NS_TestClass_alias_04 +{ + using F = NS_TestClass_alias_04_Foo.Bar; + using System; + + class B : F.A + { + public static void Main_old(String[] args) + { + Debug.WriteLine("Worked!"); + } + + public static bool testMethod() + { + Main_old(null); + return true; + } + } +} + + + +namespace NS_TestClass_alias_10_Foo.Bar +{ + class A { } +} + +namespace NS_TestClass_alias_10_Baz +{ + class B : NS_TestClass_alias_10_F.A { } +} + +namespace NS_TestClass_alias_10 +{ + using System; + + class C : NS_TestClass_alias_10_F.A { } + + class main + { + public static int Main_old() + { + return 0; + } + + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} + +namespace NS_TestClass_alias_13 +{ + using tns = NS_TestClass_alias_13; + using System; + + class main + { + public static int Main_old() + { + return 0; + } + + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} + +namespace NS_TestClass_alias_14 +{ + using tns = NS_TestClass_alias_14.main; + using System; + + class main + { + public static int Main_old() + { + return 0; + } + + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} + +namespace NS_TestClass_direct_01_Foo.Bar +{ + class A { } +} + +namespace NS_TestClass_direct_01 +{ + using NS_TestClass_direct_01_Foo.Bar; + using System; + + class B : A { } + + class main + { + + public static int Main_old() + { + return 0; + } + + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} + +namespace NS_TestClass_direct_02_Foo.Bar +{ + class A + { + public void showMessage() + { + Debug.WriteLine("Foo.Bar.A"); + } + } +} + +namespace NS_TestClass_direct_02 +{ + using NS_TestClass_direct_02_Foo.Bar; + using System; + + class A + { + public void showMessage() + { + Debug.WriteLine("testns.A"); + } + } + + class main + { + public static void Main_old() + { + A a = new A(); + a.showMessage(); + } + + public static bool testMethod() + { + Main_old(); + return true; + } + } +} + +namespace NS_TestClass_direct_03_Foo.Bar +{ + class A { } +} + +namespace NS_TestClass_direct_03 +{ + using NS_TestClass_direct_03_Foo.Bar; + using System; + + class A + { + public int i; + } + + class main + { + + public static int Main_old() + { + A a = new A(); + a.i = 25; + + Debug.WriteLine("This works!"); + + return 0; + } + + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} + +namespace NS_TestClass_direct_05_Foo +{ + class A { } +} + +namespace NS_TestClass_direct_05_Bar +{ + class A { } +} + +namespace NS_TestClass_direct_05 +{ + using NS_TestClass_direct_05_Foo; + using NS_TestClass_direct_05_Bar; + using A = NS_TestClass_direct_05_Foo.A; + using System; + + class main + { + public static int Main_old() + { + A a = new A(); + + Debug.WriteLine("This works!"); + + return 0; + } + + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} + +class C1 { } +public class C2 { } +internal class C3 { } + +namespace N +{ + class C4 { } + public class C5 { } + internal class C6 { } +} + +class C +{ + class C7 { } + public class C8 { } + protected internal class C9 { } + protected class C10 { } + internal class C11 { } + private class C12 { } +} + +struct S +{ + class C13 { } + public class C14 { } + internal class C15 { } + private class C16 { } +} + +class NS_TestClass_validaccess_01 +{ + static void Main_old() { } + + public static bool testMethod() + { + Main_old(); + return true; + } +} + +struct S1 { } +public struct S2 { } +internal struct S3 { } + +namespace N +{ + struct S4 { } + public struct S5 { } + internal struct S6 { } +} + +class C_02 +{ + struct S7 { } + public struct S8 { } + protected internal struct S9 { } + protected struct S10 { } + internal struct S11 { } + private struct S12 { } +} + +struct S_02 +{ + struct S13 { } + public struct S14 { } + internal struct S15 { } + private struct S16 { } +} + +class NS_TestClass_validaccess_02 +{ + static void Main_old() { } + + public static bool testMethod() + { + Main_old(); + return true; + } +} + +interface I1 { } +public interface I2 { } +internal interface I3 { } + +namespace N1 +{ + interface I4 { } + public interface I5 { } + internal interface I6 { } +} + +class C1_03 +{ + interface I7 { } + public interface I8 { } + protected internal interface I9 { } + protected interface I10 { } + internal interface I11 { } + private interface I12 { } +} + +struct S1_03 +{ + interface I13 { } + public interface I14 { } + internal interface I15 { } + private interface I16 { } +} + +class NS_TestClass_validaccess_03 +{ + static void Main_old() { } + + public static bool testMethod() + { + Main_old(); + return true; + } +} + + + +enum E1 { } +public enum E2 { } +internal enum E3 { } + +namespace N1 +{ + enum E4 { } + public enum E5 { } + internal enum E6 { } +} + +class C1_04 +{ + enum E7 { } + public enum E8 { } + protected internal enum E9 { } + protected enum E10 { } + internal enum E11 { } + private enum E12 { } +} + +struct S1_04 +{ + enum E13 { } + public enum E14 { } + internal enum E15 { } + private enum E16 { } +} + +class NS_TestClass_validaccess_04 +{ + static void Main_old() { } + + public static bool testMethod() + { + Main_old(); + return true; + } +} + +delegate void D1(); +public delegate void D2(); +internal delegate void D3(); + +namespace N1 +{ + delegate void D4(); + public delegate void D5(); + internal delegate void D6(); +} + +class C1_05 +{ + delegate void D7(); + public delegate void D8(); + protected internal delegate void D9(); + protected delegate void D10(); + internal delegate void D11(); + private delegate void D12(); +} + +struct S1_05 +{ + delegate void D13(); + public delegate void D14(); + internal delegate void D15(); + private delegate void D16(); +} + +class NS_TestClass_validaccess_05 +{ + static void Main_old() { } + + public static bool testMethod() + { + Main_old(); + return true; + } +} + +namespace NS_TestClass_contexts_025 +{ + class Test + { + /// + public static void M1() + { + throw new System.Exception(); + } + + static int Main_old() + { + try + { + NS_TestClass_contexts_025.Test.M1(); + } + catch + { + return 0; + } + + return 1; + } + + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} diff --git a/Tests/NFUnitTestNamespace/nano.runsettings b/Tests/NFUnitTestNamespace/nano.runsettings new file mode 100644 index 00000000..fa881e3a --- /dev/null +++ b/Tests/NFUnitTestNamespace/nano.runsettings @@ -0,0 +1,14 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + False + + \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/packages.config b/Tests/NFUnitTestNamespace/packages.config new file mode 100644 index 00000000..1adb9284 --- /dev/null +++ b/Tests/NFUnitTestNamespace/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/NFUnitTestStatementsTests.nfproj b/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj similarity index 100% rename from Tests/NFUnitTestStatementsTests/NFUnitTestStatementsTests.nfproj rename to Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj diff --git a/Tests/NFUnitTestStruct/UnitTestStructs.cs b/Tests/NFUnitTestStruct/UnitTestStructs.cs index b4cdd633..daeecbb8 100644 --- a/Tests/NFUnitTestStruct/UnitTestStructs.cs +++ b/Tests/NFUnitTestStruct/UnitTestStructs.cs @@ -1,3 +1,9 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/Tests/NFUnitTestSystemLib/UnitTestGCTest.cs b/Tests/NFUnitTestSystemLib/UnitTestGCTest.cs index 36e77f1e..a2b64261 100644 --- a/Tests/NFUnitTestSystemLib/UnitTestGCTest.cs +++ b/Tests/NFUnitTestSystemLib/UnitTestGCTest.cs @@ -1,4 +1,10 @@ -using nanoFramework.TestFramework; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs b/Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs index 9ba4625a..59db64a7 100644 --- a/Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs +++ b/Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs @@ -1,4 +1,10 @@ -using nanoFramework.TestFramework; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; using System; using System.Collections; using System.Diagnostics; diff --git a/Tests/NFUnitTestSystemLib/UnitTestParseTests.cs b/Tests/NFUnitTestSystemLib/UnitTestParseTests.cs index 6f0ddca3..68588116 100644 --- a/Tests/NFUnitTestSystemLib/UnitTestParseTests.cs +++ b/Tests/NFUnitTestSystemLib/UnitTestParseTests.cs @@ -1,4 +1,10 @@ -using nanoFramework.TestFramework; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/Tests/NFUnitTestSystemLib/UnitTestStringTests.cs b/Tests/NFUnitTestSystemLib/UnitTestStringTests.cs index 9b011333..24dccda0 100644 --- a/Tests/NFUnitTestSystemLib/UnitTestStringTests.cs +++ b/Tests/NFUnitTestSystemLib/UnitTestStringTests.cs @@ -1,4 +1,10 @@ -using nanoFramework.TestFramework; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/Tests/NFUnitTestSystemLib/UnitTestTypeTests.cs b/Tests/NFUnitTestSystemLib/UnitTestTypeTests.cs index 7d5abbb3..f102065c 100644 --- a/Tests/NFUnitTestSystemLib/UnitTestTypeTests.cs +++ b/Tests/NFUnitTestSystemLib/UnitTestTypeTests.cs @@ -1,4 +1,10 @@ -using nanoFramework.TestFramework; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; using System; using System.Diagnostics; using System.Reflection; diff --git a/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs b/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs index 255ebf9b..5c0e6459 100644 --- a/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs +++ b/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs @@ -1,4 +1,10 @@ -using nanoFramework.TestFramework; +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 4e170aab..09e1dfda 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -29,7 +29,9 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestSystemLib", "Test EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestStruct", "Tests\NFUnitTestStruct\NFUnitTestStruct.nfproj", "{77D55D0B-A50F-4CAF-8CC5-F15063D9A41E}" EndProject -Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestStatementsTests", "Tests\NFUnitTestStatementsTests\NFUnitTestStatementsTests.nfproj", "{222D8571-6646-47E4-95A5-8AED732DCB70}" +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestStatements", "Tests\NFUnitTestStatementsTests\NFUnitTestStatements.nfproj", "{222D8571-6646-47E4-95A5-8AED732DCB70}" +EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestNamespace", "Tests\NFUnitTestNamespace\NFUnitTestNamespace.nfproj", "{9B5EFD66-CCDC-4D00-960C-993296C56F3B}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -87,6 +89,12 @@ Global {222D8571-6646-47E4-95A5-8AED732DCB70}.Release|Any CPU.ActiveCfg = Release|Any CPU {222D8571-6646-47E4-95A5-8AED732DCB70}.Release|Any CPU.Build.0 = Release|Any CPU {222D8571-6646-47E4-95A5-8AED732DCB70}.Release|Any CPU.Deploy.0 = Release|Any CPU + {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Release|Any CPU.Build.0 = Release|Any CPU + {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -99,6 +107,7 @@ Global {E63A23A8-5335-4976-BA47-0AC7F1AEDD32} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {77D55D0B-A50F-4CAF-8CC5-F15063D9A41E} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {222D8571-6646-47E4-95A5-8AED732DCB70} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {9B5EFD66-CCDC-4D00-960C-993296C56F3B} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From f87171067bee90cf1fbc274cb0a0e5f9fb0a830d Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 12:38:58 +0300 Subject: [PATCH 29/55] Adding LExical tests --- .../NFUnitTestLexical.nfproj | 60 + .../Properties/AssemblyInfo.cs | 33 + .../NFUnitTestLexical/UnitTestLExicalTest1.cs | 2349 +++++++++++++++++ Tests/NFUnitTestLexical/nano.runsettings | 13 + Tests/NFUnitTestLexical/packages.config | 5 + nanoFramework.CoreLibrary.sln | 9 + 6 files changed, 2469 insertions(+) create mode 100644 Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj create mode 100644 Tests/NFUnitTestLexical/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestLexical/UnitTestLExicalTest1.cs create mode 100644 Tests/NFUnitTestLexical/nano.runsettings create mode 100644 Tests/NFUnitTestLexical/packages.config diff --git a/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj new file mode 100644 index 00000000..ac47ea3f --- /dev/null +++ b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj @@ -0,0 +1,60 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + e0538338-9941-410c-b8c8-0c928f26f8a7 + Library + Properties + 512 + NFUnitTestLexical + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/Properties/AssemblyInfo.cs b/Tests/NFUnitTestLexical/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestLexical/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestLexical/UnitTestLExicalTest1.cs b/Tests/NFUnitTestLexical/UnitTestLExicalTest1.cs new file mode 100644 index 00000000..37196e27 --- /dev/null +++ b/Tests/NFUnitTestLexical/UnitTestLExicalTest1.cs @@ -0,0 +1,2349 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#define \u0066endf2 + +#define \u0066oobar2 + +#define middle\u0066oobar + +#define end\u0066 + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestLexical +{ + [TestClass] + public class UnitTestLExicalTest1 + { + [TestMethod] + public void Lexical_comments_01_Test() + { + Debug.WriteLine("Section 2.4.4 Test"); + Debug.WriteLine("Verifies valid/invalid comment"); + Assert.True(Lexical_TestClass_comments_01.testMethod()); + } + + [TestMethod] + public void Lexical_comments_02_Test() + { + Debug.WriteLine("Section 2.4.4 Test"); + Debug.WriteLine("Verifies valid/invalid comment"); + Assert.True(Lexical_TestClass_comments_02.testMethod()); + } + + [TestMethod] + public void Lexical_comments_03_Test() + { + Debug.WriteLine("Section 2.4.4 Test"); + Debug.WriteLine("Verifies valid/invalid comment"); + Assert.True(Lexical_TestClass_comments_03.testMethod()); + } + + [TestMethod] + public void Lexical_comments_04_Test() + { + Debug.WriteLine("Section 2.4.4 Test"); + Debug.WriteLine("Verifies valid/invalid comment"); + Assert.True(Lexical_TestClass_comments_04.testMethod()); + } + + [TestMethod] + public void Lexical_comments_05_Test() + { + Debug.WriteLine("Section 2.4.4 Test"); + Debug.WriteLine("Verifies valid/invalid comment"); + Assert.True(Lexical_TestClass_comments_05.testMethod()); + } + + [TestMethod] + public void Lexical_comments_06_Test() + { + Debug.WriteLine("Section 2.4.4 Test"); + Debug.WriteLine("Verifies valid/invalid comment"); + Assert.True(Lexical_TestClass_comments_06.testMethod()); + } + + [TestMethod] + public void Lexical_comments_07_Test() + { + Debug.WriteLine("Section 2.4.4 Test"); + Debug.WriteLine("Verifies valid/invalid comment"); + Assert.True(Lexical_TestClass_comments_07.testMethod()); + } + + [TestMethod] + public void Lexical_comments_10_Test() + { + Debug.WriteLine("Section 2.4.4 Test"); + Debug.WriteLine("Verifies valid/invalid comment"); + Assert.True(Lexical_TestClass_comments_10.testMethod()); + } + + [TestMethod] + public void Lexical_bool_01_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify true works on bools"); + Assert.True(Lexical_TestClass_bool_01.testMethod()); + } + + [TestMethod] + public void Lexical_bool_02_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify false works on bools"); + Assert.True(Lexical_TestClass_bool_02.testMethod()); + } + + [TestMethod] + public void Lexical_int_01_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify 0 as int literal"); + Assert.True(Lexical_TestClass_int_01.testMethod()); + } + + [TestMethod] + public void Lexical_int_02_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify positive int literals"); + Assert.True(Lexical_TestClass_int_02.testMethod()); + } + + [TestMethod] + public void Lexical_int_03_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify negative int literals"); + Assert.True(Lexical_TestClass_int_03.testMethod()); + } + + [TestMethod] + public void Lexical_int_04_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify negative hex literals"); + Assert.True(Lexical_TestClass_int_04.testMethod()); + } + + [TestMethod] + public void Lexical_int_05_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify positive hex literals"); + Assert.True(Lexical_TestClass_int_05.testMethod()); + } + + [TestMethod] + public void Lexical_int_06_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify 0 as hex int literal"); + Assert.True(Lexical_TestClass_int_06.testMethod()); + } + + [TestMethod] + public void Lexical_intsuffix_01_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("L/l suffix on longs"); + Assert.True(Lexical_TestClass_intsuffix_01.testMethod()); + } + + [TestMethod] + public void Lexical_intsuffix_02_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("LU, Ul,uL,ul,LU,Lu,lU,lu suffix on ulongs"); + Assert.True(Lexical_TestClass_intsuffix_02.testMethod()); + } + + [TestMethod] + public void Lexical_intsuffix_03_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("LU, Ul,uL,ul,LU,Lu,lU,lu suffix on ulongs"); + Assert.True(Lexical_TestClass_intsuffix_03.testMethod()); + } + + [TestMethod] + public void Lexical_intsuffix_04_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("Verify UL,Ul,uL,ul,LU,Lu,lU,lu suffix are of type ulong"); + Assert.True(Lexical_TestClass_intsuffix_04.testMethod()); + } + + [TestMethod] + public void Lexical_intsuffix_06_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("Verify L, l suffixes are of type uint"); + Assert.True(Lexical_TestClass_intsuffix_06.testMethod()); + } + + [TestMethod] + public void Lexical_intsuffix_07_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("Using the lowercase 'l' suffix should generate a level 4 warning (VS7:86407)"); + Assert.True(Lexical_TestClass_intsuffix_07.testMethod()); + } + + [TestMethod] + public void Lexical_suff_typepick_03_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("Verify that literals with l, L suffixes are typed according to spec"); + Assert.True(Lexical_TestClass_suff_typepick_03.testMethod()); + } + + [TestMethod] + public void Lexical_real_01_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify (+/-) double double literals"); + Assert.True(Lexical_TestClass_real_01.testMethod()); + } + + [TestMethod] + public void Lexical_real_02_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Assert.True(Lexical_TestClass_real_02.testMethod()); + } + + [TestMethod] + public void Lexical_real_03_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify (-/+) non-double double literals"); + Assert.True(Lexical_TestClass_real_03.testMethod()); + } + + [TestMethod] + public void Lexical_real_04_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify E and e (-/+) as double literals"); + Assert.True(Lexical_TestClass_real_04.testMethod()); + } + + [TestMethod] + public void Lexical_real_05_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify E and e (-/+) as double literals"); + Assert.True(Lexical_TestClass_real_05.testMethod()); + } + + [TestMethod] + public void Lexical_real_06_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify E and e (-/+) as double literals"); + Assert.True(Lexical_TestClass_real_06.testMethod()); + } + + [TestMethod] + public void Lexical_char_01_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify keyboard symbols as chars"); + Assert.True(Lexical_TestClass_char_01.testMethod()); + } + + [TestMethod] + public void Lexical_char_02_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify all escape sequences in section 2.4.9.4"); + Assert.True(Lexical_TestClass_char_02.testMethod()); + } + + [TestMethod] + public void Lexical_char_03_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("Hex encoded Unicode characters"); + Assert.True(Lexical_TestClass_char_03.testMethod()); + } + + [TestMethod] + public void Lexical_realsuffix_01_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("D/d suffix on double literals"); + Debug.WriteLine("Real suffixes"); + Assert.True(Lexical_TestClass_realsuffix_01.testMethod()); + } + + [TestMethod] + public void Lexical_realsuffix_02_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("F/f suffix on float literals"); + Debug.WriteLine("Real suffixes"); + Assert.True(Lexical_TestClass_realsuffix_02.testMethod()); + } + + [TestMethod] + public void Lexical_string_01_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify escape sequences in string literals"); + Assert.True(Lexical_TestClass_string_01.testMethod()); + } + + [TestMethod] + public void Lexical_string_02_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify hex escape sequences in string literals"); + Assert.True(Lexical_TestClass_string_02.testMethod()); + } + + [TestMethod] + public void Lexical_string_03_Test() + { + Debug.WriteLine("Section 2.4.9 Test"); + Debug.WriteLine("verify null strings work"); + Assert.True(Lexical_TestClass_string_03.testMethod()); + } + + [TestMethod] + public void Lexical_pre_001_Test() + { + Debug.WriteLine("Section 2.3Preprocessing"); + Debug.WriteLine("simple pre processor"); + Assert.True(Lexical_TestClass_pre_001.testMethod()); + } + + [TestMethod] + public void Lexical_pre_004_Test() + { + Debug.WriteLine("Section 2.3Preprocessing"); + Debug.WriteLine("Verify that class name namespace isn't searched"); + Assert.True(Lexical_TestClass_pre_004.testMethod()); + } + + [TestMethod] + public void Lexical_pre_005_Test() + { + Debug.WriteLine("Section 2.3Preprocessing"); + Debug.WriteLine("Verify that invalid syntax doesn't mess up compiler in non-ifdef sections"); + Assert.True(Lexical_TestClass_pre_005.testMethod()); + } + + [TestMethod] + public void Lexical_pre_008_Test() + { + Debug.WriteLine("Section 2.3Preprocessing"); + Debug.WriteLine("Verify #elif and #else"); + Assert.True(Lexical_TestClass_pre_008.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_09_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("#warning verification"); + Assert.True(Lexical_TestClass_preproc_09.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_30_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verifying comments and #preprocessor items"); + Debug.WriteLine("This define should not be included #define TEST "); + Assert.True(Lexical_TestClass_preproc_30.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_38_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verify the code that is skipped because of an #if is not checked by compiler at all"); + Assert.True(Lexical_TestClass_preproc_38.testMethod()); + } + + [TestMethod] + public void Lexical_line_02_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("#line: Valid integer-literal passed to #line should work correctly with a real warning"); + Assert.True(Lexical_TestClass_line_02.testMethod()); + } + + [TestMethod] + public void Lexical_line_03_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("#line: Valid integer-literal passed to #line should work correctly with a #warning directive"); + Assert.True(Lexical_TestClass_line_03.testMethod()); + } + + [TestMethod] + public void Lexical_line_06_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("#line: Valid integer-literal/string-literal passed to #line should work correctly with a real warning"); + Assert.True(Lexical_TestClass_line_06.testMethod()); + } + + [TestMethod] + public void Lexical_line_07_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("#line: Valid integer-literal/string-literal passed to #line should work correctly with a #warning directive"); + Assert.True(Lexical_TestClass_line_07.testMethod()); + } + + [TestMethod] + public void Lexical_line_26_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("#line: Should work cleanly inside an #if-#endif block that evaluates to false"); + Assert.True(Lexical_TestClass_line_26.testMethod()); + } + + [TestMethod] + public void Lexical_line_35_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("#line: #line default in a false #if block should compile cleanly"); + Assert.True(Lexical_TestClass_line_35.testMethod()); + } + + [TestMethod] + public void Lexical_region_01_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Make sure #region works without banner text"); + Assert.True(Lexical_TestClass_region_01.testMethod()); + } + + [TestMethod] + public void Lexical_region_02_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Make sure #region works with banner text"); + Assert.True(Lexical_TestClass_region_02.testMethod()); + } + + [TestMethod] + public void Lexical_region_05_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Nesting a #region inside another should work "); + Assert.True(Lexical_TestClass_region_05.testMethod()); + } + + [TestMethod] + public void Lexical_region_06_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Nesting five #region blocks should compile successfully "); + Assert.True(Lexical_TestClass_region_06.testMethod()); + } + + [TestMethod] + public void Lexical_region_07_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Nesting two #region blocks within a single #region block should compile successfully "); + Assert.True(Lexical_TestClass_region_07.testMethod()); + } + + [TestMethod] + public void Lexical_region_10_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Make sure #region works with banner text enclosed in double-quotes"); + Assert.True(Lexical_TestClass_region_10.testMethod()); + } + + [TestMethod] + public void Lexical_region_11_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("A single-line comment following a #region should compile successfully"); + Assert.True(Lexical_TestClass_region_11.testMethod()); + } + + [TestMethod] + public void Lexical_region_12_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("A single-line comment following an #endregion should compile successfully"); + Assert.True(Lexical_TestClass_region_12.testMethod()); + } + + [TestMethod] + public void Lexical_region_15_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Any text following the #endregion directive should be ignored"); + Assert.True(Lexical_TestClass_region_15.testMethod()); + } + + [TestMethod] + public void Lexical_lineterm_01_Test() + { + Debug.WriteLine("Section 2.4 Lexical Analysis"); + Debug.WriteLine("Test different ways to end a line with semi-colon"); + Assert.True(Lexical_TestClass_lineterm_01.testMethod()); + } + + [TestMethod] + public void Lexical_atkeyword_03_Test() + { + Debug.WriteLine("Section 2.4 Lexical Analysis - Keywords"); + Debug.WriteLine("The identifiers @test and test should refer to the same variable"); + Assert.True(Lexical_TestClass_atkeyword_03.testMethod()); + } + + [TestMethod] + public void Lexical_atkeyword_04_Test() + { + Debug.WriteLine("Section 2.4 Lexical Analysis - Keywords"); + Debug.WriteLine("Verify that 'if' can be an identifier using unicode escape sequences as well as an @keyword"); + Assert.True(Lexical_TestClass_atkeyword_04.testMethod()); + } + + [TestMethod] + public void Lexical_atkeyword_05_Test() + { + Debug.WriteLine("Section 2.4 Lexical Analysis - Keywords"); + Debug.WriteLine("Verify that prefixing an identifer that is prefixed by a double underscore does not generate warning"); + Assert.True(Lexical_TestClass_atkeyword_05.testMethod()); + } + + [TestMethod] + public void Lexical_ident_01_Test() + { + Debug.WriteLine("Section 2.4.7 Identifiers"); + Debug.WriteLine("identifier-start-character can be alphabetic"); + Assert.True(Lexical_TestClass_ident_01.testMethod()); + } + + [TestMethod] + public void Lexical_ident_02_Test() + { + Debug.WriteLine("Section 2.4.7 Identifiers"); + Debug.WriteLine("identifier-start-character can be an underscore"); + Assert.True(Lexical_TestClass_ident_02.testMethod()); + } + + [TestMethod] + public void Lexical_ident_03_Test() + { + Debug.WriteLine("Section 2.4.7 Identifiers"); + Debug.WriteLine("identifier-part-character can be a number"); + Assert.True(Lexical_TestClass_ident_03.testMethod()); + } + + [TestMethod] + public void Lexical_ident_04_Test() + { + Debug.WriteLine("Section 2.4.7 Identifiers"); + Debug.WriteLine("identifier-part-character can be a number (in the middle)"); + Assert.True(Lexical_TestClass_ident_04.testMethod()); + } + + [TestMethod] + public void Lexical_ident_05_Test() + { + Debug.WriteLine("Section 2.4.2 Identifiers"); + Debug.WriteLine("Identifiers that start with double underscores (__) should not generate a warning/error though it used to"); + Assert.True(Lexical_TestClass_ident_05.testMethod()); + } + + [TestMethod] + public void Lexical_ident_06_Test() + { + Debug.WriteLine("Section 2.4.2 Identifiers"); + Debug.WriteLine("Identifiers that have embedded double underscores (__) should generate a warning/error though it used to"); + Assert.True(Lexical_TestClass_ident_06.testMethod()); + } + + [TestMethod] + public void Lexical_ident_07_Test() + { + Debug.WriteLine("Section 2.4.2 Identifiers"); + Debug.WriteLine("Identifiers that end with double underscores (__) should generate a warning/error though it used to"); + Assert.True(Lexical_TestClass_ident_07.testMethod()); + } + [TestMethod] + public void Lexical_nullunicode_01_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("A \\u0000 within comments should not stop compiler from reading to EOF"); + Assert.True(Lexical_TestClass_nullunicode_01.testMethod()); + } + + [TestMethod] + public void Lexical_nullunicode_03_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("A \\u0000 in a string should be equal to \x0000 and \0"); + Assert.True(Lexical_TestClass_nullunicode_03.testMethod()); + } + + [TestMethod] + public void Lexical_nullunicode_04_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("A \\u0000 is ignored if within preprocessor-excluded code"); + Assert.True(Lexical_TestClass_nullunicode_04.testMethod()); + } + + [TestMethod] + public void Lexical_unicode_02_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("A simple program that is saved as utf-8 with Notepad compiles and runs correctly."); + Assert.True(Lexical_TestClass_unicode_02.testMethod()); + } + + [TestMethod] + public void Lexical_unicode_04_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("Displaying a unicode character with Debug.WriteLine(().ToString())"); + Assert.True(Lexical_TestClass_unicode_04.testMethod()); + } + + [TestMethod] + public void Lexical_unicode_05_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("Displaying a unicode character with Debug.WriteLine(().ToString())"); + Debug.WriteLine("Since the correct language is not installed on my machine, should get a 'QQQ' as output"); + Assert.True(Lexical_TestClass_unicode_05.testMethod()); + } + + [TestMethod] + public void Lexical_unicode_06_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("Identifier whose name is defined with \\uXXXX works correctly (Bug 111180)"); + Assert.True(Lexical_TestClass_unicode_06.testMethod()); + } + + [TestMethod] + public void Lexical_unicode_07_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("Identifier whose name starts with \\uXXXX works correctly"); + Assert.True(Lexical_TestClass_unicode_07.testMethod()); + } + + [TestMethod] + public void Lexical_unicode_08_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("Identifier whose name has a \\uXXXX in the middle of it works correctly"); + Assert.True(Lexical_TestClass_unicode_08.testMethod()); + } + + [TestMethod] + public void Lexical_unicode_09_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("Identifier whose name ends with a \\uXXXX works correctly "); + Assert.True(Lexical_TestClass_unicode_09.testMethod()); + } + + [TestMethod] + public void Lexical_unicode_10_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("Unicode escape sequence to start preprocessor identifier"); + Debug.WriteLine("Bug #33538 - Fixed"); + Assert.True(Lexical_TestClass_unicode_10.testMethod()); + } + + [TestMethod] + public void Lexical_unicode_11_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("Unicode escape sequence to start preprocessor identifier"); + Debug.WriteLine("Bug #33538 - Fixed"); + Assert.True(Lexical_TestClass_unicode_11.testMethod()); + } + + [TestMethod] + public void Lexical_unicode_12_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("Unicode escape sequence to start preprocessor identifier"); + Debug.WriteLine("Bug #33538 - Fixed"); + Assert.True(Lexical_TestClass_unicode_12.testMethod()); + } + + [TestMethod] + public void Lexical_unicode_13_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("Unicode escape sequence in middle of a #define (#de\\u0066ine)"); + Debug.WriteLine("Bug #33538 - Fixed"); + Assert.True(Lexical_TestClass_unicode_13.testMethod()); + } + + [TestMethod] + public void Lexical_unicode_17_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("The literal \\u0000 should not be interpreted as a unicode escape sequence"); + Assert.True(Lexical_TestClass_unicode_17.testMethod()); + } + + [TestMethod] + public void Lexical_uni8digit_01_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("Identifier whose name is defined with \\uXXXXXXXX works correctly"); + Assert.True(Lexical_TestClass_uni8digit_01.testMethod()); + } + + [TestMethod] + public void Lexical_uni8digit_02_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("Using Debug.WriteLine with \\uXXXXXXXX works correctly"); + Assert.True(Lexical_TestClass_uni8digit_02.testMethod()); + } + + [TestMethod] + public void Lexical_uni8digit_03_Test() + { + Debug.WriteLine("Section 2.5 Lexical Analysis"); + Debug.WriteLine("Verify valid boundaries of values for \\uXXXXXXXX work correctly"); + Assert.True(Lexical_TestClass_uni8digit_03.testMethod()); + } + + [TestMethod] + public void Lexical_atstrings_01_Test() + { + Debug.WriteLine("Back-Quoted String Test"); + Debug.WriteLine("Newlines should be valid within @-quoted string literals"); + Assert.True(Lexical_TestClass_atstrings_01.testMethod()); + } + + [TestMethod] + public void Lexical_atstrings_02_Test() + { + Debug.WriteLine("Back-Quoted String Test"); + Debug.WriteLine("Unicode escape sequences are not processed within @-quoted string literals"); + Assert.True(Lexical_TestClass_atstrings_02.testMethod()); + } + + [TestMethod] + public void Lexical_atstrings_03_Test() + { + Debug.WriteLine("Back-Quoted String Test"); + Debug.WriteLine("Slash escape sequences are not processed within @-quoted string literals"); + Assert.True(Lexical_TestClass_atstrings_03.testMethod()); + } + + [TestMethod] + public void Lexical_atstrings_04_Test() + { + Debug.WriteLine("Back-Quoted String Test"); + Debug.WriteLine("Passing @-quoted strings to Debug.WriteLine(().ToString()) should work"); + Assert.True(Lexical_TestClass_atstrings_04.testMethod()); + } + + [TestMethod] + public void Lexical_mscombo_01_Test() + { + Debug.WriteLine("XML Doc Test (Just lexical tests, no output validation)"); + Debug.WriteLine("Combination of multi and single line xml doc comments"); + Assert.True(Lexical_TestClass_mscombo_01.testMethod()); + } + + [TestMethod] + public void Lexical_mscombo_05_Test() + { + Debug.WriteLine("XML Doc Test (Just lexical tests, no output validation)"); + Debug.WriteLine("Combination of multi and single line xml doc comments"); + Assert.True(Lexical_TestClass_mscombo_05.testMethod()); + } + + //Compiled Test Cases + public class Lexical_TestClass_comments_01 + { + /* This is a comment */ + public static void Main_old(String[] args) { } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_comments_02 + { + // This is a comment + public static void Main_old(String[] args) { } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_comments_03 + { + // This is a comment // + public static void Main_old(String[] args) { } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_comments_04 + { + /* This is a comment + This is a comment + */ + public static void Main_old(String[] args) { } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_comments_05 + { + /* This is a comment + This is a comment */ + public static void Main_old(String[] args) { } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_comments_06 + { + /* This is a comment + // This is a comment + This is a comment */ + public static void Main_old(String[] args) { } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_comments_07 + { + /* This is a comment + // This is a comment */ + public static void Main_old(String[] args) { } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_comments_10 + { + // /* This is a comment + public static void Main_old(String[] args) { } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_bool_01 + { + public static void Main_old(String[] args) + { + bool test1; + bool test2; + test1 = true; + test2 = test1; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_bool_02 + { + public static void Main_old(String[] args) + { + bool test1; + bool test2; + test1 = false; + test2 = test1; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_int_01 + { + public static void Main_old(String[] args) + { + int test1; + int test2; + test1 = 0; + test2 = test1; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_int_02 + { + public static void Main_old(String[] args) + { + int test1; + int test2; + test1 = 10; + test2 = test1; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_int_03 + { + public static void Main_old(String[] args) + { + int test1; + int test2; + test1 = -10; + test2 = test1; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_int_04 + { + public static void Main_old(String[] args) + { + int test1; + int test2; + test1 = -0xF; + test2 = test1; + Debug.WriteLine((test2).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_int_05 + { + public static void Main_old(String[] args) + { + int test1; + int test2; + test1 = 0xF; + test2 = test1; + Debug.WriteLine((test2).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_int_06 + { + public static void Main_old(String[] args) + { + int test1; + int test2; + test1 = 0x0; + test2 = test1; + Debug.WriteLine((test2).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_intsuffix_01 + { + public static void Main_old(String[] args) + { + long test1; + long test2; + test1 = 10L; + test2 = test1; + test1 = 10L; + test2 = test1; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_intsuffix_02 + { + public static void Main_old(String[] args) + { + ulong test1; + ulong test2; + test1 = 10LU; + test2 = test1; + test1 = 10Ul; + test2 = test1; + test1 = 10uL; + test2 = test1; + test1 = 10ul; + test2 = test1; + test1 = 10LU; + test2 = test1; + test1 = 10Lu; + test2 = test1; + test1 = 10LU; + test2 = test1; + test1 = 10Lu; + test2 = test1; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_intsuffix_03 + { + public static void Main_old(String[] args) + { + uint test1; + uint test2; + test1 = 10u; + test2 = test1; + test1 = 10U; + test2 = test1; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_intsuffix_04 + { + public static int Main_old() + { + int result = 0; + if (10UL is ulong) result += 0; else result += 1; + if (10Ul is ulong) result += 0; else result += 1; + if (10uL is ulong) result += 0; else result += 1; + if (10ul is ulong) result += 0; else result += 1; + if (10LU is ulong) result += 0; else result += 1; + if (10Lu is ulong) result += 0; else result += 1; + if (10LU is ulong) result += 0; else result += 1; + if (10Lu is ulong) result += 0; else result += 1; + + Debug.WriteLine((result).ToString()); + return result; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Lexical_TestClass_intsuffix_06 + { + public static int Main_old(String[] args) + { + int result = 0; + if (10L is long) result += 0; else result += 1; + if (10L is long) result += 0; else result += 1; + return result; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Lexical_TestClass_intsuffix_07 + { + public static void Main_old() + { + long test1; + long test2; + test1 = 10L; + test2 = test1; + test1 = 10L; + test2 = test1; + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Lexical_TestClass_suff_typepick_03 + { + public static int Main_old(String[] args) + { + int result = 0; + // these should all be considered of type long (lowercase suffix) + if (-9223372036854775808L is long) result += 0; else result += 1; + if (9223372036854775807L is long) result += 0; else result += 1; + // these should all be considered of type long (uppercase suffix) + if (-9223372036854775808L is long) result += 0; else result += 1; + if (9223372036854775807L is long) result += 0; else result += 1; + // these should all be considered of type ulong (lowercase suffix) + if (9223372036854775808L is ulong) result += 0; else result += 1; + if (18446744073709551615L is ulong) result += 0; else result += 1; + // these should all be considered of type ulong (uppercase suffix) + if (9223372036854775808L is ulong) result += 0; else result += 1; + if (18446744073709551615L is ulong) result += 0; else result += 1; + return result; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Lexical_TestClass_real_01 + { + public static void Main_old(String[] args) + { + double test1, test2; + test1 = 9.99; + test2 = -9.99; + test1 = test2; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_real_02 + { + public static void Main_old(String[] args) + { + double test1, test2; + test1 = .99; + test2 = -.99; + test1 = test2; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_real_03 + { + public static void Main_old(String[] args) + { + double test1, test2; + test1 = 99; + test2 = -99; + test1 = test2; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_real_04 + { + public static void Main_old(String[] args) + { + double test1, test2, test3; + test1 = 9.99e5; + test2 = -9.99E-5; + test3 = -9.99E+5; + test1 = test2; + test2 = test3; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_real_05 + { + public static void Main_old(String[] args) + { + double test1, test2, test3; + test1 = .99e5; + test2 = -.99E-5; + test3 = -.99E+5; + test1 = test2; + test2 = test3; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_real_06 + { + public static void Main_old(String[] args) + { + double test1, test2, test3; + test1 = 99e5; + test2 = -99E-5; + test3 = -99E+5; + test1 = test2; + test2 = test3; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_char_01 + { + public static void Main_old(String[] args) + { + char test, getter; + + test = 'a'; + test = 'A'; + test = '1'; + test = '0'; + test = '9'; + test = '!'; + test = '@'; + test = '#'; + test = '$'; + test = '%'; + test = '^'; + test = '&'; + test = '*'; + test = '('; + test = ')'; + test = '-'; + test = '='; + test = '_'; + test = '+'; + test = '`'; + test = '~'; + test = '{'; + test = '}'; + test = '['; + test = ']'; + test = '|'; + test = '"'; + test = ':'; + test = ';'; + test = ','; + test = '.'; + test = '/'; + test = '<'; + test = '>'; + getter = test; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_char_02 + { + public static void Main_old(String[] args) + { + char test, getter; + + test = '\''; + test = '\"'; + test = '\\'; + test = '\0'; + test = '\a'; + test = '\b'; + test = '\f'; + test = '\n'; + test = '\r'; + test = '\t'; + test = '\v'; + getter = test; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_char_03 + { + public static void Main_old(String[] args) + { + char test, getter; + + test = '\x0027'; + test = '\x0022'; + test = '\x005C'; + test = '\x0000'; + test = '\x0007'; + test = '\x0008'; + test = '\x000C'; + test = '\x000A'; + test = '\x000D'; + test = '\x0009'; + test = '\x000B'; + + getter = test; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_realsuffix_01 + { + public static void Main_old(String[] args) + { + double test1; + double test2; + test1 = -9.99D; + test2 = 9.99d; + test1 = .99D; + test2 = -.99d; + test1 = 9D; + test2 = -9d; + test1 = 9.99E5D; + test2 = -9.99e-5d; + test1 = .99e+5D; + test2 = -9E-5d; + test2 = test1; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_realsuffix_02 + { + public static void Main_old(String[] args) + { + float test1; + float test2; + test1 = -9.99F; + test2 = 9.99f; + test1 = .99F; + test2 = -.99f; + test1 = 9F; + test2 = -9f; + test1 = 9.99E5F; + test2 = -9.99e-5f; + test1 = .99e+5F; + test2 = -9E-5f; + test2 = test1; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_string_01 + { + public static void Main_old(String[] args) + { + String test1; + test1 = "asdfjkl;\nasdfjkl;"; + Debug.WriteLine((test1).ToString()); + test1 = "\"testing\'"; + Debug.WriteLine((test1).ToString()); + test1 = "escape seq at end\\"; + Debug.WriteLine((test1).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_string_02 + { + public static void Main_old(String[] args) + { + String test1; + test1 = "asdfjkl;\x000Aasdfjkl;"; + Debug.WriteLine((test1).ToString()); + test1 = "\x0022testing\x0027"; + Debug.WriteLine((test1).ToString()); + test1 = "escape seq at end\x005C"; + Debug.WriteLine((test1).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_string_03 + { + public static void Main_old(String[] args) + { + String test1, test2; + test1 = null; + test2 = test1; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + + + public class Lexical_TestClass_pre_001 + { + public static int Main_old(string[] args) + { + int i = 2; +#if true + i = 0; +#endif +#if false + i = 1; +#endif + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + } + public class Lexical_TestClass_pre_004 + { + public static int Main_old(string[] args) + { + int i = 0; +#if Lexical_TestClass_pre_004 + i = 1; +#endif + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + } + public class Lexical_TestClass_pre_005 + { + public static int Main_old(string[] args) + { + int i = 0; +#if false + skdjf ksdklfj mcxnvsdh 9-u23kjd f0120 skdc.zxcnv + sdjfu239nzjnv,mciw -32poduf.zxcnv djfs9a]du +#if true + this shouldn't even be looked at. Except for counting up the #if/#endif pairs +#else + This should be skipped too! +#endif +#if false + this shouldn't even be looked at. Except for counting up the #if/#endif pairs +#else + This should be skipped too! +#endif + This should also be ignored +#endif + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + } + + /* + public class Lexical_TestClass_pre_006 + { + public static int Main_old(string[] args) + { + int i = 0; + #warning Klaatu barada nikto + #if false + #if true + #error This wasn't supposed to trigger + #else + #error This wasn't supposed to trigger either + #endif + #endif + return (i); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + } + */ + public class Lexical_TestClass_pre_008 + { + public static int Main_old(string[] args) + { + int i = 2; +#if false +#error false is true? +#elif true + i--; +#else +#error Else shouldn't trigger here +#endif +#if false +#error false is still true? +#elif foobar +#error foobar wasn't supposed to be defined +#else + i--; +#endif + return (i > 0 ? 1 : 0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + } + class Lexical_TestClass_preproc_09 + { + public static void Main_old(String[] args) + { +#warning This is a WARNING! + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + + + + + class Lexical_TestClass_preproc_30 + { + public static void Main_old(String[] args) + { +#if TEST + Debug.WriteLine("Bad"); +#else + Debug.WriteLine("Good"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_preproc_38 + { + public static void Main_old(String[] args) + { +#if foo + this code should be completely skipped +#else + Debug.WriteLine("Else triggered"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_line_02 + { + public static void Main_old() + { +#line 13 + int a = 3; + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Lexical_TestClass_line_03 + { + public static void Main_old() + { +#line 13 +#warning This is a warning + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Lexical_TestClass_line_06 + { + public static void Main_old() + { +#line 13 "myfile.cs" + int a = 3; + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + + public class Lexical_TestClass_line_07 + { + public static void Main_old() + { +#line 13 "myfile.cs" +#warning This is a warning + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Lexical_TestClass_line_26 + { + public static void Main_old() + { +#if false +#line 13 + short s = 123456; +#endif + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Lexical_TestClass_line_35 + { + public static void Main_old() + { +#if false +#line default + short s1 = 123456; +#endif + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + + + public class Lexical_TestClass_region_01 + { + public static void Main_old() + { + #region + Debug.WriteLine("This works!"); + #endregion + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Lexical_TestClass_region_02 + { + public static void Main_old() + { + #region This is the banner text + Debug.WriteLine("This works!"); + #endregion + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Lexical_TestClass_region_05 + { + public static void Main_old() + { + #region + Debug.WriteLine("1"); + #region + Debug.WriteLine("2"); + #endregion + Debug.WriteLine("3"); + #endregion + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Lexical_TestClass_region_06 + { + public static void Main_old() + { + #region + Debug.WriteLine("1"); + #region + Debug.WriteLine("2"); + #region + Debug.WriteLine("3"); + #region + Debug.WriteLine("4"); + #region + Debug.WriteLine("5"); + #endregion + Debug.WriteLine("6"); + #endregion + Debug.WriteLine("7"); + #endregion + Debug.WriteLine("8"); + #endregion + Debug.WriteLine("9"); + #endregion + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Lexical_TestClass_region_07 + { + public static void Main_old() + { + #region + Debug.WriteLine("1"); + #region + Debug.WriteLine("2"); + #endregion + Debug.WriteLine("3"); + #region + Debug.WriteLine("4"); + #endregion + Debug.WriteLine("5"); + #endregion + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Lexical_TestClass_region_10 + { + public static void Main_old() + { + #region "This is the banner text" + Debug.WriteLine("This works!"); + #endregion + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Lexical_TestClass_region_11 + { + public static void Main_old() + { + #region // This is a single-line comment + Debug.WriteLine("This works!"); + #endregion + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Lexical_TestClass_region_12 + { + public static void Main_old() + { + #region + Debug.WriteLine("This works!"); + #endregion // This is a single-line comment + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + + + + public class Lexical_TestClass_region_15 + { + public static void Main_old() + { + #region + Debug.WriteLine("This works!"); + #endregion This text should be ignored + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_lineterm_01 + { + public static void Main_old(String[] args) + { + Debug.WriteLine("1"); // normal + Debug.WriteLine("2"); // space between + Debug.WriteLine("3") + ; // ; on the next line + Debug.WriteLine("4") + // comment in between + ; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_atkeyword_03 + { + public static void Main_old(String[] args) + { + int @test; + test = 5; + Debug.WriteLine((@test).ToString()); + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_atkeyword_04 + { + static int Main_old() + { + string \u0069f; + @if = "Hello, world"; + Debug.WriteLine((i\u0066).ToString()); + + if (@if == "Hello, world") + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Lexical_TestClass_atkeyword_05 + { + static void Main_old() + { + int @__test; + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Lexical_TestClass_ident_01 + { + public static void Main_old(String[] args) + { + int alpha = 4; + int Alpha = 5; + Alpha = alpha; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + public class Lexical_TestClass_ident_02 + { + public static void Main_old(String[] args) + { + int _alpha = 4; + int _Alpha = 5; + _Alpha = _alpha; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + + + + + + public class Lexical_TestClass_ident_03 + { + public static void Main_old(String[] args) + { + int alpha4 = 4; + int Alpha3 = 5; + Alpha3 = alpha4; + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_ident_04 + { + static void Main_old() + { + int alpha4a = 4; + int Alpha3a = 5; + Alpha3a = alpha4a; + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_ident_05 + { + static void Main_old() + { + int __alpha4 = 4; + int __Alpha3 = 5; + __Alpha3 = __alpha4; + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_ident_06 + { + static void Main_old() + { + int x__alpha4 = 4; + int x__Alpha3 = 5; + x__Alpha3 = x__alpha4; + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_ident_07 + { + static void Main_old() + { + int alpha4__ = 4; + int Alpha3__ = 5; + Alpha3__ = alpha4__; + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_nullunicode_01 + { + public static void Main_old() + { + // This should not stop the compiler from moving on \u0000 + + Debug.WriteLine("Worked"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_nullunicode_03 + { + public static int Main_old() + { + string first = "This string\0 should show"; + string second = "This string\u0000 should show"; + string third = "This string\x0000 should show"; + if ((first == second) && (second == third)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Lexical_TestClass_nullunicode_04 + { + public static int Main_old() + { +#if NOTDEFINED + + \u0000 // This should be ignored + +#endif + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + // + class Lexical_TestClass_unicode_02 + { + public static void Main_old() + { + Debug.WriteLine("Worked!"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + + + + class Lexical_TestClass_unicode_04 + { + public static void Main_old() + { + Debug.WriteLine("\u0057"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_unicode_05 + { + public static void Main_old() + { + Debug.WriteLine("\u0701"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_unicode_06 + { + public static void Main_old() + { + int \u0057ash; + Wash = 3; + Debug.WriteLine((Wash).ToString()); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_unicode_07 + { + public static void Main_old() + { + int \u0391Lpha; // \u0391 is the capital greek letter Alpha + \u0391Lpha = 3; + Debug.WriteLine((\u0391Lpha).ToString()); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_unicode_08 + { + public static void Main_old() + { + int start\u0391Lpha; // \u0391 is the capital greek letter Alpha + start\u0391Lpha = 3; + Debug.WriteLine((start\u0391Lpha).ToString()); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + + class Lexical_TestClass_unicode_09 + { + public static void Main_old() + { + int lpha\u0391; // \u0391 is the capital greek letter Alpha + lpha\u0391 = 3; + Debug.WriteLine((lpha\u0391).ToString()); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + + class Lexical_TestClass_unicode_17 + { + public static void Main_old() + { + string s = "\\u0000"; + Debug.WriteLine((s).ToString()); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + + class Lexical_TestClass_uni8digit_01 + { + public static void Main_old() + { + int \U00000057ash; + Wash = 3; + Debug.WriteLine((Wash).ToString()); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_uni8digit_02 + { + static void Main_old() + { + Debug.WriteLine("\U00000057ash"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_uni8digit_03 + { + static void Main_old() + { + string a = "\U00000000"; + string b = "\U0010FFFF"; + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_atstrings_01 + { + public const string hello = @"hel +lo"; + public static void Main_old() + { + Debug.WriteLine((hello).ToString()); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_atstrings_02 + { + public static string a = @"hello, world!"; + public static string b = @"\u0068ello, world!"; + public static void Main_old() + { + Debug.WriteLine((a).ToString()); + Debug.WriteLine((b).ToString()); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_atstrings_03 + { + public static string a = @"Hello,\nworld"; + public static string b = @"Hello,\tworld"; + public static void Main_old() + { + Debug.WriteLine((a).ToString()); + Debug.WriteLine((b).ToString()); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_atstrings_04 + { + public static void Main_old() + { + Debug.WriteLine(@"Hello, world!"); + Debug.WriteLine(@"Testing"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_mscombo_01 + { + + /// This is the summary + + public int Field = 0; + static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_mscombo_05 + { + + /// This is the summary + + public int Field = 0; + static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + + class Lexical_TestClass_unicode_10 + { + public static void Main_old() + { +#if foobar2 + Debug.WriteLine("Worked!"); +#endif + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_unicode_11 + { + public static void Main_old() + { +#if middlefoobar + Debug.WriteLine("Worked!"); +#endif + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_unicode_12 + { + public static void Main_old() + { +#if endf + Debug.WriteLine("Worked!"); +#endif + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Lexical_TestClass_unicode_13 + { + public static void Main_old() + { +#if endf2 + Debug.WriteLine("Worked!"); +#endif + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + } +} diff --git a/Tests/NFUnitTestLexical/nano.runsettings b/Tests/NFUnitTestLexical/nano.runsettings new file mode 100644 index 00000000..62f0a008 --- /dev/null +++ b/Tests/NFUnitTestLexical/nano.runsettings @@ -0,0 +1,13 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + + \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/packages.config b/Tests/NFUnitTestLexical/packages.config new file mode 100644 index 00000000..dcab08b1 --- /dev/null +++ b/Tests/NFUnitTestLexical/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 09e1dfda..47d62988 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -33,6 +33,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestStatements", "Tes EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestNamespace", "Tests\NFUnitTestNamespace\NFUnitTestNamespace.nfproj", "{9B5EFD66-CCDC-4D00-960C-993296C56F3B}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestLexical", "Tests\NFUnitTestLexical\NFUnitTestLexical.nfproj", "{E0538338-9941-410C-B8C8-0C928F26F8A7}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -95,6 +97,12 @@ Global {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Release|Any CPU.ActiveCfg = Release|Any CPU {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Release|Any CPU.Build.0 = Release|Any CPU {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Release|Any CPU.Deploy.0 = Release|Any CPU + {E0538338-9941-410C-B8C8-0C928F26F8A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E0538338-9941-410C-B8C8-0C928F26F8A7}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E0538338-9941-410C-B8C8-0C928F26F8A7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {E0538338-9941-410C-B8C8-0C928F26F8A7}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0538338-9941-410C-B8C8-0C928F26F8A7}.Release|Any CPU.Build.0 = Release|Any CPU + {E0538338-9941-410C-B8C8-0C928F26F8A7}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -108,6 +116,7 @@ Global {77D55D0B-A50F-4CAF-8CC5-F15063D9A41E} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {222D8571-6646-47E4-95A5-8AED732DCB70} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {9B5EFD66-CCDC-4D00-960C-993296C56F3B} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {E0538338-9941-410C-B8C8-0C928F26F8A7} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From 7b69b943ac0426e95849004be2d6c7d49a482752 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 12:45:19 +0300 Subject: [PATCH 30/55] Adding lexical test 2 --- .../NFUnitTestLexical.nfproj | 3 +- .../NFUnitTestLexical/UnitTestLexicalTest2.cs | 676 ++++++++++++++++++ 2 files changed, 678 insertions(+), 1 deletion(-) create mode 100644 Tests/NFUnitTestLexical/UnitTestLexicalTest2.cs diff --git a/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj index ac47ea3f..b022fdec 100644 --- a/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj +++ b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj @@ -27,8 +27,9 @@ $(MSBuildProjectDirectory)\nano.runsettings - + + diff --git a/Tests/NFUnitTestLexical/UnitTestLexicalTest2.cs b/Tests/NFUnitTestLexical/UnitTestLexicalTest2.cs new file mode 100644 index 00000000..19f18179 --- /dev/null +++ b/Tests/NFUnitTestLexical/UnitTestLexicalTest2.cs @@ -0,0 +1,676 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +#define while //Lexical_TestClass_pre_009 + +#define True1 //Lexical_TestClass_pre_012 +#define True2 +#define False1 +#undef False1 +#undef False1 +#undef False2 + +//Lexical_TestClass_pre_013 +#define foo// Should work fine +#define bar // As should this +#define aaa +#define bbb +#undef aaa// Should Work +#undef bbb// Should also work +#if !foo +#error !foo +#endif +#if !bar +#error !bar +#endif +#if aaa +#error aaa +#endif +#if bbb +#error bbb +#endif + +#define TESTDEF //Lexical_TestClass_preproc_03 + +#define TESTDEF3 //Lexical_TestClass_preproc_04 +#define TESTDEF2 +#undef TESTDEF3 + + +#define FOO //Lexical_TestClass_preproc_05 +#if FOO +#define BAR +#endif + +#define FOO2 //Lexical_TestClass_preproc_06 +#undef FOO2 +#undef FOO2 + +#define FOO3 //Lexical_TestClass_preproc_07 +#undef BAR3 + + +#define TEST //Lexical_TestClass_preproc_15-25,32 + +#define TEST2 //Lexical_TestClass_preproc_17-23,32 + + +#define for //Lexical_TestClass_preproc_39 + + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestLexical +{ + [TestClass] + class UnitTestLexicalTest2 + { + [TestMethod] + public void Lexical_pre_009_Test() + { + Debug.WriteLine("Section 2.3Preprocessing"); + Debug.WriteLine("Verify #define and #undef"); + Assert.True(Lexical_TestClass_pre_009.testMethod()); + } + + [TestMethod] + public void Lexical_pre_012_Test() + { + Debug.WriteLine("Section 2.3Preprocessing"); + Debug.WriteLine("Verify #if operators and parens"); + Assert.True(Lexical_TestClass_pre_012.testMethod()); + } + + [TestMethod] + public void Lexical_pre_013_Test() + { + Debug.WriteLine("Section 2.3Preprocessing"); + Debug.WriteLine("Verify # commands with comments"); + Assert.True(Lexical_TestClass_pre_013.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_03_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("#define/#undef - verify #define works"); + Assert.True(Lexical_TestClass_preproc_03.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_04_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("#define/#undef - verify #undef works"); + Assert.True(Lexical_TestClass_preproc_04.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_05_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Exact example used in spec definition - 2.3.1"); + Assert.True(Lexical_TestClass_preproc_05.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_06_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Using #undef on a non-existing identifier compiles fine"); + Assert.True(Lexical_TestClass_preproc_06.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_07_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Nested #if's"); + Assert.True(Lexical_TestClass_preproc_07.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_15_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verify the ! operator on #identifiers"); + Assert.True(Lexical_TestClass_preproc_15.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_16_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verify the ! operator on #identifiers with parenthesis"); + Assert.True(Lexical_TestClass_preproc_16.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_17_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verify the double ampersand operator works"); + Assert.True(Lexical_TestClass_preproc_17.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_18_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verify the double ampersand operator works with parentheses"); + Assert.True(Lexical_TestClass_preproc_18.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_19_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verify the || operator works "); + Assert.True(Lexical_TestClass_preproc_19.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_20_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verify the || operator works with parentheses"); + Assert.True(Lexical_TestClass_preproc_20.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_21_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verify the == operator works with/without parentheses"); + Assert.True(Lexical_TestClass_preproc_21.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_22_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verify the != operator works with/without parentheses"); + Assert.True(Lexical_TestClass_preproc_22.testMethod()); + } + [TestMethod] + public void Lexical_preproc_23_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Grouping operators: ! double ampersand || != == true false"); + Assert.True(Lexical_TestClass_preproc_23.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_24_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verifying comments and #preprocessor items"); + Assert.True(Lexical_TestClass_preproc_24.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_25_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verifying comments and #preprocessor items"); + Assert.True(Lexical_TestClass_preproc_25.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_31_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verifying comments and #preprocessor items"); + Assert.True(Lexical_TestClass_preproc_31.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_32_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verify the usage of #elif"); + Assert.True(Lexical_TestClass_preproc_32.testMethod()); + } + + [TestMethod] + public void Lexical_preproc_39_Test() + { + Debug.WriteLine("Section 2.3 Preprocessing"); + Debug.WriteLine("Verify that a # keyword (i.e. for) can be used as a #preprocessor identifier"); + Assert.True(Lexical_TestClass_preproc_39.testMethod()); + } + + //Compiled Test Cases + + public class Lexical_TestClass_pre_009 + { + public static int Main_old(string[] args) + { + int i = 2; +#if while + while (--i > 0) + ; +#endif + return (i > 0 ? 1 : 0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + } + + public class Lexical_TestClass_pre_012 + { + public static int Main_old(string[] args) + { + int i = 6; +#if True1 == true + i--; +#endif +#if False1 == false + i--; +#endif +#if false +#error #elif True2 == True1 +#elif True2 == True1 + i--; +#else +#error #else #elif True2 == True1 +#endif +#if (True1 != false) && ((False1) == False2) && (true || false) + i--; +#else +#error #if (True != false) && ((False1) == False2) && (true || false) +#endif +#if ((true == True1) != (false && true)) + i--; +#else +#error ((true == True1) != (false && true)) +#endif +#if !(!(!!(true))) != false + i--; +#else +#error !(!(!!(true))) != false +#endif + return (i > 0 ? 1 : 0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + } + + public class Lexical_TestClass_pre_013 + { + public static int Main_old(string[] args) + { + int i = 0; + return (i > 0 ? 1 : 0); + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + } + + public class Lexical_TestClass_preproc_03 + { + public static void Main_old(String[] args) + { + Debug.WriteLine("Starting!"); +#if TESTDEF + Debug.WriteLine("Good"); +#else + Debug.WriteLine("Bad"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + + public class Lexical_TestClass_preproc_04 + { + public static void Main_old(String[] args) + { + Debug.WriteLine("Starting!"); +#if TESTDEF3 + Debug.WriteLine("TESTDEF3 is defined"); +#else + Debug.WriteLine("TESTDEF3 is not defined"); +#endif +#if TESTDEF2 + Debug.WriteLine("TESTDEF2 is defined"); +#else + Debug.WriteLine("TESTDEF2 not defined"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + + +#if BAR + class Lexical_TestClass_preproc_05 + { + public static void Main_old(String[] args) { } + public static bool testMethod() + { + Main_old(null); + return true; + } + } +#endif + + + + class Lexical_TestClass_preproc_06 + { + public static void Main_old(String[] args) { } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + + + class Lexical_TestClass_preproc_07 + { + public static void Main_old(String[] args) + { + Debug.WriteLine("Starting:"); +#if FOO3 + Debug.WriteLine("Inside FOO"); +#if BAR3 + Debug.WriteLine("Inside BAR"); +#else + Debug.WriteLine("Inside BAR's else"); +#endif +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_preproc_15 + { + public static void Main_old(String[] args) + { +#if !TEST + Debug.WriteLine("Problem"); +#else + Debug.WriteLine("Good"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + + class Lexical_TestClass_preproc_16 + { + public static void Main_old(String[] args) + { +#if !(TEST) + Debug.WriteLine("Problem"); +#else + Debug.WriteLine("Good"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + + class Lexical_TestClass_preproc_17 + { + public static void Main_old(String[] args) + { +#if TEST && TEST2 + Debug.WriteLine("Good"); +#endif +#if TEST && TEST3 + Debug.WriteLine("Problem"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_preproc_18 + { + public static void Main_old(String[] args) + { +#if (TEST && TEST2) + Debug.WriteLine("Good"); +#endif +#if (TEST && TEST3) + Debug.WriteLine("Problem"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_preproc_19 + { + public static void Main_old(String[] args) + { +#if TEST || TEST2 + Debug.WriteLine("Good"); +#endif +#if TEST3 || TEST2 + Debug.WriteLine("Good"); +#endif +#if TEST3 || TEST4 + Debug.WriteLine("Problem"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_preproc_20 + { + public static void Main_old(String[] args) + { +#if (TEST || TEST2) + Debug.WriteLine("Good"); +#endif +#if (TEST3 || TEST2) + Debug.WriteLine("Good"); +#endif +#if (TEST3 || TEST4) + Debug.WriteLine("Problem"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_preproc_21 + { + public static void Main_old(String[] args) + { +#if TEST == TEST2 + Debug.WriteLine("Good"); +#endif +#if (TEST == TEST2) + Debug.WriteLine("Good"); +#endif +#if TEST==TEST2 + Debug.WriteLine("Good"); +#endif +#if (TEST == TEST3) + Debug.WriteLine("Bad"); +#endif +#if TEST3 == TEST + Debug.WriteLine("Bad"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_preproc_22 + { + public static void Main_old(String[] args) + { +#if TEST != TEST2 + Debug.WriteLine("Bad"); +#endif +#if (TEST != TEST2) + Debug.WriteLine("Bad"); +#endif +#if TEST!=TEST2 + Debug.WriteLine("Bad"); +#endif +#if (TEST != TEST3) + Debug.WriteLine("Good"); +#endif +#if TEST3 != TEST + Debug.WriteLine("Good"); +#endif +#if TEST3!=TEST + Debug.WriteLine("Good"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_preproc_23 + { + public static void Main_old(String[] args) + { +#if (TEST && TEST2) || (TEST3 || TEST4) + Debug.WriteLine("1 - Good"); +#endif +#if (TEST3 == TEST4) || (TEST == TEST2) + Debug.WriteLine("2 - Good"); +#endif +#if (TEST != TEST3) && (TEST2 != TEST4) + Debug.WriteLine("3 - Good"); +#endif +#if (! TEST4) && (TEST2 == TEST) + Debug.WriteLine("4 - Good"); +#endif +#if (TEST == true) && (TEST2 != false) + Debug.WriteLine("5 - Good"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_preproc_24 + { + public static void Main_old(String[] args) + { +#if TEST + Debug.WriteLine("Good"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_preproc_25 + { + public static void Main_old(String[] args) + { +#if TEST + Debug.WriteLine("Good"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_preproc_31 + { + public static void Main_old(String[] args) + { +#if TEST + Debug.WriteLine("Bad"); +#else + Debug.WriteLine("Good"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_preproc_32 + { + public static void Main_old(String[] args) + { +#if TEST3 + Debug.WriteLine("Bad"); +#elif TEST2 && TEST + Debug.WriteLine("Good"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + class Lexical_TestClass_preproc_39 + { + public static void Main_old(String[] args) + { +#if for + for (int x = 0; x < 3; x++) + Debug.WriteLine("Worked"); +#else + Debug.WriteLine("It should not be showing this!"); +#endif + } + public static bool testMethod() + { + Main_old(null); + return true; + } + } + + } +} From 22abe8237771707c416ec0d1d611a874a944b396 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 13:14:46 +0300 Subject: [PATCH 31/55] Adding interfaces tests --- .../NFUnitTestInterface.nfproj | 60 + .../Properties/AssemblyInfo.cs | 33 + .../UnitTestInterfaceTests.cs | 3460 +++++++++++++++++ Tests/NFUnitTestInterface/nano.runsettings | 13 + Tests/NFUnitTestInterface/packages.config | 5 + nanoFramework.CoreLibrary.sln | 9 + 6 files changed, 3580 insertions(+) create mode 100644 Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj create mode 100644 Tests/NFUnitTestInterface/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestInterface/UnitTestInterfaceTests.cs create mode 100644 Tests/NFUnitTestInterface/nano.runsettings create mode 100644 Tests/NFUnitTestInterface/packages.config diff --git a/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj b/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj new file mode 100644 index 00000000..6307d67a --- /dev/null +++ b/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj @@ -0,0 +1,60 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 89c61c69-a9f3-43bf-b501-5913be8fe829 + Library + Properties + 512 + NFUnitTestInterface + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/Properties/AssemblyInfo.cs b/Tests/NFUnitTestInterface/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestInterface/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestInterface/UnitTestInterfaceTests.cs b/Tests/NFUnitTestInterface/UnitTestInterfaceTests.cs new file mode 100644 index 00000000..aca8cfd3 --- /dev/null +++ b/Tests/NFUnitTestInterface/UnitTestInterfaceTests.cs @@ -0,0 +1,3460 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestInterface +{ + [TestClass] + public class UnitTestInterfaceTests + { + [TestMethod] + public void Interface_base_06_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("If effective visibility is internal, public iface may have an internal base iface "); + Debug.WriteLine("(Bug 86453: has some details on this. But it has to do with class internal)"); + Assert.True(Interface_TestClass_base_06.testMethod()); + } + [TestMethod] + public void Interface_decl_01_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simplest interface declared in global namespace"); + Assert.True(Interface_TestClass_decl_01.testMethod()); + } + + [TestMethod] + public void Interface_decl_03_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simplest interface declared in class in default global namespace"); + Assert.True(Interface_TestClass_decl_03.testMethod()); + } + + [TestMethod] + public void Interface_decl_05_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simple interface declaration with diff types of methods, args, and properties"); + Assert.True(Interface_TestClass_decl_05.testMethod()); + } + + [TestMethod] + public void Interface_decl_06_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simple interface declaration properties with only gets"); + Assert.True(Interface_TestClass_decl_06.testMethod()); + } + + [TestMethod] + public void Interface_decl_07_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simple interface declaration properties with only sets"); + Assert.True(Interface_TestClass_decl_07.testMethod()); + } + + [TestMethod] + public void Interface_inherit_01_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Verify that an interface can be hidden by 'new' member in derived class"); + Assert.True(Interface_TestClass_inherit_01.testMethod()); + } + + [TestMethod] + public void Interface_inherit_02_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simplest form of interface inheritance"); + Assert.True(Interface_TestClass_inherit_02.testMethod()); + } + + [TestMethod] + public void Interface_inherit_03_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simplest form of interface inheritance, inheriting multiple interfaces"); + Assert.True(Interface_TestClass_inherit_03.testMethod()); + } + + [TestMethod] + public void Interface_inherit_04_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simplest form of interface inheritance, inheriting multiple interfaces"); + Assert.True(Interface_TestClass_inherit_04.testMethod()); + } + + [TestMethod] + public void Interface_inherit_08_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Verify that an interface hidden without using new results in warning"); + Assert.True(Interface_TestClass_inherit_08.testMethod()); + } + + [TestMethod] + public void Interface_modifier_01_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Verify public and internal interfaces declared in global namespace are valid"); + Assert.True(Interface_TestClass_modifier_01.testMethod()); + } + + [TestMethod] + public void Interface_modifier_05_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Verify public and internal interfaces are valid inside classes"); + Assert.True(Interface_TestClass_modifier_05.testMethod()); + } + + [TestMethod] + public void Interface_modifier_06_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Verify private and protected interfaces are valid inside classes"); + Assert.True(Interface_TestClass_modifier_06.testMethod()); + } + + [TestMethod] + public void Interface_modifier_07_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Verify new interface gens warning if not hiding anything"); + Assert.True(Interface_TestClass_modifier_07.testMethod()); + } + + [TestMethod] + public void Interface_modifier_08_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Verify new interface is valid inside classes when properly hiding an inherited member"); + Assert.True(Interface_TestClass_modifier_08.testMethod()); + } + + [TestMethod] + public void Interface_modifier_10_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Verify protected internal interfaces are valid inside classes"); + Assert.True(Interface_TestClass_modifier_10.testMethod()); + } + + [TestMethod] + public void Interface_semicolon_01_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simplest interface declared (with semi-colon) in global namespace"); + Assert.True(Interface_TestClass_semicolon_01.testMethod()); + } + + [TestMethod] + public void Interface_semicolon_03_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simplest interface declared (with semi-colon) in class in default global namespace"); + Assert.True(Interface_TestClass_semicolon_03.testMethod()); + } + + [TestMethod] + public void Interface_impl_04_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("A member of an interface-type can be assigned an instance of class that implements it"); + Assert.True(Interface_TestClass_impl_04.testMethod()); + } + + [TestMethod] + public void Interface_impl_05_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Warning gets generated when two methods implement an inherited method"); + Assert.True(Interface_TestClass_impl_05.testMethod()); + } + + [TestMethod] + public void Interface_impl_06_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Using the 'override' keyword allows you to hide previous method implementation"); + Assert.True(Interface_TestClass_impl_06.testMethod()); + } + + [TestMethod] + public void Interface_impl_07_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("A class that implements an interface with method, property, event, and indexer"); + Assert.True(Interface_TestClass_impl_07.testMethod()); + } + + [TestMethod] + public void Interface_impl_08_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Implementing method that was defined identically by two different base-interfaces should work"); + Assert.True(Interface_TestClass_impl_08.testMethod()); + } + + [TestMethod] + public void Interface_impl_09_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Implementing property that was defined identically by two different base-interfaces should work"); + Assert.True(Interface_TestClass_impl_09.testMethod()); + } + + [TestMethod] + public void Interface_impl_10_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Implementing an event that was defined identically by two different base-interfaces should work"); + Assert.True(Interface_TestClass_impl_10.testMethod()); + } + + [TestMethod] + public void Interface_impl_11_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Implementing an indexer that was defined identically by two different base-interfaces should work"); + Assert.True(Interface_TestClass_impl_11.testMethod()); + } + + [TestMethod] + public void Interface_impl_12_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("The members of base class participate in interface mapping"); + Assert.True(Interface_TestClass_impl_12.testMethod()); + } + + [TestMethod] + public void Interface_impl_13_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Two interfaces on the same object must resolve to the same reference"); + Assert.True(Interface_TestClass_impl_13.testMethod()); + } + + [TestMethod] + public void Interface_implinherit_01_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Interface methods implementation inheritance map as expected (1st/2nd example in 13.4.3)"); + Assert.True(Interface_TestClass_implinherit_01.testMethod()); + } + + [TestMethod] + public void Interface_implinherit_02_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Interface methods implementation inheritance (w/virtual) map as expected (3rd/4th example in 13.4.3)"); + Assert.True(Interface_TestClass_implinherit_02.testMethod()); + } + + [TestMethod] + public void Interface_explicit_04_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicit interface member implementation of a method"); + Assert.True(Interface_TestClass_explicit_04.testMethod()); + } + + [TestMethod] + public void Interface_explicit_05_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicit interface member implementation of a property"); + Assert.True(Interface_TestClass_explicit_05.testMethod()); + } + + [TestMethod] + public void Interface_explicit_06_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicit interface member implementation of an event (Bug 89766)"); + Assert.True(Interface_TestClass_explicit_06.testMethod()); + } + + [TestMethod] + public void Interface_explicit_07_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicit interface member implementation of an indexer"); + Assert.True(Interface_TestClass_explicit_07.testMethod()); + } + + [TestMethod] + public void Interface_explicit_10_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicitly implemented members (method) can be called through interface instances"); + Assert.True(Interface_TestClass_explicit_10.testMethod()); + } + + [TestMethod] + public void Interface_explicit_11_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicitly implemented members (property) can be called through interface instances"); + Assert.True(Interface_TestClass_explicit_11.testMethod()); + } + + [TestMethod] + public void Interface_explicit_12_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicitly implemented members (indexer) can be called through interface instances"); + Assert.True(Interface_TestClass_explicit_12.testMethod()); + } + + [TestMethod] + public void Interface_explicit_13_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicitly implemented members (event) can be called through interface instances (Bug 89766)"); + Assert.True(Interface_TestClass_explicit_13.testMethod()); + } + + [TestMethod] + public void Interface_explicit_21_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Hidden base interface members may be implemented in all of the ways used in this"); + Assert.True(Interface_TestClass_explicit_21.testMethod()); + } + + [TestMethod] + public void Interface_explicit_25_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicitly implementing overloaded methods should work "); + Assert.True(Interface_TestClass_explicit_25.testMethod()); + } + + [TestMethod] + public void Interface_mdfrmeth_09_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("An abstract class can implement an interface's methods as abstract"); + Assert.True(Interface_TestClass_mdfrmeth_09.testMethod()); + } + + [TestMethod] + public void Interface_ifreimp_01_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("A class that inherits an interface implementation is permitted to re-implement the interface by including it in the base class list"); + // Known failure + Assert.False(Interface_TestClass_ifreimp_01.testMethod()); + } + + [TestMethod] + public void Interface_ifreimp_02_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Inherited public member declarations and inherited explicit interface member declarations participate in the interface mapping process for re-implemented interfaces (Bug 90165)"); + // Known failure + Assert.False(Interface_TestClass_ifreimp_02.testMethod()); + } + + [TestMethod] + public void Interface_ifreimp_03_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Interface reimplementation also reimplements the interface's base interfaces. Verify mapping is done correctly. (90165)"); + Debug.WriteLine("This Test is an expected fail in the baseline, but has passed in recent testing"); + Assert.True(Interface_TestClass_ifreimp_03.testMethod()); + } + + [TestMethod] + public void Interface_abstract_01_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("An abstract class is permitted to map base-interface methods onto abstract methods"); + Assert.True(Interface_TestClass_abstract_01.testMethod()); + } + + [TestMethod] + public void Interface_abstract_02_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("The abstract methods implementing interface methods must be overridden by inheriting classes"); + Assert.True(Interface_TestClass_abstract_02.testMethod()); + } + + [TestMethod] + public void Interface_abstract_03_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicit interface member implementations are permitted to call abstract methods"); + Assert.True(Interface_TestClass_abstract_03.testMethod()); + } + + [TestMethod] + public void Interface_indexer_02_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Simplest interface indexer declaration (int)"); + Assert.True(Interface_TestClass_indexer_02.testMethod()); + } + + [TestMethod] + public void Interface_indexer_03_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Simplest interface indexer declaration (String)"); + Assert.True(Interface_TestClass_indexer_03.testMethod()); + } + + [TestMethod] + public void Interface_indexer_04_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Simplest interface indexer declaration (user-defined struct)"); + Assert.True(Interface_TestClass_indexer_04.testMethod()); + } + + [TestMethod] + public void Interface_indexer_05_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Interface indexer with multiple parameters in formal-index-parameter-list"); + Assert.True(Interface_TestClass_indexer_05.testMethod()); + } + + [TestMethod] + public void Interface_indexer_06_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Interface indexer with just get accessor"); + Assert.True(Interface_TestClass_indexer_06.testMethod()); + } + + [TestMethod] + public void Interface_indexer_07_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Interface indexer with just set accessor"); + Assert.True(Interface_TestClass_indexer_07.testMethod()); + } + + [TestMethod] + public void Interface_indexer_18_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Using 'new' on an interface member (indexer) that doesn't hide an inherited member should gen warning "); + Debug.WriteLine("(Related Bug: 86609)"); + Assert.True(Interface_TestClass_indexer_18.testMethod()); + } + + [TestMethod] + public void Interface_meth_09_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Using 'new' on an interface member (method) that doesn't hide an inherited member should gen warning (Bug: 86609)"); + Assert.True(Interface_TestClass_meth_09.testMethod()); + } + + [TestMethod] + public void Interface_prop_09_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Using 'new' on an interface member (property) that doesn't hide an inherited member should gen warning (Bug: 86609)"); + Assert.True(Interface_TestClass_prop_09.testMethod()); + } + + [TestMethod] + public void Interface_namesig_02_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Member functions of an interface may have same name if they have diff args"); + Assert.True(Interface_TestClass_namesig_02.testMethod()); + } + + [TestMethod] + public void Interface_namesig_03_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Interface member that is hidden by an inheriting interface (without using new) gens warning"); + Assert.True(Interface_TestClass_namesig_03.testMethod()); + } + + [TestMethod] + public void Interface_namesig_04_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Interface that inherits 2 other interfaces that have a member with same sig"); + Assert.True(Interface_TestClass_namesig_04.testMethod()); + } + + [TestMethod] + public void Interface_namesig_05_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Interface member that is hidden by an inheriting interface (using new) works correctly"); + Assert.True(Interface_TestClass_namesig_05.testMethod()); + } + + [TestMethod] + public void Interface_events_08_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Using 'new' on an interface member (event) that doesn't hide an inherited member should gen warning (Bug: 118831)"); + Assert.True(Interface_TestClass_events_08.testMethod()); + } + + [TestMethod] + public void Interface_events_09_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Simple Event declaration within an interface"); + Assert.True(Interface_TestClass_events_09.testMethod()); + } + + [TestMethod] + public void Interface_maccess_01_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Inherited members with same sig, from diff interfaces, can be accessed through casting"); + Assert.True(Interface_TestClass_maccess_01.testMethod()); + } + + [TestMethod] + public void Interface_maccess_03_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Inherited members with same method names but diff args can be accessed by casting"); + Assert.True(Interface_TestClass_maccess_03.testMethod()); + } + + [TestMethod] + public void Interface_maccess_04_Test() + { + Debug.WriteLine("Section 13.2 Interface members"); + Debug.WriteLine("Inherited members with same method names but diff args should work if arg passed is not ambiguous (Regression bug: 90867)"); + Assert.True(Interface_TestClass_maccess_04.testMethod()); + } + + [TestMethod] + public void Interface_modifier_02_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Verify private interfaces gen error when declared in global namespace"); + Assert.True(Interface_TestClass_modifier_02.testMethod()); + } + + [TestMethod] + public void Interface_modifier_03_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Verify protected interfaces gen error when declared in global namespace"); + Assert.True(Interface_TestClass_modifier_03.testMethod()); + } + + [TestMethod] + public void Interface_struct_impl_01_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Simple struct implementation of two interfaces"); + Assert.True(Interface_TestClass_struct_impl_01.testMethod()); + } + + [TestMethod] + public void Interface_struct_impl_02_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("A struct that implements an interface also implicitly implements all of the interface's base interfaces"); + Assert.True(Interface_TestClass_struct_impl_02.testMethod()); + } + + [TestMethod] + public void Interface_struct_impl_04_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("A member of an interface-type can be assigned an instance of a struct that implements it"); + Assert.True(Interface_TestClass_struct_impl_04.testMethod()); + } + + [TestMethod] + public void Interface_struct_impl_05_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("A struct that implements an interface with a method, property, event, and indexer"); + Assert.True(Interface_TestClass_struct_impl_05.testMethod()); + } + + [TestMethod] + public void Interface_struct_impl_06_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Implementing a method that was defined identically by two different base-interfaces should work"); + Assert.True(Interface_TestClass_struct_impl_06.testMethod()); + } + + [TestMethod] + public void Interface_struct_impl_07_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Implementing a property that was defined identically by two different base-interfaces should work"); + Assert.True(Interface_TestClass_struct_impl_07.testMethod()); + } + + [TestMethod] + public void Interface_struct_impl_08_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Implementing an event that was defined identically by two different base-interfaces should work"); + Assert.True(Interface_TestClass_struct_impl_08.testMethod()); + } + + [TestMethod] + public void Interface_struct_impl_09_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Implementing an indexer that was defined identically by two different base-interfaces should work"); + Assert.True(Interface_TestClass_struct_impl_09.testMethod()); + } + + [TestMethod] + public void Interface_struct_explicit_01_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicit interface member implementations"); + Assert.True(Interface_TestClass_struct_explicit_01.testMethod()); + } + + [TestMethod] + public void Interface_struct_explicit_03_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Implementing an iface method in a struct that doesn't list the iface as a base iface but does list a iface that inherits the iface should work"); + Assert.True(Interface_TestClass_struct_explicit_03.testMethod()); + } + + [TestMethod] + public void Interface_struct_explicit_04_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicit interface member implementation of a method"); + Assert.True(Interface_TestClass_struct_explicit_04.testMethod()); + } + + [TestMethod] + public void Interface_struct_explicit_05_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicit interface member implementation of a property"); + Assert.True(Interface_TestClass_struct_explicit_05.testMethod()); + } + + [TestMethod] + public void Interface_struct_explicit_06_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicit interface member implementation of an event (Bug: 89766)"); + Assert.True(Interface_TestClass_struct_explicit_06.testMethod()); + } + + [TestMethod] + public void Interface_struct_explicit_07_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicit interface member implementation of an indexer"); + Assert.True(Interface_TestClass_struct_explicit_07.testMethod()); + } + + [TestMethod] + public void Interface_struct_explicit_09_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Multiple base interfaces and explicit interface member implementations work"); + Assert.True(Interface_TestClass_struct_explicit_09.testMethod()); + } + + [TestMethod] + public void Interface_struct_explicit_10_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicitly implemented members (method) can be called through interface instances"); + Assert.True(Interface_TestClass_struct_explicit_10.testMethod()); + } + + [TestMethod] + public void Interface_struct_explicit_11_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicitly implemented members (property) can be called through interface instances (Bug 90570)"); + Assert.True(Interface_TestClass_struct_explicit_11.testMethod()); + } + + [TestMethod] + public void Interface_struct_explicit_12_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicitly implemented members (indexer) can be called through interface instances (Bug 90570)"); + Assert.True(Interface_TestClass_struct_explicit_12.testMethod()); + } + + [TestMethod] + public void Interface_struct_explicit_13_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicitly implemented members (event) can be called through interface instances (89766)"); + Assert.True(Interface_TestClass_struct_explicit_13.testMethod()); + } + + [TestMethod] + public void Interface_struct_explicit_19_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Explicitly implementing member from interface not in base-list (but in base-list of a base interface) should work"); + Assert.True(Interface_TestClass_struct_explicit_19.testMethod()); + } + + [TestMethod] + public void Interface_struct_explicit_20_Test() + { + Debug.WriteLine("Section 13.4 Interface implementations"); + Debug.WriteLine("Hidden base interface members may be implemented in all of the ways used in this"); + Assert.True(Interface_TestClass_struct_explicit_20.testMethod()); + } + + [TestMethod] + public void Interface_struct_decl_01_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simplest interface declared in a struct in default global namespace"); + Assert.True(Interface_TestClass_struct_decl_01.testMethod()); + } + + [TestMethod] + public void Interface_struct_decl_02_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simplest interface declared in a struct in a declared namespace"); + Assert.True(Interface_TestClass_decl_02_NS.Interface_TestClass_decl_02.testMethod()); + } + + [TestMethod] + public void Interface_struct_inherit_01_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simplest form of interface inheritance, inheriting multiple interfaces"); + Assert.True(Interface_TestClass_struct_inherit_01.testMethod()); + } + + [TestMethod] + public void Interface_struct_modifier_01_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Verify public and internal interfaces are valid inside structs"); + Assert.True(Interface_TestClass_struct_modifier_01.testMethod()); + } + + [TestMethod] + public void Interface_struct_modifier_02_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Verify private interfaces are valid inside structs"); + Assert.True(Interface_TestClass_struct_modifier_02.testMethod()); + } + + [TestMethod] + public void Interface_struct_modifier_03_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Verify new interface gens warning if not hiding anything"); + Assert.True(Interface_TestClass_struct_modifier_03.testMethod()); + } + + [TestMethod] + public void Interface_struct_semicolon_01_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simplest interface declared (with semi-colon) in a struct in default global namespace"); + Assert.True(Interface_TestClass_struct_semicolon_01.testMethod()); + } + + [TestMethod] + public void Interface_struct_semicolon_02_Test() + { + Debug.WriteLine("Section 13.1 Interface declarations "); + Debug.WriteLine("Simplest interface declared (with semi-colon) in a struct in a declared namespace"); + Assert.True(Interface_TestClass_semicolon_02_NS.Interface_TestClass_semicolon_02.testMethod()); + } + + //Compiled Test Cases + class Interface_TestClass_base_06 + { + internal interface Interface_TestClass_base_06_I { } + + public interface Interface_TestClass_base_06_2 : Interface_TestClass_base_06_I { } + + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_decl_01_I + { + }; + class Interface_TestClass_decl_01 + { + public static void Main_old() + { + Debug.WriteLine("This works!"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + class Interface_TestClass_decl_03 + { + interface Interface_TestClass_decl_03_I + { + } + public static void Main_old() + { + Debug.WriteLine("This works!"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + interface Interface_TestClass_decl_05_1 + { + // methods returning various different types + void meth1(); + int meth2(); + double meth3(); + bool meth4(); + char meth5(); + String meth6(); + float meth7(); + // methods accepting various different types as arguments + void arg1(int x); + void arg2(double x); + void arg3(bool x); + void arg4(char x); + void arg5(String x); + void arg6(float x); + // properties of various different types + int typ1 { get; set; } + double typ2 { get; set; } + bool typ3 { get; set; } + char typ4 { get; set; } + String typ5 { get; set; } + float typ6 { get; set; } + } + class Interface_TestClass_decl_05 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_decl_06_1 + { + // properties of various different types + int typ1 { get; } + double typ2 { get; } + bool typ3 { get; } + char typ4 { get; } + String typ5 { get; } + float typ6 { get; } + } + class Interface_TestClass_decl_06 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_decl_07_1 + { + // properties of various different types + int typ1 { set; } + double typ2 { set; } + bool typ3 { set; } + char typ4 { set; } + String typ5 { set; } + float typ6 { set; } + } + class Interface_TestClass_decl_07 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Interface_TestClass_inherit_01_1 + { + public interface m { } + } + class Interface_TestClass_inherit_01 : Interface_TestClass_inherit_01_1 + { + new void m() { } + + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_inherit_02_I { } + interface Interface_TestClass_inherit_02_2 : Interface_TestClass_inherit_02_I { } + class Interface_TestClass_inherit_02 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_inherit_03_A { } + interface Interface_TestClass_inherit_03_B { } + interface Interface_TestClass_inherit_03_C { } + interface Interface_TestClass_inherit_03_D : Interface_TestClass_inherit_03_A, Interface_TestClass_inherit_03_B, Interface_TestClass_inherit_03_C + { } + class Interface_TestClass_inherit_03 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_inherit_04_A + { + void m(); + } + interface Interface_TestClass_inherit_04_B : Interface_TestClass_inherit_04_A { } + interface Interface_TestClass_inherit_04_C : Interface_TestClass_inherit_04_B { } + class Interface_TestClass_inherit_04 : Interface_TestClass_inherit_04_C + { + public void m() + { + Debug.WriteLine("This works!"); + } + + public static void Main_old() + { + Interface_TestClass_inherit_04 Interface_TestClass_inherit_04_1 = new Interface_TestClass_inherit_04(); + Interface_TestClass_inherit_04_1.m(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Interface_TestClass_inherit_08_1 + { + public interface m { } + } + class Interface_TestClass_inherit_08 : Interface_TestClass_inherit_08_1 + { + void m() { } + + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public interface Interface_TestClass_modifier_01_I { } + internal interface Interface_TestClass_modifier_01_I2 { } + class Interface_TestClass_modifier_01 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Interface_TestClass_modifier_05 + { + public interface Interface_TestClass_modifier_05_I { } + internal interface Interface_TestClass_modifier_05_I2 { } + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Interface_TestClass_modifier_06 + { + private interface Interface_TestClass_modifier_06_I { } + protected interface Interface_TestClass_modifier_06_I2 { } + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Interface_TestClass_modifier_07 + { + new interface Interface_TestClass_modifier_07_I { } + + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Interface_TestClass_modifier_08_1 + { + public void m() { } + } + class Interface_TestClass_modifier_08 : Interface_TestClass_modifier_08_1 + { + new interface m { } + + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class Interface_TestClass_modifier_10 + { + protected internal interface Interface_TestClass_modifier_10_I { } + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_semicolon_01_I + { + }; + class Interface_TestClass_semicolon_01 + { + public static void Main_old() + { + Debug.WriteLine("This works!"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + class Interface_TestClass_semicolon_03 + { + interface Interface_TestClass_semicolon_03_I + { + }; + public static void Main_old() + { + Debug.WriteLine("This works!"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + /* + public class Interface_TestClass_implbyinherit_01b_1 : Interface_TestClass_implbyinherit_01b_2, Interface_TestClass_implbyinherit_01b_I1 + { + public static void Main_old() + { + } + public static bool testMethod() + { + Main_old(); + return true; + } + }*/ + interface Interface_TestClass_impl_01_I1 + { + void F(); + } + interface Interface_TestClass_impl_01_I2 + { + void G(); + } + class Interface_TestClass_impl_01_1 : Interface_TestClass_impl_01_I1, Interface_TestClass_impl_01_I2 + { + public void F() { } + public void G() { } + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_impl_02_I2 + { + void Interface_TestClass_impl_02_B(); + } + interface Interface_TestClass_impl_02_I3 : Interface_TestClass_impl_02_I2 + { + void Interface_TestClass_impl_02_D(); + } + class Interface_TestClass_impl_02_1 : Interface_TestClass_impl_02_I3 + { + public void Interface_TestClass_impl_02_B() { } + public void Interface_TestClass_impl_02_D() { } + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_impl_04_I1 + { + void F(); + } + class Interface_TestClass_impl_04_C : Interface_TestClass_impl_04_I1 + { + public void F() + { + Debug.WriteLine("Interface_TestClass_impl_04_C.F()"); + } + } + class Interface_TestClass_impl_04 + { + public static void Main_old() + { + Interface_TestClass_impl_04_C cc = new Interface_TestClass_impl_04_C(); + Interface_TestClass_impl_04_I1 ic = cc; + cc.F(); + ic.F(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_impl_05_I1 + { + void F(); + } + class Interface_TestClass_impl_05_C : Interface_TestClass_impl_05_I1 + { + public void F() + { + Debug.WriteLine("Interface_TestClass_impl_05_C.F()"); + } + } + class Interface_TestClass_impl_05_D : Interface_TestClass_impl_05_C + { + public void F() + { + Debug.WriteLine("Interface_TestClass_impl_05_D.F()"); + } + } + class Interface_TestClass_impl_05 + { + public static void Main_old() + { + Interface_TestClass_impl_05_C cc = new Interface_TestClass_impl_05_C(); + Interface_TestClass_impl_05_D cd = new Interface_TestClass_impl_05_D(); + Interface_TestClass_impl_05_I1 ic = cc; + Interface_TestClass_impl_05_I1 id = cd; + cc.F(); + ic.F(); + id.F(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_impl_06_I1 + { + void F(); + } + class Interface_TestClass_impl_06_C : Interface_TestClass_impl_06_I1 + { + public virtual void F() + { + Debug.WriteLine("Interface_TestClass_impl_06_C.F()"); + } + } + class Interface_TestClass_impl_06_D : Interface_TestClass_impl_06_C + { + public override void F() + { + Debug.WriteLine("Interface_TestClass_impl_06_D.F()"); + } + } + class Interface_TestClass_impl_06 + { + public static void Main_old() + { + Interface_TestClass_impl_06_C cc = new Interface_TestClass_impl_06_C(); + Interface_TestClass_impl_06_D cd = new Interface_TestClass_impl_06_D(); + Interface_TestClass_impl_06_I1 ic = cc; + Interface_TestClass_impl_06_I1 id = cd; + cc.F(); + ic.F(); + id.F(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public delegate void Interface_TestClass_impl_07_ev(object sender); + interface Interface_TestClass_impl_07_I + { + void Method(); + int Property { get; set; } + event Interface_TestClass_impl_07_ev Clicked; + string this[int index] { get; set; } + } + class Interface_TestClass_impl_07_1 : Interface_TestClass_impl_07_I + { + private int num; + + public void Method() + { + Debug.WriteLine("Method()"); + } + public int Property + { + get + { + return num; + } + set + { + if (value >= 0 && value <= 10) + num = value; + } + } + public event Interface_TestClass_impl_07_ev Clicked; + public string this[int index] + { + get { return "Interface_TestClass_impl_07"; } + set { } + } + } + class Interface_TestClass_impl_07 + { + public static void Main_old() + { + Interface_TestClass_impl_07 t = new Interface_TestClass_impl_07(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_impl_08_I1 + { + void Paint(); + } + interface Interface_TestClass_impl_08_I2 + { + void Paint(); + } + class Interface_TestClass_impl_08 : Interface_TestClass_impl_08_I1, Interface_TestClass_impl_08_I2 + { + public void Paint() { } + + public static void Main_old() + { + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_impl_09_I1 + { + int MyProp { get; set; } + } + interface Interface_TestClass_impl_09_I2 + { + int MyProp { get; set; } + } + class Interface_TestClass_impl_09 : Interface_TestClass_impl_09_I1, Interface_TestClass_impl_09_I2 + { + public int MyProp + { + get + { + return 0; + } + set + { + } + } + + public static void Main_old() + { + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public delegate void MyDelegate(object sender); + interface Interface_TestClass_impl_10_I1 + { + event MyDelegate Interface_TestClass_impl_10_ev; + } + interface Interface_TestClass_impl_10_I2 + { + event MyDelegate Interface_TestClass_impl_10_ev; + } + class Interface_TestClass_impl_10 : Interface_TestClass_impl_10_I1, Interface_TestClass_impl_10_I2 + { + public event MyDelegate Interface_TestClass_impl_10_ev; + + public static void Main_old() + { + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_impl_11_I1 + { + string this[int index] { get; set; } + } + interface Interface_TestClass_impl_11_I2 + { + string this[int index] { get; set; } + } + class Interface_TestClass_impl_11 : Interface_TestClass_impl_11_I1, Interface_TestClass_impl_11_I2 + { + public string this[int index] + { + get { return "Interface_TestClass_impl_11_1"; } + set { } + } + + public static void Main_old() + { + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_impl_12_I1 + { + void F(); + } + class Interface_TestClass_impl_12_1 + { + public void F() { } + public void G() { } + } + class MyOtherClass : Interface_TestClass_impl_12_1, Interface_TestClass_impl_12_I1 + { + public new void G() { } + } + class Interface_TestClass_impl_12 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_impl_13_I1 + { + int foo(); + } + interface Interface_TestClass_impl_13_I2 + { + int foo(); + } + class Interface_TestClass_impl_13_2 : Interface_TestClass_impl_13_I1, Interface_TestClass_impl_13_I2 + { + public int foo() { return 0; } + } + class Interface_TestClass_impl_13 + { + public static int Main_old() + { + Interface_TestClass_impl_13_2 x = new Interface_TestClass_impl_13_2(); + + Interface_TestClass_impl_13_I1 Interface_TestClass_impl_13_2 = x; + Interface_TestClass_impl_13_I2 b = x; + + if (Interface_TestClass_impl_13_2 == b) + { + return 0; + } + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + interface Interface_TestClass_implinherit_01_I1 + { + void Paint(); + } + class Interface_TestClass_implinherit_01_1 : Interface_TestClass_implinherit_01_I1 + { + public void Paint() + { + Debug.WriteLine("Interface_TestClass_implinherit_01_1.Paint()"); + } + } + class Interface_TestClass_implinherit_01_2 : Interface_TestClass_implinherit_01_1 + { + new public void Paint() + { + Debug.WriteLine("Interface_TestClass_implinherit_01_2.Paint()"); + } + } + class Interface_TestClass_implinherit_01 + { + public static void Main_old() + { + Interface_TestClass_implinherit_01_1 c = new Interface_TestClass_implinherit_01_1(); + Interface_TestClass_implinherit_01_2 t = new Interface_TestClass_implinherit_01_2(); + Interface_TestClass_implinherit_01_I1 ic = c; + Interface_TestClass_implinherit_01_I1 it = t; + c.Paint(); + t.Paint(); + ic.Paint(); + it.Paint(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_implinherit_02_I1 + { + void Paint(); + } + class Interface_TestClass_implinherit_02_1 : Interface_TestClass_implinherit_02_I1 + { + public virtual void Paint() + { + Debug.WriteLine("Interface_TestClass_implinherit_02_1.Paint()"); + } + } + class Interface_TestClass_implinherit_02_2 : Interface_TestClass_implinherit_02_1 + { + public override void Paint() + { + Debug.WriteLine("Interface_TestClass_implinherit_02_2.Paint()"); + } + } + class Interface_TestClass_implinherit_02 + { + public static void Main_old() + { + Interface_TestClass_implinherit_02_1 c = new Interface_TestClass_implinherit_02_1(); + Interface_TestClass_implinherit_02_2 t = new Interface_TestClass_implinherit_02_2(); + Interface_TestClass_implinherit_02_I1 ic = c; + Interface_TestClass_implinherit_02_I1 it = t; + c.Paint(); + t.Paint(); + ic.Paint(); + it.Paint(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_explicit_01_I1 + { + void F(); + } + interface Interface_TestClass_explicit_01_I2 + { + void G(); + } + class Interface_TestClass_explicit_01_C : Interface_TestClass_explicit_01_I1, Interface_TestClass_explicit_01_I2 + { + void Interface_TestClass_explicit_01_I1.F() { } + void Interface_TestClass_explicit_01_I2.G() { } + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_explicit_03_I1 + { + void F(); + } + interface Interface_TestClass_explicit_03_I2 : Interface_TestClass_explicit_03_I1 + { + void G(); + } + class Interface_TestClass_explicit_03_C : Interface_TestClass_explicit_03_I2 + { + void Interface_TestClass_explicit_03_I1.F() { } + void Interface_TestClass_explicit_03_I2.G() { } + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_explicit_04_1 + { + void Method(); + } + class Interface_TestClass_explicit_04_2 : Interface_TestClass_explicit_04_1 + { + void Interface_TestClass_explicit_04_1.Method() + { + Debug.WriteLine("Method()"); + } + } + class Interface_TestClass_explicit_04 + { + public static void Main_old() + { + Interface_TestClass_explicit_04_2 t = new Interface_TestClass_explicit_04_2(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_explicit_05_1 + { + int Property { get; set; } + } + class Interface_TestClass_explicit_05_2 : Interface_TestClass_explicit_05_1 + { + private int num; + + int Interface_TestClass_explicit_05_1.Property + { + get + { + return num; + } + set + { + if (value >= 0 && value <= 10) + num = value; + } + } + } + class Interface_TestClass_explicit_05 + { + public static void Main_old() + { + Interface_TestClass_explicit_05_2 t = new Interface_TestClass_explicit_05_2(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public delegate void Interface_TestClass_explicit_06_ev(object sender); + interface Interface_TestClass_explicit_06_1 + { + event Interface_TestClass_explicit_06_ev Clicked; + } + class Interface_TestClass_explicit_06_2 : Interface_TestClass_explicit_06_1 + { + event Interface_TestClass_explicit_06_ev Interface_TestClass_explicit_06_1.Clicked + { + add { } + remove { } + } + public void MyHandler(object sender) + { + + } + } + class Interface_TestClass_explicit_06 + { + public static void Main_old() + { + Interface_TestClass_explicit_06_2 t = new Interface_TestClass_explicit_06_2(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_explicit_07_1 + { + string this[int index] { get; set; } + } + class Interface_TestClass_explicit_07_2 : Interface_TestClass_explicit_07_1 + { + string Interface_TestClass_explicit_07_1.this[int index] + { + get { return "Interface_TestClass_explicit_07"; } + set { } + } + } + class Interface_TestClass_explicit_07 + { + public static void Main_old() + { + Interface_TestClass_explicit_07_2 t = new Interface_TestClass_explicit_07_2(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface ICloneable + { + object Clone(); + } + interface Interface_TestClass_explicit_09_I2 + { + int CompareTo(object other); + } + class Interface_TestClass_explicit_09_1 : ICloneable, Interface_TestClass_explicit_09_I2 + { + object ICloneable.Clone() + { + return new object(); + } + + int Interface_TestClass_explicit_09_I2.CompareTo(object other) + { + return 0; + } + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_explicit_10_C + { + object Clone(); + } + interface Interface_TestClass_explicit_10_I2 + { + int CompareTo(object other); + } + class Interface_TestClass_explicit_10_1 : Interface_TestClass_explicit_10_C, Interface_TestClass_explicit_10_I2 + { + object Interface_TestClass_explicit_10_C.Clone() + { + return new object(); + } + + int Interface_TestClass_explicit_10_I2.CompareTo(object other) + { + return 0; + } + } + class Interface_TestClass_explicit_10 + { + public static void Main_old() + { + Interface_TestClass_explicit_10_1 le = new Interface_TestClass_explicit_10_1(); + object o = ((Interface_TestClass_explicit_10_C)le).Clone(); + + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch (System.Exception) + { + + return false; + } + return true; + } + } + interface ICloneable_2 + { + int Value { get; set; } + } + interface Interface_TestClass_explicit_11_I2 + { + int CompareTo(object other); + } + class Interface_TestClass_explicit_11_1 : ICloneable_2, Interface_TestClass_explicit_11_I2 + { + private int val; + + int ICloneable_2.Value + { + get { return val; } + set { val = value; } + } + + int Interface_TestClass_explicit_11_I2.CompareTo(object other) + { + return 0; + } + } + class Interface_TestClass_explicit_11 + { + public static int Main_old() + { + try + { + Interface_TestClass_explicit_11_1 le = new Interface_TestClass_explicit_11_1(); + ((ICloneable_2)le).Value = 5; + if (((ICloneable_2)le).Value == 5) + return 0; + else + return 1; + } + catch (System.Exception) + { + + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + interface ICloneable_3 + { + string this[string hashkey] { get; set; } + } + interface Interface_TestClass_explicit_12_I2 + { + int CompareTo(object other); + } + class Interface_TestClass_explicit_12_1 : ICloneable_3, Interface_TestClass_explicit_12_I2 + { + public string st = ""; + string ICloneable_3.this[string hashkey] + { + get + { + return "success"; + } + set + { + st = value; + } + } + + int Interface_TestClass_explicit_12_I2.CompareTo(object other) + { + return 0; + } + } + class Interface_TestClass_explicit_12 + { + public static int Main_old() + { + try + { + Interface_TestClass_explicit_12_1 le = new Interface_TestClass_explicit_12_1(); + ((ICloneable_3)le)["Interface_TestClass_explicit_12_1"] = "correct"; + string s = ((ICloneable_3)le)["Interface_TestClass_explicit_12_1"]; + if (le.st == "correct" && s == "success") + return 0; + else + return 1; + } + catch (System.Exception) + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public delegate void Interface_TestClass_explicit_13_ev(object sender); + interface Interface_TestClass_explicit_13_1 + { + event Interface_TestClass_explicit_13_ev Clicked; + } + class Interface_TestClass_explicit_13_2 : Interface_TestClass_explicit_13_1 + { + event Interface_TestClass_explicit_13_ev Interface_TestClass_explicit_13_1.Clicked + { + add { } + remove { } + } + public void MyHandler(object sender) + { + + } + } + class Interface_TestClass_explicit_13 + { + public static void Main_old() + { + new Interface_TestClass_explicit_13().Run(); + } + public void Run() + { + Interface_TestClass_explicit_13_2 t = new Interface_TestClass_explicit_13_2(); + ((Interface_TestClass_explicit_13_1)t).Clicked += new Interface_TestClass_explicit_13_ev(TheHandler); + } + public void TheHandler(object sender) + { + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch (System.Exception) + { + return false; + + } + return true; + } + } + + interface Interface_TestClass_explicit_20_I3 : ICloneable + { + string OtherMethod(); + } + class Interface_TestClass_explicit_20_1 : Interface_TestClass_explicit_20_I3 + { + string Interface_TestClass_explicit_20_I3.OtherMethod() + { + return "Interface_TestClass_explicit_20_1"; + } + + object ICloneable.Clone() + { + return new object(); + } + + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_explicit_21_I2 + { + int P { get; } + } + interface Interface_TestClass_explicit_21_I3 : Interface_TestClass_explicit_21_I2 + { + new int P(); + } + class Interface_TestClass_explicit_21_1 : Interface_TestClass_explicit_21_I3 + { + int Interface_TestClass_explicit_21_I2.P { get { return 1; } } + int Interface_TestClass_explicit_21_I3.P() { return 1; } + } + class Interface_TestClass_explicit_21_2 : Interface_TestClass_explicit_21_I3 + { + public int P { get { return 1; } } + int Interface_TestClass_explicit_21_I3.P() { return 1; } + } + class Interface_TestClass_explicit_21_3 : Interface_TestClass_explicit_21_I3 + { + int Interface_TestClass_explicit_21_I2.P { get { return 1; } } + public int P() { return 1; } + } + class Interface_TestClass_explicit_21 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + class TypeA { } + class TypeB { } + interface Interface_TestClass_explicit_25_I3 + { + int foo(TypeA Interface_TestClass_explicit_25_2); + int foo(TypeB b); + } + class Interface_TestClass_explicit_25_A : Interface_TestClass_explicit_25_I3 + { + int Interface_TestClass_explicit_25_I3.foo(TypeA Interface_TestClass_explicit_25_2) + { + return 1; + } + + int Interface_TestClass_explicit_25_I3.foo(TypeB b) + { + return 2; + } + } + class Interface_TestClass_explicit_25 + { + static int Main_old() + { + try + { + TypeA Interface_TestClass_explicit_25_2 = new TypeA(); + TypeB b = new TypeB(); + Interface_TestClass_explicit_25_A Interface_TestClass_explicit_25_1 = new Interface_TestClass_explicit_25_A(); + if (((Interface_TestClass_explicit_25_I3)Interface_TestClass_explicit_25_1).foo(Interface_TestClass_explicit_25_2) != 1) + return 1; + if (((Interface_TestClass_explicit_25_I3)Interface_TestClass_explicit_25_1).foo(b) != 2) + return 1; + return 0; + } + catch (System.Exception) + { + return 1; + + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + interface Interface_TestClass_mdfrmeth_09_I1 + { + void F(); + void G(); + } + abstract class Interface_TestClass_mdfrmeth_09_C : Interface_TestClass_mdfrmeth_09_I1 + { + public abstract void F(); + public abstract void G(); + } + class Interface_TestClass_mdfrmeth_09 + { + public static void Main_old() + { + + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_ifreimp_01_I1 + { + void Paint(); + } + class Interface_TestClass_ifreimp_01_1 : Interface_TestClass_ifreimp_01_I1 + { + void Interface_TestClass_ifreimp_01_I1.Paint() + { + Debug.WriteLine("Interface_TestClass_ifreimp_01_1.Interface_TestClass_ifreimp_01_I1.Paint()"); + throw new Exception("Incorrect method got called!"); + } + } + class Interface_TestClass_ifreimp_01_3 : Interface_TestClass_ifreimp_01_1, Interface_TestClass_ifreimp_01_I1 + { + public void Paint() + { + Debug.WriteLine("Interface_TestClass_ifreimp_01_3.Paint()"); + } + } + class Interface_TestClass_ifreimp_01 + { + public static bool testMethod() + { + Interface_TestClass_ifreimp_01_I1 instance = new Interface_TestClass_ifreimp_01_3(); + try + { + instance.Paint(); + } + catch (Exception) + { + return false; + } + + return true; + } + } + interface Interface_TestClass_ifreimp_02_I1 + { + void F(); + void G(); + void H(); + void I(); + } + class Interface_TestClass_ifreimp_02_2 : Interface_TestClass_ifreimp_02_I1 + { + void Interface_TestClass_ifreimp_02_I1.F() + { + Debug.WriteLine("Interface_TestClass_ifreimp_02_2.Interface_TestClass_ifreimp_02_I1.F()"); + throw new Exception("Incorrect method got called!"); + } + + void Interface_TestClass_ifreimp_02_I1.G() + { + Debug.WriteLine("Interface_TestClass_ifreimp_02_2.Interface_TestClass_ifreimp_02_I1.G()"); + } + + public void H() + { + Debug.WriteLine("Interface_TestClass_ifreimp_02_2.H()"); + throw new Exception("Incorrect method got called!"); + } + + public void I() + { + Debug.WriteLine("Interface_TestClass_ifreimp_02_2.I()"); + } + } + class Interface_TestClass_ifreimp_02_1 : Interface_TestClass_ifreimp_02_2, Interface_TestClass_ifreimp_02_I1 + { + public void F() + { + Debug.WriteLine("Interface_TestClass_ifreimp_02_1.F()"); + } + + void Interface_TestClass_ifreimp_02_I1.H() + { + Debug.WriteLine("Interface_TestClass_ifreimp_02_1.Interface_TestClass_ifreimp_02_I1.H()"); + } + } + class Interface_TestClass_ifreimp_02 + { + public static bool testMethod() + { + try + { + Interface_TestClass_ifreimp_02_I1 im = new Interface_TestClass_ifreimp_02_1(); ; + im.F(); + im.G(); + im.H(); + im.I(); + } + catch (Exception) + { + return false; + } + + return true; + } + } + interface Interface_TestClass_ifreimp_03_I2 + { + void F(); + } + interface Interface_TestClass_ifreimp_03_I3 : Interface_TestClass_ifreimp_03_I2 + { + void G(); + } + class Interface_TestClass_ifreimp_03_C : Interface_TestClass_ifreimp_03_I3 + { + void Interface_TestClass_ifreimp_03_I2.F() + { + Debug.WriteLine("Interface_TestClass_ifreimp_03_C.Interface_TestClass_ifreimp_03_I2.F()"); + } + void Interface_TestClass_ifreimp_03_I3.G() + { + Debug.WriteLine("Interface_TestClass_ifreimp_03_C.Interface_TestClass_ifreimp_03_I3.G()"); + } + } + class Interface_TestClass_ifreimp_03_D : Interface_TestClass_ifreimp_03_C, Interface_TestClass_ifreimp_03_I3 + { + public void F() + { + Debug.WriteLine("Interface_TestClass_ifreimp_03_D.F()"); + } + public void G() + { + Debug.WriteLine("Interface_TestClass_ifreimp_03_D.G()"); + } + } + class Interface_TestClass_ifreimp_03 + { + public static void Main_old() + { + Interface_TestClass_ifreimp_03_D d = new Interface_TestClass_ifreimp_03_D(); + Interface_TestClass_ifreimp_03_I2 ib = d; + ib.F(); + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch (System.Exception) + { + return false; + } + return true; + } + } + interface Interface_TestClass_abstract_01_I1 + { + void F(); + void G(); + } + abstract class Interface_TestClass_abstract_01_C : Interface_TestClass_abstract_01_I1 + { + public abstract void F(); + public abstract void G(); + } + class Interface_TestClass_abstract_01 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_abstract_02_I1 + { + void F(); + void G(); + } + abstract class Interface_TestClass_abstract_02_C : Interface_TestClass_abstract_02_I1 + { + public abstract void F(); + public abstract void G(); + } + class Interface_TestClass_abstract_02_D : Interface_TestClass_abstract_02_C + { + public override void F() { } + public override void G() { } + } + class Interface_TestClass_abstract_02 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_abstract_03_I1 + { + void F(); + void G(); + } + abstract class Interface_TestClass_abstract_03_C : Interface_TestClass_abstract_03_I1 + { + public void F() { FF(); } + public void G() { GG(); } + protected abstract void FF(); + protected abstract void GG(); + } + class Interface_TestClass_abstract_03 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_indexer_02_1 + { + int this[int ident1] { get; set; } + } + class Interface_TestClass_indexer_02 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_indexer_03_1 + { + String this[String ident1] { get; set; } + } + class Interface_TestClass_indexer_03 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + struct Interface_TestClass_indexer_04_str + { + } + interface Interface_TestClass_indexer_04_1 + { + Interface_TestClass_indexer_04_str this[Interface_TestClass_indexer_04_str ident1] { get; set; } + } + class Interface_TestClass_indexer_04 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + struct Interface_TestClass_indexer_05_str + { + } + interface Interface_TestClass_indexer_05_1 + { + Interface_TestClass_indexer_05_str this[Interface_TestClass_indexer_05_str ident1, int x, double y] { get; set; } + } + class Interface_TestClass_indexer_05 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + struct Interface_TestClass_indexer_06_str + { + } + interface Interface_TestClass_indexer_06_1 + { + Interface_TestClass_indexer_06_str this[Interface_TestClass_indexer_06_str ident1, int x, double y] { get; } + } + class Interface_TestClass_indexer_06 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + struct Interface_TestClass_indexer_07_str + { + } + interface Interface_TestClass_indexer_07_1 + { + Interface_TestClass_indexer_07_str this[Interface_TestClass_indexer_07_str ident1, int x, double y] { set; } + } + class Interface_TestClass_indexer_07 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public delegate void Interface_TestClass_indexer_18_ev(object sender); + interface Interface_TestClass_indexer_18_2 + { + new int this[int ident1] { get; set; } + } + class Interface_TestClass_indexer_18 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_meth_09_1 + { + new void F(int x); + } + class Interface_TestClass_meth_09 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_prop_09_2 + { + new int x + { + get; + set; + } + } + class Interface_TestClass_prop_09 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + interface Interface_TestClass_namesig_02_1 + { + void F(int x); + void F(String x); + } + class Interface_TestClass_namesig_02_c : Interface_TestClass_namesig_02_1 + { + public void F(int x) + { + Debug.WriteLine("F(int x) works!"); + } + public void F(String x) + { + Debug.WriteLine("F(String x) works!"); + } + } + class Interface_TestClass_namesig_02 + { + public static void Main_old() + { + Interface_TestClass_namesig_02_c tc = new Interface_TestClass_namesig_02_c(); + tc.F(23); + tc.F("Interface_TestClass_namesig_02"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_namesig_03_1 + { + void F(int x); + } + interface Interface_TestClass_namesig_03_2 : Interface_TestClass_namesig_03_1 + { + int F(int x); + } + class Interface_TestClass_namesig_03 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_namesig_04_1 + { + void F(int x); + } + interface Interface_TestClass_namesig_04_2 + { + void F(int x); + } + interface Interface_TestClass_namesig_04_3 : Interface_TestClass_namesig_04_1, Interface_TestClass_namesig_04_2 + { + } + class Interface_TestClass_namesig_04 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_namesig_05_1 + { + void F(int x); + } + interface Interface_TestClass_namesig_05_2 : Interface_TestClass_namesig_05_1 + { + new int F(int x); + } + class Interface_TestClass_namesig_05 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public delegate void Interface_TestClass_events_08_ev(object sender); + interface Interface_TestClass_events_08_2 + { + new event Interface_TestClass_events_08_ev Click; + } + class Interface_TestClass_events_08 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public delegate void Interface_TestClass_events_09_EH(object sender); + interface Interface_TestClass_events_09_1 + { + event Interface_TestClass_events_09_EH Click; + } + class Interface_TestClass_events_09 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_maccess_01_I1 + { + int Count { get; set; } + } + interface Interface_TestClass_maccess_01_I2 + { + void Count(int i); + } + interface IListCounter : Interface_TestClass_maccess_01_I1, Interface_TestClass_maccess_01_I2 { } + class Interface_TestClass_maccess_01 + { + void Test(IListCounter x) + { + ((Interface_TestClass_maccess_01_I1)x).Count = 1; + ((Interface_TestClass_maccess_01_I2)x).Count(1); + } + + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_maccess_03_I1 + { + void Add(int i); + } + interface Interface_TestClass_maccess_03_I2 + { + void Add(double d); + } + interface Interface_TestClass_maccess_03_I3 : Interface_TestClass_maccess_03_I1, Interface_TestClass_maccess_03_I2 { } + class Interface_TestClass_maccess_03 + { + void Test(Interface_TestClass_maccess_03_I3 n) + { + ((Interface_TestClass_maccess_03_I1)n).Add(1); + ((Interface_TestClass_maccess_03_I2)n).Add(1); + } + + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_maccess_04_I1 + { + void Add(int i); + } + interface Interface_TestClass_maccess_04_I2 + { + void Add(double d); + } + interface Interface_TestClass_maccess_04_I3 : Interface_TestClass_maccess_04_I1, Interface_TestClass_maccess_04_I2 { } + class Interface_TestClass_maccess_04 + { + void Test(Interface_TestClass_maccess_04_I3 n) + { + n.Add(1.2); + } + + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_maccess_06_I2 + { + int F(int i); + } + interface Interface_TestClass_maccess_06_I4 : Interface_TestClass_maccess_06_I2 + { + new string F(int i); + } + interface Interface_TestClass_maccess_06_I5 : Interface_TestClass_maccess_06_I2 + { + void G(); + } + interface Interface_TestClass_maccess_06_I3 : Interface_TestClass_maccess_06_I4, Interface_TestClass_maccess_06_I5 { } + class Interface_TestClass_maccess_06_C + { + void Interface_TestClass_maccess_06(Interface_TestClass_maccess_06_I3 d) + { + // Calling d.F(1) should return Interface_TestClass_maccess_06_2 string, which proves that + // it's calling Interface_TestClass_maccess_06_I4's F method as expected. + string x = d.F(1); + } + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + private interface Interface_TestClass_modifier_02_I { } + class Interface_TestClass_modifier_02 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + protected interface Interface_TestClass_modifier_03_I { } + class Interface_TestClass_modifier_03 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + //Compiled Test Cases + interface Interface_TestClass_struct_impl_01_I1 + { + void F(); + } + interface Interface_TestClass_struct_impl_01_I2 + { + void G(); + } + struct Interface_TestClass_struct_impl_01_1 : Interface_TestClass_struct_impl_01_I1, Interface_TestClass_impl_01_I2 + { + public void F() { } + public void G() { } + } + class Interface_TestClass_struct_impl_01 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_struct_impl_02_I2 + { + void Interface_TestClass_struct_impl_02_B(); + } + interface Interface_TestClass_struct_impl_02_I3 : Interface_TestClass_struct_impl_02_I2 + { + void Interface_TestClass_struct_impl_02_D(); + } + struct Interface_TestClass_struct_impl_02_1 : Interface_TestClass_struct_impl_02_I3 + { + public void Interface_TestClass_struct_impl_02_B() { } + public void Interface_TestClass_struct_impl_02_D() { } + } + class Interface_TestClass_struct_impl_02 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_struct_impl_04_I1 + { + void F(); + } + struct Interface_TestClass_struct_impl_04_C : Interface_TestClass_struct_impl_04_I1 + { + public void F() + { + Debug.WriteLine("Interface_TestClass_struct_impl_04_C.F()"); + } + } + class Interface_TestClass_struct_impl_04 + { + public static void Main_old() + { + Interface_TestClass_struct_impl_04_C cc = new Interface_TestClass_struct_impl_04_C(); + Interface_TestClass_struct_impl_04_I1 ic = cc; + cc.F(); + ic.F(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public delegate void Interface_TestClass_struct_impl_05_ev(object sender); + interface Interface_TestClass_struct_impl_05_1 + { + void Method(); + int Property { get; set; } + event Interface_TestClass_struct_impl_05_ev Clicked; + string this[int index] { get; set; } + } + struct Interface_TestClass_struct_impl_05_2 : Interface_TestClass_struct_impl_05_1 + { + private int num; + + public void Method() + { + Debug.WriteLine("Method()"); + } + public int Property + { + get + { + return num; + } + set + { + if (value >= 0 && value <= 10) + num = value; + } + } + public event Interface_TestClass_struct_impl_05_ev Clicked; + public string this[int index] + { + get { return "Interface_TestClass_struct_impl_05"; } + set { } + } + } + class Interface_TestClass_struct_impl_05 + { + public static void Main_old() + { + Interface_TestClass_struct_impl_05_2 t = new Interface_TestClass_struct_impl_05_2(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_struct_impl_06_I1 + { + void Paint(); + } + interface Interface_TestClass_struct_impl_06_I2 + { + void Paint(); + } + struct Interface_TestClass_struct_impl_06_1 : Interface_TestClass_struct_impl_06_I1, Interface_TestClass_struct_impl_06_I2 + { + public void Paint() { } + } + class Interface_TestClass_struct_impl_06 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_struct_impl_07_I1 + { + int MyProp { get; set; } + } + interface Interface_TestClass_struct_impl_07_I2 + { + int MyProp { get; set; } + } + struct Interface_TestClass_struct_impl_07_1 : Interface_TestClass_struct_impl_07_I1, Interface_TestClass_struct_impl_07_I2 + { + public int MyProp + { + get + { + return 0; + } + set + { + } + } + } + class Interface_TestClass_struct_impl_07 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public delegate void Interface_TestClass_struct_impl_08_Del(object sender); + interface Interface_TestClass_struct_impl_08_I1 + { + event Interface_TestClass_struct_impl_08_Del Interface_TestClass_struct_impl_08_ev; + } + interface Interface_TestClass_struct_impl_08_I2 + { + event Interface_TestClass_struct_impl_08_Del Interface_TestClass_struct_impl_08_ev; + } + struct Interface_TestClass_struct_impl_08_1 : Interface_TestClass_struct_impl_08_I1, Interface_TestClass_struct_impl_08_I2 + { + public event Interface_TestClass_struct_impl_08_Del Interface_TestClass_struct_impl_08_ev; + } + class Interface_TestClass_struct_impl_08 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_struct_impl_09_I1 + { + string this[int index] { get; set; } + } + interface Interface_TestClass_struct_impl_09_I2 + { + string this[int index] { get; set; } + } + struct Interface_TestClass_struct_impl_09_1 : Interface_TestClass_struct_impl_09_I1, Interface_TestClass_struct_impl_09_I2 + { + public string this[int index] + { + get { return "Interface_TestClass_struct_impl_09_1"; } + set { } + } + } + class Interface_TestClass_struct_impl_09 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_struct_explicit_01_I1 + { + void F(); + } + interface Interface_TestClass_struct_explicit_01_I2 + { + void G(); + } + struct Interface_TestClass_struct_explicit_01_C : Interface_TestClass_struct_explicit_01_I1, Interface_TestClass_struct_explicit_01_I2 + { + void Interface_TestClass_struct_explicit_01_I1.F() { } + void Interface_TestClass_struct_explicit_01_I2.G() { } + } + class Interface_TestClass_struct_explicit_01 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_struct_explicit_03_I1 + { + void F(); + } + interface Interface_TestClass_struct_explicit_03_I2 : Interface_TestClass_struct_explicit_03_I1 + { + void G(); + } + struct Interface_TestClass_struct_explicit_03_C : Interface_TestClass_struct_explicit_03_I2 + { + void Interface_TestClass_struct_explicit_03_I1.F() { } + void Interface_TestClass_struct_explicit_03_I2.G() { } + } + class Interface_TestClass_struct_explicit_03 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_struct_explicit_04_1 + { + void Method(); + } + struct Interface_TestClass_struct_explicit_04_2 : Interface_TestClass_struct_explicit_04_1 + { + void Interface_TestClass_struct_explicit_04_1.Method() + { + Debug.WriteLine("Method()"); + } + } + class Interface_TestClass_struct_explicit_04 + { + public static void Main_old() + { + Interface_TestClass_struct_explicit_04_2 t = new Interface_TestClass_struct_explicit_04_2(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_struct_explicit_05_1 + { + int Property { get; set; } + } + struct Interface_TestClass_struct_explicit_05_2 : Interface_TestClass_struct_explicit_05_1 + { + private int num; + + int Interface_TestClass_struct_explicit_05_1.Property + { + get + { + return num; + } + set + { + if (value >= 0 && value <= 10) + num = value; + } + } + } + class Interface_TestClass_struct_explicit_05 + { + public static void Main_old() + { + Interface_TestClass_struct_explicit_05_2 t = new Interface_TestClass_struct_explicit_05_2(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public delegate void Interface_TestClass_struct_explicit_06_ev(object sender); + interface Interface_TestClass_struct_explicit_06_1 + { + event Interface_TestClass_struct_explicit_06_ev Clicked; + } + struct Interface_TestClass_struct_explicit_06_2 : Interface_TestClass_struct_explicit_06_1 + { + event Interface_TestClass_struct_explicit_06_ev Interface_TestClass_struct_explicit_06_1.Clicked + { + add { } + remove { } + } + public void MyHandler(object sender) + { + + } + } + class Interface_TestClass_struct_explicit_06 + { + public static void Main_old() + { + Interface_TestClass_struct_explicit_06_2 t = new Interface_TestClass_struct_explicit_06_2(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_struct_explicit_07_1 + { + string this[int index] { get; set; } + } + struct Interface_TestClass_struct_explicit_07_2 : Interface_TestClass_struct_explicit_07_1 + { + string Interface_TestClass_struct_explicit_07_1.this[int index] + { + get { return "Interface_TestClass_struct_explicit_07"; } + set { } + } + } + class Interface_TestClass_struct_explicit_07 + { + public static void Main_old() + { + Interface_TestClass_struct_explicit_07_2 t = new Interface_TestClass_struct_explicit_07_2(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_struct_explicit_09_I1 + { + object Clone(); + } + interface Interface_TestClass_struct_explicit_09_I2 + { + int CompareTo(object other); + } + struct Interface_TestClass_struct_explicit_09_1 : Interface_TestClass_struct_explicit_09_I1, Interface_TestClass_struct_explicit_09_I2 + { + object Interface_TestClass_struct_explicit_09_I1.Clone() + { + return new object(); + } + + int Interface_TestClass_struct_explicit_09_I2.CompareTo(object other) + { + return 0; + } + } + class Interface_TestClass_struct_explicit_09 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_struct_explicit_10_I1 + { + object Clone(); + } + interface Interface_TestClass_struct_explicit_10_I2 + { + int CompareTo(object other); + } + struct Interface_TestClass_struct_explicit_10_1 : Interface_TestClass_struct_explicit_10_I1, Interface_TestClass_struct_explicit_10_I2 + { + object Interface_TestClass_struct_explicit_10_I1.Clone() + { + return new object(); + } + + int Interface_TestClass_struct_explicit_10_I2.CompareTo(object other) + { + return 0; + } + } + class Interface_TestClass_struct_explicit_10 + { + public static void Main_old() + { + Interface_TestClass_struct_explicit_10_1 le = new Interface_TestClass_struct_explicit_10_1(); + object o = ((Interface_TestClass_struct_explicit_10_I1)le).Clone(); + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch (System.Exception) + { + return false; + } + return true; + } + } + interface Interface_TestClass_struct_explicit_11_I1 + { + int Value { get; set; } + } + interface Interface_TestClass_struct_explicit_11_I2 + { + int CompareTo(object other); + } + struct Interface_TestClass_struct_explicit_11_1 : Interface_TestClass_struct_explicit_11_I1, Interface_TestClass_struct_explicit_11_I2 + { + private int val; + + int Interface_TestClass_struct_explicit_11_I1.Value + { + get + { + return val; + } + set + { + val = value; + Debug.WriteLine(val.ToString()); + } + } + + int Interface_TestClass_struct_explicit_11_I2.CompareTo(object other) + { + return 0; + } + } + class Interface_TestClass_struct_explicit_11 + { + public static int Main_old() + { + try + { + Interface_TestClass_struct_explicit_11_1 le = new Interface_TestClass_struct_explicit_11_1(); + ((Interface_TestClass_struct_explicit_11_I1)le).Value = 5; + + Debug.WriteLine((((Interface_TestClass_struct_explicit_11_I1)le).Value).ToString()); + return 0; + } + catch (System.Exception) + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + interface Interface_TestClass_struct_explicit_12_I1 + { + string this[string hashkey] { get; set; } + } + interface Interface_TestClass_struct_explicit_12_I2 + { + int CompareTo(object other); + } + struct Interface_TestClass_struct_explicit_12_1 : Interface_TestClass_struct_explicit_12_I1, Interface_TestClass_struct_explicit_12_I2 + { + public string st; + string Interface_TestClass_struct_explicit_12_I1.this[string hashkey] + { + get + { + return "success"; + } + set + { + st = value; + } + } + + int Interface_TestClass_struct_explicit_12_I2.CompareTo(object other) + { + return 0; + } + } + class Interface_TestClass_struct_explicit_12 + { + public static int Main_old() + { + try + { + Interface_TestClass_struct_explicit_12_1 le = new Interface_TestClass_struct_explicit_12_1(); + ((Interface_TestClass_struct_explicit_12_I1)le)["Interface_TestClass_struct_explicit_12_1"] = "correct"; + string s = ((Interface_TestClass_struct_explicit_12_I1)le)["Interface_TestClass_struct_explicit_12_1"]; + if (s == "success") + return 0; + else + return 1; + } + catch (System.Exception) + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public delegate void Interface_TestClass_struct_explicit_13_ev(object sender); + interface Interface_TestClass_struct_explicit_13_1 + { + event Interface_TestClass_struct_explicit_13_ev Clicked; + } + struct Interface_TestClass_struct_explicit_13_2 : Interface_TestClass_struct_explicit_13_1 + { + event Interface_TestClass_struct_explicit_13_ev Interface_TestClass_struct_explicit_13_1.Clicked + { + add { } + remove { } + } + public void MyHandler(object sender) + { + } + } + class Interface_TestClass_struct_explicit_13 + { + public static void Main_old() + { + new Interface_TestClass_struct_explicit_13().Run(); + } + public void Run() + { + Interface_TestClass_struct_explicit_13_2 t = new Interface_TestClass_struct_explicit_13_2(); + ((Interface_TestClass_struct_explicit_13_1)t).Clicked += new Interface_TestClass_struct_explicit_13_ev(TheHandler); + } + public void TheHandler(object sender) + { + } + public static bool testMethod() + { + try + { + Main_old(); + } + catch (System.Exception) + { + return false; + } + return true; + } + } + interface Interface_TestClass_struct_explicit_19_I1 + { + object Clone(); + } + interface Interface_TestClass_struct_explicit_19_I3 : Interface_TestClass_struct_explicit_19_I1 + { + string OtherMethod(); + } + class Interface_TestClass_struct_explicit_19_1 : Interface_TestClass_struct_explicit_19_I3 + { + string Interface_TestClass_struct_explicit_19_I3.OtherMethod() + { + return "Interface_TestClass_struct_explicit_19_1"; + } + + object Interface_TestClass_struct_explicit_19_I1.Clone() + { + return new object(); + } + } + class Interface_TestClass_struct_explicit_19 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + interface Interface_TestClass_struct_explicit_20_I2 + { + int P { get; } + } + interface Interface_TestClass_struct_explicit_20_I3 : Interface_TestClass_struct_explicit_20_I2 + { + new int P(); + } + struct Interface_TestClass_struct_explicit_20_1 : Interface_TestClass_struct_explicit_20_I3 + { + int Interface_TestClass_struct_explicit_20_I2.P { get { return 1; } } + int Interface_TestClass_struct_explicit_20_I3.P() { return 1; } + } + struct Interface_TestClass_struct_explicit_20_2 : Interface_TestClass_struct_explicit_20_I3 + { + public int P { get { return 1; } } + int Interface_TestClass_struct_explicit_20_I3.P() { return 1; } + } + struct Interface_TestClass_struct_explicit_20_3 : Interface_TestClass_struct_explicit_20_I3 + { + int Interface_TestClass_struct_explicit_20_I2.P { get { return 1; } } + public int P() { return 1; } + } + class Interface_TestClass_struct_explicit_20 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + struct Interface_TestClass_struct_decl_01_1 + { + interface Interface_TestClass_struct_decl_01_I + { + } + } + class Interface_TestClass_struct_decl_01 + { + public static void Main_old() + { + Debug.WriteLine("This works!"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + interface Interface_TestClass_struct_inherit_01_A + { + void m(); + } + interface Interface_TestClass_struct_inherit_01_B : Interface_TestClass_struct_inherit_01_A { } + interface Interface_TestClass_struct_inherit_01_C : Interface_TestClass_struct_inherit_01_B { } + struct Interface_TestClass_struct_inherit_01_1 : Interface_TestClass_struct_inherit_01_C + { + public void m() + { + Debug.WriteLine("This works!"); + } + } + class Interface_TestClass_struct_inherit_01 + { + public static void Main_old() + { + Interface_TestClass_struct_inherit_01_1 t = new Interface_TestClass_struct_inherit_01_1(); + t.m(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + struct Interface_TestClass_struct_modifier_01_1 + { + public interface Interface_TestClass_struct_modifier_01_I { } + internal interface Interface_TestClass_struct_modifier_01_I2 { } + } + class Interface_TestClass_struct_modifier_01 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + struct Interface_TestClass_struct_modifier_02_1 + { + private interface Interface_TestClass_struct_modifier_02_I { } + } + class Interface_TestClass_struct_modifier_02 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + struct Interface_TestClass_struct_modifier_03_1 + { + new interface Interface_TestClass_struct_modifier_03_I { } + } + class Interface_TestClass_struct_modifier_03 + { + public static void Main_old() { } + public static bool testMethod() + { + Main_old(); + return true; + } + } + struct Interface_TestClass_struct_semicolon_01_1 + { + interface Interface_TestClass_struct_semicolon_01_I + { + }; + } + class Interface_TestClass_struct_semicolon_01 + { + public static void Main_old() + { + Debug.WriteLine("This works!"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + + + + + } +} +namespace Interface_TestClass_struct_decl_02_NS +{ + + struct Interface_TestClass_struct_decl_02_I + { + } + + class Interface_TestClass_struct_decl_02 + { + public static void Main_old() + { + Debug.WriteLine("This works!"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } +} + +namespace Interface_TestClass_struct_semicolon_02_NS +{ + + struct Interface_TestClass_struct_semicolon_02_1 + { + interface Interface_TestClass_struct_semicolon_02_I + { + }; + } + class Interface_TestClass_struct_semicolon_02 + { + public static void Main_old() + { + Debug.WriteLine("This works!"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } +} + + +namespace Interface_TestClass_decl_02_NS +{ + + interface Interface_TestClass_decl_02_I + { + } + class Interface_TestClass_decl_02 + { + public static void Main_old() + { + Debug.WriteLine("This works!"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } +} + + +namespace Interface_TestClass_semicolon_04_NS +{ + + class Interface_TestClass_semicolon_04 + { + interface Interface_TestClass_semicolon_04_I + { + }; + public static void Main_old() + { + Debug.WriteLine("This works!"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } +} + + +namespace Interface_TestClass_semicolon_02_NS +{ + + interface Interface_TestClass_semicolon_02_I + { + }; + class Interface_TestClass_semicolon_02 + { + public static void Main_old() + { + Debug.WriteLine("This works!"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } +} + + +namespace Interface_TestClass_decl_04_NS +{ + + class Interface_TestClass_decl_04 + { + interface Interface_TestClass_decl_04_I + { + } + public static void Main_old() + { + Debug.WriteLine("This works!"); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } +} + diff --git a/Tests/NFUnitTestInterface/nano.runsettings b/Tests/NFUnitTestInterface/nano.runsettings new file mode 100644 index 00000000..62f0a008 --- /dev/null +++ b/Tests/NFUnitTestInterface/nano.runsettings @@ -0,0 +1,13 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + + \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/packages.config b/Tests/NFUnitTestInterface/packages.config new file mode 100644 index 00000000..dcab08b1 --- /dev/null +++ b/Tests/NFUnitTestInterface/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 47d62988..3d639f79 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -35,6 +35,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestNamespace", "Test EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestLexical", "Tests\NFUnitTestLexical\NFUnitTestLexical.nfproj", "{E0538338-9941-410C-B8C8-0C928F26F8A7}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestInterface", "Tests\NFUnitTestInterface\NFUnitTestInterface.nfproj", "{89C61C69-A9F3-43BF-B501-5913BE8FE829}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -103,6 +105,12 @@ Global {E0538338-9941-410C-B8C8-0C928F26F8A7}.Release|Any CPU.ActiveCfg = Release|Any CPU {E0538338-9941-410C-B8C8-0C928F26F8A7}.Release|Any CPU.Build.0 = Release|Any CPU {E0538338-9941-410C-B8C8-0C928F26F8A7}.Release|Any CPU.Deploy.0 = Release|Any CPU + {89C61C69-A9F3-43BF-B501-5913BE8FE829}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {89C61C69-A9F3-43BF-B501-5913BE8FE829}.Debug|Any CPU.Build.0 = Debug|Any CPU + {89C61C69-A9F3-43BF-B501-5913BE8FE829}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {89C61C69-A9F3-43BF-B501-5913BE8FE829}.Release|Any CPU.ActiveCfg = Release|Any CPU + {89C61C69-A9F3-43BF-B501-5913BE8FE829}.Release|Any CPU.Build.0 = Release|Any CPU + {89C61C69-A9F3-43BF-B501-5913BE8FE829}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -117,6 +125,7 @@ Global {222D8571-6646-47E4-95A5-8AED732DCB70} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {9B5EFD66-CCDC-4D00-960C-993296C56F3B} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {E0538338-9941-410C-B8C8-0C928F26F8A7} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {89C61C69-A9F3-43BF-B501-5913BE8FE829} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From d4aa49e7dd22827c598c0605cf53cb74e17bf34a Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 17:00:45 +0300 Subject: [PATCH 32/55] Adding arithmetic tests, expressions tests --- .../NFUnitTestArithmetic.nfproj | 62 + .../Properties/AssemblyInfo.cs | 33 + .../UnitTestArithmeticTest1.cs | 1408 +++ .../UnitTestArithmeticTest2.cs | 2943 ++++++ .../UnitTestOtherArithmeticTests.cs | 8026 +++++++++++++++++ Tests/NFUnitTestArithmetic/nano.runsettings | 14 + Tests/NFUnitTestArithmetic/packages.config | 5 + nanoFramework.CoreLibrary.sln | 9 + 8 files changed, 12500 insertions(+) create mode 100644 Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj create mode 100644 Tests/NFUnitTestArithmetic/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestArithmetic/UnitTestArithmeticTest1.cs create mode 100644 Tests/NFUnitTestArithmetic/UnitTestArithmeticTest2.cs create mode 100644 Tests/NFUnitTestArithmetic/UnitTestOtherArithmeticTests.cs create mode 100644 Tests/NFUnitTestArithmetic/nano.runsettings create mode 100644 Tests/NFUnitTestArithmetic/packages.config diff --git a/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj new file mode 100644 index 00000000..0bee964c --- /dev/null +++ b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj @@ -0,0 +1,62 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 6b598666-54c8-4705-a7fb-b2bc75ca00bc + Library + Properties + 512 + NFUnitTestArithmetic + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestArithmetic/Properties/AssemblyInfo.cs b/Tests/NFUnitTestArithmetic/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestArithmetic/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestArithmetic/UnitTestArithmeticTest1.cs b/Tests/NFUnitTestArithmetic/UnitTestArithmeticTest1.cs new file mode 100644 index 00000000..1e99a94a --- /dev/null +++ b/Tests/NFUnitTestArithmetic/UnitTestArithmeticTest1.cs @@ -0,0 +1,1408 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestArithmetic +{ + [TestClass] + public class UnitTestArithmeticTest1 + { + [TestMethod] + public void Arith_arith001_Test() + { + Debug.WriteLine("Section 7.4 "); + Debug.WriteLine("This code tests basic literal integral arthimetic additive expressions."); + Assert.True(Arith_TestClass_arith001.testMethod()); + } + + [TestMethod] + public void Arith_arith003_Test() + { + Debug.WriteLine("Section 7.4 "); + Debug.WriteLine("This code tests basic literal integral arthimetic multiplicative expressions."); + Assert.True(Arith_TestClass_arith003.testMethod()); + } + + [TestMethod] + public void Arith_arith005_Test() + { + Debug.WriteLine("Section 7.4 "); + Debug.WriteLine("This code tests basic integral arthimetic additive expressions using variables."); + Assert.True(Arith_TestClass_arith005.testMethod()); + } + + [TestMethod] + public void Arith_arith007_Test() + { + Debug.WriteLine("Section 7.4 "); + Debug.WriteLine("This code tests basic integral arthimetic multiplicative expressions with variables."); + Assert.True(Arith_TestClass_arith007.testMethod()); + } + + [TestMethod] + public void Arith_arith023_Test() + { + Debug.WriteLine("Section 7.4 "); + Debug.WriteLine("This code tests enum additive expressions."); + Assert.True(Arith_TestClass_arith023.testMethod()); + } + + [TestMethod] + public void Arith_arith024_Test() + { + Debug.WriteLine("Section 7.4 "); + Debug.WriteLine("This code tests enum additive expressions."); + Assert.True(Arith_TestClass_arith024.testMethod()); + } + + [TestMethod] + public void Arith_arith028_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith028.testMethod()); + } + + [TestMethod] + public void Arith_arith029_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith029.testMethod()); + } + + [TestMethod] + public void Arith_arith030_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith030.testMethod()); + } + + [TestMethod] + public void Arith_arith031_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith031.testMethod()); + } + + [TestMethod] + public void Arith_arith032_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith032.testMethod()); + } + + [TestMethod] + public void Arith_arith033_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith033.testMethod()); + } + + [TestMethod] + public void Arith_arith034_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith034.testMethod()); + } + + [TestMethod] + public void Arith_arith035_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith035.testMethod()); + } + + [TestMethod] + public void Arith_arith036_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith036.testMethod()); + } + + [TestMethod] + public void Arith_arith037_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith037.testMethod()); + } + + [TestMethod] + public void Arith_arith038_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith038.testMethod()); + } + + [TestMethod] + public void Arith_arith039_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith039.testMethod()); + } + + [TestMethod] + public void Arith_arith040_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith040.testMethod()); + } + + [TestMethod] + public void Arith_arith041_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith041.testMethod()); + } + + [TestMethod] + public void Arith_arith042_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith042.testMethod()); + } + + [TestMethod] + public void Arith_arith043_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith043.testMethod()); + } + + [TestMethod] + public void Arith_arith044_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith044.testMethod()); + } + + [TestMethod] + public void Arith_arith045_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith045.testMethod()); + } + + [TestMethod] + public void Arith_arith046_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith046.testMethod()); + } + + [TestMethod] + public void Arith_arith047_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith047.testMethod()); + } + + [TestMethod] + public void Arith_arith048_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith048.testMethod()); + } + + [TestMethod] + public void Arith_arith049_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith049.testMethod()); + } + + [TestMethod] + public void Arith_arith050_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith050.testMethod()); + } + + [TestMethod] + public void Arith_arith051_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith051.testMethod()); + } + + [TestMethod] + public void Arith_arith052_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith052.testMethod()); + } + + [TestMethod] + public void Arith_arith053_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith053.testMethod()); + } + + [TestMethod] + public void Arith_arith054_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith054.testMethod()); + } + + [TestMethod] + public void Arith_arith055_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith055.testMethod()); + } + + [TestMethod] + public void Arith_arith056_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith056.testMethod()); + } + + [TestMethod] + public void Arith_arith057_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith057.testMethod()); + } + + [TestMethod] + public void Arith_arith058_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith058.testMethod()); + } + + [TestMethod] + public void Arith_arith059_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith059.testMethod()); + } + + [TestMethod] + public void Arith_arith060_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith060.testMethod()); + } + + [TestMethod] + public void Arith_arith061_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith061.testMethod()); + } + + [TestMethod] + public void Arith_arith062_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith062.testMethod()); + } + + [TestMethod] + public void Arith_arith064_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith064.testMethod()); + } + + [TestMethod] + public void Arith_arith065_Test() + { + Debug.WriteLine("Section 7.7"); + Assert.True(Arith_TestClass_arith065.testMethod()); + } + + //Compiled Test Cases + public class Arith_TestClass_arith001 + { + public static int Main_old() + { + int intRet = 0; + //Scenario 1: type int + if (5 != (3 + 2)) + { + intRet = 1; + Debug.WriteLine("Failure at Scenario 1"); + } + //Scenario 2: type int + if (4 != (9 - 5)) + { + Debug.WriteLine("Failure at Scenario 2"); + intRet = 1; + } + + //Scenario 7: type long + if (1047L != (999L + 48L)) + { + Debug.WriteLine("Failure at Scenario 7"); + intRet = 1; + } + //Scenario 8: type long + if (441L != (786L - 345L)) + { + Debug.WriteLine("Failure at Scenario 8"); + intRet = 1; + } + return intRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith003 + { + public static int Main_old() + { + int intRet = 0; + //Scenario 1: type int + if (12 != (4 * 3)) + { + Debug.WriteLine("Failure at Scenario 1"); + intRet = 1; + } + //Scenario 2: type int + if (4 != (8 / 2)) + { + Debug.WriteLine("Failure at Scenario 2"); + intRet = 1; + } + //Scenario 3; type int + if (14 != (64 % 25)) + { + Debug.WriteLine("Failure at Scenario 3"); + intRet = 1; + } + + //Scenario 10: type long + if (361362L != (458L * 789L)) + { + Debug.WriteLine("Failure at Scenario 10"); + intRet = 1; + } + //Scenario 11: type long + if (36L != (32004L / 889L)) + { + Debug.WriteLine("Failure at Scenario 11"); + intRet = 1; + } + //Scenario 12: type long + if (29L != (985013L % 56L)) + { + Debug.WriteLine("Failure at Scenario 12"); + intRet = 1; + } + return intRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith005 + { + public static int Main_old() + { + int intRet = 0; + int i1 = 0; + int i2 = 0; + int i3 = 0; + byte b1 = 0; + byte b2 = 0; + byte b3 = 0; + short s1 = 0; + short s2 = 0; + short s3 = 0; + + long l1 = 0L; + long l2 = 0L; + long l3 = 0L; + //Scenario 1: type int + i1 = 7; + i2 = 2; + i3 = 5; + if (i1 != (i2 + i3)) + { + Debug.WriteLine("Failure at Scenario 1"); + intRet = 1; + } + //Scenario 2: type int + i1 = 16; + i2 = 19; + i3 = 3; + if (i1 != (i2 - i3)) + { + Debug.WriteLine("Failure at Scenario 2"); + intRet = 1; + } + //Scenario 3: type byte + b1 = 88; + b2 = 86; + b3 = 2; + if (b1 != (b2 + b3)) + { + Debug.WriteLine("Failure at Scenario 3"); + intRet = 1; + } + //Scenario 4: type byte + b1 = 62; + b2 = 101; + b3 = 39; + if (b1 != (b2 - b3)) + { + Debug.WriteLine("Failure at Scenario 4"); + intRet = 1; + } + //Scenario 5: type short + s1 = 45; + s2 = 23; + s3 = 22; + if (s1 != (s2 + s3)) + { + Debug.WriteLine("Failure at Scenario 5"); + intRet = 1; + } + //Scenario 6: type short + s1 = 87; + s2 = 101; + s3 = 14; + if (s1 != (s2 - s3)) + { + Debug.WriteLine("Failure at Scenario 6"); + intRet = 1; + } + //Scenario 7: type long + l1 = 5422L; + l2 = 4567L; + l3 = 855L; + if (l1 != (l2 + l3)) + { + Debug.WriteLine("Failure at Scenario 7"); + intRet = 1; + } + //Scenario 8: type long + l1 = 55423L; + l2 = 192343L; + l3 = 136920L; + if (l1 != (l2 - l3)) + { + Debug.WriteLine("Failure at Scenario 8"); + intRet = 1; + } + return intRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith007 + { + public static int Main_old() + { + int intRet = 0; + int i1 = 0; + int i2 = 0; + int i3 = 0; + byte b1 = 0; + byte b2 = 0; + byte b3 = 0; + short s1 = 0; + short s2 = 0; + short s3 = 0; + + long l1 = 0L; + long l2 = 0L; + long l3 = 0L; + //Scenario 1: type int + i1 = 42; + i2 = 7; + i3 = 6; + if (i1 != (i2 * i3)) + { + Debug.WriteLine("Failure at Scenario 1"); + intRet = 1; + } + //Scenario 2: type int + i1 = 11; + i2 = 154; + i3 = 14; + if (i1 != (i2 / i3)) + { + Debug.WriteLine("Failure at Scenario 2"); + intRet = 1; + } + //Scenario 3; type int + i1 = 2; + i2 = 95; + i3 = 31; + if (i1 != (i2 % i3)) + { + Debug.WriteLine("Failure at Scenario 3"); + intRet = 1; + } + //Scenario 4: type byte + b1 = 94; + b2 = 2; + b3 = 47; + if (b1 != (b2 * b3)) + { + Debug.WriteLine("Failure at Scenario 4"); + intRet = 1; + } + //Scenario 5: type byte + b1 = 16; + b2 = 96; + b3 = 6; + if (b1 != (b2 / b3)) + { + Debug.WriteLine("Failure at Scenario 5"); + intRet = 1; + } + //Scenario 6: type byte + b1 = 48; + b2 = 220; + b3 = 86; + if (b1 != (b2 % b3)) + { + Debug.WriteLine("Failure at Scenario 6"); + intRet = 1; + } + //Scenario 7: type short + s1 = 8890; + s2 = 254; + s3 = 35; + if (s1 != (s2 * s3)) + { + Debug.WriteLine("Failure at Scenario 7"); + intRet = 1; + } + //Scenario 8: type short + s1 = 896; + s2 = 23296; + s3 = 26; + if (s1 != (s2 / s3)) + { + Debug.WriteLine("Failure at Scenario 8"); + intRet = 1; + } + //Scenario 9: type short + s1 = 72; + s2 = 432; + s3 = 90; + if (s1 != (s2 % s3)) + { + Debug.WriteLine("Failure at Scenario 9"); + intRet = 1; + } + //Scenario 10: type long + l1 = 3724L; + l2 = 38L; + l3 = 98L; + if (l1 != (l2 * l3)) + { + Debug.WriteLine("Failure at Scenario 10"); + intRet = 1; + } + //Scenario 11: type long + l1 = 821L; + l2 = 5747L; + l3 = 7L; + if (l1 != (l2 / l3)) + { + Debug.WriteLine("Failure at Scenario 11"); + intRet = 1; + } + //Scenario 12: type long + l1 = 89L; + l2 = 22989L; + l3 = 458L; + if (l1 != (l2 % l3)) + { + Debug.WriteLine("Failure at Scenario 12"); + intRet = 1; + } + return intRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + enum Arith_TestClass_arith023_Enum { a = 1, b = 2 } + public class Arith_TestClass_arith023 + { + public static int Main_old() + { + int MyInt = Arith_TestClass_arith023_Enum.a - Arith_TestClass_arith023_Enum.b; //E-E + if (MyInt == -1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + enum Arith_TestClass_arith024_Enum { a = 1, b = 2 } + public class Arith_TestClass_arith024 + { + public static int Main_old() + { + Arith_TestClass_arith024_Enum MyEnum = Arith_TestClass_arith024_Enum.a + 3; //E+U + if ((int)MyEnum == 4) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith028 + { + public static int Main_old() + { + int i1 = 2; + if ((0 * i1) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith029 + { + public static int Main_old() + { + int i1 = 2; + if ((i1 * 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith030 + { + public static int Main_old() + { + byte b1 = 2; + if ((b1 * 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith031 + { + public static int Main_old() + { + sbyte sb1 = 2; + if ((sb1 * 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith032 + { + public static int Main_old() + { + short s1 = 2; + if ((s1 * 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith033 + { + public static int Main_old() + { + ushort us1 = 2; + if ((us1 * 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith034 + { + public static int Main_old() + { + uint ui1 = 2; + if ((ui1 * 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith035 + { + public static int Main_old() + { + long l1 = 2; + if ((l1 * 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith036 + { + public static int Main_old() + { + ulong ul1 = 2; + if ((ul1 * 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith037 + { + public static int Main_old() + { + char c1 = (char)2; + if ((c1 * 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith038 + { + public static int Main_old() + { + int i1 = 2; + if ((0 / i1) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith039 + { + public static int Main_old() + { + sbyte sb1 = 2; + if ((0 / sb1) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith040 + { + public static int Main_old() + { + byte b1 = 2; + if ((0 / b1) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith041 + { + public static int Main_old() + { + short s1 = 2; + if ((0 / s1) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith042 + { + public static int Main_old() + { + ushort us1 = 2; + if ((0 / us1) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith043 + { + public static int Main_old() + { + uint ui1 = 2; + if ((0 / ui1) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith044 + { + public static int Main_old() + { + long l1 = 2; + if ((0 / l1) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith045 + { + public static int Main_old() + { + ulong ul1 = 2; + if ((0 / ul1) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith046 + { + public static int Main_old() + { + char c1 = (char)2; + if ((0 / c1) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith047 + { + public static int Main_old() + { + + int i1 = (int)(0x80000000 / -1); + + if (i1 == int.MinValue) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith048 + { + public static int Main_old() + { + + int i1 = (int)(0x80000000 % -1); + + if (i1 == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith049 + { + public static int Main_old() + { + + string s1 = "foo" + "bar"; + if (s1 == "foobar") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith050 + { + public static int Main_old() + { + + string s1 = null + "foo"; + if (s1 == "foo") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith051 + { + public static int Main_old() + { + + string s1 = "foo" + null; + if (s1 == "foo") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith052 + { + public static int Main_old() + { + + string s1 = "" + "foo"; + if (s1 == "foo") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith053 + { + public static int Main_old() + { + + string s1 = "foo" + ""; + if (s1 == "foo") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith054 + { + public static int Main_old() + { + + string s1 = ("foo" + "bar"); + if (s1 == "foobar") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith055 + { + public static int Main_old() + { + + string s1 = ("f" + ("oo" + "bar")); + if (s1 == "foobar") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith056 + { + public static int Main_old() + { + + string s1 = (("f" + "oo") + "ba" + "r"); + if (s1 == "foobar") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith057 + { + public static int Main_old() + { + + string s1 = "foo"; + string s2 = "bar"; + return 0; + string str = s1 + s2 + "!"; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith058 + { + public static int Main_old() + { + + int intI = -1 / int.MaxValue; + if (intI == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith059 + { + public static int Main_old() + { + + int intI = 1 / int.MaxValue; + if (intI == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith060 + { + public static int Main_old() + { + + int intI = -1 / int.MinValue; + if (intI == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith061 + { + public static int Main_old() + { + + int intI = 1 / int.MinValue; + if (intI == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith062 + { + public static int Main_old() + { + + int intI = int.MaxValue / -1; + if (intI == -2147483647) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith064 + { + public static implicit operator string(Arith_TestClass_arith064 MC) + { + return "foo"; + } + public static int Main_old() + { + Arith_TestClass_arith064 MC = new Arith_TestClass_arith064(); + string TestString1 = "bar"; + if ((MC + TestString1) == "foobar") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Arith_TestClass_arith065 + { + public static implicit operator string(Arith_TestClass_arith065 MC) + { + return "bar"; + } + public static int Main_old() + { + Arith_TestClass_arith065 MC = new Arith_TestClass_arith065(); + string TestString1 = "foo"; + if ((TestString1 + MC) == "foobar") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + } +} diff --git a/Tests/NFUnitTestArithmetic/UnitTestArithmeticTest2.cs b/Tests/NFUnitTestArithmetic/UnitTestArithmeticTest2.cs new file mode 100644 index 00000000..341a74d9 --- /dev/null +++ b/Tests/NFUnitTestArithmetic/UnitTestArithmeticTest2.cs @@ -0,0 +1,2943 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestArithmetic +{ + [TestClass] + class UnitTestArithmeticTest2 + { + [TestMethod] + public void Arith_opt001_Test() + { + Assert.True(Arith_TestClass_opt001.testMethod()); + } + + [TestMethod] + public void Arith_opt002_Test() + { + Assert.True(Arith_TestClass_opt002.testMethod()); + } + + [TestMethod] + public void Arith_opt003_Test() + { + Assert.True(Arith_TestClass_opt003.testMethod()); + } + [TestMethod] + public void Arith_opt004_Test() + { + Assert.True(Arith_TestClass_opt004.testMethod()); + } + + [TestMethod] + public void Arith_mult0001_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0001.testMethod()); + } + + [TestMethod] + public void Arith_mult0002_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0002.testMethod()); + } + + [TestMethod] + public void Arith_mult0003_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0003.testMethod()); + } + + [TestMethod] + public void Arith_mult0004_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0004.testMethod()); + } + + [TestMethod] + public void Arith_mult0008_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0008.testMethod()); + } + + [TestMethod] + public void Arith_mult0009_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0009.testMethod()); + } + + [TestMethod] + public void Arith_mult0010_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0010.testMethod()); + } + + [TestMethod] + public void Arith_mult0011_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0011.testMethod()); + } + + [TestMethod] + public void Arith_mult0015_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0015.testMethod()); + } + + [TestMethod] + public void Arith_mult0016_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0016.testMethod()); + } + + [TestMethod] + public void Arith_mult0017_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0017.testMethod()); + } + + [TestMethod] + public void Arith_mult0018_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0018.testMethod()); + } + + [TestMethod] + public void Arith_mult0022_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0022.testMethod()); + } + + [TestMethod] + public void Arith_mult0023_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0023.testMethod()); + } + + [TestMethod] + public void Arith_mult0024_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0024.testMethod()); + } + + [TestMethod] + public void Arith_mult0025_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0025.testMethod()); + } + + [TestMethod] + public void Arith_mult0050_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0050.testMethod()); + } + + [TestMethod] + public void Arith_mult0051_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0051.testMethod()); + } + + [TestMethod] + public void Arith_mult0052_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0052.testMethod()); + } + + [TestMethod] + public void Arith_mult0053_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0053.testMethod()); + } + + [TestMethod] + public void Arith_mult0057_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0057.testMethod()); + } + + [TestMethod] + public void Arith_mult0058_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0058.testMethod()); + } + + [TestMethod] + public void Arith_mult0059_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0059.testMethod()); + } + + [TestMethod] + public void Arith_mult0060_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0060.testMethod()); + } + + [TestMethod] + public void Arith_mult0064_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0064.testMethod()); + } + + [TestMethod] + public void Arith_mult0065_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0065.testMethod()); + } + + [TestMethod] + public void Arith_mult0066_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0066.testMethod()); + } + + [TestMethod] + public void Arith_mult0067_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0067.testMethod()); + } + + [TestMethod] + public void Arith_mult0071_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0071.testMethod()); + } + + [TestMethod] + public void Arith_mult0072_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0072.testMethod()); + } + + [TestMethod] + public void Arith_mult0073_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0073.testMethod()); + } + + [TestMethod] + public void Arith_mult0074_Test() + { + Debug.WriteLine("Section 7.7.1"); + Assert.True(Arith_TestClass_mult0074.testMethod()); + } + + [TestMethod] + public void Arith_div0001_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0001.testMethod()); + } + + [TestMethod] + public void Arith_div0002_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0002.testMethod()); + } + + [TestMethod] + public void Arith_div0008_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0008.testMethod()); + } + + [TestMethod] + public void Arith_div0009_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0009.testMethod()); + } + + [TestMethod] + public void Arith_div0015_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0015.testMethod()); + } + + [TestMethod] + public void Arith_div0016_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0016.testMethod()); + } + + [TestMethod] + public void Arith_div0022_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0022.testMethod()); + } + + [TestMethod] + public void Arith_div0023_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0023.testMethod()); + } + + [TestMethod] + public void Arith_div0050_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0050.testMethod()); + } + + [TestMethod] + public void Arith_div0051_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0051.testMethod()); + } + + [TestMethod] + public void Arith_div0057_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0057.testMethod()); + } + + [TestMethod] + public void Arith_div0058_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0058.testMethod()); + } + + [TestMethod] + public void Arith_div0064_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0064.testMethod()); + } + + [TestMethod] + public void Arith_div0065_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0065.testMethod()); + } + + [TestMethod] + public void Arith_div0071_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0071.testMethod()); + } + + [TestMethod] + public void Arith_div0072_Test() + { + Debug.WriteLine("Section 7.7.2"); + Assert.True(Arith_TestClass_div0072.testMethod()); + } + + [TestMethod] + public void Arith_rem0001_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0001.testMethod()); + } + + [TestMethod] + public void Arith_rem0002_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0002.testMethod()); + } + + [TestMethod] + public void Arith_rem0008_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0008.testMethod()); + } + + [TestMethod] + public void Arith_rem0009_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0009.testMethod()); + } + + [TestMethod] + public void Arith_rem0015_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0015.testMethod()); + } + + [TestMethod] + public void Arith_rem0016_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0016.testMethod()); + } + + [TestMethod] + public void Arith_rem0022_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0022.testMethod()); + } + + [TestMethod] + public void Arith_rem0023_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0023.testMethod()); + } + + [TestMethod] + public void Arith_rem0050_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0050.testMethod()); + } + + [TestMethod] + public void Arith_rem0051_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0051.testMethod()); + } + + [TestMethod] + public void Arith_rem0057_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0057.testMethod()); + } + + [TestMethod] + public void Arith_rem0058_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0058.testMethod()); + } + + [TestMethod] + public void Arith_rem0064_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0064.testMethod()); + } + + [TestMethod] + public void Arith_rem0065_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0065.testMethod()); + } + + [TestMethod] + public void Arith_rem0071_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0071.testMethod()); + } + + [TestMethod] + public void Arith_rem0072_Test() + { + Debug.WriteLine("Section 7.7.3"); + Assert.True(Arith_TestClass_rem0072.testMethod()); + } + + [TestMethod] + public void Arith_add0001_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0001.testMethod()); + } + + [TestMethod] + public void Arith_add0002_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0002.testMethod()); + } + + [TestMethod] + public void Arith_add0003_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0003.testMethod()); + } + + [TestMethod] + public void Arith_add0007_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0007.testMethod()); + } + [TestMethod] + public void Arith_add0008_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0008.testMethod()); + } + + [TestMethod] + public void Arith_add0009_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0009.testMethod()); + } + + [TestMethod] + public void Arith_add0013_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0013.testMethod()); + } + + [TestMethod] + public void Arith_add0014_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0014.testMethod()); + } + + [TestMethod] + public void Arith_add0015_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0015.testMethod()); + } + + [TestMethod] + public void Arith_add0037_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0037.testMethod()); + } + + [TestMethod] + public void Arith_add0038_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0038.testMethod()); + } + + [TestMethod] + public void Arith_add0039_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0039.testMethod()); + } + + [TestMethod] + public void Arith_add0043_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0043.testMethod()); + } + + [TestMethod] + public void Arith_add0044_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0044.testMethod()); + } + + [TestMethod] + public void Arith_add0045_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0045.testMethod()); + } + + [TestMethod] + public void Arith_add0049_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0049.testMethod()); + } + + [TestMethod] + public void Arith_add0050_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0050.testMethod()); + } + + [TestMethod] + public void Arith_add0051_Test() + { + Debug.WriteLine("Section 7.7.4"); + Assert.True(Arith_TestClass_add0051.testMethod()); + } + + [TestMethod] + public void Arith_sub0001_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0001.testMethod()); + } + + [TestMethod] + public void Arith_sub0002_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0002.testMethod()); + } + + [TestMethod] + public void Arith_sub0003_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0003.testMethod()); + } + + [TestMethod] + public void Arith_sub0007_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0007.testMethod()); + } + + [TestMethod] + public void Arith_sub0008_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0008.testMethod()); + } + + [TestMethod] + public void Arith_sub0009_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0009.testMethod()); + } + + [TestMethod] + public void Arith_sub0013_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0013.testMethod()); + } + + [TestMethod] + public void Arith_sub0014_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0014.testMethod()); + } + + [TestMethod] + public void Arith_sub0015_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0015.testMethod()); + } + + [TestMethod] + public void Arith_sub0037_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0037.testMethod()); + } + + [TestMethod] + public void Arith_sub0038_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0038.testMethod()); + } + + [TestMethod] + public void Arith_sub0039_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0039.testMethod()); + } + + [TestMethod] + public void Arith_sub0043_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0043.testMethod()); + } + + [TestMethod] + public void Arith_sub0044_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0044.testMethod()); + } + + [TestMethod] + public void Arith_sub0045_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0045.testMethod()); + } + + [TestMethod] + public void Arith_sub0049_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0049.testMethod()); + } + + [TestMethod] + public void Arith_sub0050_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0050.testMethod()); + } + + [TestMethod] + public void Arith_sub0051_Test() + { + Debug.WriteLine("Section 7.7.5"); + Assert.True(Arith_TestClass_sub0051.testMethod()); + } + + //Compiled Test Cases + class Arith_TestClass_opt001 + { + static int Main_old() + { + double t0 = 1.5; + int i = 0; + for (i = 0; i < 1; i++) + { + double dd = t0 / 3; + t0 -= dd; + if (dd > 2) + { + break; + } + } + if (t0 != 1) + return 1;// Failed. + else + return 0; // No problem. + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_opt002 + { + static int Main_old() + { + double t0 = 1.5; + int i = 0; + for (i = 0; i < 1; i++) + { + double dd = t0 / 3; + t0 += dd; + if (dd > 2) + { + break; + } + } + if (t0 != 2) + return 1;// Failed. + else + return 0; // No problem. + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_opt003 + { + static int Main_old() + { + double t0 = 1.5; + int i = 0; + for (i = 0; i < 1; i++) + { + double dd = t0 / 3; + t0 *= dd; + if (dd > 2) + { + break; + } + } + if (t0 != 0.75) + return 1;// Failed. + else + return 0; // No problem. + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_opt004 + { + static int Main_old() + { + double t0 = 1.5; + int i = 0; + for (i = 0; i < 1; i++) + { + double dd = t0 / 3; + t0 /= dd; + if (dd > 2) + { + break; + } + } + if (t0 != 3) + return 1;// Failed. + else + return 0; // No problem. + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + + class Arith_TestClass_mult0001 + { + public static int Main_old() + { + float f1 = 2.0f; + float f2 = 2.0f; + float f3 = f1 * f2; + if (f3 == 4.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0002 + { + public static int Main_old() + { + float f1 = 2.0f; + float f2 = -2.0f; + float f3 = f1 * f2; + if (f3 == -4.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0003 + { + public static int Main_old() + { + float f1 = 2.0f; + float f2 = 0.0f; + float f3 = f1 * f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0004 + { + public static int Main_old() + { + float f1 = 2.0f; + float f2 = -0.0f; + float f3 = f1 * f2; + if (f3 == -0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0008 + { + public static int Main_old() + { + float f1 = -2.0f; + float f2 = 2.0f; + float f3 = f1 * f2; + if (f3 == -4.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0009 + { + public static int Main_old() + { + float f1 = -2.0f; + float f2 = -2.0f; + float f3 = f1 * f2; + if (f3 == 4.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0010 + { + public static int Main_old() + { + float f1 = -2.0f; + float f2 = 0.0f; + float f3 = f1 * f2; + if (f3 == -0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0011 + { + public static int Main_old() + { + float f1 = -2.0f; + float f2 = -0.0f; + float f3 = f1 * f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0015 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = 2.0f; + float f3 = f1 * f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0016 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = -2.0f; + float f3 = f1 * f2; + if (f3 == -0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0017 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = 0.0f; + float f3 = f1 * f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0018 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = -0.0f; + float f3 = f1 * f2; + if (f3 == -0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0022 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = 2.0f; + float f3 = f1 * f2; + if (f3 == -0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0023 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = -2.0f; + float f3 = f1 * f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0024 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = 0.0f; + float f3 = f1 * f2; + if (f3 == -0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0025 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = -0.0f; + float f3 = f1 * f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0050 + { + public static int Main_old() + { + double d1 = 2.0; + double d2 = 2.0; + double d3 = d1 * d2; + if (d3 == 4.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0051 + { + public static int Main_old() + { + double d1 = 2.0; + double d2 = -2.0; + double d3 = d1 * d2; + if (d3 == -4.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0052 + { + public static int Main_old() + { + double d1 = 2.0; + double d2 = 0.0; + double d3 = d1 * d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0053 + { + public static int Main_old() + { + double d1 = 2.0; + double d2 = -0.0; + double d3 = d1 * d2; + if (d3 == -0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0057 + { + public static int Main_old() + { + double d1 = -2.0; + double d2 = 2.0; + double d3 = d1 * d2; + if (d3 == -4.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0058 + { + public static int Main_old() + { + double d1 = -2.0; + double d2 = -2.0; + double d3 = d1 * d2; + if (d3 == 4.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0059 + { + public static int Main_old() + { + double d1 = -2.0; + double d2 = 0.0; + double d3 = d1 * d2; + if (d3 == -0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0060 + { + public static int Main_old() + { + double d1 = -2.0; + double d2 = -0.0; + double d3 = d1 * d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0064 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = 2.0; + double d3 = d1 * d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0065 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = -2.0; + double d3 = d1 * d2; + if (d3 == -0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0066 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = 0.0; + double d3 = d1 * d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0067 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = -0.0; + double d3 = d1 * d2; + if (d3 == -0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0071 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = 2.0; + double d3 = d1 * d2; + if (d3 == -0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0072 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = -2.0; + double d3 = d1 * d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0073 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = 0.0; + double d3 = d1 * d2; + if (d3 == -0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_mult0074 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = -0.0; + double d3 = d1 * d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0001 + { + public static int Main_old() + { + float f1 = 2.0f; + float f2 = 2.0f; + float f3 = f1 / f2; + if (f3 == 1.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0002 + { + public static int Main_old() + { + float f1 = 2.0f; + float f2 = -2.0f; + float f3 = f1 / f2; + if (f3 == -1.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0008 + { + public static int Main_old() + { + float f1 = -2.0f; + float f2 = 2.0f; + float f3 = f1 / f2; + if (f3 == -1.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0009 + { + public static int Main_old() + { + float f1 = -2.0f; + float f2 = -2.0f; + float f3 = f1 / f2; + if (f3 == 1.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0015 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = 2.0f; + float f3 = f1 / f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0016 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = -2.0f; + float f3 = f1 / f2; + if (f3 == -0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0022 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = 2.0f; + float f3 = f1 / f2; + if (f3 == -0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0023 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = -2.0f; + float f3 = f1 / f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0050 + { + public static int Main_old() + { + double d1 = 2.0; + double d2 = 2.0; + double d3 = d1 / d2; + if (d3 == 1.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0051 + { + public static int Main_old() + { + double d1 = 2.0; + double d2 = -2.0; + double d3 = d1 / d2; + if (d3 == -1.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0057 + { + public static int Main_old() + { + double d1 = -2.0; + double d2 = 2.0; + double d3 = d1 / d2; + if (d3 == -1.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0058 + { + public static int Main_old() + { + double d1 = -2.0; + double d2 = -2.0; + double d3 = d1 / d2; + if (d3 == 1.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0064 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = 2.0; + double d3 = d1 / d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0065 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = -2.0; + double d3 = d1 / d2; + if (d3 == -0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0071 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = 2.0; + double d3 = d1 / d2; + if (d3 == -0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_div0072 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = -2.0; + double d3 = d1 / d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0001 + { + public static int Main_old() + { + float f1 = 3.0f; + float f2 = 2.0f; + float f3 = f1 % f2; + if (f3 == 1.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0002 + { + public static int Main_old() + { + float f1 = 3.0f; + float f2 = -2.0f; + float f3 = f1 % f2; + if (f3 == 1.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0008 + { + public static int Main_old() + { + float f1 = -3.0f; + float f2 = 2.0f; + float f3 = f1 % f2; + if (f3 == -1.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0009 + { + public static int Main_old() + { + float f1 = -3.0f; + float f2 = -2.0f; + float f3 = f1 % f2; + if (f3 == -1.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0015 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = 2.0f; + float f3 = f1 % f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0016 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = -2.0f; + float f3 = f1 % f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0022 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = 2.0f; + float f3 = f1 % f2; + if (f3 == -0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0023 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = -2.0f; + float f3 = f1 % f2; + if (f3 == -0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0050 + { + public static int Main_old() + { + double d1 = 3.0; + double d2 = 2.0; + double d3 = d1 % d2; + if (d3 == 1.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0051 + { + public static int Main_old() + { + double d1 = 3.0; + double d2 = -2.0; + double d3 = d1 % d2; + if (d3 == 1.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0057 + { + public static int Main_old() + { + double d1 = -3.0; + double d2 = 2.0; + double d3 = d1 % d2; + if (d3 == -1.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0058 + { + public static int Main_old() + { + double d1 = -3.0; + double d2 = -2.0; + double d3 = d1 % d2; + if (d3 == -1.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0064 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = 2.0; + double d3 = d1 % d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0065 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = -2.0; + double d3 = d1 % d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0071 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = 2.0; + double d3 = d1 % d2; + if (d3 == -0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_rem0072 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = -2.0; + double d3 = d1 % d2; + if (d3 == -0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0001 + { + public static int Main_old() + { + float f1 = 3.0f; + float f2 = -2.0f; + float f3 = f1 + f2; + if (f3 == 1.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0002 + { + public static int Main_old() + { + float f1 = 3.0f; + float f2 = 0.0f; + float f3 = f1 + f2; + if (f3 == 3.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0003 + { + public static int Main_old() + { + float f1 = 3.0f; + float f2 = -0.0f; + float f3 = f1 + f2; + if (f3 == 3.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0007 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = -2.0f; + float f3 = f1 + f2; + if (f3 == -2.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0008 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = 0.0f; + float f3 = f1 + f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0009 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = -0.0f; + float f3 = f1 + f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0013 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = -2.0f; + float f3 = f1 + f2; + if (f3 == -2.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0014 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = 0.0f; + float f3 = f1 + f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0015 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = -0.0f; + float f3 = f1 + f2; + if (f3 == -0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0037 + { + public static int Main_old() + { + double d1 = 3.0; + double d2 = -2.0; + double d3 = d1 + d2; + if (d3 == 1.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0038 + { + public static int Main_old() + { + double d1 = 3.0; + double d2 = 0.0; + double d3 = d1 + d2; + if (d3 == 3.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0039 + { + public static int Main_old() + { + double d1 = 3.0; + double d2 = -0.0; + double d3 = d1 + d2; + if (d3 == 3.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0043 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = -2.0; + double d3 = d1 + d2; + if (d3 == -2.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0044 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = 0.0; + double d3 = d1 + d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0045 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = -0.0; + double d3 = d1 + d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0049 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = -2.0; + double d3 = d1 + d2; + if (d3 == -2.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0050 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = 0.0; + double d3 = d1 + d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_add0051 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = -0.0; + double d3 = d1 + d2; + if (d3 == -0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0001 + { + public static int Main_old() + { + float f1 = 3.0f; + float f2 = -2.0f; + float f3 = f1 - f2; + if (f3 == 5.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0002 + { + public static int Main_old() + { + float f1 = 3.0f; + float f2 = 0.0f; + float f3 = f1 - f2; + if (f3 == 3.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0003 + { + public static int Main_old() + { + float f1 = 3.0f; + float f2 = -0.0f; + float f3 = f1 - f2; + if (f3 == 3.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0007 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = -2.0f; + float f3 = f1 - f2; + if (f3 == 2.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0008 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = 0.0f; + float f3 = f1 - f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0009 + { + public static int Main_old() + { + float f1 = 0.0f; + float f2 = -0.0f; + float f3 = f1 - f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0013 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = -2.0f; + float f3 = f1 - f2; + if (f3 == 2.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0014 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = 0.0f; + float f3 = f1 - f2; + if (f3 == -0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0015 + { + public static int Main_old() + { + float f1 = -0.0f; + float f2 = -0.0f; + float f3 = f1 - f2; + if (f3 == 0.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0037 + { + public static int Main_old() + { + double d1 = 3.0; + double d2 = -2.0; + double d3 = d1 - d2; + if (d3 == 5.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0038 + { + public static int Main_old() + { + double d1 = 3.0; + double d2 = 0.0; + double d3 = d1 - d2; + if (d3 == 3.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0039 + { + public static int Main_old() + { + double d1 = 3.0; + double d2 = -0.0; + double d3 = d1 - d2; + if (d3 == 3.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0043 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = -2.0; + double d3 = d1 - d2; + if (d3 == 2.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0044 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = 0.0; + double d3 = d1 - d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0045 + { + public static int Main_old() + { + double d1 = 0.0; + double d2 = -0.0; + double d3 = d1 - d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0049 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = -2.0; + double d3 = d1 - d2; + if (d3 == 2.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0050 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = 0.0; + double d3 = d1 - d2; + if (d3 == -0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Arith_TestClass_sub0051 + { + public static int Main_old() + { + double d1 = -0.0; + double d2 = -0.0; + double d3 = d1 - d2; + if (d3 == 0.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + } +} diff --git a/Tests/NFUnitTestArithmetic/UnitTestOtherArithmeticTests.cs b/Tests/NFUnitTestArithmetic/UnitTestOtherArithmeticTests.cs new file mode 100644 index 00000000..f65a35b0 --- /dev/null +++ b/Tests/NFUnitTestArithmetic/UnitTestOtherArithmeticTests.cs @@ -0,0 +1,8026 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestArithmetic +{ + [TestClass] + class UnitTestOtherArithmeticTests + { + [TestMethod] + public void Other_unary068_Test() + { + Debug.WriteLine(" 7.6.5 Operator Overloading - Unary operator"); + Assert.True(Other_TestClass_unary068.testMethod()); + } + [TestMethod] + public void Other_relat001_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat001.testMethod()); + } + [TestMethod] + public void Other_relat002_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat002.testMethod()); + } + [TestMethod] + public void Other_relat003_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat003.testMethod()); + } + [TestMethod] + public void Other_relat004_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat004.testMethod()); + } + [TestMethod] + public void Other_relat005_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat005.testMethod()); + } + [TestMethod] + public void Other_relat006_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat006.testMethod()); + } + [TestMethod] + public void Other_relat007_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat007.testMethod()); + } + [TestMethod] + public void Other_relat008_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat008.testMethod()); + } + [TestMethod] + public void Other_relat009_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat009.testMethod()); + } + [TestMethod] + public void Other_relat010_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat010.testMethod()); + } + [TestMethod] + public void Other_relat011_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat011.testMethod()); + } + [TestMethod] + public void Other_relat012_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat012.testMethod()); + } + [TestMethod] + public void Other_relat013_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat013.testMethod()); + } + [TestMethod] + public void Other_relat014_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat014.testMethod()); + } + [TestMethod] + public void Other_relat015_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat015.testMethod()); + } + [TestMethod] + public void Other_relat016_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat016.testMethod()); + } + [TestMethod] + public void Other_relat017_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat017.testMethod()); + } + [TestMethod] + public void Other_relat018_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat018.testMethod()); + } + [TestMethod] + public void Other_relat019_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat019.testMethod()); + } + [TestMethod] + public void Other_relat020_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat020.testMethod()); + } + [TestMethod] + public void Other_relat021_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat021.testMethod()); + } + [TestMethod] + public void Other_relat022_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat022.testMethod()); + } + [TestMethod] + public void Other_relat023_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat023.testMethod()); + } + [TestMethod] + public void Other_relat024_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat024.testMethod()); + } + [TestMethod] + public void Other_relat025_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat025.testMethod()); + } + [TestMethod] + public void Other_relat026_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat026.testMethod()); + } + [TestMethod] + public void Other_relat027_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat027.testMethod()); + } + [TestMethod] + public void Other_relat028_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat028.testMethod()); + } + [TestMethod] + public void Other_relat029_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat029.testMethod()); + } + [TestMethod] + public void Other_relat030_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat030.testMethod()); + } + [TestMethod] + public void Other_relat031_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat031.testMethod()); + } + [TestMethod] + public void Other_relat032_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat032.testMethod()); + } + [TestMethod] + public void Other_relat033_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat033.testMethod()); + } + [TestMethod] + public void Other_relat034_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat034.testMethod()); + } + [TestMethod] + public void Other_relat035_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat035.testMethod()); + } + [TestMethod] + public void Other_relat036_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat036.testMethod()); + } + + + /* + [TestMethod] + public void Other_relat037_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("If either operand is NaN, the result is false"); + Debug.WriteLine("for all operators except !=, and true for !="); + Debug.WriteLine("operator."); + Assert.True(Other_TestClass_relat037.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Other_relat038_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("If either operand is NaN, the result is false"); + Debug.WriteLine("for all operators except !=, and true for !="); + Debug.WriteLine("operator."); + Assert.True(Other_TestClass_relat038.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Other_relat039_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("If either operand is NaN, the result is false"); + Debug.WriteLine("for all operators except !=, and true for !="); + Debug.WriteLine("operator."); + Assert.True(Other_TestClass_relat039.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Other_relat040_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("If either operand is NaN, the result is false"); + Debug.WriteLine("for all operators except !=, and true for !="); + Debug.WriteLine("operator."); + Assert.True(Other_TestClass_relat040.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Other_relat041_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("If either operand is NaN, the result is false"); + Debug.WriteLine("for all operators except !=, and true for !="); + Debug.WriteLine("operator."); + Assert.True(Other_TestClass_relat041.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Other_relat042_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("If either operand is NaN, the result is false"); + Debug.WriteLine("for all operators except !=, and true for !="); + Debug.WriteLine("operator."); + Assert.True(Other_TestClass_relat042.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Other_relat043_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("Negative and positive zero is considered"); + Debug.WriteLine("equal."); + Assert.True(Other_TestClass_relat043.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Other_relat044_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("Negative and positive zero is considered"); + Debug.WriteLine("equal."); + Assert.True(Other_TestClass_relat044.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Other_relat045_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("Other_TestClass_?_A negative infinity is considered less than"); + Debug.WriteLine("all other values, but equal to another negative"); + Debug.WriteLine("infinity."); + Assert.True(Other_TestClass_relat045.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Other_relat046_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("Other_TestClass_?_A negative infinity is considered less than"); + Debug.WriteLine("all other values, but equal to another negative"); + Debug.WriteLine("infinity."); + Assert.True(Other_TestClass_relat046.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Other_relat047_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("Other_TestClass_?_A positive infinity is considered greater than all"); + Debug.WriteLine("other values, but equal to positive infinity."); + Assert.True(Other_TestClass_relat047.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Other_relat048_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("Other_TestClass_?_A positive infinity is considered greater than all"); + Debug.WriteLine("other values, but equal to positive infinity."); + Assert.True(Other_TestClass_relat048.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + */ + [TestMethod] + public void Other_relat055_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat055.testMethod()); + } + [TestMethod] + public void Other_relat056_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat056.testMethod()); + } + [TestMethod] + public void Other_relat057_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat057.testMethod()); + } + [TestMethod] + public void Other_relat058_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat058.testMethod()); + } + [TestMethod] + public void Other_relat059_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat059.testMethod()); + } + [TestMethod] + public void Other_relat060_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat060.testMethod()); + } + [TestMethod] + public void Other_relat061_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat061.testMethod()); + } + [TestMethod] + public void Other_relat062_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat062.testMethod()); + } + [TestMethod] + public void Other_relat063_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("since the predefined reference type equality"); + Debug.WriteLine("operators accept operands of type object, they"); + Debug.WriteLine("apply to all types that do not declare applicable"); + Debug.WriteLine("operator == and != members. Conversely, any "); + Debug.WriteLine("applicable user-defined equality operators"); + Debug.WriteLine("effectively hide the predefined reference type"); + Debug.WriteLine("equality operators."); + Assert.True(Other_TestClass_relat063.testMethod()); + } + [TestMethod] + public void Other_relat064_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("since the predefined reference type equality"); + Debug.WriteLine("operators accept operands of type object, they"); + Debug.WriteLine("apply to all types that do not declare applicable"); + Debug.WriteLine("operator == and != members. Conversely, any "); + Debug.WriteLine("applicable user-defined equality operators"); + Debug.WriteLine("effectively hide the predefined reference type"); + Debug.WriteLine("equality operators."); + Assert.True(Other_TestClass_relat064.testMethod()); + } + [TestMethod] + public void Other_relat065_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("since the predefined reference type equality"); + Debug.WriteLine("operators accept operands of type object, they"); + Debug.WriteLine("apply to all types that do not declare applicable"); + Debug.WriteLine("operator == and != members. Conversely, any "); + Debug.WriteLine("applicable user-defined equality operators"); + Debug.WriteLine("effectively hide the predefined reference type"); + Debug.WriteLine("equality operators."); + Assert.True(Other_TestClass_relat065.testMethod()); + } + [TestMethod] + public void Other_relat066_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("since the predefined reference type equality"); + Debug.WriteLine("operators accept operands of type object, they"); + Debug.WriteLine("apply to all types that do not declare applicable"); + Debug.WriteLine("operator == and != members. Conversely, any "); + Debug.WriteLine("applicable user-defined equality operators"); + Debug.WriteLine("effectively hide the predefined reference type"); + Debug.WriteLine("equality operators."); + Assert.True(Other_TestClass_relat066.testMethod()); + } + [TestMethod] + public void Other_relat069_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("It is an error to use the predefined reference"); + Debug.WriteLine("type equality operators to compare two references"); + Debug.WriteLine("that are known to be different at compile-time."); + Assert.True(Other_TestClass_relat069.testMethod()); + } + [TestMethod] + public void Other_relat072_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("The predefined reference type equality operators"); + Debug.WriteLine("do not permit value type operands to be compared."); + Debug.WriteLine("Therefore, unless a struct type declares its own"); + Debug.WriteLine("equality operators, it is not possible to compare"); + Debug.WriteLine("values of that struct type."); + Assert.True(Other_TestClass_relat072.testMethod()); + } + [TestMethod] + public void Other_relat073_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("For an operation of the form x==y or x!=y, "); + Debug.WriteLine("if any appicable operator == or != exists, the"); + Debug.WriteLine("operator overload resolution rules will select"); + Debug.WriteLine("that operator instead of the predefined reference"); + Debug.WriteLine("type equality operator. However, it is always"); + Debug.WriteLine("possible to select the reference type equality"); + Debug.WriteLine("operator by explicitly casting one or both of"); + Debug.WriteLine("the operands to type object."); + Assert.True(Other_TestClass_relat073.testMethod()); + } + [TestMethod] + public void Other_relat074_Test() + { + Debug.WriteLine("Section 7.9"); + Debug.WriteLine("For an operation of the form x==y or x!=y, "); + Debug.WriteLine("if any appicable operator == or != exists, the"); + Debug.WriteLine("operator overload resolution rules will select"); + Debug.WriteLine("that operator instead of the predefined reference"); + Debug.WriteLine("type equality operator. However, it is always"); + Debug.WriteLine("possible to select the reference type equality"); + Debug.WriteLine("operator by explicitly casting one or both of"); + Debug.WriteLine("the operands to type object."); + Assert.True(Other_TestClass_relat074.testMethod()); + } + [TestMethod] + public void Other_relat075_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat075.testMethod()); + } + [TestMethod] + public void Other_relat076_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat076.testMethod()); + } + [TestMethod] + public void Other_relat077_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat077.testMethod()); + } + [TestMethod] + public void Other_relat078_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat078.testMethod()); + } + /* + [TestMethod] + public void Other_relat079_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat079.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + */ + [TestMethod] + public void Other_relat080_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat080.testMethod()); + } + [TestMethod] + public void Other_relat081_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat081.testMethod()); + } + [TestMethod] + public void Other_relat083_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat083.testMethod()); + } + [TestMethod] + public void Other_relat084_Test() + { + Debug.WriteLine("Section 7.9"); + Assert.True(Other_TestClass_relat084.testMethod()); + } + [TestMethod] + public void Other_relat086_Test() + { + Debug.WriteLine("Making sure floating point relational operators are working correctly for negative"); + Debug.WriteLine("vs. positive values."); + Assert.True(Other_TestClass_relat086.testMethod()); + } + [TestMethod] + public void Other_relat087_Test() + { + Debug.WriteLine("Making sure floating point relational operators are working correctly for negative"); + Debug.WriteLine("vs. positive values."); + Assert.True(Other_TestClass_relat087.testMethod()); + } + [TestMethod] + public void Other_relat088_Test() + { + Debug.WriteLine("Making sure floating point relational operators are working correctly for negative"); + Debug.WriteLine("vs. positive values."); + Assert.True(Other_TestClass_relat088.testMethod()); + } + [TestMethod] + public void Other_relat089_Test() + { + Debug.WriteLine("Making sure floating point relational operators are working correctly for negative"); + Debug.WriteLine("vs. positive values."); + Assert.True(Other_TestClass_relat089.testMethod()); + } + [TestMethod] + public void Other_operators_logic001_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic001.testMethod()); + } + [TestMethod] + public void Other_operators_logic002_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic002.testMethod()); + } + [TestMethod] + public void Other_operators_logic003_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic003.testMethod()); + } + [TestMethod] + public void Other_operators_logic004_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic004.testMethod()); + } + [TestMethod] + public void Other_operators_logic005_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic005.testMethod()); + } + [TestMethod] + public void Other_operators_logic006_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic006.testMethod()); + } + [TestMethod] + public void Other_operators_logic007_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic007.testMethod()); + } + [TestMethod] + public void Other_operators_logic008_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic008.testMethod()); + } + [TestMethod] + public void Other_operators_logic009_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic009.testMethod()); + } + [TestMethod] + public void Other_operators_logic010_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic010.testMethod()); + } + [TestMethod] + public void Other_operators_logic011_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic011.testMethod()); + } + [TestMethod] + public void Other_operators_logic012_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic012.testMethod()); + } + [TestMethod] + public void Other_operators_logic013_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic013.testMethod()); + } + [TestMethod] + public void Other_operators_logic014_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic014.testMethod()); + } + [TestMethod] + public void Other_operators_logic015_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_operators_logic015.testMethod()); + } + [TestMethod] + public void Other_operators_logic016_Test() + { + Debug.WriteLine("Section 7.11"); + Debug.WriteLine("The operation x (double amp) y corresponds to the"); + Debug.WriteLine("operation x (amp) y except that y is evaluated only"); + Debug.WriteLine("if x is true."); + Assert.True(Other_TestClass_operators_logic016.testMethod()); + } + [TestMethod] + public void Other_operators_logic017_Test() + { + Debug.WriteLine("Section 7.11"); + Debug.WriteLine("The operation x (double amp) y corresponds to the"); + Debug.WriteLine("operation x (amp) y except that y is evaluated only"); + Debug.WriteLine("if x is true."); + Assert.True(Other_TestClass_operators_logic017.testMethod()); + } + [TestMethod] + public void Other_operators_logic018_Test() + { + Debug.WriteLine("Section 7.11"); + Debug.WriteLine("The operation x || y corresponds to the"); + Debug.WriteLine("operation x (amp) y except that y is evaluated only"); + Debug.WriteLine("if x is false."); + Assert.True(Other_TestClass_operators_logic018.testMethod()); + } + [TestMethod] + public void Other_operators_logic019_Test() + { + Debug.WriteLine("Section 7.11"); + Debug.WriteLine("The operation x || y corresponds to the"); + Debug.WriteLine("operation x (amp) y except that y is evaluated only"); + Debug.WriteLine("if x is false."); + Assert.True(Other_TestClass_operators_logic019.testMethod()); + } + /* + [TestMethod] + public void Other_operators_logic022_Test() + { + Debug.WriteLine("Section 7.11"); + Debug.WriteLine("When the operands of && or || are of types"); + Debug.WriteLine("that declare an applicable user-defined operator &"); + Debug.WriteLine("or operator |, both of the following must be true,"); + Debug.WriteLine("where T is the type in which the selected operand"); + Debug.WriteLine("is declared:"); + Debug.WriteLine("The return type and the type of each parameter of "); + Debug.WriteLine("the selected operator must be T. In other words, "); + Debug.WriteLine("the operator must compute the logical AND or the"); + Debug.WriteLine("logical OR of the two operands of type T, and must"); + Debug.WriteLine("return a result of type T."); + Debug.WriteLine("T must contain declarations of operator true and"); + Debug.WriteLine("operator false."); + Assert.True(Other_TestClass_operators_logic022.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Other_operators_logic023_Test() + { + Debug.WriteLine("Section 7.11"); + Debug.WriteLine("When the operands of && or || are of types"); + Debug.WriteLine("that declare an applicable user-defined operator &"); + Debug.WriteLine("or operator |, both of the following must be true,"); + Debug.WriteLine("where T is the type in which the selected operand"); + Debug.WriteLine("is declared:"); + Debug.WriteLine("The return type and the type of each parameter of "); + Debug.WriteLine("the selected operator must be T. In other words, "); + Debug.WriteLine("the operator must compute the logical AND or the"); + Debug.WriteLine("logical OR of the two operands of type T, and must"); + Debug.WriteLine("return a result of type T."); + Debug.WriteLine("T must contain declarations of operator true and"); + Debug.WriteLine("operator false."); + Assert.True(Other_TestClass_operators_logic023.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Other_operators_logic032_Test() + { + Debug.WriteLine("Section 7.11"); + Assert.True(Other_TestClass_operators_logic032.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + */ + [TestMethod] + public void Other_operators_logic033_Test() + { + Debug.WriteLine("Section 7.11"); + Assert.True(Other_TestClass_operators_logic033.testMethod()); + } + [TestMethod] + public void Other_cond001_Test() + { + Debug.WriteLine("Section 7.12"); + Debug.WriteLine("Other_TestClass_?_A conditional expression of the form b(question) x(colon)y"); + Debug.WriteLine("first evaluates the condition b. Then, if b"); + Debug.WriteLine("is true, x is evaluated and becomes the result"); + Debug.WriteLine("of the operation. Otherwise, y is evaluated"); + Debug.WriteLine("and becomes the result of the operation. Other_TestClass_?_A"); + Debug.WriteLine("conditional expression never evaluates both x"); + Debug.WriteLine("and y."); + Assert.True(Other_TestClass_cond001.testMethod()); + } + [TestMethod] + public void Other_cond002_Test() + { + Debug.WriteLine("Section 7.12"); + Debug.WriteLine("Other_TestClass_?_A conditional expression of the form b(question) x(colon)y"); + Debug.WriteLine("first evaluates the condition b. Then, if b"); + Debug.WriteLine("is true, x is evaluated and becomes the result"); + Debug.WriteLine("of the operation. Otherwise, y is evaluated"); + Debug.WriteLine("and becomes the result of the operation. Other_TestClass_?_A"); + Debug.WriteLine("conditional expression never evaluates both x"); + Debug.WriteLine("and y."); + Assert.True(Other_TestClass_cond002.testMethod()); + } + [TestMethod] + public void Other_cond003_Test() + { + Debug.WriteLine("Section 7.12"); + Debug.WriteLine("Other_TestClass_?_A conditional expression of the form b(question) x(colon)y"); + Debug.WriteLine("first evaluates the condition b. Then, if b"); + Debug.WriteLine("is true, x is evaluated and becomes the result"); + Debug.WriteLine("of the operation. Otherwise, y is evaluated"); + Debug.WriteLine("and becomes the result of the operation. Other_TestClass_?_A"); + Debug.WriteLine("conditional expression never evaluates both x"); + Debug.WriteLine("and y."); + Assert.True(Other_TestClass_cond003.testMethod()); + } + [TestMethod] + public void Other_cond004_Test() + { + Debug.WriteLine("Section 7.12"); + Debug.WriteLine("Other_TestClass_?_A conditional expression of the form b(question) x(colon)y"); + Debug.WriteLine("first evaluates the condition b. Then, if b"); + Debug.WriteLine("is true, x is evaluated and becomes the result"); + Debug.WriteLine("of the operation. Otherwise, y is evaluated"); + Debug.WriteLine("and becomes the result of the operation. Other_TestClass_?_A"); + Debug.WriteLine("conditional expression never evaluates both x"); + Debug.WriteLine("and y."); + Assert.True(Other_TestClass_cond004.testMethod()); + } + [TestMethod] + public void Other_cond005_Test() + { + Debug.WriteLine("Section 7.12"); + Debug.WriteLine("The conditional operator is right-associative, meaning"); + Debug.WriteLine("that operations are grouped from right to left. For example,"); + Debug.WriteLine("an expression of the form a?b:c?d:e is evaluated as a?b:(c?d:e)."); + Assert.True(Other_TestClass_cond005.testMethod()); + } + [TestMethod] + public void Other_cond006_Test() + { + Debug.WriteLine("Section 7.12"); + Debug.WriteLine("The first operand of the ?: operator must"); + Debug.WriteLine("be an expression of a type that can be "); + Debug.WriteLine("implicitly converted to bool, or an expression"); + Debug.WriteLine("of a type that implements operator true. If neither"); + Debug.WriteLine("of these requirements are satisfied, a compile-time"); + Debug.WriteLine("error occurs."); + Assert.True(Other_TestClass_cond006.testMethod()); + } + [TestMethod] + public void Other_cond008_Test() + { + Debug.WriteLine("Section 7.12"); + Debug.WriteLine("The first operand of the ?: operator must"); + Debug.WriteLine("be an expression of a type that can be "); + Debug.WriteLine("implicitly converted to bool, or an expression"); + Debug.WriteLine("of a type that implements operator true. If neither"); + Debug.WriteLine("of these requirements are satisfied, a compile-time"); + Debug.WriteLine("error occurs."); + Assert.True(Other_TestClass_cond008.testMethod()); + } + [TestMethod] + public void Other_cond010_Test() + { + Debug.WriteLine("Section 7.12"); + Debug.WriteLine("Let X and Y be the types of the second and"); + Debug.WriteLine("third operands. Then,"); + Debug.WriteLine("If X and Y are the same types, then this is"); + Debug.WriteLine("the type of the conditional expression."); + Debug.WriteLine("Otherwise, if an implicit conversion exists"); + Debug.WriteLine("from X to Y, but not from Y to X, then Y"); + Debug.WriteLine("is the type of the conditional expression."); + Debug.WriteLine("Otherwise, if an implicit conversion exists"); + Debug.WriteLine("from Y to X, but not from X to Y, then X"); + Debug.WriteLine("is the type of the conditional expression."); + Debug.WriteLine("Otherwise, no expression type can be "); + Debug.WriteLine("determined, and a compile time error occurs. "); + Assert.True(Other_TestClass_cond010.testMethod()); + } + [TestMethod] + public void Other_cond011_Test() + { + Debug.WriteLine("Section 7.12"); + Debug.WriteLine("Let X and Y be the types of the second and"); + Debug.WriteLine("third operands. Then,"); + Debug.WriteLine("If X and Y are the same types, then this is"); + Debug.WriteLine("the type of the conditional expression."); + Debug.WriteLine("Otherwise, if an implicit conversion exists"); + Debug.WriteLine("from X to Y, but not from Y to X, then Y"); + Debug.WriteLine("is the type of the conditional expression."); + Debug.WriteLine("Otherwise, if an implicit conversion exists"); + Debug.WriteLine("from Y to X, but not from X to Y, then X"); + Debug.WriteLine("is the type of the conditional expression."); + Debug.WriteLine("Otherwise, no expression type can be "); + Debug.WriteLine("determined, and a compile time error occurs. "); + Assert.True(Other_TestClass_cond011.testMethod()); + } + [TestMethod] + public void Other_cond014_Test() + { + Debug.WriteLine("Section 7.12"); + Debug.WriteLine("The run-time processing of a conditional expression of"); + Debug.WriteLine("the form b? x: y consists of the following steps:"); + Debug.WriteLine("If an implicit conversion from type b to bool exists,"); + Debug.WriteLine("then this implicit conversion is performed to produce"); + Debug.WriteLine("a bool value."); + Debug.WriteLine("Otherwise, the operator true defined by the type of"); + Debug.WriteLine("b is invoked to produce a bool value."); + Assert.True(Other_TestClass_cond014.testMethod()); + } + [TestMethod] + public void Other_cond015_Test() + { + Debug.WriteLine("Section 7.12"); + Debug.WriteLine("The run-time processing of a conditional expression of"); + Debug.WriteLine("the form b? x: y consists of the following steps:"); + Debug.WriteLine("If an implicit conversion from type b to bool exists,"); + Debug.WriteLine("then this implicit conversion is performed to produce"); + Debug.WriteLine("a bool value."); + Debug.WriteLine("Otherwise, the operator true defined by the type of"); + Debug.WriteLine("b is invoked to produce a bool value."); + Assert.True(Other_TestClass_cond015.testMethod()); + } + [TestMethod] + public void Other_is005_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The is operator is used to check whether the run-time type"); + Debug.WriteLine("of an ojbect is compatible with a given type. In an operation"); + Debug.WriteLine("of the form e is T, e must be an expression of a reference-type"); + Debug.WriteLine("and T must be a reference-type. If this is not the case, a compile"); + Debug.WriteLine("time error occurs."); + Assert.True(Other_TestClass_is005.testMethod()); + } + [TestMethod] + public void Other_is006_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The is operator is used to check whether the run-time type"); + Debug.WriteLine("of an ojbect is compatible with a given type. In an operation"); + Debug.WriteLine("of the form e is T, e must be an expression of a reference-type"); + Debug.WriteLine("and T must be a reference-type. If this is not the case, a compile"); + Debug.WriteLine("time error occurs."); + Assert.True(Other_TestClass_is006.testMethod()); + } + [TestMethod] + public void Other_is007_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is007.testMethod()); + } + [TestMethod] + public void Other_is008_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is008.testMethod()); + } + [TestMethod] + public void Other_is009_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is009.testMethod()); + } + [TestMethod] + public void Other_is010_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is010.testMethod()); + } + [TestMethod] + public void Other_is011_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is011.testMethod()); + } + [TestMethod] + public void Other_is012_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is012.testMethod()); + } + [TestMethod] + public void Other_is013_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is013.testMethod()); + } + [TestMethod] + public void Other_is014_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is014.testMethod()); + } + [TestMethod] + public void Other_is015_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is015.testMethod()); + } + [TestMethod] + public void Other_is016_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is016.testMethod()); + } + [TestMethod] + public void Other_is017_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is017.testMethod()); + } + [TestMethod] + public void Other_is018_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is018.testMethod()); + } + [TestMethod] + public void Other_is019_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is019.testMethod()); + } + [TestMethod] + public void Other_is020_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is020.testMethod()); + } + [TestMethod] + public void Other_is021_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is021.testMethod()); + } + [TestMethod] + public void Other_is022_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("The operation e is T returns true if not null"); + Debug.WriteLine("and if an implicit reference conversion from the "); + Debug.WriteLine("run-time type of the instance referenced by e to "); + Debug.WriteLine("the type given by T exists. In other words, e is T"); + Debug.WriteLine("checks that e is not null and that a cast-expression"); + Debug.WriteLine("of the form (T)(e) will complete without throwing an "); + Debug.WriteLine("System.Exception."); + Assert.True(Other_TestClass_is022.testMethod()); + } + [TestMethod] + public void Other_is023_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("If e is T is known at compile-time to always be"); + Debug.WriteLine("true or always be false, a compile-time error"); + Debug.WriteLine("occurs. The operation is known to always be "); + Debug.WriteLine("true if an implicit reference conversion exists from"); + Debug.WriteLine("the compile-time type of e to T. The operation is known"); + Debug.WriteLine("to always be false if no implicit or explicit reference"); + Debug.WriteLine("conversion exists from the compile-time type of e to t."); + Assert.True(Other_TestClass_is023.testMethod()); + } + [TestMethod] + public void Other_is024_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("If e is T is known at compile-time to always be"); + Debug.WriteLine("true or always be false, a compile-time error"); + Debug.WriteLine("occurs. The operation is known to always be "); + Debug.WriteLine("true if an implicit reference conversion exists from"); + Debug.WriteLine("the compile-time type of e to T. The operation is known"); + Debug.WriteLine("to always be false if no implicit or explicit reference"); + Debug.WriteLine("conversion exists from the compile-time type of e to t."); + Assert.True(Other_TestClass_is024.testMethod()); + } + [TestMethod] + public void Other_is025_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("If e is T is known at compile-time to always be"); + Debug.WriteLine("true or always be false, a compile-time error"); + Debug.WriteLine("occurs. The operation is known to always be "); + Debug.WriteLine("true if an implicit reference conversion exists from"); + Debug.WriteLine("the compile-time type of e to T. The operation is known"); + Debug.WriteLine("to always be false if no implicit or explicit reference"); + Debug.WriteLine("conversion exists from the compile-time type of e to t."); + Assert.True(Other_TestClass_is025.testMethod()); + } + [TestMethod] + public void Other_is026_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("If e is T is known at compile-time to always be"); + Debug.WriteLine("true or always be false, a compile-time error"); + Debug.WriteLine("occurs. The operation is known to always be "); + Debug.WriteLine("true if an implicit reference conversion exists from"); + Debug.WriteLine("the compile-time type of e to T. The operation is known"); + Debug.WriteLine("to always be false if no implicit or explicit reference"); + Debug.WriteLine("conversion exists from the compile-time type of e to t."); + Assert.True(Other_TestClass_is026.testMethod()); + } + [TestMethod] + public void Other_is027_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("If e is T is known at compile-time to always be"); + Debug.WriteLine("true or always be false, a compile-time error"); + Debug.WriteLine("occurs. The operation is known to always be "); + Debug.WriteLine("true if an implicit reference conversion exists from"); + Debug.WriteLine("the compile-time type of e to T. The operation is known"); + Debug.WriteLine("to always be false if no implicit or explicit reference"); + Debug.WriteLine("conversion exists from the compile-time type of e to t."); + Assert.True(Other_TestClass_is027.testMethod()); + } + + [TestMethod] + public void Other_is028_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("If e is T is known at compile-time to always be"); + Debug.WriteLine("true or always be false, a compile-time error"); + Debug.WriteLine("occurs. The operation is known to always be "); + Debug.WriteLine("true if an implicit reference conversion exists from"); + Debug.WriteLine("the compile-time type of e to T. The operation is known"); + Debug.WriteLine("to always be false if no implicit or explicit reference"); + Debug.WriteLine("conversion exists from the compile-time type of e to t."); + Assert.True(Other_TestClass_is028.testMethod()); + } + + [TestMethod] + public void Other_is029_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("If e is T is known at compile-time to always be"); + Debug.WriteLine("true or always be false, a compile-time error"); + Debug.WriteLine("occurs. The operation is known to always be "); + Debug.WriteLine("true if an implicit reference conversion exists from"); + Debug.WriteLine("the compile-time type of e to T. The operation is known"); + Debug.WriteLine("to always be false if no implicit or explicit reference"); + Debug.WriteLine("conversion exists from the compile-time type of e to t."); + Assert.True(Other_TestClass_is029.testMethod()); + } + + [TestMethod] + public void Other_is030_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("If e is T is known at compile-time to always be"); + Debug.WriteLine("true or always be false, a compile-time error"); + Debug.WriteLine("occurs. The operation is known to always be "); + Debug.WriteLine("true if an implicit reference conversion exists from"); + Debug.WriteLine("the compile-time type of e to T. The operation is known"); + Debug.WriteLine("to always be false if no implicit or explicit reference"); + Debug.WriteLine("conversion exists from the compile-time type of e to t."); + Assert.True(Other_TestClass_is030.testMethod()); + } + + [TestMethod] + public void Other_is031_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("If e is T is known at compile-time to always be"); + Debug.WriteLine("true or always be false, a compile-time error"); + Debug.WriteLine("occurs. The operation is known to always be "); + Debug.WriteLine("true if an implicit reference conversion exists from"); + Debug.WriteLine("the compile-time type of e to T. The operation is known"); + Debug.WriteLine("to always be false if no implicit or explicit reference"); + Debug.WriteLine("conversion exists from the compile-time type of e to t."); + Assert.True(Other_TestClass_is031.testMethod()); + } + + [TestMethod] + public void Other_is032_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("If e is T is known at compile-time to always be"); + Debug.WriteLine("true or always be false, a compile-time error"); + Debug.WriteLine("occurs. The operation is known to always be "); + Debug.WriteLine("true if an implicit reference conversion exists from"); + Debug.WriteLine("the compile-time type of e to T. The operation is known"); + Debug.WriteLine("to always be false if no implicit or explicit reference"); + Debug.WriteLine("conversion exists from the compile-time type of e to t."); + Assert.True(Other_TestClass_is032.testMethod()); + } + + [TestMethod] + public void Other_is033_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("If e is T is known at compile-time to always be"); + Debug.WriteLine("true or always be false, a compile-time error"); + Debug.WriteLine("occurs. The operation is known to always be "); + Debug.WriteLine("true if an implicit reference conversion exists from"); + Debug.WriteLine("the compile-time type of e to T. The operation is known"); + Debug.WriteLine("to always be false if no implicit or explicit reference"); + Debug.WriteLine("conversion exists from the compile-time type of e to t."); + Assert.True(Other_TestClass_is033.testMethod()); + } + + [TestMethod] + public void Other_is034_Test() + { + Debug.WriteLine("Section 7.9.9"); + Debug.WriteLine("If e is T is known at compile-time to always be"); + Debug.WriteLine("true or always be false, a compile-time error"); + Debug.WriteLine("occurs. The operation is known to always be "); + Debug.WriteLine("true if an implicit reference conversion exists from"); + Debug.WriteLine("the compile-time type of e to T. The operation is known"); + Debug.WriteLine("to always be false if no implicit or explicit reference"); + Debug.WriteLine("conversion exists from the compile-time type of e to t."); + Assert.True(Other_TestClass_is034.testMethod()); + } + + [TestMethod] + public void Other_as001_Test() + { + Debug.WriteLine("Section 7.9.10"); + Assert.True(Other_TestClass_as001.testMethod()); + } + + [TestMethod] + public void Other_as002_Test() + { + Debug.WriteLine("Section 7.9.10"); + Assert.True(Other_TestClass_as002.testMethod()); + } + + [TestMethod] + public void Other_as003_Test() + { + Debug.WriteLine("Section 7.9.10"); + Debug.WriteLine("string->object->array "); + Assert.True(Other_TestClass_as003.testMethod()); + } + + [TestMethod] + public void Other_as004_Test() + { + Debug.WriteLine("Section 7.9.10"); + Debug.WriteLine("string->object->array "); + Assert.True(Other_TestClass_as004.testMethod()); + } + + [TestMethod] + public void Other_as007_Test() + { + Debug.WriteLine("Section 7.9.10"); + Debug.WriteLine("string->object->array "); + Assert.True(Other_TestClass_as007.testMethod()); + } + + [TestMethod] + public void Other_as008_Test() + { + Debug.WriteLine("Section 7.9.10"); + Debug.WriteLine("exp as object "); + Assert.True(Other_TestClass_as008.testMethod()); + } + + [TestMethod] + public void Other_as011_Test() + { + Debug.WriteLine("Section 7.9.10"); + Debug.WriteLine("expression as for a deep inheritance"); + Assert.True(Other_TestClass_as011.testMethod()); + } + + [TestMethod] + public void Other_as012_Test() + { + Debug.WriteLine("Section 7.9.10"); + Debug.WriteLine("expression as non-type through interface (check at runtime)"); + Assert.True(Other_TestClass_as012.testMethod()); + } + + [TestMethod] + public void Other_add001_Test() + { + Debug.WriteLine("Section 7.7.4"); + Debug.WriteLine("When one or both operands are of type string, the"); + Debug.WriteLine("predefined addition operators concatenate the string"); + Debug.WriteLine("representation of the operands."); + Assert.True(Other_TestClass_add001.testMethod()); + } + + [TestMethod] + public void Other_add002_Test() + { + Debug.WriteLine("Section 7.7.4"); + Debug.WriteLine("When one or both operands are of type string, the"); + Debug.WriteLine("predefined addition operators concatenate the string"); + Debug.WriteLine("representation of the operands."); + Assert.True(Other_TestClass_add002.testMethod()); + } + + [TestMethod] + public void Other_add003_Test() + { + Debug.WriteLine("Section 7.7.4"); + Debug.WriteLine("When one or both operands are of type string, the"); + Debug.WriteLine("predefined addition operators concatenate the string"); + Debug.WriteLine("representation of the operands."); + Assert.True(Other_TestClass_add003.testMethod()); + } + + [TestMethod] + public void Other_add004_Test() + { + Debug.WriteLine("Section 7.7.4"); + Debug.WriteLine("When one or both operands are of type string, the"); + Debug.WriteLine("predefined addition operators concatenate the string"); + Debug.WriteLine("representation of the operands."); + Assert.True(Other_TestClass_add004.testMethod()); + } + + [TestMethod] + public void Other_add005_Test() + { + Debug.WriteLine("Section 7.7.4"); + Debug.WriteLine("When one or both operands are of type string, the"); + Debug.WriteLine("predefined addition operators concatenate the string"); + Debug.WriteLine("representation of the operands."); + Assert.True(Other_TestClass_add005.testMethod()); + } + + [TestMethod] + public void Other_add006_Test() + { + Debug.WriteLine("Section 7.7.4"); + Debug.WriteLine("When one or both operands are of type string, the"); + Debug.WriteLine("predefined addition operators concatenate the string"); + Debug.WriteLine("representation of the operands."); + Assert.True(Other_TestClass_add006.testMethod()); + } + + [TestMethod] + public void Other_logic001_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic001.testMethod()); + } + + [TestMethod] + public void Other_logic002_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic002.testMethod()); + } + + [TestMethod] + public void Other_logic003_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic003.testMethod()); + } + + [TestMethod] + public void Other_logic004_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic004.testMethod()); + } + + [TestMethod] + public void Other_logic005_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic005.testMethod()); + } + + [TestMethod] + public void Other_logic006_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic006.testMethod()); + } + + [TestMethod] + public void Other_logic007_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic007.testMethod()); + } + + [TestMethod] + public void Other_logic008_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic008.testMethod()); + } + + [TestMethod] + public void Other_logic009_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic009.testMethod()); + } + + [TestMethod] + public void Other_logic010_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic010.testMethod()); + } + + [TestMethod] + public void Other_logic011_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic011.testMethod()); + } + + [TestMethod] + public void Other_logic012_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic012.testMethod()); + } + + [TestMethod] + public void Other_logic013_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic013.testMethod()); + } + + [TestMethod] + public void Other_logic014_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic014.testMethod()); + } + + [TestMethod] + public void Other_logic015_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic015.testMethod()); + } + + [TestMethod] + public void Other_logic016_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic016.testMethod()); + } + + [TestMethod] + public void Other_logic017_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic017.testMethod()); + } + + [TestMethod] + public void Other_logic018_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic018.testMethod()); + } + + [TestMethod] + public void Other_logic019_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic019.testMethod()); + } + + [TestMethod] + public void Other_logic020_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic020.testMethod()); + } + + [TestMethod] + public void Other_logic021_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic021.testMethod()); + } + + [TestMethod] + public void Other_logic022_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic022.testMethod()); + } + + [TestMethod] + public void Other_logic023_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic023.testMethod()); + } + + [TestMethod] + public void Other_logic024_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic024.testMethod()); + } + + [TestMethod] + public void Other_logic025_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic025.testMethod()); + } + + [TestMethod] + public void Other_logic026_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic026.testMethod()); + } + + [TestMethod] + public void Other_logic027_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic027.testMethod()); + } + + [TestMethod] + public void Other_logic028_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic028.testMethod()); + } + + [TestMethod] + public void Other_logic029_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic029.testMethod()); + } + + [TestMethod] + public void Other_logic030_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic030.testMethod()); + } + + [TestMethod] + public void Other_logic032_Test() + { + Debug.WriteLine("Section 7.10"); + Assert.True(Other_TestClass_logic032.testMethod()); + } + + //Compiled Test Cases + + public class Other_TestClass_Shift_001 + { + public static int Main_old(string[] args) + { + byte bits = 8; + bits = (byte)(bits << 1); + if (bits != 16) + return (1); + bits = (byte)(bits >> 1); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_002 + { + public static int Main_old(string[] args) + { + sbyte bits = 8; + bits = (sbyte)(bits << 1); + if (bits != 16) + return (1); + bits = (sbyte)(bits >> 1); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_003 + { + public static int Main_old(string[] args) + { + short bits = 8; + bits = (short)(bits << 1); + if (bits != 16) + return (1); + bits = (short)(bits >> 1); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_004 + { + public static int Main_old(string[] args) + { + ushort bits = 8; + bits = (ushort)(bits << 1); + if (bits != 16) + return (1); + bits = (ushort)(bits >> 1); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_005 + { + public static int Main_old(string[] args) + { + int bits = 8; + bits = (int)(bits << 1); + if (bits != 16) + return (1); + bits = (int)(bits >> 1); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_006 + { + public static int Main_old(string[] args) + { + uint bits = 8; + bits = (uint)(bits << 1); + if (bits != 16) + return (1); + bits = (uint)(bits >> 1); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_007 + { + public static int Main_old(string[] args) + { + long bits = 8; + bits = (long)(bits << 1); + if (bits != 16) + return (1); + bits = (long)(bits >> 1); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_008 + { + public static int Main_old(string[] args) + { + ulong bits = 8; + bits = (ulong)(bits << 1); + if (bits != 16) + return (1); + bits = (ulong)(bits >> 1); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_009 + { + public static int Main_old(string[] args) + { + char bits = (char)8; + bits = (char)(bits << 1); + if (bits != 16) + return (1); + bits = (char)(bits >> 1); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_015 + { + public static int Main_old(string[] args) + { + int shifter = 1; + byte bits = 8; + bits = (byte)(bits << shifter); + if (bits != 16) + return (1); + bits = (byte)(bits >> shifter); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_016 + { + public static int Main_old(string[] args) + { + int shifter = 1; + sbyte bits = 8; + bits = (sbyte)(bits << shifter); + if (bits != 16) + return (1); + bits = (sbyte)(bits >> shifter); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_017 + { + public static int Main_old(string[] args) + { + int shifter = 1; + short bits = 8; + bits = (short)(bits << shifter); + if (bits != 16) + return (1); + bits = (short)(bits >> shifter); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_018 + { + public static int Main_old(string[] args) + { + int shifter = 1; + ushort bits = 8; + bits = (ushort)(bits << shifter); + if (bits != 16) + return (1); + bits = (ushort)(bits >> shifter); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_019 + { + public static int Main_old(string[] args) + { + int shifter = 1; + int bits = 8; + bits = (int)(bits << shifter); + if (bits != 16) + return (1); + bits = (int)(bits >> shifter); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_020 + { + public static int Main_old(string[] args) + { + int shifter = 1; + uint bits = 8; + bits = (uint)(bits << shifter); + if (bits != 16) + return (1); + bits = (uint)(bits >> shifter); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_021 + { + public static int Main_old(string[] args) + { + int shifter = 1; + long bits = 8; + bits = (long)(bits << shifter); + if (bits != 16) + return (1); + bits = (long)(bits >> shifter); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_022 + { + public static int Main_old(string[] args) + { + int shifter = 1; + ulong bits = 8; + bits = (ulong)(bits << shifter); + if (bits != 16) + return (1); + bits = (ulong)(bits >> shifter); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_023 + { + public static int Main_old(string[] args) + { + int shifter = 1; + char bits = (char)8; + bits = (char)(bits << shifter); + if (bits != 16) + return (1); + bits = (char)(bits >> shifter); + if (bits != 8) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_shift_029 + { + public static int Main_old(string[] args) + { + sbyte sb = 0x01; + sb = (sbyte)(sb << 7); + if (sb != unchecked((sbyte)0xFFFFFF80)) + return (1); + sb = (sbyte)(sb >> 7); + if (sb != -1) + return (1); + short sh = 0x01; + sh = (short)(sh << 15); + if (sh != unchecked((short)0xFFFF8000)) + return (1); + sh = (short)(sh >> 15); + if (sh != -1) + return (1); + int in1 = 0x01; + in1 = in1 << 31; + if (in1 != unchecked((int)0x80000000)) + return (1); + in1 = in1 >> 31; + if (in1 != -1) + return (1); + long lo = 0x01; + lo = lo << 63; + unchecked + { + if (lo != (long)0x8000000000000000) + return (1); + } + lo = lo >> 63; + if (lo != -1) + { + return (1); + } + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_shift_030 + { + public static int Main_old(string[] args) + { + byte ub = 0x01; + ub = (byte)(ub << 7); + if (ub != 0x80) + return (1); + ub = (byte)(ub >> 7); + if (ub != 0x01) + return (1); + ushort ush = 0x01; + ush = (ushort)(ush << 15); + if (ush != 0x8000) + return (1); + ush = (ushort)(ush >> 15); + if (ush != 0x01) + return (1); + uint uin = 0x01; + uin = uin << 31; + if (uin != 0x80000000) + return (1); + uin = uin >> 31; + if (uin != 0x01) + return (1); + ulong ulo = 0x01; + ulo = ulo << 63; + if (ulo != 0x8000000000000000) + return (1); + ulo = ulo >> 63; + if (ulo != 0x01) + { + return (1); + } + char ch = (char)0x01; + ch = (char)(ch << 15); + if (ch != 0x8000) + return (1); + ch = (char)(ch >> 15); + if (ch != 0x01) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_037 + { + public static int Main_old() + { + + int intI = 8 >> 3; + if (intI == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_Shift_038 + { + public static int Main_old() + { + + int intI = 1 << 3; + if (intI == 8) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_Shift_041 + { + public byte ub; + public ushort ush; + public uint uin; + public ulong ulo; + public char ch; + + public static int Main_old(string[] args) + { + Other_TestClass_Shift_041 T = new Other_TestClass_Shift_041(); + + T.ub = 0x01; + T.ub = (byte)(T.ub << 7); + if (T.ub != 0x80) + return (1); + T.ub = (byte)(T.ub >> 7); + if (T.ub != 0x01) + return (1); + T.ush = 0x01; + T.ush = (ushort)(T.ush << 15); + if (T.ush != 0x8000) + return (1); + T.ush = (ushort)(T.ush >> 15); + if (T.ush != 0x01) + return (1); + T.uin = 0x01; + T.uin = T.uin << 31; + if (T.uin != 0x80000000) + return (1); + T.uin = T.uin >> 31; + if (T.uin != 0x01) + return (1); + T.ulo = 0x01; + T.ulo = T.ulo << 63; + if (T.ulo != 0x8000000000000000) + return (1); + T.ulo = T.ulo >> 63; + if (T.ulo != 0x01) + { + return (1); + } + T.ch = (char)0x01; + T.ch = (char)(T.ch << 15); + if (T.ch != 0x8000) + return (1); + T.ch = (char)(T.ch >> 15); + if (T.ch != 0x01) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_042 + { + public sbyte sb; + public short sh; + public int in1; + public long lo; + + public static int Main_old(string[] args) + { + Other_TestClass_Shift_042 T = new Other_TestClass_Shift_042(); + T.sb = 0x01; + T.sb = (sbyte)(T.sb << 7); + if (T.sb != unchecked((sbyte)0xFFFFFF80)) + return (1); + T.sb = (sbyte)(T.sb >> 7); + if (T.sb != -1) + return (1); + T.sh = 0x01; + T.sh = (short)(T.sh << 15); + if (T.sh != unchecked((short)0xFFFF8000)) + return (1); + T.sh = (short)(T.sh >> 15); + if (T.sh != -1) + return (1); + T.in1 = 0x01; + T.in1 = T.in1 << 31; + if (T.in1 != unchecked((int)0x80000000)) + return (1); + T.in1 = T.in1 >> 31; + if (T.in1 != -1) + return (1); + T.lo = 0x01; + T.lo = T.lo << 63; + unchecked + { + if (T.lo != (long)0x8000000000000000) + return (1); + } + T.lo = T.lo >> 63; + if (T.lo != -1) + { + return (1); + } + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_043 + { + public byte ub; + public ushort ush; + public uint uin; + public ulong ulo; + public char ch; + + public static int Main_old(string[] args) + { + Other_TestClass_Shift_043 T = new Other_TestClass_Shift_043(); + + T.ub = 0x01; + T.ub <<= 7; + if (T.ub != 0x80) + return (1); + T.ub >>= 7; + if (T.ub != 0x01) + return (1); + T.ush = 0x01; + T.ush <<= 15; + if (T.ush != 0x8000) + return (1); + T.ush >>= 15; + if (T.ush != 0x01) + return (1); + T.uin = 0x01; + T.uin <<= 31; + if (T.uin != 0x80000000) + return (1); + T.uin >>= 31; + if (T.uin != 0x01) + return (1); + T.ulo = 0x01; + T.ulo <<= 63; + if (T.ulo != 0x8000000000000000) + return (1); + T.ulo >>= 63; + if (T.ulo != 0x01) + { + return (1); + } + T.ch = (char)0x01; + T.ch <<= 15; + if (T.ch != 0x8000) + return (1); + T.ch >>= 15; + if (T.ch != 0x01) + return (1); + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Other_TestClass_Shift_044 + { + public sbyte sb; + public short sh; + public int in1; + public long lo; + + public static int Main_old(string[] args) + { + Other_TestClass_Shift_044 T = new Other_TestClass_Shift_044(); + T.sb = 0x01; + T.sb <<= 7; + if (T.sb != unchecked((sbyte)0xFFFFFF80)) + return (1); + T.sb >>= 7; + if (T.sb != -1) + return (1); + T.sh = 0x01; + T.sh <<= 15; + if (T.sh != unchecked((short)0xFFFF8000)) + return (1); + T.sh >>= 15; + if (T.sh != -1) + return (1); + T.in1 = 0x01; + T.in1 <<= 31; + if (T.in1 != unchecked((int)0x80000000)) + return (1); + T.in1 >>= 31; + if (T.in1 != -1) + return (1); + T.lo = 0x01; + T.lo <<= 63; + unchecked + { + if (T.lo != (long)0x8000000000000000) + return (1); + } + T.lo >>= 63; + if (T.lo != -1) + { + return (1); + } + return (0); + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + class Other_TestClass_assign001 + { + public static int Main_old() + { + int Other_TestClass_assign001; + Other_TestClass_assign001 = 1; + if (Other_TestClass_assign001 == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_assign002 + { + public static int Main_old() + { + int Other_TestClass_assign002 = 1; + Other_TestClass_assign002 += 1; + if (Other_TestClass_assign002 == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_assign003 + { + public static int Main_old() + { + int Other_TestClass_assign003 = 3; + Other_TestClass_assign003 -= 1; + if (Other_TestClass_assign003 == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_assign004 + { + public static int Main_old() + { + int Other_TestClass_assign004 = 3; + Other_TestClass_assign004 *= 4; + if (Other_TestClass_assign004 == 12) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_assign005 + { + public static int Main_old() + { + int Other_TestClass_assign005 = 12; + Other_TestClass_assign005 /= 4; + if (Other_TestClass_assign005 == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_assign006 + { + public static int Main_old() + { + int Other_TestClass_assign006 = 15; + Other_TestClass_assign006 %= 4; + if (Other_TestClass_assign006 == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_assign007 + { + public static int Main_old() + { + int Other_TestClass_assign007 = 5; + Other_TestClass_assign007 &= 4; + if (Other_TestClass_assign007 == 4) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_assign008 + { + public static int Main_old() + { + int Other_TestClass_assign008 = 3; + Other_TestClass_assign008 |= 4; + if (Other_TestClass_assign008 == 7) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_assign009 + { + public static int Main_old() + { + int Other_TestClass_assign009 = 5; + Other_TestClass_assign009 ^= 4; + if (Other_TestClass_assign009 == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_assign010 + { + public static int Main_old() + { + int Other_TestClass_assign010 = 4; + Other_TestClass_assign010 <<= 2; + if (Other_TestClass_assign010 == 16) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_assign011 + { + public static int Main_old() + { + int Other_TestClass_assign011 = 4; + Other_TestClass_assign011 >>= 2; + if (Other_TestClass_assign011 == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary001 + { + public static int Main_old() + { + int test1 = 2; + int test2 = +test1; + if (test2 == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary002 + { + public static int Main_old() + { + uint test1 = 2; + uint test2 = +test1; + if (test2 == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary003 + { + public static int Main_old() + { + long test1 = 2; + long test2 = +test1; + if (test2 == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary004 + { + public static int Main_old() + { + ulong test1 = 2; + ulong test2 = +test1; + if (test2 == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary005 + { + public static int Main_old() + { + float test1 = 2; + float test2 = +test1; + if (test2 == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary006 + { + public static int Main_old() + { + double test1 = 2; + double test2 = +test1; + if (test2 == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary007 + { + public static int Main_old() + { + double test1 = 2; + double test2 = +test1; + if (test2 == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary008 + { + public static int Main_old() + { + int test1 = 2; + int test2 = -test1; + if (test2 == -2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary009 + { + public static int Main_old() + { + long test1 = 2; + long test2 = -test1; + if (test2 == -2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary012 + { + public static int Main_old() + { + int test1 = int.MinValue; + int test2 = 0; + unchecked + { + test2 = -test1; + } + + if ((test1 == int.MinValue) && (test2 == int.MinValue)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary013 + { + public static int Main_old() + { + long test1 = long.MinValue; + long test2 = 0; + unchecked + { + test2 = -test1; + } + + if ((test1 == long.MinValue) && (test2 == long.MinValue)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary014 + { + public static int Main_old() + { + uint test1 = 2; + long test2 = 0; + if (((-test1).GetType() == test2.GetType()) && ((-test1) == -2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary015 + { + public static int Main_old() + { + int intI = 0; + if ((-2147483648).GetType() == intI.GetType()) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary017 + { + public static int Main_old() + { + long test1 = -9223372036854775808; + if (test1 == -9223372036854775808) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary018 + { + public static int Main_old() + { + float test1 = 2.0f; + float test2 = -test1; + if (test2 == -2.0f) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary019 + { + public static int Main_old() + { + double test1 = 2.0; + double test2 = -test1; + if (test2 == -2.0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + class Other_TestClass_unary023 + { + public static int Main_old() + { + bool test1 = true; + bool test2 = !test1; + if (test2 == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary024 + { + public static int Main_old() + { + bool test1 = false; + bool test2 = !test1; + if (test2 == true) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary025 + { + public static int Main_old() + { + int test1 = 2; + int test2 = ~test1; + if (test2 == -3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary026 + { + public static int Main_old() + { + uint test1 = 2; + uint test2 = ~test1; + if (test2 == 0xFFFFFFFD) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary027 + { + public static int Main_old() + { + long test1 = 2; + long test2 = ~test1; + if (test2 == -3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary028 + { + public static int Main_old() + { + ulong test1 = 2; + ulong test2 = ~test1; + if (test2 == 0xFFFFFFFFFFFFFFFD) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary029 + { + public static int Main_old() + { + int intI = 2; + int intJ = 2; + ++intI; + --intJ; + if ((intI == 3) && (intJ == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary030 + { + int intI; + public int MyInt + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static int Main_old() + { + Other_TestClass_unary030 MC1 = new Other_TestClass_unary030(); + Other_TestClass_unary030 MC2 = new Other_TestClass_unary030(); + MC1.MyInt = 2; + MC2.MyInt = 2; + ++MC1.MyInt; + --MC2.MyInt; + if ((MC1.MyInt == 3) && (MC2.MyInt == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary031 + { + int intI = 2; + public int this[int intJ] + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static int Main_old() + { + Other_TestClass_unary031 MC1 = new Other_TestClass_unary031(); + Other_TestClass_unary031 MC2 = new Other_TestClass_unary031(); + ++MC1[0]; + --MC2[0]; + if ((MC1[0] == 3) && (MC2[0] == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary036 + { + public static int Main_old() + { + sbyte test1 = 2; + sbyte test2 = 2; + ++test1; + --test2; + if ((test1 == 3) && (test2 == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary037 + { + public static int Main_old() + { + byte test1 = 2; + byte test2 = 2; + ++test1; + --test2; + if ((test1 == 3) && (test2 == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary038 + { + public static int Main_old() + { + short test1 = 2; + short test2 = 2; + ++test1; + --test2; + if ((test1 == 3) && (test2 == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary039 + { + public static int Main_old() + { + ushort test1 = 2; + ushort test2 = 2; + ++test1; + --test2; + if ((test1 == 3) && (test2 == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary040 + { + public static int Main_old() + { + int test1 = 2; + int test2 = 2; + ++test1; + --test2; + if ((test1 == 3) && (test2 == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary041 + { + public static int Main_old() + { + uint test1 = 2; + uint test2 = 2; + ++test1; + --test2; + if ((test1 == 3) && (test2 == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary042 + { + public static int Main_old() + { + long test1 = 2; + long test2 = 2; + ++test1; + --test2; + if ((test1 == 3) && (test2 == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary043 + { + public static int Main_old() + { + ulong test1 = 2; + ulong test2 = 2; + ++test1; + --test2; + if ((test1 == 3) && (test2 == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary044 + { + public static int Main_old() + { + char test1 = (char)2; + char test2 = (char)2; + ++test1; + --test2; + if ((test1 == 3) && (test2 == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary045 + { + public static int Main_old() + { + float test1 = 2.0f; + float test2 = 2.0f; + ++test1; + --test2; + if ((test1 == 3.0f) && (test2 == 1.0f)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary046 + { + public static int Main_old() + { + double test1 = 2.0; + double test2 = 2.0; + ++test1; + --test2; + if ((test1 == 3.0) && (test2 == 1.0)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary048 + { + public static int Main_old() + { + sbyte test1 = 2; + sbyte test2 = test1++; + sbyte test3 = ++test1; + if ((test2 == 2) && (test3 == 4)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary049 + { + public static int Main_old() + { + byte test1 = 2; + byte test2 = test1++; + byte test3 = ++test1; + if ((test2 == 2) && (test3 == 4)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary050 + { + public static int Main_old() + { + short test1 = 2; + short test2 = test1++; + short test3 = ++test1; + if ((test2 == 2) && (test3 == 4)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary051 + { + public static int Main_old() + { + ushort test1 = 2; + ushort test2 = test1++; + ushort test3 = ++test1; + if ((test2 == 2) && (test3 == 4)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary052 + { + public static int Main_old() + { + int test1 = 2; + int test2 = test1++; + int test3 = ++test1; + if ((test2 == 2) && (test3 == 4)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary053 + { + public static int Main_old() + { + uint test1 = 2; + uint test2 = test1++; + uint test3 = ++test1; + if ((test2 == 2) && (test3 == 4)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary054 + { + public static int Main_old() + { + long test1 = 2; + long test2 = test1++; + long test3 = ++test1; + if ((test2 == 2) && (test3 == 4)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary055 + { + public static int Main_old() + { + ulong test1 = 2; + ulong test2 = test1++; + ulong test3 = ++test1; + if ((test2 == 2) && (test3 == 4)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary056 + { + public static int Main_old() + { + char test1 = (char)2; + char test2 = test1++; + char test3 = ++test1; + if ((test2 == 2) && (test3 == 4)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary057 + { + public static int Main_old() + { + float test1 = 2.0f; + float test2 = test1++; + float test3 = ++test1; + if ((test2 == 2.0f) && (test3 == 4.0f)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_unary058 + { + public static int Main_old() + { + double test1 = 2.0; + double test2 = test1++; + double test3 = ++test1; + if ((test2 == 2.0) && (test3 == 4.0)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_unary068 + { + private int i; + public int I + { + get { return i; } + set { i = value; } + } + public static Other_TestClass_unary068 operator ++(Other_TestClass_unary068 a) + { + a.i++; + return a; + } + public static Other_TestClass_unary068 operator --(Other_TestClass_unary068 a) + { + a.i--; + return a; + } + public static int Main_old() + { + Other_TestClass_unary068 a = new Other_TestClass_unary068(); + + for (a.I = 0; a.I < 10; a++) ; + for (; a.I > -1; a--) ; + for (; a.I < 10; ++a) ; + for (; a.I > 0; --a) ; + return a.I; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat001 + { + public static int Main_old() + { + int test1 = 2; + int test2 = 2; + int test3 = 3; + if ((test1 == test2) && !(test1 == test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat002 + { + public static int Main_old() + { + uint test1 = 2; + uint test2 = 2; + uint test3 = 3; + if ((test1 == test2) && !(test1 == test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat003 + { + public static int Main_old() + { + long test1 = 2; + long test2 = 2; + long test3 = 3; + if ((test1 == test2) && !(test1 == test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat004 + { + public static int Main_old() + { + ulong test1 = 2; + ulong test2 = 2; + ulong test3 = 3; + if ((test1 == test2) && !(test1 == test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat005 + { + public static int Main_old() + { + int test1 = 2; + int test2 = 2; + int test3 = 3; + if (!(test1 != test2) && (test1 != test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat006 + { + public static int Main_old() + { + uint test1 = 2; + uint test2 = 2; + uint test3 = 3; + if (!(test1 != test2) && (test1 != test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat007 + { + public static int Main_old() + { + long test1 = 2; + long test2 = 2; + long test3 = 3; + if (!(test1 != test2) && (test1 != test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat008 + { + public static int Main_old() + { + ulong test1 = 2; + ulong test2 = 2; + ulong test3 = 3; + if (!(test1 != test2) && (test1 != test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat009 + { + public static int Main_old() + { + int test1 = 2; + int test2 = 3; + if ((test1 < test2) && !(test2 < test1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat010 + { + public static int Main_old() + { + uint test1 = 2; + uint test2 = 3; + if ((test1 < test2) && !(test2 < test1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat011 + { + public static int Main_old() + { + long test1 = 2; + long test2 = 3; + if ((test1 < test2) && !(test2 < test1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat012 + { + public static int Main_old() + { + ulong test1 = 2; + ulong test2 = 3; + if ((test1 < test2) && !(test2 < test1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat013 + { + public static int Main_old() + { + int test1 = 2; + int test2 = 3; + if (!(test1 > test2) && (test2 > test1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat014 + { + public static int Main_old() + { + uint test1 = 2; + uint test2 = 3; + if (!(test1 > test2) && (test2 > test1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat015 + { + public static int Main_old() + { + long test1 = 2; + long test2 = 3; + if (!(test1 > test2) && (test2 > test1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat016 + { + public static int Main_old() + { + ulong test1 = 2; + ulong test2 = 3; + if (!(test1 > test2) && (test2 > test1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat017 + { + public static int Main_old() + { + int test1 = 2; + int test2 = 3; + int test3 = 2; + if ((test1 <= test2) && !(test2 <= test1) && (test1 <= test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat018 + { + public static int Main_old() + { + uint test1 = 2; + uint test2 = 3; + uint test3 = 2; + if ((test1 <= test2) && !(test2 <= test1) && (test1 <= test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat019 + { + public static int Main_old() + { + long test1 = 2; + long test2 = 3; + long test3 = 2; + if ((test1 <= test2) && !(test2 <= test1) && (test1 <= test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat020 + { + public static int Main_old() + { + ulong test1 = 2; + ulong test2 = 3; + ulong test3 = 2; + if ((test1 <= test2) && !(test2 <= test1) && (test1 <= test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat021 + { + public static int Main_old() + { + int test1 = 2; + int test2 = 3; + int test3 = 2; + if (!(test1 >= test2) && (test2 >= test1) && (test1 >= test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat022 + { + public static int Main_old() + { + uint test1 = 2; + uint test2 = 3; + uint test3 = 2; + if (!(test1 >= test2) && (test2 >= test1) && (test1 >= test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat023 + { + public static int Main_old() + { + long test1 = 2; + long test2 = 3; + long test3 = 2; + if (!(test1 >= test2) && (test2 >= test1) && (test1 >= test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat024 + { + public static int Main_old() + { + ulong test1 = 2; + ulong test2 = 3; + ulong test3 = 2; + if (!(test1 >= test2) && (test2 >= test1) && (test1 >= test3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat025 + { + public static int Main_old() + { + float f1 = 1.0f; + float f2 = 1.0f; + float f3 = 2.0f; + if ((f1 == f2) && !(f1 == f3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat026 + { + public static int Main_old() + { + double d1 = 1.0; + double d2 = 1.0; + double d3 = 2.0; + if ((d1 == d2) && !(d1 == d3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat027 + { + public static int Main_old() + { + float f1 = 1.0f; + float f2 = 1.0f; + float f3 = 2.0f; + if (!(f1 != f2) && (f1 != f3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat028 + { + public static int Main_old() + { + double d1 = 1.0; + double d2 = 1.0; + double d3 = 2.0; + if (!(d1 != d2) && (d1 != d3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat029 + { + public static int Main_old() + { + float f1 = 1.0f; + float f2 = 1.0f; + float f3 = 2.0f; + if (!(f1 < f2) && (f1 < f3) && !(f3 < f1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat030 + { + public static int Main_old() + { + double d1 = 1.0; + double d2 = 1.0; + double d3 = 2.0; + if (!(d1 < d2) && (d1 < d3) && !(d3 < d1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat031 + { + public static int Main_old() + { + float f1 = 1.0f; + float f2 = 1.0f; + float f3 = 2.0f; + if (!(f1 > f2) && !(f1 > f3) && (f3 > f1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat032 + { + public static int Main_old() + { + double d1 = 1.0; + double d2 = 1.0; + double d3 = 2.0; + if (!(d1 > d2) && !(d1 > d3) && (d3 > d1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat033 + { + public static int Main_old() + { + float f1 = 1.0f; + float f2 = 1.0f; + float f3 = 2.0f; + if ((f1 <= f2) && (f1 <= f3) && !(f3 <= f1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat034 + { + public static int Main_old() + { + double d1 = 1.0; + double d2 = 1.0; + double d3 = 2.0; + if ((d1 <= d2) && (d1 <= d3) && !(d3 <= d1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat035 + { + public static int Main_old() + { + float f1 = 1.0f; + float f2 = 1.0f; + float f3 = 2.0f; + if ((f1 >= f2) && !(f1 >= f3) && (f3 >= f1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat036 + { + public static int Main_old() + { + double d1 = 1.0; + double d2 = 1.0; + double d3 = 2.0; + if ((d1 >= d2) && !(d1 >= d3) && (d3 >= d1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + /* + class Other_TestClass_relat037 + { + public static int Main_old() + { + float f1 = 2.0f; + float f2 = float.NaN; + double d1 = 2.0; + double d2 = double.NaN; + if (f1 == f2) + { + return 1; + } + if (f2 == f2) + { + return 1; + } + if (d1 == d2) + { + return 1; + } + if (d2 == d2) + { + return 1; + } + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat038 + { + public static int Main_old() + { + float f1 = 2.0f; + float f2 = float.NaN; + double d1 = 2.0; + double d2 = double.NaN; + if (!(f1 != f2)) + { + return 1; + } + if (!(f2 != f2)) + { + return 1; + } + if (!(d1 != d2)) + { + return 1; + } + if (!(d2 != d2)) + { + return 1; + } + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat039 + { + public static int Main_old() + { + float f1 = 2.0f; + float f2 = float.NaN; + double d1 = 2.0; + double d2 = double.NaN; + if (f1 < f2) + { + return 1; + } + if (f2 < f2) + { + return 1; + } + if (d1 < d2) + { + return 1; + } + if (d2 < d2) + { + return 1; + } + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat040 + { + public static int Main_old() + { + float f1 = 2.0f; + float f2 = float.NaN; + double d1 = 2.0; + double d2 = double.NaN; + if (f1 > f2) + { + return 1; + } + if (f2 > f2) + { + return 1; + } + if (d1 > d2) + { + return 1; + } + if (d2 > d2) + { + return 1; + } + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat041 + { + public static int Main_old() + { + float f1 = 2.0f; + float f2 = float.NaN; + double d1 = 2.0; + double d2 = double.NaN; + if (f1 <= f2) + { + return 1; + } + if (f2 <= f2) + { + return 1; + } + if (d1 <= d2) + { + return 1; + } + if (d2 <= d2) + { + return 1; + } + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat042 + { + public static int Main_old() + { + float f1 = 2.0f; + float f2 = float.NaN; + double d1 = 2.0; + double d2 = double.NaN; + if (f1 >= f2) + { + return 1; + } + if (f2 >= f2) + { + return 1; + } + if (d1 >= d2) + { + return 1; + } + if (d2 >= d2) + { + return 1; + } + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat043 + { + public static int Main_old() + { + float f1 = +0.0f; + float f2 = -0.0f; + double d1 = +0.0; + double d2 = -0.0; + if ((f1 == f2) && (f2 == f1) && (d1 == d2) && (d2 == d1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat044 + { + public static int Main_old() + { + float f1 = +0.0f; + float f2 = -0.0f; + double d1 = +0.0; + double d2 = -0.0; + if ((!(f1 != f2)) && (!(f2 != f1)) && (!(d1 != d2)) && (!(d2 != d1))) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat045 + { + public static int Main_old() + { + float f1 = float.MinValue; + float f2 = float.NegativeInfinity; + float f3 = float.NegativeInfinity; + if ((f1 > f2) && (f1 >= f2) && (f2 < f1) && (f2 <= f1) && (f2 == f3) && (f2 != f1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat046 + { + public static int Main_old() + { + double d1 = double.MinValue; + double d2 = double.NegativeInfinity; + double d3 = double.NegativeInfinity; + if ((d1 > d2) && (d1 >= d2) && (d2 < d1) && (d2 <= d1) && (d2 == d3) && (d2 != d1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat047 + { + public static int Main_old() + { + float f1 = float.MaxValue; + float f2 = float.PositiveInfinity; + float f3 = float.PositiveInfinity; + if ((f1 < f2) && (f1 <= f2) && (f2 > f1) && (f2 >= f1) && (f2 == f3) && (f2 != f1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat048 + { + public static int Main_old() + { + double d1 = double.MaxValue; + double d2 = double.PositiveInfinity; + double d3 = double.PositiveInfinity; + if ((d1 < d2) && (d1 <= d2) && (d2 > d1) && (d2 >= d1) && (d2 == d3) && (d2 != d1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + */ + class Other_TestClass_relat055 + { + public static int Main_old() + { + bool b1 = true; + bool b2 = true; + bool b3 = false; + bool b4 = false; + if ((b1 == b2) && (b3 == b4) && !(b1 == b3) && !(b4 == b2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat056 + { + public static int Main_old() + { + bool b1 = true; + bool b2 = true; + bool b3 = false; + bool b4 = false; + if (!(b1 != b2) && !(b3 != b4) && (b1 != b3) && (b4 != b2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + enum Others_TestClass_relat057_En { a = 1, b = 1, c = 3 } + class Other_TestClass_relat057 + { + public static int Main_old() + { + Others_TestClass_relat057_En e1 = Others_TestClass_relat057_En.a; + Others_TestClass_relat057_En e2 = Others_TestClass_relat057_En.b; + Others_TestClass_relat057_En e3 = Others_TestClass_relat057_En.c; + if ((e1 == e2) && !(e1 == e3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + enum Others_TestClass_relat058_En { a = 1, b = 1, c = 3 } + class Other_TestClass_relat058 + { + public static int Main_old() + { + Others_TestClass_relat058_En e1 = Others_TestClass_relat058_En.a; + Others_TestClass_relat058_En e2 = Others_TestClass_relat058_En.b; + Others_TestClass_relat058_En e3 = Others_TestClass_relat058_En.c; + if (!(e1 != e2) && (e1 != e3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + enum Others_TestClass_relat059_En { a = 1, b = 1, c = 3 } + class Other_TestClass_relat059 + { + public static int Main_old() + { + Others_TestClass_relat059_En e1 = Others_TestClass_relat059_En.a; + Others_TestClass_relat059_En e2 = Others_TestClass_relat059_En.b; + Others_TestClass_relat059_En e3 = Others_TestClass_relat059_En.c; + if (!(e1 > e2) && !(e1 > e3) && (e3 > e1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + enum Others_TestClass_relat060_En { a = 1, b = 1, c = 3 } + class Other_TestClass_relat060 + { + public static int Main_old() + { + Others_TestClass_relat060_En e1 = Others_TestClass_relat060_En.a; + Others_TestClass_relat060_En e2 = Others_TestClass_relat060_En.b; + Others_TestClass_relat060_En e3 = Others_TestClass_relat060_En.c; + if (!(e1 < e2) && (e1 < e3) && !(e3 < e1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + enum Others_TestClass_relat061_En { a = 1, b = 1, c = 3 } + class Other_TestClass_relat061 + { + public static int Main_old() + { + Others_TestClass_relat061_En e1 = Others_TestClass_relat061_En.a; + Others_TestClass_relat061_En e2 = Others_TestClass_relat061_En.b; + Others_TestClass_relat061_En e3 = Others_TestClass_relat061_En.c; + if ((e1 >= e2) && !(e1 >= e3) && (e3 >= e1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + enum Others_TestClass_relat062_En { a = 1, b = 1, c = 3 } + class Other_TestClass_relat062 + { + public static int Main_old() + { + Others_TestClass_relat062_En e1 = Others_TestClass_relat062_En.a; + Others_TestClass_relat062_En e2 = Others_TestClass_relat062_En.b; + Others_TestClass_relat062_En e3 = Others_TestClass_relat062_En.c; + if ((e1 <= e2) && (e1 <= e3) && !(e3 <= e1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Others_TestClass_relat063 { } + class Other_TestClass_relat063 + { + public static int Main_old() + { + Others_TestClass_relat063 t1 = new Others_TestClass_relat063(); + Others_TestClass_relat063 t2 = t1; + Others_TestClass_relat063 t3 = new Others_TestClass_relat063(); + if ((t1 == t2) && !(t1 == t3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Others_TestClass_relat064 { } + class Other_TestClass_relat064 + { + public static int Main_old() + { + Others_TestClass_relat064 t1 = new Others_TestClass_relat064(); + Others_TestClass_relat064 t2 = t1; + Others_TestClass_relat064 t3 = new Others_TestClass_relat064(); + if (!(t1 != t2) && (t1 != t3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Others_TestClass_relat065 + { + public int intI; + public static bool operator ==(Others_TestClass_relat065 t1, Others_TestClass_relat065 t2) + { + if (t1.intI == t2.intI) + { + return false; + } + else + { + return true; + } + } + public static bool operator !=(Others_TestClass_relat065 t1, Others_TestClass_relat065 t2) + { + if (t1.intI == t2.intI) + { + return true; + } + else + { + return false; + } + } + } + class Other_TestClass_relat065 + { + public static int Main_old() + { + Others_TestClass_relat065 t1 = new Others_TestClass_relat065(); + t1.intI = 2; + Others_TestClass_relat065 t2 = t1; + Others_TestClass_relat065 t3 = new Others_TestClass_relat065(); + t3.intI = 3; + if (!(t1 == t2) && (t1 == t3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Others_TestClass_relat066 + { + public int intI; + public static bool operator ==(Others_TestClass_relat066 t1, Others_TestClass_relat066 t2) + { + if (t1.intI == t2.intI) + { + return false; + } + else + { + return true; + } + } + public static bool operator !=(Others_TestClass_relat066 t1, Others_TestClass_relat066 t2) + { + if (t1.intI == t2.intI) + { + return true; + } + else + { + return false; + } + } + } + class Other_TestClass_relat066 + { + public static int Main_old() + { + Others_TestClass_relat066 t1 = new Others_TestClass_relat066(); + t1.intI = 2; + Others_TestClass_relat066 t2 = t1; + Others_TestClass_relat066 t3 = new Others_TestClass_relat066(); + t3.intI = 3; + if ((t1 != t2) && !(t1 != t3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_relat069_A { } + public class Other_TestClass_relat069_B : Other_TestClass_relat069_A { } + class Other_TestClass_relat069 + { + public static int Main_old() + { + Other_TestClass_relat069_A t1 = new Other_TestClass_relat069_A(); + Other_TestClass_relat069_B t2 = new Other_TestClass_relat069_B(); + Other_TestClass_relat069_A t3 = t2; + if (!(t1 == t2) && (t2 == t3) && (t1 != t2) && !(t2 != t3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + struct Others_TestClass_relat072_Str + { + public int intI; + public static bool operator ==(Others_TestClass_relat072_Str s1, Others_TestClass_relat072_Str s2) + { + if (s1.intI == s2.intI) + { + return true; + } + else + { + return false; + } + } + public static bool operator !=(Others_TestClass_relat072_Str s1, Others_TestClass_relat072_Str s2) + { + if (s1.intI != s2.intI) + { + return true; + } + else + { + return false; + } + } + } + class Other_TestClass_relat072 + { + public static int Main_old() + { + Others_TestClass_relat072_Str t1 = new Others_TestClass_relat072_Str(); + t1.intI = 2; + Others_TestClass_relat072_Str t2 = new Others_TestClass_relat072_Str(); + t2.intI = 3; + if (!(t1 == t2) && (t1 != t2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Others_TestClass_relat073 + { + public Others_TestClass_relat073(int i) + { + intI = i; + } + public int intI; + public static bool operator ==(Others_TestClass_relat073 t1, Others_TestClass_relat073 t2) + { + if (t1.intI == t2.intI) + { + return true; + } + else + { + return false; + } + } + public static bool operator !=(Others_TestClass_relat073 t1, Others_TestClass_relat073 t2) + { + if (t1.intI != t2.intI) + { + return true; + } + else + { + return false; + } + } + } + class Other_TestClass_relat073 + { + public static int Main_old() + { + Others_TestClass_relat073 s = new Others_TestClass_relat073(1); + Others_TestClass_relat073 t = new Others_TestClass_relat073(1); + if ((s == t) && !((object)s == t) && !(s == (object)t) && !((object)s == (object)t)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat074 + { + public static int Main_old() + { + int i = 123; + int j = 123; + if (!((object)i == (object)j)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat075 + { + public static int Main_old() + { + string s1 = "Other_TestClass_relat075 String"; + string s2 = "Other_TestClass_relat075 " + "String".ToString(); + string s3 = "Other_TestClass_relat075 String "; + if ((s1 == s2) && (s1 != s3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat076 + { + public static int Main_old() + { + string s1 = null; + string s2 = null; + string s3 = "Other_TestClass_relat076 String "; + if ((s1 == s2) && (s1 != s3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate int Others_TestClass_relat077_Del(); + class Other_TestClass_relat077 + { + public int TestMeth1() + { + return 1; + } + public int TestMeth2() + { + return 2; + } + public static int Main_old() + { + Other_TestClass_relat077 Other_TestClass_relat077 = new Other_TestClass_relat077(); + Others_TestClass_relat077_Del Del1 = new Others_TestClass_relat077_Del(Other_TestClass_relat077.TestMeth1); + Others_TestClass_relat077_Del Del2 = Del1; + Others_TestClass_relat077_Del Del3 = new Others_TestClass_relat077_Del(Other_TestClass_relat077.TestMeth2); + if ((Del1 == Del2) && !(Del1 == Del3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate int Others_TestClass_relat078_Del(); + class Other_TestClass_relat078 + { + public int TestMeth1() + { + return 1; + } + public int TestMeth2() + { + return 2; + } + public static int Main_old() + { + Other_TestClass_relat078 Other_TestClass_relat078 = new Other_TestClass_relat078(); + Others_TestClass_relat078_Del Del1 = new Others_TestClass_relat078_Del(Other_TestClass_relat078.TestMeth1); + Others_TestClass_relat078_Del Del2 = Del1; + Others_TestClass_relat078_Del Del3 = new Others_TestClass_relat078_Del(Other_TestClass_relat078.TestMeth2); + if (!(Del1 != Del2) && (Del1 != Del3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + /* + public class Other_TestClass_relat079 + { + const string s1 = null; + const string s2 = null; + public static int Main_old() + { + if ((s1 == s2) && !(s1 != s2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + */ + public class Other_TestClass_relat080 + { + const float f1 = 2.0f; + const float f2 = 2.0f; + const float f3 = 3.0f; + public static int Main_old() + { + if (!(f1 == f2)) return 1; + if ((f1 == f3)) return 1; + if ((f1 != f2)) return 1; + if (!(f1 != f3)) return 1; + if (f1 > f2) return 1; + if (!(f3 > f1)) return 1; + if (f1 > f3) return 1; + if (f1 < f2) return 1; + if (!(f1 < f3)) return 1; + if (f3 < f1) return 1; + if (!(f1 >= f2)) return 1; + if (!(f3 >= f1)) return 1; + if (f1 >= f3) return 1; + if (!(f1 <= f2)) return 1; + if (!(f1 <= f3)) return 1; + if (f3 <= f1) return 1; + + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_relat081 + { + const double d1 = 2.0; + const double d2 = 2.0; + const double d3 = 3.0; + public static int Main_old() + { + if (!(d1 == d2)) return 1; + if ((d1 == d3)) return 1; + if ((d1 != d2)) return 1; + if (!(d1 != d3)) return 1; + if (d1 > d2) return 1; + if (!(d3 > d1)) return 1; + if (d1 > d3) return 1; + if (d1 < d2) return 1; + if (!(d1 < d3)) return 1; + if (d3 < d1) return 1; + if (!(d1 >= d2)) return 1; + if (!(d3 >= d1)) return 1; + if (d1 >= d3) return 1; + if (!(d1 <= d2)) return 1; + if (!(d1 <= d3)) return 1; + if (d3 <= d1) return 1; + + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_relat083 + { + public static implicit operator string(Other_TestClass_relat083 MC) + { + return "Other_TestClass_relat0831"; + } + public static int Main_old() + { + Other_TestClass_relat083 MC = new Other_TestClass_relat083(); + if ((MC == "Other_TestClass_relat0831") && (MC != "Other_TestClass_relat0832")) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_relat084 + { + public static implicit operator string(Other_TestClass_relat084 MC) + { + return "Other_TestClass_relat0841"; + } + public static int Main_old() + { + Other_TestClass_relat084 MC = new Other_TestClass_relat084(); + string TestString1 = "Other_TestClass_relat0841"; + string TestString2 = "Other_TestClass_relat0842"; + if ((MC == TestString1) && (MC != TestString2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_relat086 + { + public static bool testMethod() + { + float f1 = 1.0f; + float f2 = -1.0f; + float f3 = -2.0f; + if ((f1 < f2) && (f1 < f3) && (f2 < f3) && (f2 > f1) && (f3 > f1) && (f3 > f2)) + { + return false; + } + else + { + return true; + } + } + } + class Other_TestClass_relat087 + { + public static bool testMethod() + { + float f1 = 1.0f; + float f2 = -1.0f; + float f3 = -2.0f; + if ((f1 <= f2) && (f1 <= f3) && (f2 <= f3) && (f2 >= f1) && (f3 >= f1) && (f3 >= f2)) + { + return false; + } + else + { + return true; + } + } + } + class Other_TestClass_relat088 + { + public static bool testMethod() + { + float f1 = float.MaxValue; + float f2 = float.MinValue; + float f3 = 0.0F; + if ((f1 < f2) && (f1 < f3) && (f3 < f2) && (f2 > f1) && (f3 > f1) && (f2 > f3)) + { + return false; + } + else + { + return true; + } + } + } + class Other_TestClass_relat089 + { + public static bool testMethod() + { + float f1 = float.MaxValue; + float f2 = 0.0f; + float f3 = float.MinValue; + if ((f1 <= f2) && (f1 <= f3) && (f2 <= f3) && (f2 >= f1) && (f3 >= f1) && (f3 >= f2)) + { + return false; + } + else + { + return true; + } + } + } + class Other_TestClass_operators_logic001 + { + public static int Main_old() + { + int test1 = 5; + int test2 = 4; + if ((test1 & test2) == 4) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic002 + { + public static int Main_old() + { + uint test1 = 5; + uint test2 = 4; + if ((test1 & test2) == 4) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic003 + { + public static int Main_old() + { + long test1 = 5; + long test2 = 4; + if ((test1 & test2) == 4) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic004 + { + public static int Main_old() + { + ulong test1 = 5; + ulong test2 = 4; + if ((test1 & test2) == 4) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic005 + { + public static int Main_old() + { + int test1 = 1; + int test2 = 4; + if ((test1 | test2) == 5) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic006 + { + public static int Main_old() + { + uint test1 = 1; + uint test2 = 4; + if ((test1 | test2) == 5) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic007 + { + public static int Main_old() + { + long test1 = 1; + long test2 = 4; + if ((test1 | test2) == 5) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic008 + { + public static int Main_old() + { + ulong test1 = 1; + ulong test2 = 4; + if ((test1 | test2) == 5) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic009 + { + public static int Main_old() + { + int test1 = 6; + int test2 = 5; + if ((test1 ^ test2) == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic010 + { + public static int Main_old() + { + uint test1 = 6; + uint test2 = 5; + if ((test1 ^ test2) == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic011 + { + public static int Main_old() + { + long test1 = 6; + long test2 = 5; + if ((test1 ^ test2) == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic012 + { + public static int Main_old() + { + ulong test1 = 6; + ulong test2 = 5; + if ((test1 ^ test2) == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic013 + { + public static int Main_old() + { + bool b1 = true; + bool b2 = true; + bool b3 = false; + bool b4 = false; + if ((b1 & b2) && !(b1 & b3) && !(b4 & b2) && !(b3 & b4)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic014 + { + public static int Main_old() + { + bool b1 = true; + bool b2 = true; + bool b3 = false; + bool b4 = false; + if ((b1 | b2) && (b1 | b3) && (b4 | b2) && !(b3 | b4)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic015 + { + public static int Main_old() + { + bool b1 = true; + bool b2 = true; + bool b3 = false; + bool b4 = false; + if (!(b1 ^ b2) && (b1 ^ b3) && (b4 ^ b2) && !(b3 ^ b4)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic016 + { + public static int Main_old() + { + bool b1 = true; + bool b2 = true; + bool b3 = false; + bool b4 = false; + if (!(b1 && b2)) return 1; + if ((b1 && b3)) return 1; + if ((b4 && b2)) return 1; + if ((b3 && b4)) return 1; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic017 + { + public static bool MethCalled = false; + public static bool Meth() + { + MethCalled = true; + return true; + } + public static int Main_old() + { + bool b1 = false; + if (b1 && Meth()) return 1; + if (MethCalled == true) return 1; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic018 + { + public static int Main_old() + { + bool b1 = true; + bool b2 = true; + bool b3 = false; + bool b4 = false; + if (!(b1 || b2)) return 1; + if (!(b1 || b3)) return 1; + if (!(b4 || b2)) return 1; + if ((b3 || b4)) return 1; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_operators_logic019 + { + public static bool MethCalled = false; + public static bool Meth() + { + MethCalled = true; + return true; + } + public static int Main_old() + { + bool b1 = true; + if (!(b1 || Meth())) return 1; + if (MethCalled == true) return 1; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + /* + class Other_TestClass_operators_logic022 + { + public static Other_TestClass_operators_logic022 operator &(Other_TestClass_operators_logic022 t1, Other_TestClass_logic022 t2) + { + return new Other_TestClass_operators_logic022(); + } + public static bool operator true(Other_TestClass_operators_logic022 t1) + { + return true; + } + + public static bool operator false(Other_TestClass_operators_logic022 t1) + { + return false; + } + public static int Main_old() + { + Other_TestClass_operators_logic022 test1 = new Other_TestClass_operators_logic022(); + Other_TestClass_operators_logic022 test2 = new Other_TestClass_operators_logic022(); + if (test1 && test2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + */ + + + /* + class Other_TestClass_operators_logic023 + { + public static Other_TestClass_operators_logic023 operator |(Other_TestClass_operators_logic023 t1, Other_TestClass_logic023 t2) + { + return new Other_TestClass_operators_logic023(); + } + public static bool operator true(Other_TestClass_operators_logic023 t1) + { + return true; + } + + public static bool operator false(Other_TestClass_operators_logic023 t1) + { + return false; + } + public static int Main_old() + { + Other_TestClass_operators_logic023 test1 = new Other_TestClass_operators_logic023(); + Other_TestClass_operators_logic023 test2 = new Other_TestClass_operators_logic023(); + if (test1 || test2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + */ + + /* + class Other_TestClass_operators_logic032 + { + public static int MethCall = 0; + public static Other_TestClass_operators_logic032 operator &(Other_TestClass_operators_logic032 t1, Other_TestClass_logic032 t2) + { + return new Other_TestClass_operators_logic032(); + } + public static bool operator true(Other_TestClass_operators_logic032 t1) + { + return true; + } + + public static bool operator false(Other_TestClass_operators_logic032 t1) + { + return true; + } + public static Other_TestClass_operators_logic032 RetClass() + { + MethCall = 1; ; + return new Other_TestClass_operators_logic032(); + } + public static int Main_old() + { + Other_TestClass_operators_logic032 test1 = new Other_TestClass_operators_logic032(); + if (test1 && RetClass()) { } + if (MethCall == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + */ + class Other_TestClass_operators_logic033 + { + public static int MethCall = 0; + public static Other_TestClass_operators_logic033 operator |(Other_TestClass_operators_logic033 t1, Other_TestClass_operators_logic033 t2) + { + return new Other_TestClass_operators_logic033(); + } + public static bool operator true(Other_TestClass_operators_logic033 t1) + { + return true; + } + + public static bool operator false(Other_TestClass_operators_logic033 t1) + { + return true; + } + public static Other_TestClass_operators_logic033 RetClass() + { + MethCall = 1; ; + return new Other_TestClass_operators_logic033(); + } + public static int Main_old() + { + Other_TestClass_operators_logic033 test1 = new Other_TestClass_operators_logic033(); + if (test1 || RetClass()) { } + if (MethCall == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_cond001 + { + public static int Main_old() + { + bool b = true; + int intI = b ? 3 : 4; + if (intI == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_cond002 + { + public static int Main_old() + { + bool b = false; + int intI = b ? 3 : 4; + if (intI == 4) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_cond003 + { + static bool Pass = true; + public static int retThree() + { + return 3; + } + public static int retFour() + { + Pass = false; + return 4; + } + public static int Main_old() + { + bool b = true; + int intI = b ? retThree() : retFour(); + if ((intI == 3) && (Pass == true)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_cond004 + { + static bool Pass = true; + public static int retThree() + { + Pass = false; + return 3; + } + public static int retFour() + { + return 4; + } + public static int Main_old() + { + bool b = false; + int intI = b ? retThree() : retFour(); + if ((intI == 4) && (Pass == true)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_cond005 + { + public static int Main_old() + { + bool b1 = false; + bool b2 = false; + int intI = b1 ? 1 : b2 ? 2 : 3; + if (intI == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Others_TestClass_cond006 + { + public static implicit operator bool(Others_TestClass_cond006 t) + { + return true; + } + } + class Other_TestClass_cond006 + { + public static int Main_old() + { + Others_TestClass_cond006 t = new Others_TestClass_cond006(); + int intI = t ? 2 : 3; + if (intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Others_TestClass_cond008 + { + public static bool operator true(Others_TestClass_cond008 t) + { + return true; + } + public static bool operator false(Others_TestClass_cond008 t) + { + return false; + } + } + class Other_TestClass_cond008 + { + public static int Main_old() + { + Others_TestClass_cond008 t = new Others_TestClass_cond008(); + int intI = t ? 2 : 3; + if (intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + interface Others_TestClass_cond010_Inter + { + int RetInt(); + } + class Others_TestClass_cond0101 : Others_TestClass_cond010_Inter + { + public static implicit operator Others_TestClass_cond0102(Others_TestClass_cond0101 t) + { + return new Others_TestClass_cond0102(); + } + public int RetInt() + { + return 1; + } + } + class Others_TestClass_cond0102 : Others_TestClass_cond010_Inter + { + public int RetInt() + { + return 2; + } + } + class Other_TestClass_cond010 + { + public static int Main_old() + { + bool b = true; + Others_TestClass_cond0101 t1 = new Others_TestClass_cond0101(); + Others_TestClass_cond0102 t2 = new Others_TestClass_cond0102(); + Others_TestClass_cond010_Inter test = b ? t1 : t2; + if (test.RetInt() == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + interface Others_TestClass_cond011_Inter + { + int RetInt(); + } + class Others_TestClass_cond0111 : Others_TestClass_cond011_Inter + { + public int RetInt() + { + return 1; + } + } + class Others_TestClass_cond0112 : Others_TestClass_cond011_Inter + { + public static implicit operator Others_TestClass_cond0111(Others_TestClass_cond0112 t) + { + return new Others_TestClass_cond0111(); + } + public int RetInt() + { + return 2; + } + } + class Other_TestClass_cond011 + { + public static int Main_old() + { + bool b = false; + Others_TestClass_cond0111 t1 = new Others_TestClass_cond0111(); + Others_TestClass_cond0112 t2 = new Others_TestClass_cond0112(); + Others_TestClass_cond011_Inter test = b ? t1 : t2; + if (test.RetInt() == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Others_TestClass_cond014 + { + public int ChkVal = 0; + public static implicit operator bool(Others_TestClass_cond014 MT) + { + MT.ChkVal = 1; + return true; + } + public static bool operator true(Others_TestClass_cond014 MT) + { + MT.ChkVal = 2; + return true; + } + public static bool operator false(Others_TestClass_cond014 MT) + { + MT.ChkVal = 3; + return false; + } + } + class Other_TestClass_cond014 + { + public static int Main_old() + { + Others_TestClass_cond014 TC = new Others_TestClass_cond014(); + int intI = TC ? 1 : 2; + if ((intI == 1) && (TC.ChkVal == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Others_TestClass_cond015 + { + public int ChkVal = 0; + public static explicit operator bool(Others_TestClass_cond015 MT) + { + MT.ChkVal = 1; + return true; + } + public static bool operator true(Others_TestClass_cond015 MT) + { + MT.ChkVal = 2; + return true; + } + public static bool operator false(Others_TestClass_cond015 MT) + { + MT.ChkVal = 3; + return false; + } + } + class Other_TestClass_cond015 + { + public static int Main_old() + { + Others_TestClass_cond015 TC = new Others_TestClass_cond015(); + int intI = TC ? 1 : 2; + if ((intI == 1) && (TC.ChkVal == 2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_is005 + { + public static int Main_old() + { + int myInt = 3; + bool b = myInt is int; + if (b == true) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Others_TestClass_is006_Str + { + } + public class Other_TestClass_is006 + { + public static int Main_old() + { + Others_TestClass_is006_Str ms = new Others_TestClass_is006_Str(); + bool b = ms is Others_TestClass_is006_Str; + if (b == true) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_is007_T { } + public class Other_TestClass_is007 + { + public static int Main_old() + { + Other_TestClass_is007_T tt = null; + object o = tt; + bool b = o is Other_TestClass_is007_T; + if (b == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_is008_T { } + public class Other_TestClass_is008 + { + public static int Main_old() + { + string tt = null; + object o = tt; + bool b = o is string; + if (b == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public interface Others_TestClass_is009_Inter { } + public class Other_TestClass_is009_T : Others_TestClass_is009_Inter { } + public class Other_TestClass_is009 + { + public static int Main_old() + { + Others_TestClass_is009_Inter tt = null; + object o = tt; + bool b = o is Others_TestClass_is009_Inter; + if (b == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_is010_T { } + public class AnotherType { } + public class Other_TestClass_is010 + { + public static int Main_old() + { + Other_TestClass_is010_T tt = new Other_TestClass_is010_T(); + object o = tt; + bool b = o is AnotherType; + if (b == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_is011_A { } + public class Other_TestClass_is011 + { + public static int Main_old() + { + string s = "foo"; + object o = s; + bool b = o is Other_TestClass_is011_A; + if (b == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public interface Others_TestClass_is012_Inter { } + public interface AnotherInter { } + public class Other_TestClass_is012_T : Others_TestClass_is012_Inter { } + public class Other_TestClass_is012 + { + public static int Main_old() + { + Other_TestClass_is012_T tt = new Other_TestClass_is012_T(); + object o = tt; + bool b = o is AnotherInter; + if (b == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is013_Base { } + public class Others_TestClass_is013_Der : Others_TestClass_is013_Base { } + public class Other_TestClass_is013 + { + public static int Main_old() + { + Others_TestClass_is013_Base mb = new Others_TestClass_is013_Base(); + object o = mb; + bool b = o is Others_TestClass_is013_Der; + if (b == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is0141 + { + public static explicit operator Others_TestClass_is0142(Others_TestClass_is0141 m) + { + return new Others_TestClass_is0142(); + } + } + public class Others_TestClass_is0142 { } + public class Other_TestClass_is014 + { + public static int Main_old() + { + Others_TestClass_is0141 mt = new Others_TestClass_is0141(); + object o = mt; + bool b = o is Others_TestClass_is0142; + if (b == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is015 { } + public class Other_TestClass_is015 + { + public static int Main_old() + { + object o = new object(); + bool b = o is Others_TestClass_is015; + if (b == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_is016_T { } + public class Other_TestClass_is016 + { + public static int Main_old() + { + Other_TestClass_is016_T tt = new Other_TestClass_is016_T(); + object o = tt; + bool b = o is Other_TestClass_is016_T; + if (b == true) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_is017 + { + public static int Main_old() + { + string s = "foo"; + object o = s; + bool b = o is string; + if (b == true) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public interface Others_TestClass_is018_Inter { } + public class Other_TestClass_is018_T : Others_TestClass_is018_Inter { } + public class Other_TestClass_is018 + { + public static int Main_old() + { + Others_TestClass_is018_Inter mi = new Other_TestClass_is018_T(); + object o = mi; + bool b = o is Others_TestClass_is018_Inter; + if (b == true) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public interface Others_TestClass_is019_Inter { } + public class Other_TestClass_is019_T : Others_TestClass_is019_Inter { } + public class Other_TestClass_is019 + { + public static int Main_old() + { + Other_TestClass_is019_T mi = new Other_TestClass_is019_T(); + object o = mi; + bool b = o is Others_TestClass_is019_Inter; + if (b == true) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is020_Base { } + public class Others_TestClass_is020_Der : Others_TestClass_is020_Base { } + public class Other_TestClass_is020 + { + public static int Main_old() + { + Others_TestClass_is020_Der md = new Others_TestClass_is020_Der(); + object o = md; + bool b = o is Others_TestClass_is020_Base; + if (b == true) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is0211 + { + public static implicit operator Others_TestClass_is0212(Others_TestClass_is0211 m) + { + return new Others_TestClass_is0212(); + } + } + public class Others_TestClass_is0212 { } + public class Other_TestClass_is021 + { + public static int Main_old() + { + Others_TestClass_is0211 mt = new Others_TestClass_is0211(); + object o = mt; + bool b = o is Others_TestClass_is0212; + if (b == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is022 { } + public class Other_TestClass_is022 + { + public static int Main_old() + { + Others_TestClass_is022 tc = new Others_TestClass_is022(); + object o = tc; + bool b = o is object; + if (b == true) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is023 { } + public class Other_TestClass_is023 + { + public static int Main_old() + { + Others_TestClass_is023 tc = new Others_TestClass_is023(); + bool b = tc is Others_TestClass_is023; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is024 { } + public class Other_TestClass_is024 + { + public static int Main_old() + { + string tc = "foo"; + bool b = tc is string; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public interface Others_TestClass_is025_Inter { } + public class Other_TestClass_is025 + { + public static int Main_old() + { + Others_TestClass_is025_Inter mi = null; + bool b = mi is Others_TestClass_is025_Inter; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public interface Others_TestClass_is026_Inter { } + public class Others_TestClass_is026 : Others_TestClass_is026_Inter { } + public class Other_TestClass_is026 + { + public static int Main_old() + { + Others_TestClass_is026 tc = new Others_TestClass_is026(); ; + bool b = tc is Others_TestClass_is026_Inter; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is027_Base { } + public class Others_TestClass_is027 : Others_TestClass_is027_Base { } + public class Other_TestClass_is027 + { + public static int Main_old() + { + Others_TestClass_is027 tc = new Others_TestClass_is027(); + bool b = tc is Others_TestClass_is027_Base; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is0281 + { + public static implicit operator Others_TestClass_is0282(Others_TestClass_is0281 m) + { + return new Others_TestClass_is0282(); + } + } + public class Others_TestClass_is0282 { } + public class Other_TestClass_is028 + { + public static int Main_old() + { + Others_TestClass_is0281 mt = new Others_TestClass_is0281(); + bool b = mt is Others_TestClass_is0282; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is029 { } + public class AnotherClass { } + public class Other_TestClass_is029 + { + public static int Main_old() + { + Others_TestClass_is029 tc = new Others_TestClass_is029(); + bool b = tc is AnotherClass; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is030 { } + public class Other_TestClass_is030 + { + public static int Main_old() + { + Others_TestClass_is030 tc = new Others_TestClass_is030(); + bool b = tc is string; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public interface Others_TestClass_is031_Inter { } + public interface Others_TestClass_is031_Inter2 { } + public class Other_TestClass_is031 + { + public static int Main_old() + { + Others_TestClass_is031_Inter mi = null; + bool b = mi is Others_TestClass_is031_Inter2; + if (b == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public interface Others_TestClass_is032_Inter { } + public class Others_TestClass_is032 { } + public class Other_TestClass_is032 + { + public static int Main_old() + { + Others_TestClass_is032 tc = new Others_TestClass_is032(); ; + bool b = tc is Others_TestClass_is032_Inter; + if (b == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is033_Base { } + public class Others_TestClass_is033 : Others_TestClass_is033_Base { } + public class Other_TestClass_is033 + { + public static int Main_old() + { + Others_TestClass_is033_Base tc = new Others_TestClass_is033_Base(); + bool b = tc is Others_TestClass_is033; + if (b == false) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_is0341 + { + public static explicit operator Others_TestClass_is0342(Others_TestClass_is0341 m) + { + return new Others_TestClass_is0342(); + } + } + public class Others_TestClass_is0342 { } + public class Other_TestClass_is034 + { + public static int Main_old() + { + Others_TestClass_is0341 mt = new Others_TestClass_is0341(); + bool b = mt is Others_TestClass_is0342; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_as001 + { + public static int Main_old() + { + string s = "MyString" as string; + if (s == "MyString") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_as002 + { + public static int Main_old() + { + object o = 5 as object; + if ((int)o == 5) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_as003 + { + public static int Main_old() + { + string s = "hello"; + object o = s; + if ((o as System.Array) == null) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_as004 + { + public static int Main_old() + { + string[] s = new string[] { "hello" }; + object o = s; + if ((o as System.Array) != null) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_as007 + { + public static int Main_old() + { + string[] s = new string[] { "hello" }; + object o = s; + if ((o as System.Array) as System.Array != null) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_as008 + { + public static int Main_old() + { + string[] s = new string[] { "hello" }; + object o = s; + if ((o as System.Array) as object != null) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_as011_A { } + class Other_TestClass_as011_B : Other_TestClass_as011_A { } + class Other_TestClass_as011_C : Other_TestClass_as011_B { } + class D : Other_TestClass_as011_C { } + class E : Other_TestClass_as011_C { } + class F : E { } + class G : F { } + class Other_TestClass_as011 + { + static int Main_old() + { + Other_TestClass_as011_A a = new F(); + F f = a as F; + if (f != null) + return 0; + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + interface IA { } + class Other_TestClass_as012_A : IA { } + class Other_TestClass_as012_B : Other_TestClass_as012_A { } + class Other_TestClass_as012_C : Other_TestClass_as012_A { } + class Other_TestClass_as012 + { + public static int Main_old() + { + Other_TestClass_as012_A ia = new Other_TestClass_as012_B(); + Other_TestClass_as012_C c = ia as Other_TestClass_as012_C; + if (c != null) + return 1; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_add001 + { + public static int Main_old() + { + string s = "foo" + "bar"; + if (s == "foobar") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_add002 + { + public static int Main_old() + { + string s = "foo" + 1; + if (s == "foo1") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_add003 + { + public static int Main_old() + { + string s = 1 + "foo"; + if (s == "1foo") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_add004_T { } + public class Other_TestClass_add004 + { + public static int Main_old() + { + + Other_TestClass_add004_T tc = new Other_TestClass_add004_T(); + string s = "foo" + tc; + if (s == "fooNFUnitTestArithmetic.UnitTestOtherArithmeticTests+Other_TestClass_add004_T") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_add005_T { } + public class Other_TestClass_add005 + { + public static int Main_old() + { + + Other_TestClass_add005_T tc = new Other_TestClass_add005_T(); + string s = tc + "foo"; + if (s == "NFUnitTestArithmetic.UnitTestOtherArithmeticTests+Other_TestClass_add005_Tfoo") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Others_TestClass_add006 { } + public class Other_TestClass_add006 + { + public static int Main_old() + { + + return 0; + string s = "foo" + "bar"; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic001 + { + public static int Main_old() + { + int i1 = 2; + if ((i1 & 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic002 + { + public static int Main_old() + { + int i1 = 2; + if ((0 & i1) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic003 + { + public static int Main_old() + { + sbyte sb1 = 2; + if ((sb1 & 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic004 + { + public static int Main_old() + { + byte b1 = 2; + if ((b1 & 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic005 + { + public static int Main_old() + { + short s1 = 2; + if ((s1 & 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic006 + { + public static int Main_old() + { + ushort us1 = 2; + if ((us1 & 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic007 + { + public static int Main_old() + { + uint ui1 = 2; + if ((ui1 & 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic008 + { + public static int Main_old() + { + long l1 = 2; + if ((l1 & 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic009 + { + public static int Main_old() + { + ulong ul1 = 2; + if ((ul1 & 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic010 + { + public static int Main_old() + { + char c1 = (char)2; + if ((c1 & 0) == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic011 + { + public static int Main_old() + { + int i1 = 2; + if ((0 | i1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic012 + { + public static int Main_old() + { + sbyte sb1 = 2; + if ((0 | sb1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic013 + { + public static int Main_old() + { + byte b1 = 2; + if ((0 | b1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic014 + { + public static int Main_old() + { + short s1 = 2; + if ((0 | s1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic015 + { + public static int Main_old() + { + ushort us1 = 2; + if ((0 | us1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic016 + { + public static int Main_old() + { + uint ui1 = 2; + if ((0 | ui1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic017 + { + public static int Main_old() + { + long l1 = 2; + if ((0 | l1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic018 + { + public static int Main_old() + { + ulong ul1 = 2; + if ((0 | ul1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic019 + { + public static int Main_old() + { + char c1 = (char)2; + if ((0 | c1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic020 + { + public static int Main_old() + { + int i1 = 2; + if ((0 ^ i1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic021 + { + public static int Main_old() + { + sbyte sb1 = 2; + if ((0 ^ sb1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic022 + { + public static int Main_old() + { + byte b1 = 2; + if ((0 ^ b1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic023 + { + public static int Main_old() + { + short s1 = 2; + if ((0 ^ s1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic024 + { + public static int Main_old() + { + ushort us1 = 2; + if ((0 ^ us1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic025 + { + public static int Main_old() + { + uint ui1 = 2; + if ((0 ^ ui1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic026 + { + public static int Main_old() + { + long l1 = 2; + if ((0 ^ l1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic027 + { + public static int Main_old() + { + ulong ul1 = 2; + if ((0 ^ ul1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic028 + { + public static int Main_old() + { + char c1 = (char)2; + if ((0 ^ c1) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic029 + { + public static int Main_old() + { + byte a = 0x01; + byte b = 0x02; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0x03) + return 1; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic030 + { + public static int Main_old() + { + { + sbyte a = 0x01; sbyte b = 0x02; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0x03) + return 1; + } + { + short a = 0x01; short b = 0x02; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0x03) + return 1; + } + { + int a = 0x01; int b = 0x02; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0x03) + return 1; + } + { + long a = 0x01; long b = 0x02; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0x03) + return 1; + } + { + byte a = 0x01; byte b = 0x02; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0x03) + return 1; + } + { + ushort a = 0x01; ushort b = 0x02; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0x03) + return 1; + } + { + uint a = 0x01; uint b = 0x02; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0x03) + return 1; + } + { + ulong a = 0x01; ulong b = 0x02; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0x03) + return 1; + } + { + char a = (char)0x01; char b = (char)0x02; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0x03) + return 1; + } + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Other_TestClass_logic032 + { + public static int Main_old() + { + checked + { + { + sbyte a = 0x0f; sbyte b = 0x01; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0x0f) + return 1; + } + { + short a = 0xff; short b = 0x01; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0xff) + return 1; + } + { + int a = 0xff; int b = 0x01; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0xff) + return 1; + } + { + long a = 0xff; long b = 0x01; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0xff) + return 1; + } + { + byte a = 0xff; byte b = 0x01; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0xff) + return 1; + } + { + ushort a = 0xff; ushort b = 0x01; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0xff) + return 1; + } + { + uint a = 0xff; uint b = 0x01; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0xff) + return 1; + } + { + ulong a = 0xff; ulong b = 0x01; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0xff) + return 1; + } + { + char a = (char)0xff; char b = (char)0x01; + if ((a ^ b & a | b) != (a | b & a ^ b)) + return 1; + if ((a ^ a ^ a | a ^ b) != 0xff) + return 1; + } + } + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + } +} diff --git a/Tests/NFUnitTestArithmetic/nano.runsettings b/Tests/NFUnitTestArithmetic/nano.runsettings new file mode 100644 index 00000000..fa881e3a --- /dev/null +++ b/Tests/NFUnitTestArithmetic/nano.runsettings @@ -0,0 +1,14 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + False + + \ No newline at end of file diff --git a/Tests/NFUnitTestArithmetic/packages.config b/Tests/NFUnitTestArithmetic/packages.config new file mode 100644 index 00000000..1adb9284 --- /dev/null +++ b/Tests/NFUnitTestArithmetic/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 3d639f79..0b9d08ee 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -37,6 +37,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestLexical", "Tests\ EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestInterface", "Tests\NFUnitTestInterface\NFUnitTestInterface.nfproj", "{89C61C69-A9F3-43BF-B501-5913BE8FE829}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestArithmetic", "Tests\NFUnitTestArithmetic\NFUnitTestArithmetic.nfproj", "{6B598666-54C8-4705-A7FB-B2BC75CA00BC}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -111,6 +113,12 @@ Global {89C61C69-A9F3-43BF-B501-5913BE8FE829}.Release|Any CPU.ActiveCfg = Release|Any CPU {89C61C69-A9F3-43BF-B501-5913BE8FE829}.Release|Any CPU.Build.0 = Release|Any CPU {89C61C69-A9F3-43BF-B501-5913BE8FE829}.Release|Any CPU.Deploy.0 = Release|Any CPU + {6B598666-54C8-4705-A7FB-B2BC75CA00BC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6B598666-54C8-4705-A7FB-B2BC75CA00BC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6B598666-54C8-4705-A7FB-B2BC75CA00BC}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {6B598666-54C8-4705-A7FB-B2BC75CA00BC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6B598666-54C8-4705-A7FB-B2BC75CA00BC}.Release|Any CPU.Build.0 = Release|Any CPU + {6B598666-54C8-4705-A7FB-B2BC75CA00BC}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -126,6 +134,7 @@ Global {9B5EFD66-CCDC-4D00-960C-993296C56F3B} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {E0538338-9941-410C-B8C8-0C928F26F8A7} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {89C61C69-A9F3-43BF-B501-5913BE8FE829} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {6B598666-54C8-4705-A7FB-B2BC75CA00BC} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From 2423adf75425bd68083e317f5ca31c0024621f39 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 17:25:37 +0300 Subject: [PATCH 33/55] More expressions tests --- .../NFUnitTestArithmetic.nfproj | 1 + .../UnitTestExpressionTests.cs | 3893 +++++++++++++++++ Tests/NFUnitTestArithmetic/nano.runsettings | 2 +- 3 files changed, 3895 insertions(+), 1 deletion(-) create mode 100644 Tests/NFUnitTestArithmetic/UnitTestExpressionTests.cs diff --git a/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj index 0bee964c..fe8bedac 100644 --- a/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj +++ b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj @@ -30,6 +30,7 @@ + diff --git a/Tests/NFUnitTestArithmetic/UnitTestExpressionTests.cs b/Tests/NFUnitTestArithmetic/UnitTestExpressionTests.cs new file mode 100644 index 00000000..18cbc07e --- /dev/null +++ b/Tests/NFUnitTestArithmetic/UnitTestExpressionTests.cs @@ -0,0 +1,3893 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestArithmetic +{ + [TestClass] + class UnitTestExpressionTests + { + [TestMethod] + public void Exp_ident001_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression consisting of a single identifier "); + Debug.WriteLine("is within a block, and the block contains a local variable or parameter with the "); + Debug.WriteLine("given name, then the primary-expression refers to that local variable."); + Assert.True(ident001.testMethod()); + } + [TestMethod] + public void Exp_ident002_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression consisting of a single identifier "); + Debug.WriteLine("is within a block, and the block contains a local variable or parameter with the "); + Debug.WriteLine("given name, then the primary-expression refers to that local variable."); + Assert.True(ident002.testMethod()); + } + [TestMethod] + public void Exp_ident003_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression consisting of a single identifier "); + Debug.WriteLine("is within a block, and the block contains a local variable or parameter with the "); + Debug.WriteLine("given name, then the primary-expression refers to that local variable."); + Assert.True(ident003.testMethod()); + } + [TestMethod] + public void Exp_ident004_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression consisting of a single identifier "); + Debug.WriteLine("is within a block, and the block contains a local variable or parameter with the "); + Debug.WriteLine("given name, then the primary-expression refers to that local variable."); + Assert.True(ident004.testMethod()); + } + [TestMethod] + public void Exp_ident007_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression consisting of a single identifier "); + Debug.WriteLine("is within the block of a constructor, instance method, or instance property accessor,"); + Debug.WriteLine("and the name identifies one or more accessible methods of the immediately enclosing"); + Debug.WriteLine("class, then the primary expression refers to that method."); + Assert.True(ident007.testMethod()); + } + [TestMethod] + public void Exp_ident008_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression consisting of a single identifier "); + Debug.WriteLine("is within the block of a constructor, instance method, or instance property accessor,"); + Debug.WriteLine("and the name identifies one or more accessible methods of the immediately enclosing"); + Debug.WriteLine("class, then the primary expression refers to that method."); + Assert.True(ident008.testMethod()); + } + [TestMethod] + public void Exp_ident009_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression consisting of a single identifier "); + Debug.WriteLine("is within the block of a constructor, instance method, or instance property accessor,"); + Debug.WriteLine("and the name identifies one or more accessible methods of the immediately enclosing"); + Debug.WriteLine("class, then the primary expression refers to that method."); + Assert.True(ident009.testMethod()); + } + [TestMethod] + public void Exp_ident010_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression consisting of a single identifier "); + Debug.WriteLine("is within the block of a constructor, instance method, or instance property accessor,"); + Debug.WriteLine("and the name identifies one or more accessible methods of the immediately enclosing"); + Debug.WriteLine("class, then the primary expression refers to that method."); + Assert.True(ident010.testMethod()); + } + [TestMethod] + public void Exp_ident011_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression consisting of a single identifier "); + Debug.WriteLine("is within the block of a constructor, instance method, or instance property accessor,"); + Debug.WriteLine("and the name identifies an accessible, non-static field or property of the immediately"); + Debug.WriteLine("enclosing class, then the primary expression refers to that field or property."); + Assert.True(ident011.testMethod()); + } + [TestMethod] + public void Exp_ident012_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression consisting of a single identifier "); + Debug.WriteLine("is within the block of a constructor, instance method, or instance property accessor,"); + Debug.WriteLine("and the name identifies an accessible, non-static field or property of the immediately"); + Debug.WriteLine("enclosing class, then the primary expression refers to that field or property."); + Assert.True(ident012.testMethod()); + } + [TestMethod] + public void Exp_ident013_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression consisting of a single identifier "); + Debug.WriteLine("is within the block of a constructor, instance method, or instance property accessor,"); + Debug.WriteLine("and the name identifies an accessible, non-static field or property of the immediately"); + Debug.WriteLine("enclosing class, then the primary expression refers to that field or property."); + Assert.True(ident013.testMethod()); + } + [TestMethod] + public void Exp_ident014_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident014.testMethod()); + } + [TestMethod] + public void Exp_ident015_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident015.testMethod()); + } + [TestMethod] + public void Exp_ident016_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident016.testMethod()); + } + [TestMethod] + public void Exp_ident017_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident017.testMethod()); + } + [TestMethod] + public void Exp_ident018_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident018.testMethod()); + } + [TestMethod] + public void Exp_ident019_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident019_Top.ident019.testMethod()); + } + [TestMethod] + public void Exp_ident020_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident020_Top.ident020.testMethod()); + } + [TestMethod] + public void Exp_ident021_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident021_Top.ident021.testMethod()); + } + [TestMethod] + public void Exp_ident022_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident022_Top.ident022.testMethod()); + } + [TestMethod] + public void Exp_ident023_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident023_Top.ident023.testMethod()); + } + [TestMethod] + public void Exp_ident024_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident024_Top.ident024.testMethod()); + } + [TestMethod] + public void Exp_ident025_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident025_Top.ident025_Next.ident025.testMethod()); + } + [TestMethod] + public void Exp_ident026_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident026_Top.ident026_Next.ident026.testMethod()); + } + [TestMethod] + public void Exp_ident027_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident027_Top.ident027_Next.ident027.testMethod()); + } + [TestMethod] + public void Exp_ident028_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if the primary expression appears within the body of a class, "); + Debug.WriteLine("struct, or enumeration declaration, and continuing with each enclosing class or struct"); + Debug.WriteLine("declaration, if the name identifies one or more accessible members of that class, "); + Debug.WriteLine("struct, or enumeration, then the primary expression is evaluated exactly as if it was "); + Debug.WriteLine("a member access of the form T.E where T is the type in which the member was found and "); + Debug.WriteLine("E is the primary expression."); + Assert.True(ident028_Top.ident028_Next.ident028.testMethod()); + } + [TestMethod] + public void Exp_ident029_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if a primary expression consisting of a single identifier refers "); + Debug.WriteLine("to a member in an enclosing namespace, then the primary expression is evaluated "); + Debug.WriteLine("to that member and classified as a namespace or a type."); + Assert.True(ident029.testMethod()); + } + [TestMethod] + public void Exp_ident030_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if a primary expression consisting of a single identifier refers "); + Debug.WriteLine("to a member in an enclosing namespace, then the primary expression is evaluated "); + Debug.WriteLine("to that member and classified as a namespace or a type."); + Assert.True(ident030.testMethod()); + } + + [TestMethod] + public void Exp_ident031_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if a primary expression consisting of a single identifier refers "); + Debug.WriteLine("to a member in an enclosing namespace, then the primary expression is evaluated "); + Debug.WriteLine("to that member and classified as a namespace or a type."); + Assert.True(NS_ident031_I.ident031.testMethod()) ; + } + [TestMethod] + public void Exp_ident032_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if a primary expression consisting of a single identifier refers "); + Debug.WriteLine("to an imported type, then the primary expression refers to that type."); + Assert.True(NS_ident032_I.ident032.testMethod()) ; + } + [TestMethod] + public void Exp_ident033_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if a primary expression consisting of a single identifier refers "); + Debug.WriteLine("to an imported type, then the primary expression refers to that type."); + Assert.True(NS_ident033_O.NS_ident033_I.ident033.testMethod()) ; + } + [TestMethod] + public void Exp_ident034_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if a primary expression consisting of a single identifier refers "); + Debug.WriteLine("to a single type in an imported namespace, then the primary expression refers to that "); + Debug.WriteLine("type."); + Assert.True(NS_ident034_I.ident034.testMethod()) ; + } + [TestMethod] + public void Exp_ident035_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if a primary expression consisting of a single identifier refers "); + Debug.WriteLine("to a single type in an imported namespace, then the primary expression refers to that "); + Debug.WriteLine("type."); + Assert.True(NS_ident035_O.NS_ident035_I.ident035.testMethod()) ; + } + [TestMethod] + public void Exp_ident038_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if a primary expression consisting of a single identifier refers "); + Debug.WriteLine("to an imported type, then the primary expression refers to that type."); + Assert.True(NS_ident038_I.ident038.testMethod()) ; + } + [TestMethod] + public void Exp_ident039_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if a primary expression consisting of a single identifier refers "); + Debug.WriteLine("to an imported type, then the primary expression refers to that type."); + Assert.True(NS_ident039_O.NS_ident039_I.ident039.testMethod()) ; + } + + [TestMethod] + public void Exp_ident040_Test() + { + Debug.WriteLine("Section 7.2.2 "); + Debug.WriteLine("This code tests that if a primary expression consisting of a single identifier refers "); + Debug.WriteLine("to an imported type, then the primary expression refers to that type."); + Assert.True(NS_ident040_I.ident040.testMethod()) ; + } + + [TestMethod] + public void Exp_mem001_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a namespace and I is the name of an accessible member of that namespace, then the "); + Debug.WriteLine("result is the member, either a namespace or a type."); + Assert.True(mem001.testMethod()) ; + } + /* + [TestMethod] + public void Exp_mem002_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a namespace and I is the name of an accessible member of that namespace, then the "); + Debug.WriteLine("result is the member, either a namespace or a type."); + Assert.True(mem002.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + * */ + [TestMethod] + public void Exp_mem003_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I is also a type, then the result of the member is that type."); + Assert.True(mem003.testMethod()) ; + } + [TestMethod] + public void Exp_mem004_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I is also a type, then the result of the member is that type."); + Assert.True(mem004.testMethod()) ; + } + [TestMethod] + public void Exp_mem005_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I identifies one or more methods, then the result is a method group."); + Assert.True(mem005.testMethod()); + } + [TestMethod] + public void Exp_mem006_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I identifies one or more methods, then the result is a method group."); + Assert.True(mem006.testMethod()); + } + [TestMethod] + public void Exp_mem007_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I identifies one or more methods, then the result is a method group."); + Assert.True(mem007.testMethod()); + } + [TestMethod] + public void Exp_mem008_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I identifies one or more methods, then the result is a method group."); + Assert.True(mem008.testMethod()); + } + [TestMethod] + public void Exp_mem011_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I is a static property, then the result is that static property."); + Assert.True(mem011.testMethod()); + } + [TestMethod] + public void Exp_mem012_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I is a static property, then the result is that static property."); + Assert.True(mem012.testMethod()); + } + [TestMethod] + public void Exp_mem013_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I is a static read only field, then the result is a value of the "); + Debug.WriteLine("static field I."); + Assert.True(mem013.testMethod()); + } + [TestMethod] + public void Exp_mem014_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I is a static read only field, then the result is a value of the "); + Debug.WriteLine("static field I."); + Assert.True(mem014.testMethod()); + } + [TestMethod] + public void Exp_mem015_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I is a static field, then the result is the static field I."); + Assert.True(mem015.testMethod()); + } + [TestMethod] + public void Exp_mem016_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I is a static field, then the result is the static field I."); + Assert.True(mem016.testMethod()); + } + [TestMethod] + public void Exp_mem017_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I is a constant, then the result is the value of that constant."); + Assert.True(mem017.testMethod()); + } + [TestMethod] + public void Exp_mem018_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I is a constant, then the result is the value of that constant."); + Assert.True(mem018.testMethod()); + } + [TestMethod] + public void Exp_mem019_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a type and I identifies an enumeration member, then the result is the value of"); + Debug.WriteLine("that enumeration member."); + Assert.True(mem019.testMethod()); + } + [TestMethod] + public void Exp_mem021_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the type of which is T, and I identifies one or "); + Debug.WriteLine("more method groups, then the result is the method group."); + Assert.True(mem021.testMethod()); + } + [TestMethod] + public void Exp_mem022_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the type of which is T, and I identifies one or "); + Debug.WriteLine("more method groups, then the result is the method group."); + Assert.True(mem022.testMethod()); + } + [TestMethod] + public void Exp_mem023_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the type of which is T, and I identifies one or "); + Debug.WriteLine("more method groups, then the result is the method group."); + Assert.True(mem023.testMethod()); + } + [TestMethod] + public void Exp_mem025_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the type of which is T, and I identifies one or "); + Debug.WriteLine("more method groups, then the result is the method group."); + Assert.True(mem025.testMethod()); + } + [TestMethod] + public void Exp_mem026_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the type of which is T, and I identifies one or "); + Debug.WriteLine("more method groups, then the result is the method group."); + Assert.True(mem026.testMethod()); + } + [TestMethod] + public void Exp_mem027_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the type of which is T, and I identifies an "); + Debug.WriteLine("instance property, then the result is that instance property."); + Assert.True(mem027.testMethod()); + } + [TestMethod] + public void Exp_mem028_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the type of which is T, and I identifies an "); + Debug.WriteLine("instance property, then the result is that instance property."); + Assert.True(mem028.testMethod()); + } + [TestMethod] + public void Exp_mem029_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the type of which is T, and I identifies an "); + Debug.WriteLine("instance property, then the result is that instance property."); + Assert.True(mem029.testMethod()); + } + [TestMethod] + public void Exp_mem031_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the type of which is T, and I identifies an "); + Debug.WriteLine("instance property, then the result is that instance property."); + Assert.True(mem031.testMethod()); + } + [TestMethod] + public void Exp_mem032_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the type of which is T, and I identifies an "); + Debug.WriteLine("instance property, then the result is that instance property."); + Assert.True(mem032.testMethod()); + } + [TestMethod] + public void Exp_mem034_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the class type of which is T, and I identifies"); + Debug.WriteLine("an instance field, then if the value of E is null, a System.Exception is "); + Debug.WriteLine("thrown."); + Assert.True(mem034.testMethod()); + } + [TestMethod] + public void Exp_mem035_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the class type of which is T, and I identifies"); + Debug.WriteLine("an instance field, then if the value of E is null, a System.Exception is "); + Debug.WriteLine("thrown."); + Assert.True(mem035.testMethod()); + } + [TestMethod] + public void Exp_mem036_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the class type of which is T, and I identifies"); + Debug.WriteLine("a read only instance field outside the class declaration, then the result is a value"); + Debug.WriteLine("of the field I."); + Assert.True(mem036.testMethod()); + } + [TestMethod] + public void Exp_mem038_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the class type of which is T, and I identifies"); + Debug.WriteLine("a read only instance field outside the class declaration, then the result is a value"); + Debug.WriteLine("of the field I."); + Assert.True(mem038.testMethod()); + } + [TestMethod] + public void Exp_mem040_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the class type of which is T, and I identifies"); + Debug.WriteLine("a read only instance field outside the class declaration, then the result is a value"); + Debug.WriteLine("of the field I."); + Assert.True(mem040.testMethod()); + } + [TestMethod] + public void Exp_mem042_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the class type of which is T, and I identifies"); + Debug.WriteLine("an instance field of class type T."); + Assert.True(mem042.testMethod()); + } + [TestMethod] + public void Exp_mem043_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the class type of which is T, and I identifies"); + Debug.WriteLine("an instance field of class type T."); + Assert.True(mem043.testMethod()); + } + [TestMethod] + public void Exp_mem044_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the class type of which is T, and I identifies"); + Debug.WriteLine("an instance field of class type T."); + Assert.True(mem044.testMethod()); + } + [TestMethod] + public void Exp_mem045_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the class type of which is T, and I identifies"); + Debug.WriteLine("an instance field of class type T."); + Assert.True(mem045.testMethod()); + } + [TestMethod] + public void Exp_mem046_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the class type of which is T, and I identifies"); + Debug.WriteLine("an instance field of class type T."); + Assert.True(mem046.testMethod()); + } + [TestMethod] + public void Exp_mem047_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the class type of which is T, and I identifies"); + Debug.WriteLine("an instance field of class type T."); + Assert.True(mem047.testMethod()); + } + [TestMethod] + public void Exp_mem048_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the struct type of which is T, and I identifies"); + Debug.WriteLine("a read only instance field outside the class declaration, then the result is a value"); + Debug.WriteLine("of the field I."); + Assert.True(mem048.testMethod()); + } + [TestMethod] + public void Exp_mem050_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the struct type of which is T, and I identifies"); + Debug.WriteLine("a read only instance field outside the class declaration, then the result is a value"); + Debug.WriteLine("of the field I."); + Assert.True(mem050.testMethod()); + } + [TestMethod] + public void Exp_mem052_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests that if the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the struct type of which is T, and I identifies"); + Debug.WriteLine("a read only instance field outside the class declaration, then the result is a value"); + Debug.WriteLine("of the field I."); + Assert.True(mem052.testMethod()); + } + [TestMethod] + public void Exp_mem054_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the struct type of which is T, and I identifies"); + Debug.WriteLine("an instance field of class type T."); + Assert.True(mem054.testMethod()); + } + [TestMethod] + public void Exp_mem055_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the struct type of which is T, and I identifies"); + Debug.WriteLine("an instance field of class type T."); + Assert.True(mem055.testMethod()); + } + [TestMethod] + public void Exp_mem056_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the struct type of which is T, and I identifies"); + Debug.WriteLine("an instance field of class type T."); + Assert.True(mem056.testMethod()); + } + [TestMethod] + public void Exp_mem058_Test() + { + Debug.WriteLine("Section 7.2.7 "); + Debug.WriteLine("This code tests the primary expression consisting of the form E.I, where E "); + Debug.WriteLine("is a variable, property, or value, the struct type of which is T, and I identifies"); + Debug.WriteLine("an instance field of class type T."); + Assert.True(mem058.testMethod()); + } + [TestMethod] + public void Exp_lit001_Test() + { + Debug.WriteLine("Section 7.2.1 "); + Debug.WriteLine("This code tests that a boolean-literal is of type bool."); + Assert.True(lit001.testMethod()) ; + } + [TestMethod] + public void Exp_lit004_Test() + { + Debug.WriteLine("Section 7.2.1 "); + Debug.WriteLine("This code tests that an int-literal is of type int."); + Assert.True(lit004.testMethod()) ; + } + [TestMethod] + public void Exp_lit005_Test() + { + Debug.WriteLine("Section 7.2.1 "); + Debug.WriteLine("This code tests that a long-literal is of type long."); + Assert.True(lit005.testMethod()) ; + } + [TestMethod] + public void Exp_lit006_Test() + { + Debug.WriteLine("Section 7.2.1 "); + Debug.WriteLine("This code tests that a float-literal is of type float."); + Assert.True(lit006.testMethod()) ; + } + [TestMethod] + public void Exp_lit007_Test() + { + Debug.WriteLine("Section 7.2.1 "); + Debug.WriteLine("This code tests that a double-literal is of type double."); + Assert.True(lit007.testMethod()) ; + } + [TestMethod] + public void Exp_lit008_Test() + { + Debug.WriteLine("Section 7.2.1 "); + Debug.WriteLine("This code tests that a double-literal is of type double."); + Assert.True(lit008.testMethod()); + } + [TestMethod] + public void Exp_lit009_Test() + { + Debug.WriteLine("Section 7.2.1 "); + Debug.WriteLine("This code tests that a character-literal is of type char."); + Assert.True(lit009.testMethod()); + } + [TestMethod] + public void Exp_lit010_Test() + { + Debug.WriteLine("Section 7.2.1 "); + Debug.WriteLine("This code tests that a string-literal is of type string."); + Assert.True(lit010.testMethod()); + } + [TestMethod] + public void Exp_lit011_Test() + { + Debug.WriteLine("Section 7.2.1 "); + Debug.WriteLine("string compare with with its base type."); + Assert.True(lit011.testMethod()); + } + [TestMethod] + public void Exp_base006_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Assert.True(base006.testMethod()) ; + } + [TestMethod] + public void Exp_base007_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Assert.True(base007.testMethod()) ; + } + [TestMethod] + public void Exp_base009_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Assert.True(base009.testMethod()) ; + } + [TestMethod] + public void Exp_base010_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Assert.True(base010.testMethod()) ; + } + [TestMethod] + public void Exp_base011_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Assert.True(base011.testMethod()); + } + [TestMethod] + public void Exp_base012_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Assert.True(base012.testMethod()); + } + [TestMethod] + public void Exp_base013_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Assert.True(base013.testMethod()); + } + [TestMethod] + public void Exp_base014_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Assert.True(base014.testMethod()); + } + [TestMethod] + public void Exp_base015_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Assert.True(base015.testMethod()); + } + [TestMethod] + public void Exp_base016_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Assert.True(base016.testMethod()); + } + [TestMethod] + public void Exp_base017_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Debug.WriteLine("Expected Fail"); + Assert.True(base017.testMethod()); + } + [TestMethod] + public void Exp_base018_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Debug.WriteLine("Expected Fail"); + Assert.True(base018.testMethod()); + } + [TestMethod] + public void Exp_base019_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Debug.WriteLine("Expected Fail"); + Assert.True(base019.testMethod()); + } + [TestMethod] + public void Exp_base020_Test() + { + Debug.WriteLine("Section 7.2.8 "); + Debug.WriteLine("A base class access is permitted only in the block of a constructor,"); + Debug.WriteLine("an instance method, or an instance property accessor."); + Debug.WriteLine("Expected Fail"); + Assert.True(base020.testMethod()); + } + + //Compiled Test Cases + public class ident001 + { + static int intI = 1; + public static int Main_old() + { + int intI = 0; + return intI; //should return zero + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class ident002 + { + static int intI = 1; + public static int f(int intI) + { + return intI; + } + public static int Main_old() + { + return f(0); //should return zero + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class ident003 + { + static int intI = 1; + public static int Main_old() + { + if (true) + { + int intI = 0; + return intI; + } + + return 1; //error if we reach this point + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class ident004 + { + static int intI = 1; + public static int Main_old() + { + { + int intI = 0; + return intI; + } + + return 1; //error if we reach this point + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class ident007 + { + static int intRet = 1; + public static void ChangeRet() + { + intRet = 0; + } + public ident007() + { + ChangeRet(); //primary expression in constructor + } + public static int Main_old() + { + ident007 MyClass = new ident007(); //this should change return value + return intRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class ident008 + { + static int intRet = 1; + public static void ChangeRet() + { + intRet = 0; + } + public void ChangeVal() + { + ChangeRet(); //primary expression in instance method + } + public static int Main_old() + { + ident008 MyClass = new ident008(); + MyClass.ChangeVal(); //this should change return value + return intRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class ident009 + { + static int intRet = 1; + public static void ChangeRet() + { + intRet = 0; + } + + public int MyInt + { + get + { + ChangeRet(); //primary expression in instance property accessor + return 0; + } + set { } + } + public static int Main_old() + { + ident009 MyClass = new ident009(); + int intI = MyClass.MyInt; //this should change the return value + return intRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class ident010 + { + static int intRet = 1; + public static void ChangeRet() + { + intRet = 0; + } + + public int MyInt + { + get + { + return 0; + } + set + { + ChangeRet(); //primary expression in instance property accessor + } + } + public static int Main_old() + { + ident010 MyClass = new ident010(); + MyClass.MyInt = 1; //this should change the return value to zero + return intRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class ident011 + { + int intRet = 0; + int TestInt = 3; + + public int TestProp + { + get + { + return 7; + } + set + { + TestInt = 2; + } + } + public ident011() + { + if (TestInt != 3) intRet = 1; //accessing non-static field + if (TestInt != this.TestInt) intRet = 1; //accessing non-static field + if (TestProp != 7) intRet = 1; //accessing instance property + if (TestProp != this.TestProp) intRet = 1;//accessing instance property + TestProp = 8; //accessing instance property + if (TestInt != 2) intRet = 1; //confirming property setter was called + } + public static int Main_old() + { + ident011 MyClass = new ident011(); + return MyClass.intRet; //return value will return 1 if something went wrong + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class ident012 + { + int intRet = 0; + int TestInt = 3; + + public int TestProp + { + get + { + return 7; + } + set + { + TestInt = 2; + } + } + public void TestCode() + { + if (TestInt != 3) intRet = 1; //accessing non-static field + if (TestInt != this.TestInt) intRet = 1; //accessing non-static field + if (TestProp != 7) intRet = 1; //accessing instance property + if (TestProp != this.TestProp) intRet = 1;//accessing instance property + TestProp = 8; //accessing instance property + if (TestInt != 2) intRet = 1; //confirming property setter was called + } + public static int Main_old() + { + ident012 MyClass = new ident012(); + MyClass.TestCode(); + return MyClass.intRet; //return value will return 1 if something went wrong + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class ident013 + { + int intRet = 0; + int TestInt = 3; + + public int TestProp + { + get + { + return 7; + } + set + { + TestInt = 2; + } + } + public int CallProp + { + get + { + if (TestInt != 3) intRet = 1; //accessing non-static field + if (TestInt != this.TestInt) intRet = 1; //accessing non-static field + if (TestProp != 7) intRet = 1; //accessing instance property + if (TestProp != this.TestProp) intRet = 1;//accessing instance property + TestProp = 8; //accessing instance property + if (TestInt != 2) intRet = 1; //confirming property setter was called + return 0; + } + set + { + if (TestInt != 3) intRet = 1; //accessing non-static field + if (TestInt != this.TestInt) intRet = 1; //accessing non-static field + if (TestProp != 7) intRet = 1; //accessing instance property + if (TestProp != this.TestProp) intRet = 1;//accessing instance property + TestProp = 8; //accessing instance property + if (TestInt != 2) intRet = 1; //confirming property setter was called + } + } + public static int Main_old() + { + ident013 MyClass = new ident013(); + int intI = MyClass.CallProp; //calling getter + MyClass.TestInt = 3; //resetting for the setter + MyClass.CallProp = 2; //calling setter + return MyClass.intRet; //return value will return 1 if something went wrong + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class ident014 + { + static int IntThree = 3; + static int TestInt = IntThree; //identifier appears within body of class + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class ident015 + { + static int ReturnThree() + { + return 3; + } + static int TestInt = ReturnThree(); //identifier appears within body of class + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct ident016 + { + static int IntThree = 3; + static int TestInt = IntThree; //identifier appears within body of class + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct ident017 + { + static int ReturnThree() + { + return 3; + } + static int TestInt = ReturnThree(); //identifier appears within body of class + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + enum AA { a = 3, b = a }; //identifier appears within body of enum + public class ident018 + { + public static int Main_old() + { + if ((int)AA.b == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class ident019_Top + { + public static int IntThree = 3; + + public class ident019 + { + public static int TestInt = IntThree; + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } + public class ident020_Top + { + public static int ReturnThree() + { + return 3; + } + + public class ident020 + { + + public static int TestInt = ReturnThree(); + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } + public class ident021_Top + { + public static int IntThree = 3; + + public struct ident021 + { + public static int TestInt = IntThree; + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } + public class ident022_Top + { + public static int ReturnThree() + { + return 3; + } + + public struct ident022 + { + + public static int TestInt = ReturnThree(); + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } + public struct ident023_Top + { + public static int IntThree = 3; + + public struct ident023 + { + public static int TestInt = IntThree; + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } + public struct ident024_Top + { + public static int ReturnThree() + { + return 3; + } + + public struct ident024 + { + + public static int TestInt = ReturnThree(); + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } + public class ident025_Top + { + public static int IntThree = 3; + + public class ident025_Next + { + public class ident025 + { + public static int TestInt = IntThree; + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } + } + public class ident026_Top + { + public static int ReturnThree() + { + return 3; + } + public class ident026_Next + { + public class ident026 + { + + public static int TestInt = ReturnThree(); + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } + } + public class ident027_Top + { + public static int IntThree = 2; + + public class ident027_Next + { + public static int IntThree = 3; //should refer to this one + public class ident027 + { + public static int TestInt = IntThree; + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } + } + public class ident028_Top + { + public static int ReturnThree() + { + return 2; + } + public class ident028_Next + { + public static int ReturnThree() + { + return 3; + } + public class ident028 + { + + public static int TestInt = ReturnThree(); + public static int Main_old() + { + if (TestInt == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } + } + public class Exp_TestClass_ident029_TC + { + public int TestInt = 1; + } + public class ident029 + { + + public static int Main_old() + { + Exp_TestClass_ident029_TC TC = new Exp_TestClass_ident029_TC(); //testing type identifier in same namespace + if (TC.TestInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_ident030_TC + { + public int TestInt = 1; + } + + public class ident030 + { + + public static int Main_old() + { + Exp_TestClass_ident030_TC TC = new Exp_TestClass_ident030_TC(); //testing type identifier in enclosing namespace + if (TC.TestInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + + + + public class mem001 + { + public static int Main_old() + { + Exp_TestClass_mem001_TS.Exp_TestClass_mem001_TC TC = new Exp_TestClass_mem001_TS.Exp_TestClass_mem001_TC(); //testing E.I + if (TC.TestInt == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + /* + public class mem002 { + public static int Main_old() + { + Exp_TestClass_mem002_TC TC = new Exp_TestClass_mem002_TC(); //testing E.I + if (TC.TestInt == 3) { + return 0; + } + else { + return 1; + } + } +public static bool testMethod() +{ + return (Main_old() == 0); +} + } + */ + public class Exp_TestClass_mem003_TC + { + public class InnerClass + { + public int TestInt = 2; + } + } + public class mem003 + { + public static int Main_old() + { + Exp_TestClass_mem003_TC.InnerClass TC = new Exp_TestClass_mem003_TC.InnerClass(); //testing E.I + if (TC.TestInt == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem004_TC + { + public class InnerClass + { + public int TestInt = 2; + } + } + public class mem004 + { + public static int Main_old() + { + Exp_TestClass_mem004_TC.InnerClass TC = new Exp_TestClass_mem004_TC.InnerClass(); //testing E.I + if (TC.TestInt == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem005_TC + { + public static int IntRet() + { + return 1; + } + } + public class mem005 + { + public static int Main_old() + { + if (Exp_TestClass_mem005_TC.IntRet() == 1) + { //testing E.I + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem006_TC + { + public static int IntRet() + { + return 1; + } + } + public class mem006 + { + public static int Main_old() + { + if (Exp_TestClass_mem006_TC.IntRet() == 1) + { //testing E.I + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem007_TC + { + public static int IntRet() + { + return 1; + } + public static int IntRet(int IntI) + { + return IntI; + } + } + public class mem007 + { + public static int Main_old() + { + if (Exp_TestClass_mem007_TC.IntRet(4) == 4) + { //testing E.I + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem008_TC + { + public static int IntRet() + { + return 1; + } + public static int IntRet(int IntI) + { + return IntI; + } + } + public class mem008 + { + public static int Main_old() + { + if (Exp_TestClass_mem008_TC.IntRet(4) == 4) + { //testing E.I + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem011_TC + { + + public static int TestInt = 0; + public static int MyInt + { + get + { + TestInt = 1; + return TestInt; + } + set + { + TestInt = TestInt + 1; + } + } + } + + public class mem011 + { + public static int Main_old() + { + int RetInt = 0; + if (Exp_TestClass_mem011_TC.MyInt != 1) RetInt = 1; //testing E.I + if (Exp_TestClass_mem011_TC.TestInt != 1) RetInt = 1; + Exp_TestClass_mem011_TC.MyInt = 3; //testing E.I + if (Exp_TestClass_mem011_TC.TestInt != 2) RetInt = 1; + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem012_TC + { + + public static int TestInt = 0; + public static int MyInt + { + get + { + TestInt = 1; + return TestInt; + } + set + { + TestInt = TestInt + 1; + } + } + } + + public class mem012 + { + public static int Main_old() + { + int RetInt = 0; + if (Exp_TestClass_mem012_TC.MyInt != 1) RetInt = 1; //testing E.I + if (Exp_TestClass_mem012_TC.TestInt != 1) RetInt = 1; + Exp_TestClass_mem012_TC.MyInt = 3; //testing E.I + if (Exp_TestClass_mem012_TC.TestInt != 2) RetInt = 1; + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem013_TC + { + + public static readonly int TestInt = 2; + } + + public class mem013 + { + public static int Main_old() + { + if (Exp_TestClass_mem013_TC.TestInt == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem014_TC + { + + public static readonly int TestInt = 2; + } + + public class mem014 + { + public static int Main_old() + { + if (Exp_TestClass_mem014_TC.TestInt == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem015_TC + { + + public static int TestInt = 2; + } + + public class mem015 + { + public static int Main_old() + { + int RetInt = 0; + if (Exp_TestClass_mem015_TC.TestInt != 2) + { //testing E.I + RetInt = 1; + } + Exp_TestClass_mem015_TC.TestInt = 3; //testing E.I + if (Exp_TestClass_mem015_TC.TestInt != 3) + { //testing E.I + RetInt = 1; + } + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem016_TC + { + + public static int TestInt = 2; + } + + public class mem016 + { + public static int Main_old() + { + int RetInt = 0; + if (Exp_TestClass_mem016_TC.TestInt != 2) + { //testing E.I + RetInt = 1; + } + Exp_TestClass_mem016_TC.TestInt = 3; //testing E.I + if (Exp_TestClass_mem016_TC.TestInt != 3) + { //testing E.I + RetInt = 1; + } + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem017_TC + { + + public const int TestInt = 2; + } + + public class mem017 + { + public static int Main_old() + { + if (Exp_TestClass_mem017_TC.TestInt == 2) + { //testing E.I + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem018_TC + { + + public const int TestInt = 2; + } + + public class mem018 + { + public static int Main_old() + { + if (Exp_TestClass_mem018_TC.TestInt == 2) + { //testing E.I + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + enum mem019_AA { a = 3, b = a }; + public class mem019 + { + public static int Main_old() + { + if ((int)mem019_AA.a == 3) + { //testing E.I + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem021_TC + { + public int IntRet() + { + return 2; + } + public int IntRet(int IntI) + { + return IntI; + } + } + public class mem021 + { + public static Exp_TestClass_mem021_TC GetTC + { + get + { + return new Exp_TestClass_mem021_TC(); + } + } + public static int Main_old() + { + int MyRet = 0; + if (GetTC.IntRet() != 2) + { //testing E.I + MyRet = 1; + } + if (GetTC.IntRet(3) != 3) + { //testing E.I + MyRet = 1; + } + return MyRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem022_TC + { + public int IntRet() + { + return 2; + } + public int IntRet(int IntI) + { + return IntI; + } + } + public class mem022 + { + public static int Main_old() + { + int MyRet = 0; + Exp_TestClass_mem022_TC TC = new Exp_TestClass_mem022_TC(); + if (TC.IntRet() != 2) + { //testing E.I + MyRet = 1; + } + if (TC.IntRet(3) != 3) + { //testing E.I + MyRet = 1; + } + return MyRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem023_TC + { + public int IntRet() + { + return 2; + } + public int IntRet(int IntI) + { + return IntI; + } + } + public class mem023 + { + public static int Main_old() + { + int MyRet = 0; + Exp_TestClass_mem023_TC TC = new Exp_TestClass_mem023_TC(); + if (new Exp_TestClass_mem023_TC().IntRet() != 2) + { //testing E.I + MyRet = 1; + } + if (new Exp_TestClass_mem023_TC().IntRet(3) != 3) + { //testing E.I + MyRet = 1; + } + return MyRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem025_TC + { + public int IntRet() + { + return 2; + } + public int IntRet(int IntI) + { + return IntI; + } + } + public class mem025 + { + public static int Main_old() + { + int MyRet = 0; + Exp_TestClass_mem025_TC TC = new Exp_TestClass_mem025_TC(); + if (TC.IntRet() != 2) + { //testing E.I + MyRet = 1; + } + if (TC.IntRet(3) != 3) + { //testing E.I + MyRet = 1; + } + return MyRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem026_TC + { + public int IntRet() + { + return 2; + } + public int IntRet(int IntI) + { + return IntI; + } + } + public class mem026 + { + public static int Main_old() + { + int MyRet = 0; + Exp_TestClass_mem026_TC TC = new Exp_TestClass_mem026_TC(); + if (new Exp_TestClass_mem026_TC().IntRet() != 2) + { //testing E.I + MyRet = 1; + } + if (new Exp_TestClass_mem026_TC().IntRet(3) != 3) + { //testing E.I + MyRet = 1; + } + return MyRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem027_TC + { + + public static int IntVal = 2; + public int IntRet + { + get + { + return IntVal; + } + set + { + IntVal = IntVal + 1; + } + } + } + public class mem027 + { + public static Exp_TestClass_mem027_TC GetTC + { + get + { + return new Exp_TestClass_mem027_TC(); + } + } + public static int Main_old() + { + int MyRet = 0; + if (GetTC.IntRet != 2) + { //testing E.I + MyRet = 1; + } + GetTC.IntRet = 3; //testing E.I + if (Exp_TestClass_mem027_TC.IntVal != 3) + { + MyRet = 1; + } + return MyRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem028_TC + { + + public static int IntVal = 2; + public int IntRet + { + get + { + return IntVal; + } + set + { + IntVal = IntVal + 1; + } + } + } + public class mem028 + { + public static int Main_old() + { + int MyRet = 0; + Exp_TestClass_mem028_TC TC = new Exp_TestClass_mem028_TC(); + if (TC.IntRet != 2) + { //testing E.I + MyRet = 1; + } + TC.IntRet = 3; //testing E.I + if (Exp_TestClass_mem028_TC.IntVal != 3) + { + MyRet = 1; + } + return MyRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem029_TC + { + + public static int IntVal = 2; + public int IntRet + { + get + { + return IntVal; + } + set + { + IntVal = IntVal + 1; + } + } + } + public class mem029 + { + public static int Main_old() + { + int MyRet = 0; + if (new Exp_TestClass_mem029_TC().IntRet != 2) + { //testing E.I + MyRet = 1; + } + new Exp_TestClass_mem029_TC().IntRet = 3; //testing E.I + if (Exp_TestClass_mem029_TC.IntVal != 3) + { + MyRet = 1; + } + return MyRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem031_TC + { + + public static int IntVal = 2; + public int IntRet + { + get + { + return IntVal; + } + set + { + IntVal = IntVal + 1; + } + } + } + public class mem031 + { + public static int Main_old() + { + int MyRet = 0; + Exp_TestClass_mem031_TC TC = new Exp_TestClass_mem031_TC(); + if (TC.IntRet != 2) + { //testing E.I + MyRet = 1; + } + TC.IntRet = 3; //testing E.I + if (Exp_TestClass_mem031_TC.IntVal != 3) + { + MyRet = 1; + } + return MyRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem032_TC + { + public int IntRet + { + get + { + return 2; + } + } + } + public class mem032 + { + public static int Main_old() + { + int MyRet = 0; + if (new Exp_TestClass_mem032_TC().IntRet != 2) + { //testing E.I + MyRet = 1; + } + return MyRet; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem034_TC + { + public int IntI = 0; + } + public class mem034 + { + public static int Main_old() + { + int RetInt = 1; + Exp_TestClass_mem034_TC TC = null; + try + { + int MyInt = TC.IntI; + } + catch (System.Exception) + { + RetInt = 0; + } + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem035_TC + { + public int IntI = 0; + } + public class mem035 + { + public static Exp_TestClass_mem035_TC getTC + { + get + { + return null; + } + } + public static int Main_old() + { + int RetInt = 1; + + try + { + int TempInt = getTC.IntI; + } + catch (System.Exception) + { + RetInt = 0; + } + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem036_TC + { + public readonly int IntI = 0; + } + public class mem036 + { + public static int Main_old() + { + int RetInt = 1; + Exp_TestClass_mem036_TC TC = new Exp_TestClass_mem036_TC(); + RetInt = TC.IntI; //testing E.I + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem038_TC + { + public readonly int IntI = 0; + } + public class mem038 + { + public static Exp_TestClass_mem038_TC getTC + { + get + { + return new Exp_TestClass_mem038_TC(); + } + } + public static int Main_old() + { + int RetInt = 1; + Exp_TestClass_mem038_TC TC = new Exp_TestClass_mem038_TC(); + RetInt = getTC.IntI; //testing E.I + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem040_TC + { + public readonly int IntI = 0; + } + public class mem040 + { + public static int Main_old() + { + int RetInt = 1; + RetInt = new Exp_TestClass_mem040_TC().IntI; //testing E.I + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem042_TC + { + public int IntI = 0; + } + public class mem042 + { + public static int Main_old() + { + int RetInt = 1; + Exp_TestClass_mem042_TC TC = new Exp_TestClass_mem042_TC(); + RetInt = TC.IntI; //testing E.I + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem043_TC + { + public int IntI = 0; + } + public class mem043 + { + public static int Main_old() + { + Exp_TestClass_mem043_TC TC = new Exp_TestClass_mem043_TC(); + TC.IntI = 3; //testing E.I + if (TC.IntI == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem044_TC + { + public int IntI = 0; + } + public class mem044 + { + public static Exp_TestClass_mem044_TC getTC + { + get + { + return new Exp_TestClass_mem044_TC(); + } + } + public static int Main_old() + { + int RetInt = 1; + RetInt = getTC.IntI; //testing E.I + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem045_TC + { + public int IntI = 0; + } + public class mem045 + { + static Exp_TestClass_mem045_TC TC = new Exp_TestClass_mem045_TC(); + public static Exp_TestClass_mem045_TC getTC + { + get + { + return TC; + } + } + public static int Main_old() + { + getTC.IntI = 3; //testing E.I + ZMyClass.MyPrint(TC.IntI); + if (TC.IntI == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class ZMyClass + { + public static void MyPrint() + { Debug.WriteLine("\n"); } + public static void MyPrint(string str) + { Debug.WriteLine(str); } + public static void MyPrint(object ob) + { + Debug.WriteLine(ob.ToString()); + } + public static void MyPrint(string fmt, params object[] arg) + { + string str = ""; + for (int i = 0; i < arg.Length; i++) + { + str = str + arg[i].ToString(); + } + Debug.WriteLine(str); + } + } + public class Exp_TestClass_mem046_TC + { + public int IntI = 0; + } + public class mem046 + { + public static int Main_old() + { + int RetInt = 1; + RetInt = new Exp_TestClass_mem046_TC().IntI; //testing E.I + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_mem047_TC + { + public int IntI = 0; + } + public class mem047 + { + public static int Main_old() + { + new Exp_TestClass_mem047_TC().IntI = 3; //if it compiles, no error + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem048_TC + { + public Exp_TestClass_mem048_TC(int intI) + { + IntI = 0; + } + public readonly int IntI; + } + public class mem048 + { + public static int Main_old() + { + int RetInt = 1; + Exp_TestClass_mem048_TC TC = new Exp_TestClass_mem048_TC(2); + RetInt = TC.IntI; //testing E.I + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem050_TC + { + public Exp_TestClass_mem050_TC(int intI) + { + IntI = 0; + } + public readonly int IntI; + } + public class mem050 + { + public static Exp_TestClass_mem050_TC getTC + { + get + { + return new Exp_TestClass_mem050_TC(3); + } + } + public static int Main_old() + { + int RetInt = 1; + Exp_TestClass_mem050_TC TC = new Exp_TestClass_mem050_TC(3); + RetInt = getTC.IntI; //testing E.I + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem052_TC + { + public Exp_TestClass_mem052_TC(int intI) + { + IntI = 0; + } + public readonly int IntI; + } + public class mem052 + { + public static int Main_old() + { + int RetInt = 1; + RetInt = new Exp_TestClass_mem052_TC(3).IntI; //testing E.I + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem054_TC + { + public Exp_TestClass_mem054_TC(int intI) + { + IntI = 0; + } + public int IntI; + } + public class mem054 + { + public static int Main_old() + { + int RetInt = 1; + Exp_TestClass_mem054_TC TC = new Exp_TestClass_mem054_TC(3); + RetInt = TC.IntI; //testing E.I + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem055_TC + { + public Exp_TestClass_mem055_TC(int intI) + { + IntI = 0; + } + public int IntI; + } + public class mem055 + { + public static int Main_old() + { + Exp_TestClass_mem055_TC TC = new Exp_TestClass_mem055_TC(3); + TC.IntI = 3; //testing E.I + if (TC.IntI == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem056_TC + { + public Exp_TestClass_mem056_TC(int intI) + { + IntI = 0; + } + public int IntI; + } + public class mem056 + { + public static Exp_TestClass_mem056_TC getTC + { + get + { + return new Exp_TestClass_mem056_TC(3); + } + } + public static int Main_old() + { + int RetInt = 1; + Exp_TestClass_mem056_TC TC = new Exp_TestClass_mem056_TC(3); + RetInt = getTC.IntI; //testing E.I + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct Exp_TestClass_mem058_TC + { + public Exp_TestClass_mem058_TC(int intI) + { + IntI = 0; + } + public int IntI; + } + public class mem058 + { + public static int Main_old() + { + int RetInt = 1; + RetInt = new Exp_TestClass_mem058_TC(3).IntI; //testing E.I + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class lit001 + { + public static int Main_old() + { + int RetInt = 1; + Type t1 = true.GetType(); + Type t2 = false.GetType(); + Type t3 = typeof(System.Boolean); + if ((t1 == t3) && (t2 == t3)) + { + RetInt = 0; + } + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class lit004 + { + public static int Main_old() + { + int RetInt = 1; + Type t1 = 3.GetType(); + Type t2 = (-44).GetType(); + Type t3 = 234.GetType(); + Type t4 = typeof(System.Int32); + if ((t1 == t4) && (t2 == t4) && (t3 == t4)) + { + RetInt = 0; + } + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class lit005 + { + public static int Main_old() + { + int RetInt = 1; + Type t1 = 3L.GetType(); + Type t2 = (-3000L).GetType(); + Type t3 = typeof(System.Int64); + if ((t1 == t3) && (t2 == t3)) + { + RetInt = 0; + } + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class lit006 + { + public static int Main_old() + { + int RetInt = 1; + Type t1 = 2.0f.GetType(); + Type t2 = (-2.33F).GetType(); + Type t3 = typeof(System.Single); + if ((t1 == t3) && (t2 == t3)) + { + RetInt = 0; + } + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class lit007 + { + public static int Main_old() + { + int RetInt = 1; + Type t1 = 2.0d.GetType(); + Type t2 = (-2.33D).GetType(); + Type t3 = 2.343.GetType(); + Type t4 = typeof(System.Double); + if ((t1 == t4) && (t2 == t4) && (t3 == t4)) + { + RetInt = 0; + } + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class lit008 + { + public static int Main_old() + { + int RetInt = 1; + Type t1 = 2.0.GetType(); + Type t2 = (-2.33).GetType(); + Type t3 = typeof(System.Double); + if ((t1 == t3) && (t2 == t3)) + { + RetInt = 0; + } + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class lit009 + { + public static int Main_old() + { + int RetInt = 1; + Type t1 = 'a'.GetType(); + Type t2 = typeof(System.Char); + if (t1 == t2) + { + RetInt = 0; + } + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class lit010 + { + public static int Main_old() + { + int RetInt = 1; + Type t1 = "foobar".GetType(); + Type t2 = typeof(System.String); + if (t1 == t2) + { + RetInt = 0; + } + return RetInt; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class lit011 + { + public static int Main_old() + { + string s = "This is an expression test"; + object o = s; + bool b = o == s; + bool bb = s == o; + + if (b && bb) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_base006_Base + { + public int intI() + { + return 1; + } + } + public class base006 : Exp_TestClass_base006_Base + { + public int TestInt() + { + return base.intI(); + } + public static int Main_old() + { + base006 TC = new base006(); + if (TC.TestInt() == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_base007_Base + { + public virtual int intI() + { + return 1; + } + } + public class base007 : Exp_TestClass_base007_Base + { + override public int intI() + { + return 2; + } + public int TestInt() + { + return base.intI(); + } + public static int Main_old() + { + base007 TC = new base007(); + if (TC.TestInt() == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_base009_Base + { + public int intI() + { + return 1; + } + } + public class base009 : Exp_TestClass_base009_Base + { + int TestInt = 0; + public base009() + { + TestInt = base.intI(); + } + public static int Main_old() + { + base009 TC = new base009(); + if (TC.TestInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_base010_Base + { + public virtual int intI() + { + return 1; + } + } + public class base010 : Exp_TestClass_base010_Base + { + int TestInt = 0; + override public int intI() + { + return 2; + } + public base010() + { + TestInt = base.intI(); + } + public static int Main_old() + { + base010 TC = new base010(); + if (TC.TestInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_base011_Base + { + public int intI() + { + return 1; + } + } + public class base011 : Exp_TestClass_base011_Base + { + int MyInt = 0; + public int TestInt + { + get + { + MyInt = base.intI(); + return 2; + } + } + public static int Main_old() + { + + int Temp; + + base011 TC = new base011(); + Temp = TC.TestInt; + if (TC.MyInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_base012_Base + { + public virtual int intI() + { + return 1; + } + } + public class base012 : Exp_TestClass_base012_Base + { + int MyInt = 0; + public int TestInt + { + get + { + MyInt = base.intI(); + return 2; + } + } + override public int intI() + { + return 2; + } + public static int Main_old() + { + + int Temp; + + base012 TC = new base012(); + Temp = TC.TestInt; + if (TC.MyInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_base013_Base + { + public int intI() + { + return 1; + } + } + public class base013 : Exp_TestClass_base013_Base + { + int MyInt = 0; + public int TestInt + { + set + { + MyInt = base.intI(); + } + } + public static int Main_old() + { + base013 TC = new base013(); + TC.TestInt = 3; + if (TC.MyInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_base014_Base + { + public virtual int intI() + { + return 1; + } + } + public class base014 : Exp_TestClass_base014_Base + { + int MyInt = 0; + public int TestInt + { + set + { + MyInt = base.intI(); + } + } + override public int intI() + { + return 2; + } + public static int Main_old() + { + base014 TC = new base014(); + TC.TestInt = 3; + if (TC.MyInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_base015_Base + { + public int intI = 3; + } + public class base015 : Exp_TestClass_base015_Base + { + new int intI = 5; + public int TestInt() + { + return base.intI; + } + public static int Main_old() + { + base015 TC = new base015(); + if (TC.TestInt() == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exp_TestClass_base016_Base + { + public int intI + { + get + { + return 3; + } + } + } + public class base016 : Exp_TestClass_base016_Base + { + new public int intI + { + get + { + return 4; + } + } + public int TestInt() + { + return base.intI; + } + public static int Main_old() + { + base016 TC = new base016(); + if (TC.TestInt() == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct base017 + { + override public string ToString() + { + return "foobar"; + } + public string GetStr() + { + return base.ToString(); + } + public static int Main_old() + { + base017 TC = new base017(); + if (TC.GetStr().Equals("NFUnitTestArithmetic.UnitTestExpressionTests+base017")) + { + return 0; + } + else + { + Debug.WriteLine(TC.GetStr()); + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct base018 + { + String TestString; + + public base018(int IntI) + { + TestString = null; + TestString = base.ToString(); + } + override public String ToString() + { + return "foobar"; + } + public static int Main_old() + { + base018 TC = new base018(3); + if (TC.TestString.Equals("NFUnitTestArithmetic.UnitTestExpressionTests+base018")) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct base019 + { + String TestString; + override public String ToString() + { + return "foobar"; + } + public int GetInt + { + get + { + TestString = base.ToString(); + return 1; + } + } + public static int Main_old() + { + int Temp; + + base019 TC = new base019(); + Temp = TC.GetInt; + if (TC.TestString.Equals("NFUnitTestArithmetic.UnitTestExpressionTests+base019")) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public struct base020 + { + String TestString; + override public String ToString() + { + return "foobar"; + } + public int SetInt + { + set + { + TestString = base.ToString(); + } + } + public static int Main_old() + { + base020 TC = new base020(); + TC.SetInt = 3; + if (TC.TestString.Equals("NFUnitTestArithmetic.UnitTestExpressionTests+base020")) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + + + + } +} + +namespace Exp_TestClass_mem001_TS +{ + public class Exp_TestClass_mem001_TC + { + public int TestInt = 2; + } +} + +namespace Exp_TestClass_mem002_TS +{ + namespace InnerSpace + { + public class Exp_TestClass_mem002_TC + { + public int TestInt = 3; + } + } +} + + + +public class Exp_TestClass_ident030_TC +{ + public int TestInt = 1; +} +namespace NS_ident030_I +{ + public class ident030 + { + + public static int Main_old() + { + Exp_TestClass_ident030_TC TC = new Exp_TestClass_ident030_TC(); //testing type identifier in enclosing namespace + if (TC.TestInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +namespace Exp_TestClass_ident031_T +{ + public class Exp_TestClass_ident031_TC + { + public int TestInt = 1; + } +} +namespace NS_ident031_I +{ + using Exp_TestClass_ident031_T; //testing namespace identifier in enclosing namespace + public class ident031 + { + public static int Main_old() + { + Exp_TestClass_ident031_TC TC = new Exp_TestClass_ident031_TC(); + if (TC.TestInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +namespace Exp_TestClass_ident032_T +{ + public class Exp_TestClass_ident032_TC + { + public int TestInt = 1; + } +} +namespace NS_ident032_I +{ + using Exp_TestClass_ident032_TC = Exp_TestClass_ident032_T.Exp_TestClass_ident032_TC; + public class ident032 + { + public static int Main_old() + { + Exp_TestClass_ident032_TC TC = new Exp_TestClass_ident032_TC(); //identifier refers to imported type + if (TC.TestInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +namespace Exp_TestClass_ident033_T +{ + public class Exp_TestClass_ident033_TC + { + public int TestInt = 1; + } +} +namespace NS_ident033_O +{ + + using Exp_TestClass_ident033_TC = Exp_TestClass_ident033_T.Exp_TestClass_ident033_TC; + namespace NS_ident033_I + { + public class ident033 + { + public static int Main_old() + { + Exp_TestClass_ident033_TC TC = new Exp_TestClass_ident033_TC(); //identifier refers to imported type + if (TC.TestInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } +} +namespace Exp_TestClass_ident034_T +{ + public class Exp_TestClass_ident034_TC + { + public int TestInt = 1; + } +} +namespace NS_ident034_I +{ + using Exp_TestClass_ident034_T; + public class ident034 + { + public static int Main_old() + { + Exp_TestClass_ident034_TC TC = new Exp_TestClass_ident034_TC(); //identifier refers to type in imported namespace + if (TC.TestInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +namespace Exp_TestClass_ident035_T +{ + public class Exp_TestClass_ident035_TC + { + public int TestInt = 1; + } +} +namespace NS_ident035_O +{ + + using Exp_TestClass_ident035_T; + namespace NS_ident035_I + { + public class ident035 + { + public static int Main_old() + { + Exp_TestClass_ident035_TC TC = new Exp_TestClass_ident035_TC(); //identifier refers to type in imported namespace + if (TC.TestInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } +} +namespace Exp_TestClass_ident038_T +{ + public class Exp_TestClass_ident038_TC + { + public int TestInt = 1; + } +} +namespace Exp_TestClass_ident038_T2 +{ + public class Exp_TestClass_ident038_TC + { + public int TestInt = 2; + } +} +namespace NS_ident038_I +{ + using Exp_TestClass_ident038_T; + using Exp_TestClass_ident038_TC = Exp_TestClass_ident038_T2.Exp_TestClass_ident038_TC; + public class ident038 + { + public static int Main_old() + { + Exp_TestClass_ident038_TC TC = new Exp_TestClass_ident038_TC(); //identifier refers to type in imported type + if (TC.TestInt == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +namespace Exp_TestClass_ident039_T +{ + public class Exp_TestClass_ident039_TC + { + public int TestInt = 1; + } +} +namespace Exp_TestClass_ident039_T2 +{ + public class Exp_TestClass_ident039_TC + { + public int TestInt = 2; + } +} +namespace NS_ident039_O +{ + using Exp_TestClass_ident039_TC = Exp_TestClass_ident039_T2.Exp_TestClass_ident039_TC; + using Exp_TestClass_ident039_T; + namespace NS_ident039_I + { + public class ident039 + { + public static int Main_old() + { + Exp_TestClass_ident039_TC TC = new Exp_TestClass_ident039_TC(); //identifier refers to type in imported type + if (TC.TestInt == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } +} +namespace Exp_TestClass_ident040_T +{ + public class Exp_TestClass_ident040_TC + { + public int TestInt = 1; + } +} +namespace NS_ident040_I +{ + using Exp_TestClass_ident040_T; + using Exp_TestClass_ident040_TC = Exp_TestClass_ident040_T.Exp_TestClass_ident040_TC; + public class ident040 + { + public static int Main_old() + { + Exp_TestClass_ident040_TC TC = new Exp_TestClass_ident040_TC(); //identifier refers to type in imported type + if (TC.TestInt == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} diff --git a/Tests/NFUnitTestArithmetic/nano.runsettings b/Tests/NFUnitTestArithmetic/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestArithmetic/nano.runsettings +++ b/Tests/NFUnitTestArithmetic/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file From 946456eed1dc81ae345d4bd86d35f21be1f0ab21 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 17:45:42 +0300 Subject: [PATCH 34/55] Adding exceptions tests --- .../NFUnitTestException.nfproj | 60 + .../Properties/AssemblyInfo.cs | 33 + .../UnitTestExceptionTests.cs | 2297 +++++++++++++++++ Tests/NFUnitTestException/nano.runsettings | 14 + Tests/NFUnitTestException/packages.config | 5 + nanoFramework.CoreLibrary.sln | 9 + 6 files changed, 2418 insertions(+) create mode 100644 Tests/NFUnitTestException/NFUnitTestException.nfproj create mode 100644 Tests/NFUnitTestException/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestException/UnitTestExceptionTests.cs create mode 100644 Tests/NFUnitTestException/nano.runsettings create mode 100644 Tests/NFUnitTestException/packages.config diff --git a/Tests/NFUnitTestException/NFUnitTestException.nfproj b/Tests/NFUnitTestException/NFUnitTestException.nfproj new file mode 100644 index 00000000..a9ecb290 --- /dev/null +++ b/Tests/NFUnitTestException/NFUnitTestException.nfproj @@ -0,0 +1,60 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + bdb01244-6ead-476e-9084-27d0d249e9a6 + Library + Properties + 512 + NFUnitTestException + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestException/Properties/AssemblyInfo.cs b/Tests/NFUnitTestException/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestException/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestException/UnitTestExceptionTests.cs b/Tests/NFUnitTestException/UnitTestExceptionTests.cs new file mode 100644 index 00000000..b35dbccd --- /dev/null +++ b/Tests/NFUnitTestException/UnitTestExceptionTests.cs @@ -0,0 +1,2297 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestException +{ + [TestClass] + public class UnitTestExceptionTests + { + [TestMethod] + public void Exc_excep01_Test() + { + Debug.WriteLine("This test will confirm that the the thrown exception is caught by the matching catch"); + Assert.True(Exc_TestClass_excep01.testMethod()); + } + [TestMethod] + public void Exc_excep02_Test() + { + Debug.WriteLine("This test will confirm that the the thrown exception is caught by the matching catch, not the base class catch blocks"); + Assert.True(Exc_TestClass_excep02.testMethod()); + } + [TestMethod] + public void Exc_excep04_Test() + { + Debug.WriteLine("This test will confirm that the the thrown exception is caught and the error code can be set"); + Assert.True(Exc_TestClass_excep04.testMethod()); + } + [TestMethod] + public void Exc_excep05_Test() + { + Debug.WriteLine("This test will confirm that the the thrown exception is caught by the matching catch, not the base class catch"); + Assert.True(Exc_TestClass_excep05.testMethod()); + } + [TestMethod] + public void Exc_excep06_Test() + { + Debug.WriteLine("This test will confirm that the the thrown exception is caught by the base class catch"); + Assert.True(Exc_TestClass_excep06.testMethod()); + } + [TestMethod] + public void Exc_excep07_Test() + { + Debug.WriteLine("This test will confirm that the the thrown exception is caught by the base class catch()"); + Assert.True(Exc_TestClass_excep07.testMethod()); + } + [TestMethod] + public void Exc_excep09_Test() + { + Debug.WriteLine("This test will confirm that the catch() functions."); + Assert.True(Exc_TestClass_excep09.testMethod()); + } + [TestMethod] + public void Exc_excep10_Test() + { + Debug.WriteLine("This test will confirm that the thrown exception is handled in the catch()"); + Debug.WriteLine("when no matching catch is available."); + Assert.True(Exc_TestClass_excep10.testMethod()); + } + [TestMethod] + public void Exc_excep11_Test() + { + Debug.WriteLine("This test will confirm that the the thrown exception is caught by the matching catch, not the catch()"); + Assert.True(Exc_TestClass_excep11.testMethod()); + } + [TestMethod] + public void Exc_excep27_Test() + { + Debug.WriteLine("Throwing an exception transfers control to a handler."); + Assert.True(Exc_TestClass_excep27.testMethod()); + } + [TestMethod] + public void Exc_excep28_Test() + { + Debug.WriteLine("When an exception is thrown, control is transferred to a handler"); + Assert.True(Exc_TestClass_excep28.testMethod()); + } + [TestMethod] + public void Exc_excep30_Test() + { + Debug.WriteLine("A throw-expression with no operand rethrows the exception being handled."); + Assert.True(Exc_TestClass_excep30.testMethod()); + } + [TestMethod] + public void Exc_excep31_Test() + { + Debug.WriteLine("A throw-expression with no operand does not copy the exception being handled."); + Assert.True(Exc_TestClass_excep31.testMethod()); + } + [TestMethod] + public void Exc_excep33_Test() + { + Debug.WriteLine("The exception thrown by a rethrow is the one most recently caught and not finished."); + Assert.True(Exc_TestClass_excep33.testMethod()); + } + [TestMethod] + public void Exc_excep34_Test() + { + Debug.WriteLine("When initialization is complete for the formal parameter of a catch clause, an exception is considered caught."); + Assert.True(Exc_TestClass_excep34.testMethod()); + } + [TestMethod] + public void Exc_excep35_Test() + { + Debug.WriteLine("A handler is not allowed to catch an expression thrown outside"); + Debug.WriteLine("its function-try-block and any function called from its function-"); + Debug.WriteLine("try-block."); + Assert.True(Exc_TestClass_excep35.testMethod()); + } + [TestMethod] + public void Exc_excep40_Test() + { + Debug.WriteLine("If no match is found among the handlers for a try-block, the"); + Debug.WriteLine("search for a matching handler continues in a dynamically"); + Debug.WriteLine("surrounding try-block."); + Assert.True(Exc_TestClass_excep40.testMethod()); + } + [TestMethod] + public void Exc_excep41_Test() + { + Debug.WriteLine("If no match is found among the handlers for a try-block, the"); + Debug.WriteLine("search for a matching handler continues in a dynamically"); + Debug.WriteLine("surrounding try-block."); + Assert.True(Exc_TestClass_excep41.testMethod()); + } + + // TODO: check this + /* + * This test is excluded because it causes a Metadata processor crash, it failed in the baseline + * + [TestMethod] + public void Exc_excep42_Test() + { + Debug.WriteLine("Handle throws up to 255 levels deep."); + Assert.True(Exc_TestClass_excep42.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + */ + [TestMethod] + public void Exc_excep42b_Test() + { + Debug.WriteLine("Handle throws up to 33 levels deep."); + Assert.True(Exc_TestClass_excep42b.testMethod()); + } + + // TODO: Check this + /* + * This test is excluded because it causes a Metadata processor crash, it failed in the baseline + * + [TestMethod] + public void Exc_excep43_Test() + { + Debug.WriteLine("Handle throws up to 255 levels deep, but don't catch. VM should not die."); + Assert.True(Exc_TestClass_excep43.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + */ + [TestMethod] + public void Exc_excep56_Test() + { + Debug.WriteLine("Should get unreachable code warning, but nothing more."); + Assert.True(Exc_TestClass_excep56.testMethod()); + } + [TestMethod] + public void Exc_excep57_Test() + { + Debug.WriteLine("Should get unreachable code warning, but nothing more."); + Assert.True(Exc_TestClass_excep57.testMethod()); + } + [TestMethod] + public void Exc_excep58_Test() + { + Debug.WriteLine("Any finally clauses associated with try statements will be executed before catch clause execution"); + Assert.True(Exc_TestClass_excep58.testMethod()); + } + [TestMethod] + public void Exc_excep59_Test() + { + Debug.WriteLine("Any finally clauses associated with try statements will be executed before catch clause execution"); + Assert.True(Exc_TestClass_excep59.testMethod()); + } + [TestMethod] + public void Exc_excep60_Test() + { + Debug.WriteLine("Inner exceptions can be chained"); + Assert.True(Exc_TestClass_excep60.testMethod()); + } + [TestMethod] + public void Exc_excep61_Test() + { + Debug.WriteLine("Inner exceptions can be chained to arbitrary length"); + Assert.True(Exc_TestClass_excep61.testMethod()); + } + [TestMethod] + public void Exc_excep62_Test() + { + Debug.WriteLine("Any finally clauses associated with try statements will be executed before catch clause execution"); + Assert.True(Exc_TestClass_excep62.testMethod()); + } + //[TestMethod] + //public void Exc_excep63_Test() + //{ + // Debug.WriteLine("If a catch search reaches a static ctor then a Exception is thrown,"); + // Debug.WriteLine("at the point of static ctor invocation. The inner exception is the original exception."); + + // Debug.WriteLine("an exception thrown in a static constructor brings up a dialog box in Visual Studio."); + // Debug.WriteLine("Disable this test so that it doesn't hose VS until it is fixed."); + + // // TODO: check this + // Assert.True(Exc_TestClass_excep63.testMethod()); + // { + // Debug.WriteLine("This is bug number: 21724 Resolved By Design."); + // Debug.WriteLine("This is bug number: 21724 If a catch search reaches a static ctor then a Exception is thrown at the point of static ctor invocation. The inner exception is the original exception. "); + // Debug.WriteLine("When this bug is fixed change this back to pass and chang eht known failure to fail"); + // } + //} + //[TestMethod] + //public void Exc_excep64_Test() + //{ + // Debug.WriteLine("If a catch search reaches a static field initializer then a Exception is thrown,"); + // Debug.WriteLine("at the point of static ctor invocation. The inner exception is the original exception."); + + // Debug.WriteLine("an exception thrown in a static constructor brings up a dialog box in Visual Studio."); + // Debug.WriteLine("Disable this test so that it doesn't hose VS until it is fixed."); + + // // TODO: check this + // Assert.True(Exc_TestClass_excep64.testMethod()); + // { + // Debug.WriteLine("This is bug number: 21724 Resolved By Design."); + // Debug.WriteLine("This is bug number: 21724 If a catch search reaches a static ctor then a Exception is thrown at the point of static ctor invocation. The inner exception is the original exception. "); + + // } + //} + // TODO: check this + /* + * This test is excluded because it throws an exception, it succeeded in the baseline + * It however currently fails in the desktop environment, in both cases the sleep is not sufficient to provoke GC + * and when GC is called, the dtor does not exit or call its base class' dtor when it throws an exception. + * + [TestMethod] + public void Exc_excep65_Test() + { + Debug.WriteLine("If a catch search reaches a static ctor then a Exception is thrown,"); + Debug.WriteLine("at the point of static ctor invocation. The inner exception is the original exception."); + + Assert.True(Exc_TestClass_excep65.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + */ + + //Compiled Test Cases + public class Exc_TestClass_excep01 + { + private static int retval = 1; + public static int Main_old() + { + try + { + Debug.WriteLine("In try block, ready to throw."); + throw new Exception("An exception has occurred"); + } + catch (Exception s) + { + Debug.WriteLine("In catch block."); + Debug.WriteLine(s.Message); + retval = 0; + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep02_E1 : Exception + { + public Exc_TestClass_excep02_E1(String str) + : base(str) + { } + } + public class Exc_TestClass_excep02 + { + private static int retval = 1; + public static int Main_old() + { + try + { + Debug.WriteLine("In try block, ready to throw."); + throw new Exc_TestClass_excep02_E1("An exception has occurred"); + } + catch (Exc_TestClass_excep02_E1 s) + { + Debug.WriteLine("In Exc_TestClass_excep02_E1 catch block."); + Debug.WriteLine(s.Message); + retval = 0; + } + catch (Exception) + { + Debug.WriteLine("FAIL - In Exception catch block."); + retval = 2; + } + //catch (Exception e) + //{ + // Debug.WriteLine ("FAIL - In Exception catch block."); + // retval = 3; + //} + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep04 + { + private static int retval = 3; + public static int Main_old() + { + try + { + try + { + Debug.WriteLine("In try block, ready to throw."); + throw new Exception("An exception has occurred"); + } + catch (Exception s) + { + Debug.WriteLine("In catch block."); + Debug.WriteLine(s.Message); + retval -= 1; + } + } + finally + { + Debug.WriteLine("Entering finally block"); + retval -= 2; + } + Debug.WriteLine("Ready to return."); + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval=={0} " + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep05_E1 : Exception + { + public Exc_TestClass_excep05_E1(String str) + : base(str) + { } + } + public class Exc_TestClass_excep05 + { + private static int retval = 2; + public static int Main_old() + { + try + { + try + { + Debug.WriteLine("In try block, ready to throw."); + throw new Exc_TestClass_excep05_E1("An exception has occurred"); + } + catch (Exc_TestClass_excep05_E1 s) + { + Debug.WriteLine("In catch block."); + Debug.WriteLine(s.Message); + retval--; + } + catch (Exception) + { + Debug.WriteLine("FAIL -- Should not enter catch (Exception) block"); + retval++; + } + } + finally + { + Debug.WriteLine("In finally block"); + --retval; + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep06_E1 : Exception + { + public Exc_TestClass_excep06_E1(String str) + : base(str) + { } + } + public class Exc_TestClass_excep06 + { + private static int retval = 1; + public static int Main_old() + { + try + { + Debug.WriteLine("In try block, ready to throw."); + throw new Exc_TestClass_excep06_E1("An exception has occurred"); + } + catch (Exception s) + { + Debug.WriteLine("In catch block."); + Debug.WriteLine(s.Message); + retval = 0; + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep07_E1 : Exception + { + public Exc_TestClass_excep07_E1(String str) + : base(str) + { } + } + public class Exc_TestClass_excep07 + { + private static int retval = 1; + public static int Main_old() + { + try + { + try + { + Debug.WriteLine("In try block, ready to throw."); + } + catch (Exception s) + { + Debug.WriteLine("In catch block."); + Debug.WriteLine(s.Message); + retval++; + } + } + finally + { + Debug.WriteLine("In finally block"); + retval--; + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep09 + { + private static int retval = 1; + public static int Main_old() + { + try + { + Debug.WriteLine("In try block, ready to throw."); + throw new Exception("An exception has occurred"); + } + catch + { + Debug.WriteLine("In catch block."); + retval = 0; + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep10_E1 : Exception + { + public Exc_TestClass_excep10_E1(String str) + : base(str) + { } + } + public class Exc_TestClass_excep10 + { + private static int retval = 1; + public static int Main_old() + { + try + { + Debug.WriteLine("In try block, ready to throw."); + throw new Exception("An exception has occurred"); + } + catch (Exc_TestClass_excep10_E1) + { + Debug.WriteLine("FAIL -- Should not enter catch (Exception a) block."); + retval = 1; + } + catch + { + Debug.WriteLine("In catch block."); + retval -= 1; + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep11 + { + private static int retval = 1; + public static int Main_old() + { + try + { + Debug.WriteLine("In try block, ready to throw."); + throw new Exception("An exception has occurred"); + } + catch (Exception r) + { + Debug.WriteLine("In catch (Exception r) block."); + Debug.WriteLine(r.Message); + retval -= 1; + } + catch + { + Debug.WriteLine("FAIL -- Should not enter catch () block."); + retval += 1; + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep27_B + { + public void toss() { throw new Exception("Exception thrown in function toss()."); } + } + public class Exc_TestClass_excep27 + { + private static int retval = 5; + public static int Main_old() + { + try + { + Exc_TestClass_excep27_B b = new Exc_TestClass_excep27_B(); + b.toss(); + } + catch (Exception e) { retval -= 5; Debug.WriteLine(e.Message); } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep28_B + { + public int toss(int Where) + { + int r = 99; + try + { + if (Where == 0) throw new Exception("Where == 0"); + } + catch (Exception) + { + r = 0; + } + try + { + if (Where == 1) throw new Exception("Where == 1"); + } + catch (Exception) + { + r = 1; + } + try + { + if (Where == 2) throw new Exception("Where == 2"); + } + catch (Exception) + { + r = 2; + } + return r; + } + } + public class Exc_TestClass_excep28 + { + private static int retval = 7; + private static int tossval = -1; + public static int Main_old() + { + Exc_TestClass_excep28_B b = new Exc_TestClass_excep28_B(); + tossval = b.toss(0); + if (tossval != 0) + { + Debug.WriteLine("toss(0) returned "); + Debug.WriteLine(tossval.ToString()); + Debug.WriteLine(" instead of 0."); + } + else + { + retval -= 4; + } + tossval = b.toss(1); + if (tossval != 1) + { + Debug.WriteLine("toss(1) returned "); + Debug.WriteLine(tossval.ToString()); + Debug.WriteLine(" instead of 1."); + } + else + { + retval -= 2; + } + tossval = b.toss(2); + if (tossval != 2) + { + Debug.WriteLine("toss(2) returned "); + Debug.WriteLine(tossval.ToString()); + Debug.WriteLine(" instead of 2."); + } + else + { + retval -= 1; + } + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep30_C1 + { + static int s = 1; + public int rethrow() + { + try + { + throw new Exception(); + } + catch (Exception) + { + s = 20; + throw; // rethrow float + } + catch + { + s = 99; + } + return s; + } + public int f00() + { + try + { + rethrow(); + } + catch (Exception) + { + s += 10; + } + return s; + } + } + public class Exc_TestClass_excep30 + { + private static int retval = 3; + public static int Main_old() + { + Exc_TestClass_excep30_C1 t = new Exc_TestClass_excep30_C1(); + if (t.f00() == 30) // If the throw was handled properly... + retval = 0; + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep31_E1 : Exception + { + public int i = 99; + public Exc_TestClass_excep31_E1(int ii) { i = ii; } + } + public class Exc_TestClass_excep31_C1 + { + static int s = 1; + public int rethrow() + { + try + { + throw new Exc_TestClass_excep31_E1(1); + } + catch (Exc_TestClass_excep31_E1 e) + { + e.i = 20; + throw; // rethrow float + } + catch + { + s = 99; + } + return s; + } + public int f00() + { + try + { + rethrow(); + } + catch (Exc_TestClass_excep31_E1 e) + { + if (e.i == 20) + s = 0; + } + return s; + } + } + public class Exc_TestClass_excep31 + { + private static int retval = 3; + public static int Main_old() + { + Exc_TestClass_excep31_C1 t = new Exc_TestClass_excep31_C1(); + if (t.f00() == 0) // If the throw was handled properly... + retval = 0; + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep33_E2 : Exception + { + } + public class Exc_TestClass_excep33_E3 : Exception + { + } + public class Exc_TestClass_excep33_E4 : Exception + { + } + public class Exc_TestClass_excep33 + { + private static int retval = 2; + public static int Main_old() + { + Exc_TestClass_excep33_E2 s0 = new Exc_TestClass_excep33_E2(); + Exc_TestClass_excep33_E3 s1 = new Exc_TestClass_excep33_E3(); + Exc_TestClass_excep33_E4 s2 = new Exc_TestClass_excep33_E4(); + try + { + try + { + throw s0; + } + catch (Exc_TestClass_excep33_E2) + { + try + { + throw s1; + } + catch (Exc_TestClass_excep33_E3) + { + try + { + throw s2; + } + catch (Exc_TestClass_excep33_E4) + { + throw; + } + } + } + } + catch (Exc_TestClass_excep33_E2) + { + Debug.WriteLine("Unexpected Exc_TestClass_excep33_E2 catch."); + } + catch (Exc_TestClass_excep33_E3) + { + Debug.WriteLine("Unexpected Exc_TestClass_excep33_E3 catch."); + } + catch (Exc_TestClass_excep33_E4) + { + Debug.WriteLine("Caught in Exc_TestClass_excep33_E4, as expected."); + retval = 0; + } + catch + { + Debug.WriteLine("Unexpected ... catch."); + } + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + + } + public class Exc_TestClass_excep34_E2 : Exception + { + public char c = ' '; + } + public class Exc_TestClass_excep34_E3 : Exception + { + public float f = 1.3f; + } + public class Exc_TestClass_excep34 + { + private static int retval = 2; + public static int Main_old() + { + Exc_TestClass_excep34_E2 s0 = new Exc_TestClass_excep34_E2(); + Exc_TestClass_excep34_E3 s1 = new Exc_TestClass_excep34_E3(); + try + { + try + { + throw s0; + } + catch (Exc_TestClass_excep34_E2) + { + try + { + throw s1; + } + catch (Exc_TestClass_excep34_E3) + { + throw; + } + } + } + catch (Exc_TestClass_excep34_E2) + { + Debug.WriteLine("Unexpected Exc_TestClass_excep34_E2 catch.\n"); + } + catch (Exc_TestClass_excep34_E3) + { + Debug.WriteLine("Caught in Exc_TestClass_excep34_E3 as expected.\n"); + retval = 0; + } + catch + { + Debug.WriteLine("Unexpected ... catch.\n"); + } + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + public class Exc_TestClass_excep35_V + { + public static int counter = 0; + } + public class Exc_TestClass_excep35_E1 : Exception + { + public Exc_TestClass_excep35_E1() + { + try { } + catch (Exc_TestClass_excep35_E1) + { + ++Exc_TestClass_excep35_V.counter; + } + } + } + + public class Exc_TestClass_excep35 + { + private static int retval = 2; + public static int Main_old() + { + Exc_TestClass_excep35_E1 s0 = new Exc_TestClass_excep35_E1(); + try + { + throw new Exc_TestClass_excep35_E1(); + } + catch + { + } + retval = Exc_TestClass_excep35_V.counter; + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + + + + public class Exc_TestClass_excep40_E1 : Exception + { + } + public class Exc_TestClass_excep40_E3 : Exception + { + } + public class Exc_TestClass_excep40_F + { + public static int xpath = 0; + public void f01() + { + try + { + throw new Exc_TestClass_excep40_E3(); + } + catch (Exc_TestClass_excep40_E1) + { + xpath = 5; + } + } + public void f00() + { + try + { + f01(); + } + catch (Exception) + { + xpath = 1; + } + } + public void f02() + { + try + { + throw new Exc_TestClass_excep40_E3(); + } + catch (Exc_TestClass_excep40_E1) + { + xpath = 5; + } + } + public void f03() + { + try + { + f01(); + } + catch (Exc_TestClass_excep40_E3) + { + xpath = 1; + } + } + } + public class Exc_TestClass_excep40 + { + private static int retval = 3; + public static int Main_old() + { + Exc_TestClass_excep40_F f = new Exc_TestClass_excep40_F(); + f.f00(); + if (Exc_TestClass_excep40_F.xpath == 1) + retval--; + Exc_TestClass_excep40_F.xpath = 0; + f.f03(); + if (Exc_TestClass_excep40_F.xpath == 1) + retval -= 2; + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + public class Exc_TestClass_excep41_E1 : Exception + { + } + public class Exc_TestClass_excep41_E3 : Exception + { + } + public class Exc_TestClass_excep41_E4 : Exception + { + } + public class Exc_TestClass_excep41_F + { + public static int xpath = 0; + public void f01() + { + try + { + Debug.WriteLine("In f01(), throwing an Exc_TestClass_excep41_E3..."); + throw new Exc_TestClass_excep41_E3(); + Debug.WriteLine("After throw in f01(). SHOULD NOT BE HERE!"); + } + catch (Exc_TestClass_excep41_E1) + { + Debug.WriteLine("In catch in f01()"); + xpath += 4; + } + } + public void f00() + { + try + { + Debug.WriteLine("Calling f01()..."); + f01(); + Debug.WriteLine("Returned from f01()"); + } + catch (Exc_TestClass_excep41_E4) + { + Debug.WriteLine("In catch in f00()"); + xpath += 2; + } + } + } + public class Exc_TestClass_excep41 + { + private static int retval = 1; + public static int Main_old() + { + Exc_TestClass_excep41_F f = new Exc_TestClass_excep41_F(); + try + { + Debug.WriteLine("Calling f00()..."); + f.f00(); + Debug.WriteLine("Returned from f00()..."); + } + catch (Exc_TestClass_excep41_E3) + { + Debug.WriteLine("In catch in f00()"); + Exc_TestClass_excep41_F.xpath += 1; + } + if (Exc_TestClass_excep41_F.xpath == 1) + retval--; + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, xpath=={0} " + (Exc_TestClass_excep41_F.xpath).ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + /* + public class Exc_TestClass_excep42_E1 : Exception + { + + } + public class Exc_TestClass_excep42_E3 : Exception + { + } + public class Exc_TestClass_excep42_E4 : Exception + { + } + public class Exc_TestClass_excep42_F + { + public static int tb = -1; + public void f255(int i) + { + Exc_TestClass_excep42_E1 s = new Exc_TestClass_excep42_E1(); + Exc_TestClass_excep42_E3 s1 = new Exc_TestClass_excep42_E3(); + Debug.WriteLine("i==" + i.ToString()); + if (i == 255) + { + Debug.WriteLine("Throwing Exc_TestClass_excep42_E1"); + tb = 0; + throw s; + } + else + throw s1; + } + public void f254(int i) { try { f255(++i); } catch (Exc_TestClass_excep42_E4) { tb = 254; } catch { throw; } } + public void f253(int i) { try { f254(++i); } catch (Exc_TestClass_excep42_E4) { tb = 253; } catch { throw; } } + public void f252(int i) { try { f253(++i); } catch (Exc_TestClass_excep42_E4) { tb = 252; } catch { throw; } } + public void f251(int i) { try { f252(++i); } catch (Exc_TestClass_excep42_E4) { tb = 251; } catch { throw; } } + public void f250(int i) { try { f251(++i); } catch (Exc_TestClass_excep42_E4) { tb = 250; } catch { throw; } } + public void f249(int i) { try { f250(++i); } catch (Exc_TestClass_excep42_E4) { tb = 249; } catch { throw; } } + public void f248(int i) { try { f249(++i); } catch (Exc_TestClass_excep42_E4) { tb = 248; } catch { throw; } } + public void f247(int i) { try { f248(++i); } catch (Exc_TestClass_excep42_E4) { tb = 247; } catch { throw; } } + public void f246(int i) { try { f247(++i); } catch (Exc_TestClass_excep42_E4) { tb = 246; } catch { throw; } } + public void f245(int i) { try { f246(++i); } catch (Exc_TestClass_excep42_E4) { tb = 245; } catch { throw; } } + public void f244(int i) { try { f245(++i); } catch (Exc_TestClass_excep42_E4) { tb = 244; } catch { throw; } } + public void f243(int i) { try { f244(++i); } catch (Exc_TestClass_excep42_E4) { tb = 243; } catch { throw; } } + public void f242(int i) { try { f243(++i); } catch (Exc_TestClass_excep42_E4) { tb = 242; } catch { throw; } } + public void f241(int i) { try { f242(++i); } catch (Exc_TestClass_excep42_E4) { tb = 241; } catch { throw; } } + public void f240(int i) { try { f241(++i); } catch (Exc_TestClass_excep42_E4) { tb = 240; } catch { throw; } } + public void f239(int i) { try { f240(++i); } catch (Exc_TestClass_excep42_E4) { tb = 239; } catch { throw; } } + public void f238(int i) { try { f239(++i); } catch (Exc_TestClass_excep42_E4) { tb = 238; } catch { throw; } } + public void f237(int i) { try { f238(++i); } catch (Exc_TestClass_excep42_E4) { tb = 237; } catch { throw; } } + public void f236(int i) { try { f237(++i); } catch (Exc_TestClass_excep42_E4) { tb = 236; } catch { throw; } } + public void f235(int i) { try { f236(++i); } catch (Exc_TestClass_excep42_E4) { tb = 235; } catch { throw; } } + public void f234(int i) { try { f235(++i); } catch (Exc_TestClass_excep42_E4) { tb = 234; } catch { throw; } } + public void f233(int i) { try { f234(++i); } catch (Exc_TestClass_excep42_E4) { tb = 233; } catch { throw; } } + public void f232(int i) { try { f233(++i); } catch (Exc_TestClass_excep42_E4) { tb = 232; } catch { throw; } } + public void f231(int i) { try { f232(++i); } catch (Exc_TestClass_excep42_E4) { tb = 231; } catch { throw; } } + public void f230(int i) { try { f231(++i); } catch (Exc_TestClass_excep42_E4) { tb = 230; } catch { throw; } } + public void f229(int i) { try { f230(++i); } catch (Exc_TestClass_excep42_E4) { tb = 229; } catch { throw; } } + public void f228(int i) { try { f229(++i); } catch (Exc_TestClass_excep42_E4) { tb = 228; } catch { throw; } } + public void f227(int i) { try { f228(++i); } catch (Exc_TestClass_excep42_E4) { tb = 227; } catch { throw; } } + public void f226(int i) { try { f227(++i); } catch (Exc_TestClass_excep42_E4) { tb = 226; } catch { throw; } } + public void f225(int i) { try { f226(++i); } catch (Exc_TestClass_excep42_E4) { tb = 225; } catch { throw; } } + public void f224(int i) { try { f225(++i); } catch (Exc_TestClass_excep42_E4) { tb = 224; } catch { throw; } } + public void f223(int i) { try { f224(++i); } catch (Exc_TestClass_excep42_E4) { tb = 223; } catch { throw; } } + public void f222(int i) { try { f223(++i); } catch (Exc_TestClass_excep42_E4) { tb = 222; } catch { throw; } } + public void f221(int i) { try { f222(++i); } catch (Exc_TestClass_excep42_E4) { tb = 221; } catch { throw; } } + public void f220(int i) { try { f221(++i); } catch (Exc_TestClass_excep42_E4) { tb = 220; } catch { throw; } } + public void f219(int i) { try { f220(++i); } catch (Exc_TestClass_excep42_E4) { tb = 219; } catch { throw; } } + public void f218(int i) { try { f219(++i); } catch (Exc_TestClass_excep42_E4) { tb = 218; } catch { throw; } } + public void f217(int i) { try { f218(++i); } catch (Exc_TestClass_excep42_E4) { tb = 217; } catch { throw; } } + public void f216(int i) { try { f217(++i); } catch (Exc_TestClass_excep42_E4) { tb = 216; } catch { throw; } } + public void f215(int i) { try { f216(++i); } catch (Exc_TestClass_excep42_E4) { tb = 215; } catch { throw; } } + public void f214(int i) { try { f215(++i); } catch (Exc_TestClass_excep42_E4) { tb = 214; } catch { throw; } } + public void f213(int i) { try { f214(++i); } catch (Exc_TestClass_excep42_E4) { tb = 213; } catch { throw; } } + public void f212(int i) { try { f213(++i); } catch (Exc_TestClass_excep42_E4) { tb = 212; } catch { throw; } } + public void f211(int i) { try { f212(++i); } catch (Exc_TestClass_excep42_E4) { tb = 211; } catch { throw; } } + public void f210(int i) { try { f211(++i); } catch (Exc_TestClass_excep42_E4) { tb = 210; } catch { throw; } } + public void f209(int i) { try { f210(++i); } catch (Exc_TestClass_excep42_E4) { tb = 209; } catch { throw; } } + public void f208(int i) { try { f209(++i); } catch (Exc_TestClass_excep42_E4) { tb = 208; } catch { throw; } } + public void f207(int i) { try { f208(++i); } catch (Exc_TestClass_excep42_E4) { tb = 207; } catch { throw; } } + public void f206(int i) { try { f207(++i); } catch (Exc_TestClass_excep42_E4) { tb = 206; } catch { throw; } } + public void f205(int i) { try { f206(++i); } catch (Exc_TestClass_excep42_E4) { tb = 205; } catch { throw; } } + public void f204(int i) { try { f205(++i); } catch (Exc_TestClass_excep42_E4) { tb = 204; } catch { throw; } } + public void f203(int i) { try { f204(++i); } catch (Exc_TestClass_excep42_E4) { tb = 203; } catch { throw; } } + public void f202(int i) { try { f203(++i); } catch (Exc_TestClass_excep42_E4) { tb = 202; } catch { throw; } } + public void f201(int i) { try { f202(++i); } catch (Exc_TestClass_excep42_E4) { tb = 201; } catch { throw; } } + public void f200(int i) { try { f201(++i); } catch (Exc_TestClass_excep42_E4) { tb = 200; } catch { throw; } } + public void f199(int i) { try { f200(++i); } catch (Exc_TestClass_excep42_E4) { tb = 199; } catch { throw; } } + public void f198(int i) { try { f199(++i); } catch (Exc_TestClass_excep42_E4) { tb = 198; } catch { throw; } } + public void f197(int i) { try { f198(++i); } catch (Exc_TestClass_excep42_E4) { tb = 197; } catch { throw; } } + public void f196(int i) { try { f197(++i); } catch (Exc_TestClass_excep42_E4) { tb = 196; } catch { throw; } } + public void f195(int i) { try { f196(++i); } catch (Exc_TestClass_excep42_E4) { tb = 195; } catch { throw; } } + public void f194(int i) { try { f195(++i); } catch (Exc_TestClass_excep42_E4) { tb = 194; } catch { throw; } } + public void f193(int i) { try { f194(++i); } catch (Exc_TestClass_excep42_E4) { tb = 193; } catch { throw; } } + public void f192(int i) { try { f193(++i); } catch (Exc_TestClass_excep42_E4) { tb = 192; } catch { throw; } } + public void f191(int i) { try { f192(++i); } catch (Exc_TestClass_excep42_E4) { tb = 191; } catch { throw; } } + public void f190(int i) { try { f191(++i); } catch (Exc_TestClass_excep42_E4) { tb = 190; } catch { throw; } } + public void f189(int i) { try { f190(++i); } catch (Exc_TestClass_excep42_E4) { tb = 189; } catch { throw; } } + public void f188(int i) { try { f189(++i); } catch (Exc_TestClass_excep42_E4) { tb = 188; } catch { throw; } } + public void f187(int i) { try { f188(++i); } catch (Exc_TestClass_excep42_E4) { tb = 187; } catch { throw; } } + public void f186(int i) { try { f187(++i); } catch (Exc_TestClass_excep42_E4) { tb = 186; } catch { throw; } } + public void f185(int i) { try { f186(++i); } catch (Exc_TestClass_excep42_E4) { tb = 185; } catch { throw; } } + public void f184(int i) { try { f185(++i); } catch (Exc_TestClass_excep42_E4) { tb = 184; } catch { throw; } } + public void f183(int i) { try { f184(++i); } catch (Exc_TestClass_excep42_E4) { tb = 183; } catch { throw; } } + public void f182(int i) { try { f183(++i); } catch (Exc_TestClass_excep42_E4) { tb = 182; } catch { throw; } } + public void f181(int i) { try { f182(++i); } catch (Exc_TestClass_excep42_E4) { tb = 181; } catch { throw; } } + public void f180(int i) { try { f181(++i); } catch (Exc_TestClass_excep42_E4) { tb = 180; } catch { throw; } } + public void f179(int i) { try { f180(++i); } catch (Exc_TestClass_excep42_E4) { tb = 179; } catch { throw; } } + public void f178(int i) { try { f179(++i); } catch (Exc_TestClass_excep42_E4) { tb = 178; } catch { throw; } } + public void f177(int i) { try { f178(++i); } catch (Exc_TestClass_excep42_E4) { tb = 177; } catch { throw; } } + public void f176(int i) { try { f177(++i); } catch (Exc_TestClass_excep42_E4) { tb = 176; } catch { throw; } } + public void f175(int i) { try { f176(++i); } catch (Exc_TestClass_excep42_E4) { tb = 175; } catch { throw; } } + public void f174(int i) { try { f175(++i); } catch (Exc_TestClass_excep42_E4) { tb = 174; } catch { throw; } } + public void f173(int i) { try { f174(++i); } catch (Exc_TestClass_excep42_E4) { tb = 173; } catch { throw; } } + public void f172(int i) { try { f173(++i); } catch (Exc_TestClass_excep42_E4) { tb = 172; } catch { throw; } } + public void f171(int i) { try { f172(++i); } catch (Exc_TestClass_excep42_E4) { tb = 171; } catch { throw; } } + public void f170(int i) { try { f171(++i); } catch (Exc_TestClass_excep42_E4) { tb = 170; } catch { throw; } } + public void f169(int i) { try { f170(++i); } catch (Exc_TestClass_excep42_E4) { tb = 169; } catch { throw; } } + public void f168(int i) { try { f169(++i); } catch (Exc_TestClass_excep42_E4) { tb = 168; } catch { throw; } } + public void f167(int i) { try { f168(++i); } catch (Exc_TestClass_excep42_E4) { tb = 167; } catch { throw; } } + public void f166(int i) { try { f167(++i); } catch (Exc_TestClass_excep42_E4) { tb = 166; } catch { throw; } } + public void f165(int i) { try { f166(++i); } catch (Exc_TestClass_excep42_E4) { tb = 165; } catch { throw; } } + public void f164(int i) { try { f165(++i); } catch (Exc_TestClass_excep42_E4) { tb = 164; } catch { throw; } } + public void f163(int i) { try { f164(++i); } catch (Exc_TestClass_excep42_E4) { tb = 163; } catch { throw; } } + public void f162(int i) { try { f163(++i); } catch (Exc_TestClass_excep42_E4) { tb = 162; } catch { throw; } } + public void f161(int i) { try { f162(++i); } catch (Exc_TestClass_excep42_E4) { tb = 161; } catch { throw; } } + public void f160(int i) { try { f161(++i); } catch (Exc_TestClass_excep42_E4) { tb = 160; } catch { throw; } } + public void f159(int i) { try { f160(++i); } catch (Exc_TestClass_excep42_E4) { tb = 159; } catch { throw; } } + public void f158(int i) { try { f159(++i); } catch (Exc_TestClass_excep42_E4) { tb = 158; } catch { throw; } } + public void f157(int i) { try { f158(++i); } catch (Exc_TestClass_excep42_E4) { tb = 157; } catch { throw; } } + public void f156(int i) { try { f157(++i); } catch (Exc_TestClass_excep42_E4) { tb = 156; } catch { throw; } } + public void f155(int i) { try { f156(++i); } catch (Exc_TestClass_excep42_E4) { tb = 155; } catch { throw; } } + public void f154(int i) { try { f155(++i); } catch (Exc_TestClass_excep42_E4) { tb = 154; } catch { throw; } } + public void f153(int i) { try { f154(++i); } catch (Exc_TestClass_excep42_E4) { tb = 153; } catch { throw; } } + public void f152(int i) { try { f153(++i); } catch (Exc_TestClass_excep42_E4) { tb = 152; } catch { throw; } } + public void f151(int i) { try { f152(++i); } catch (Exc_TestClass_excep42_E4) { tb = 151; } catch { throw; } } + public void f150(int i) { try { f151(++i); } catch (Exc_TestClass_excep42_E4) { tb = 150; } catch { throw; } } + public void f149(int i) { try { f150(++i); } catch (Exc_TestClass_excep42_E4) { tb = 149; } catch { throw; } } + public void f148(int i) { try { f149(++i); } catch (Exc_TestClass_excep42_E4) { tb = 148; } catch { throw; } } + public void f147(int i) { try { f148(++i); } catch (Exc_TestClass_excep42_E4) { tb = 147; } catch { throw; } } + public void f146(int i) { try { f147(++i); } catch (Exc_TestClass_excep42_E4) { tb = 146; } catch { throw; } } + public void f145(int i) { try { f146(++i); } catch (Exc_TestClass_excep42_E4) { tb = 145; } catch { throw; } } + public void f144(int i) { try { f145(++i); } catch (Exc_TestClass_excep42_E4) { tb = 144; } catch { throw; } } + public void f143(int i) { try { f144(++i); } catch (Exc_TestClass_excep42_E4) { tb = 143; } catch { throw; } } + public void f142(int i) { try { f143(++i); } catch (Exc_TestClass_excep42_E4) { tb = 142; } catch { throw; } } + public void f141(int i) { try { f142(++i); } catch (Exc_TestClass_excep42_E4) { tb = 141; } catch { throw; } } + public void f140(int i) { try { f141(++i); } catch (Exc_TestClass_excep42_E4) { tb = 140; } catch { throw; } } + public void f139(int i) { try { f140(++i); } catch (Exc_TestClass_excep42_E4) { tb = 139; } catch { throw; } } + public void f138(int i) { try { f139(++i); } catch (Exc_TestClass_excep42_E4) { tb = 138; } catch { throw; } } + public void f137(int i) { try { f138(++i); } catch (Exc_TestClass_excep42_E4) { tb = 137; } catch { throw; } } + public void f136(int i) { try { f137(++i); } catch (Exc_TestClass_excep42_E4) { tb = 136; } catch { throw; } } + public void f135(int i) { try { f136(++i); } catch (Exc_TestClass_excep42_E4) { tb = 135; } catch { throw; } } + public void f134(int i) { try { f135(++i); } catch (Exc_TestClass_excep42_E4) { tb = 134; } catch { throw; } } + public void f133(int i) { try { f134(++i); } catch (Exc_TestClass_excep42_E4) { tb = 133; } catch { throw; } } + public void f132(int i) { try { f133(++i); } catch (Exc_TestClass_excep42_E4) { tb = 132; } catch { throw; } } + public void f131(int i) { try { f132(++i); } catch (Exc_TestClass_excep42_E4) { tb = 131; } catch { throw; } } + public void f130(int i) { try { f131(++i); } catch (Exc_TestClass_excep42_E4) { tb = 130; } catch { throw; } } + public void f129(int i) { try { f130(++i); } catch (Exc_TestClass_excep42_E4) { tb = 129; } catch { throw; } } + public void f128(int i) { try { f129(++i); } catch (Exc_TestClass_excep42_E4) { tb = 128; } catch { throw; } } + public void f127(int i) { try { f128(++i); } catch (Exc_TestClass_excep42_E4) { tb = 127; } catch { throw; } } + public void f126(int i) { try { f127(++i); } catch (Exc_TestClass_excep42_E4) { tb = 126; } catch { throw; } } + public void f125(int i) { try { f126(++i); } catch (Exc_TestClass_excep42_E4) { tb = 125; } catch { throw; } } + public void f124(int i) { try { f125(++i); } catch (Exc_TestClass_excep42_E4) { tb = 124; } catch { throw; } } + public void f123(int i) { try { f124(++i); } catch (Exc_TestClass_excep42_E4) { tb = 123; } catch { throw; } } + public void f122(int i) { try { f123(++i); } catch (Exc_TestClass_excep42_E4) { tb = 122; } catch { throw; } } + public void f121(int i) { try { f122(++i); } catch (Exc_TestClass_excep42_E4) { tb = 121; } catch { throw; } } + public void f120(int i) { try { f121(++i); } catch (Exc_TestClass_excep42_E4) { tb = 120; } catch { throw; } } + public void f119(int i) { try { f120(++i); } catch (Exc_TestClass_excep42_E4) { tb = 119; } catch { throw; } } + public void f118(int i) { try { f119(++i); } catch (Exc_TestClass_excep42_E4) { tb = 118; } catch { throw; } } + public void f117(int i) { try { f118(++i); } catch (Exc_TestClass_excep42_E4) { tb = 117; } catch { throw; } } + public void f116(int i) { try { f117(++i); } catch (Exc_TestClass_excep42_E4) { tb = 116; } catch { throw; } } + public void f115(int i) { try { f116(++i); } catch (Exc_TestClass_excep42_E4) { tb = 115; } catch { throw; } } + public void f114(int i) { try { f115(++i); } catch (Exc_TestClass_excep42_E4) { tb = 114; } catch { throw; } } + public void f113(int i) { try { f114(++i); } catch (Exc_TestClass_excep42_E4) { tb = 113; } catch { throw; } } + public void f112(int i) { try { f113(++i); } catch (Exc_TestClass_excep42_E4) { tb = 112; } catch { throw; } } + public void f111(int i) { try { f112(++i); } catch (Exc_TestClass_excep42_E4) { tb = 111; } catch { throw; } } + public void f110(int i) { try { f111(++i); } catch (Exc_TestClass_excep42_E4) { tb = 110; } catch { throw; } } + public void f109(int i) { try { f110(++i); } catch (Exc_TestClass_excep42_E4) { tb = 109; } catch { throw; } } + public void f108(int i) { try { f109(++i); } catch (Exc_TestClass_excep42_E4) { tb = 108; } catch { throw; } } + public void f107(int i) { try { f108(++i); } catch (Exc_TestClass_excep42_E4) { tb = 107; } catch { throw; } } + public void f106(int i) { try { f107(++i); } catch (Exc_TestClass_excep42_E4) { tb = 106; } catch { throw; } } + public void f105(int i) { try { f106(++i); } catch (Exc_TestClass_excep42_E4) { tb = 105; } catch { throw; } } + public void f104(int i) { try { f105(++i); } catch (Exc_TestClass_excep42_E4) { tb = 104; } catch { throw; } } + public void f103(int i) { try { f104(++i); } catch (Exc_TestClass_excep42_E4) { tb = 103; } catch { throw; } } + public void f102(int i) { try { f103(++i); } catch (Exc_TestClass_excep42_E4) { tb = 102; } catch { throw; } } + public void f101(int i) { try { f102(++i); } catch (Exc_TestClass_excep42_E4) { tb = 101; } catch { throw; } } + public void f100(int i) { try { f101(++i); } catch (Exc_TestClass_excep42_E4) { tb = 100; } catch { throw; } } + public void f099(int i) { try { f100(++i); } catch (Exc_TestClass_excep42_E4) { tb = 99; } catch { throw; } } + public void f098(int i) { try { f099(++i); } catch (Exc_TestClass_excep42_E4) { tb = 98; } catch { throw; } } + public void f097(int i) { try { f098(++i); } catch (Exc_TestClass_excep42_E4) { tb = 97; } catch { throw; } } + public void f096(int i) { try { f097(++i); } catch (Exc_TestClass_excep42_E4) { tb = 96; } catch { throw; } } + public void f095(int i) { try { f096(++i); } catch (Exc_TestClass_excep42_E4) { tb = 95; } catch { throw; } } + public void f094(int i) { try { f095(++i); } catch (Exc_TestClass_excep42_E4) { tb = 94; } catch { throw; } } + public void f093(int i) { try { f094(++i); } catch (Exc_TestClass_excep42_E4) { tb = 93; } catch { throw; } } + public void f092(int i) { try { f093(++i); } catch (Exc_TestClass_excep42_E4) { tb = 92; } catch { throw; } } + public void f091(int i) { try { f092(++i); } catch (Exc_TestClass_excep42_E4) { tb = 91; } catch { throw; } } + public void f090(int i) { try { f091(++i); } catch (Exc_TestClass_excep42_E4) { tb = 90; } catch { throw; } } + public void f089(int i) { try { f090(++i); } catch (Exc_TestClass_excep42_E4) { tb = 89; } catch { throw; } } + public void f088(int i) { try { f089(++i); } catch (Exc_TestClass_excep42_E4) { tb = 88; } catch { throw; } } + public void f087(int i) { try { f088(++i); } catch (Exc_TestClass_excep42_E4) { tb = 87; } catch { throw; } } + public void f086(int i) { try { f087(++i); } catch (Exc_TestClass_excep42_E4) { tb = 86; } catch { throw; } } + public void f085(int i) { try { f086(++i); } catch (Exc_TestClass_excep42_E4) { tb = 85; } catch { throw; } } + public void f084(int i) { try { f085(++i); } catch (Exc_TestClass_excep42_E4) { tb = 84; } catch { throw; } } + public void f083(int i) { try { f084(++i); } catch (Exc_TestClass_excep42_E4) { tb = 83; } catch { throw; } } + public void f082(int i) { try { f083(++i); } catch (Exc_TestClass_excep42_E4) { tb = 82; } catch { throw; } } + public void f081(int i) { try { f082(++i); } catch (Exc_TestClass_excep42_E4) { tb = 81; } catch { throw; } } + public void f080(int i) { try { f081(++i); } catch (Exc_TestClass_excep42_E4) { tb = 80; } catch { throw; } } + public void f079(int i) { try { f080(++i); } catch (Exc_TestClass_excep42_E4) { tb = 79; } catch { throw; } } + public void f078(int i) { try { f079(++i); } catch (Exc_TestClass_excep42_E4) { tb = 78; } catch { throw; } } + public void f077(int i) { try { f078(++i); } catch (Exc_TestClass_excep42_E4) { tb = 77; } catch { throw; } } + public void f076(int i) { try { f077(++i); } catch (Exc_TestClass_excep42_E4) { tb = 76; } catch { throw; } } + public void f075(int i) { try { f076(++i); } catch (Exc_TestClass_excep42_E4) { tb = 75; } catch { throw; } } + public void f074(int i) { try { f075(++i); } catch (Exc_TestClass_excep42_E4) { tb = 74; } catch { throw; } } + public void f073(int i) { try { f074(++i); } catch (Exc_TestClass_excep42_E4) { tb = 73; } catch { throw; } } + public void f072(int i) { try { f073(++i); } catch (Exc_TestClass_excep42_E4) { tb = 72; } catch { throw; } } + public void f071(int i) { try { f072(++i); } catch (Exc_TestClass_excep42_E4) { tb = 71; } catch { throw; } } + public void f070(int i) { try { f071(++i); } catch (Exc_TestClass_excep42_E4) { tb = 70; } catch { throw; } } + public void f069(int i) { try { f070(++i); } catch (Exc_TestClass_excep42_E4) { tb = 69; } catch { throw; } } + public void f068(int i) { try { f069(++i); } catch (Exc_TestClass_excep42_E4) { tb = 68; } catch { throw; } } + public void f067(int i) { try { f068(++i); } catch (Exc_TestClass_excep42_E4) { tb = 67; } catch { throw; } } + public void f066(int i) { try { f067(++i); } catch (Exc_TestClass_excep42_E4) { tb = 66; } catch { throw; } } + public void f065(int i) { try { f066(++i); } catch (Exc_TestClass_excep42_E4) { tb = 65; } catch { throw; } } + public void f064(int i) { try { f065(++i); } catch (Exc_TestClass_excep42_E4) { tb = 64; } catch { throw; } } + public void f063(int i) { try { f064(++i); } catch (Exc_TestClass_excep42_E4) { tb = 63; } catch { throw; } } + public void f062(int i) { try { f063(++i); } catch (Exc_TestClass_excep42_E4) { tb = 62; } catch { throw; } } + public void f061(int i) { try { f062(++i); } catch (Exc_TestClass_excep42_E4) { tb = 61; } catch { throw; } } + public void f060(int i) { try { f061(++i); } catch (Exc_TestClass_excep42_E4) { tb = 60; } catch { throw; } } + public void f059(int i) { try { f060(++i); } catch (Exc_TestClass_excep42_E4) { tb = 59; } catch { throw; } } + public void f058(int i) { try { f059(++i); } catch (Exc_TestClass_excep42_E4) { tb = 58; } catch { throw; } } + public void f057(int i) { try { f058(++i); } catch (Exc_TestClass_excep42_E4) { tb = 57; } catch { throw; } } + public void f056(int i) { try { f057(++i); } catch (Exc_TestClass_excep42_E4) { tb = 56; } catch { throw; } } + public void f055(int i) { try { f056(++i); } catch (Exc_TestClass_excep42_E4) { tb = 55; } catch { throw; } } + public void f054(int i) { try { f055(++i); } catch (Exc_TestClass_excep42_E4) { tb = 54; } catch { throw; } } + public void f053(int i) { try { f054(++i); } catch (Exc_TestClass_excep42_E4) { tb = 53; } catch { throw; } } + public void f052(int i) { try { f053(++i); } catch (Exc_TestClass_excep42_E4) { tb = 52; } catch { throw; } } + public void f051(int i) { try { f052(++i); } catch (Exc_TestClass_excep42_E4) { tb = 51; } catch { throw; } } + public void f050(int i) { try { f051(++i); } catch (Exc_TestClass_excep42_E4) { tb = 50; } catch { throw; } } + public void f049(int i) { try { f050(++i); } catch (Exc_TestClass_excep42_E4) { tb = 49; } catch { throw; } } + public void f048(int i) { try { f049(++i); } catch (Exc_TestClass_excep42_E4) { tb = 48; } catch { throw; } } + public void f047(int i) { try { f048(++i); } catch (Exc_TestClass_excep42_E4) { tb = 47; } catch { throw; } } + public void f046(int i) { try { f047(++i); } catch (Exc_TestClass_excep42_E4) { tb = 46; } catch { throw; } } + public void f045(int i) { try { f046(++i); } catch (Exc_TestClass_excep42_E4) { tb = 45; } catch { throw; } } + public void f044(int i) { try { f045(++i); } catch (Exc_TestClass_excep42_E4) { tb = 44; } catch { throw; } } + public void f043(int i) { try { f044(++i); } catch (Exc_TestClass_excep42_E4) { tb = 43; } catch { throw; } } + public void f042(int i) { try { f043(++i); } catch (Exc_TestClass_excep42_E4) { tb = 42; } catch { throw; } } + public void f041(int i) { try { f042(++i); } catch (Exc_TestClass_excep42_E4) { tb = 41; } catch { throw; } } + public void f040(int i) { try { f041(++i); } catch (Exc_TestClass_excep42_E4) { tb = 40; } catch { throw; } } + public void f039(int i) { try { f040(++i); } catch (Exc_TestClass_excep42_E4) { tb = 39; } catch { throw; } } + public void f038(int i) { try { f039(++i); } catch (Exc_TestClass_excep42_E4) { tb = 38; } catch { throw; } } + public void f037(int i) { try { f038(++i); } catch (Exc_TestClass_excep42_E4) { tb = 37; } catch { throw; } } + public void f036(int i) { try { f037(++i); } catch (Exc_TestClass_excep42_E4) { tb = 36; } catch { throw; } } + public void f035(int i) { try { f036(++i); } catch (Exc_TestClass_excep42_E4) { tb = 35; } catch { throw; } } + public void f034(int i) { try { f035(++i); } catch (Exc_TestClass_excep42_E4) { tb = 34; } catch { throw; } } + public void f033(int i) { try { f034(++i); } catch (Exc_TestClass_excep42_E4) { tb = 33; } catch { throw; } } + public void f032(int i) { try { f033(++i); } catch (Exc_TestClass_excep42_E4) { tb = 32; } catch { throw; } } + public void f031(int i) { try { f032(++i); } catch (Exc_TestClass_excep42_E4) { tb = 31; } catch { throw; } } + public void f030(int i) { try { f031(++i); } catch (Exc_TestClass_excep42_E4) { tb = 30; } catch { throw; } } + public void f029(int i) { try { f030(++i); } catch (Exc_TestClass_excep42_E4) { tb = 29; } catch { throw; } } + public void f028(int i) { try { f029(++i); } catch (Exc_TestClass_excep42_E4) { tb = 28; } catch { throw; } } + public void f027(int i) { try { f028(++i); } catch (Exc_TestClass_excep42_E4) { tb = 27; } catch { throw; } } + public void f026(int i) { try { f027(++i); } catch (Exc_TestClass_excep42_E4) { tb = 26; } catch { throw; } } + public void f025(int i) { try { f026(++i); } catch (Exc_TestClass_excep42_E4) { tb = 25; } catch { throw; } } + public void f024(int i) { try { f025(++i); } catch (Exc_TestClass_excep42_E4) { tb = 24; } catch { throw; } } + public void f023(int i) { try { f024(++i); } catch (Exc_TestClass_excep42_E4) { tb = 23; } catch { throw; } } + public void f022(int i) { try { f023(++i); } catch (Exc_TestClass_excep42_E4) { tb = 22; } catch { throw; } } + public void f021(int i) { try { f022(++i); } catch (Exc_TestClass_excep42_E4) { tb = 21; } catch { throw; } } + public void f020(int i) { try { f021(++i); } catch (Exc_TestClass_excep42_E4) { tb = 20; } catch { throw; } } + public void f019(int i) { try { f020(++i); } catch (Exc_TestClass_excep42_E4) { tb = 19; } catch { throw; } } + public void f018(int i) { try { f019(++i); } catch (Exc_TestClass_excep42_E4) { tb = 18; } catch { throw; } } + public void f017(int i) { try { f018(++i); } catch (Exc_TestClass_excep42_E4) { tb = 17; } catch { throw; } } + public void f016(int i) { try { f017(++i); } catch (Exc_TestClass_excep42_E4) { tb = 16; } catch { throw; } } + public void f015(int i) { try { f016(++i); } catch (Exc_TestClass_excep42_E4) { tb = 15; } catch { throw; } } + public void f014(int i) { try { f015(++i); } catch (Exc_TestClass_excep42_E4) { tb = 14; } catch { throw; } } + public void f013(int i) { try { f014(++i); } catch (Exc_TestClass_excep42_E4) { tb = 13; } catch { throw; } } + public void f012(int i) { try { f013(++i); } catch (Exc_TestClass_excep42_E4) { tb = 12; } catch { throw; } } + public void f011(int i) { try { f012(++i); } catch (Exc_TestClass_excep42_E4) { tb = 11; } catch { throw; } } + public void f010(int i) { try { f011(++i); } catch (Exc_TestClass_excep42_E4) { tb = 10; } catch { throw; } } + public void f009(int i) { try { f010(++i); } catch (Exc_TestClass_excep42_E4) { tb = 9; } catch { throw; } } + public void f008(int i) { try { f009(++i); } catch (Exc_TestClass_excep42_E4) { tb = 8; } catch { throw; } } + public void f007(int i) { try { f008(++i); } catch (Exc_TestClass_excep42_E4) { tb = 7; } catch { throw; } } + public void f006(int i) { try { f007(++i); } catch (Exc_TestClass_excep42_E4) { tb = 6; } catch { throw; } } + public void f005(int i) { try { f006(++i); } catch (Exc_TestClass_excep42_E4) { tb = 5; } catch { throw; } } + public void f004(int i) { try { f005(++i); } catch (Exc_TestClass_excep42_E4) { tb = 4; } catch { throw; } } + public void f003(int i) { try { f004(++i); } catch (Exc_TestClass_excep42_E4) { tb = 3; } catch { throw; } } + public void f002(int i) { try { f003(++i); } catch (Exc_TestClass_excep42_E4) { tb = 2; } catch { throw; } } + public void f001(int i) { try { f002(++i); } catch (Exc_TestClass_excep42_E4) { tb = 1; } catch { throw; } } + } + public class Exc_TestClass_excep42 + { + private static int retval = 1; + public static int Main_old() + { + Exc_TestClass_excep42_F f = new Exc_TestClass_excep42_F(); + try + { + f.f001(1); + } + catch (Exc_TestClass_excep42_E1) + { + Debug.WriteLine("Caught Exc_TestClass_excep42_E1"); + retval = Exc_TestClass_excep42_F.tb; + } + catch + { + Debug.WriteLine("Did not catch Exc_TestClass_excep42_E1"); + retval = -1; + } + Debug.WriteLine(retval.ToString()); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + */ + public class Exc_TestClass_excep42b_E1 : Exception + { + + } + public class Exc_TestClass_excep42b_E3 : Exception + { + } + public class Exc_TestClass_excep42b_E4 : Exception + { + } + public class Exc_TestClass_excep42b_F + { + public static int tb = -1; + public void f033(int i) + { + Exc_TestClass_excep42b_E1 s = new Exc_TestClass_excep42b_E1(); + Exc_TestClass_excep42b_E3 s1 = new Exc_TestClass_excep42b_E3(); + Debug.WriteLine("i==" + i.ToString()); + if (i == 33) + { + Debug.WriteLine("Throwing Exc_TestClass_excep42b_E1"); + tb = 0; + throw s; + } + else + throw s1; + } + public void f032(int i) { try { f033(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 32; } catch { throw; } } + public void f031(int i) { try { f032(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 31; } catch { throw; } } + public void f030(int i) { try { f031(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 30; } catch { throw; } } + public void f029(int i) { try { f030(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 29; } catch { throw; } } + public void f028(int i) { try { f029(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 28; } catch { throw; } } + public void f027(int i) { try { f028(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 27; } catch { throw; } } + public void f026(int i) { try { f027(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 26; } catch { throw; } } + public void f025(int i) { try { f026(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 25; } catch { throw; } } + public void f024(int i) { try { f025(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 24; } catch { throw; } } + public void f023(int i) { try { f024(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 23; } catch { throw; } } + public void f022(int i) { try { f023(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 22; } catch { throw; } } + public void f021(int i) { try { f022(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 21; } catch { throw; } } + public void f020(int i) { try { f021(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 20; } catch { throw; } } + public void f019(int i) { try { f020(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 19; } catch { throw; } } + public void f018(int i) { try { f019(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 18; } catch { throw; } } + public void f017(int i) { try { f018(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 17; } catch { throw; } } + public void f016(int i) { try { f017(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 16; } catch { throw; } } + public void f015(int i) { try { f016(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 15; } catch { throw; } } + public void f014(int i) { try { f015(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 14; } catch { throw; } } + public void f013(int i) { try { f014(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 13; } catch { throw; } } + public void f012(int i) { try { f013(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 12; } catch { throw; } } + public void f011(int i) { try { f012(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 11; } catch { throw; } } + public void f010(int i) { try { f011(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 10; } catch { throw; } } + public void f009(int i) { try { f010(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 9; } catch { throw; } } + public void f008(int i) { try { f009(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 8; } catch { throw; } } + public void f007(int i) { try { f008(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 7; } catch { throw; } } + public void f006(int i) { try { f007(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 6; } catch { throw; } } + public void f005(int i) { try { f006(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 5; } catch { throw; } } + public void f004(int i) { try { f005(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 4; } catch { throw; } } + public void f003(int i) { try { f004(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 3; } catch { throw; } } + public void f002(int i) { try { f003(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 2; } catch { throw; } } + public void f001(int i) { try { f002(++i); } catch (Exc_TestClass_excep42b_E4) { tb = 1; } catch { throw; } } + } + public class Exc_TestClass_excep42b + { + private static int retval = 1; + public static int Main_old() + { + Exc_TestClass_excep42b_F f = new Exc_TestClass_excep42b_F(); + try + { + f.f001(1); + } + catch (Exc_TestClass_excep42b_E1) + { + Debug.WriteLine("Caught Exc_TestClass_excep42b_E1"); + retval = Exc_TestClass_excep42b_F.tb; + } + catch + { + Debug.WriteLine("Did not catch Exc_TestClass_excep42b_E1"); + retval = -1; + } + Debug.WriteLine(retval.ToString()); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + /* + public class Exc_TestClass_excep43_E1 : Exception + { + } + public class Exc_TestClass_excep43_E3 : Exception + { + } + public class Exc_TestClass_excep43_E4 : Exception + { + } + public class Exc_TestClass_excep43_F + { + public static int tb = -1; + public void f255(int i) + { + Exc_TestClass_excep43_E1 s = new Exc_TestClass_excep43_E1(); + Exc_TestClass_excep43_E3 s1 = new Exc_TestClass_excep43_E3(); + if (i == 0) + throw s; + else + throw s1; + } + public void f254(int i) { try { f255(i); } catch (Exc_TestClass_excep43_E4) { tb = 254; } } + public void f253(int i) { try { f254(i); } catch (Exc_TestClass_excep43_E4) { tb = 253; } } + public void f252(int i) { try { f253(i); } catch (Exc_TestClass_excep43_E4) { tb = 252; } } + public void f251(int i) { try { f252(i); } catch (Exc_TestClass_excep43_E4) { tb = 251; } } + public void f250(int i) { try { f251(i); } catch (Exc_TestClass_excep43_E4) { tb = 250; } } + public void f249(int i) { try { f250(i); } catch (Exc_TestClass_excep43_E4) { tb = 249; } } + public void f248(int i) { try { f249(i); } catch (Exc_TestClass_excep43_E4) { tb = 248; } } + public void f247(int i) { try { f248(i); } catch (Exc_TestClass_excep43_E4) { tb = 247; } } + public void f246(int i) { try { f247(i); } catch (Exc_TestClass_excep43_E4) { tb = 246; } } + public void f245(int i) { try { f246(i); } catch (Exc_TestClass_excep43_E4) { tb = 245; } } + public void f244(int i) { try { f245(i); } catch (Exc_TestClass_excep43_E4) { tb = 244; } } + public void f243(int i) { try { f244(i); } catch (Exc_TestClass_excep43_E4) { tb = 243; } } + public void f242(int i) { try { f243(i); } catch (Exc_TestClass_excep43_E4) { tb = 242; } } + public void f241(int i) { try { f242(i); } catch (Exc_TestClass_excep43_E4) { tb = 241; } } + public void f240(int i) { try { f241(i); } catch (Exc_TestClass_excep43_E4) { tb = 240; } } + public void f239(int i) { try { f240(i); } catch (Exc_TestClass_excep43_E4) { tb = 239; } } + public void f238(int i) { try { f239(i); } catch (Exc_TestClass_excep43_E4) { tb = 238; } } + public void f237(int i) { try { f238(i); } catch (Exc_TestClass_excep43_E4) { tb = 237; } } + public void f236(int i) { try { f237(i); } catch (Exc_TestClass_excep43_E4) { tb = 236; } } + public void f235(int i) { try { f236(i); } catch (Exc_TestClass_excep43_E4) { tb = 235; } } + public void f234(int i) { try { f235(i); } catch (Exc_TestClass_excep43_E4) { tb = 234; } } + public void f233(int i) { try { f234(i); } catch (Exc_TestClass_excep43_E4) { tb = 233; } } + public void f232(int i) { try { f233(i); } catch (Exc_TestClass_excep43_E4) { tb = 232; } } + public void f231(int i) { try { f232(i); } catch (Exc_TestClass_excep43_E4) { tb = 231; } } + public void f230(int i) { try { f231(i); } catch (Exc_TestClass_excep43_E4) { tb = 230; } } + public void f229(int i) { try { f230(i); } catch (Exc_TestClass_excep43_E4) { tb = 229; } } + public void f228(int i) { try { f229(i); } catch (Exc_TestClass_excep43_E4) { tb = 228; } } + public void f227(int i) { try { f228(i); } catch (Exc_TestClass_excep43_E4) { tb = 227; } } + public void f226(int i) { try { f227(i); } catch (Exc_TestClass_excep43_E4) { tb = 226; } } + public void f225(int i) { try { f226(i); } catch (Exc_TestClass_excep43_E4) { tb = 225; } } + public void f224(int i) { try { f225(i); } catch (Exc_TestClass_excep43_E4) { tb = 224; } } + public void f223(int i) { try { f224(i); } catch (Exc_TestClass_excep43_E4) { tb = 223; } } + public void f222(int i) { try { f223(i); } catch (Exc_TestClass_excep43_E4) { tb = 222; } } + public void f221(int i) { try { f222(i); } catch (Exc_TestClass_excep43_E4) { tb = 221; } } + public void f220(int i) { try { f221(i); } catch (Exc_TestClass_excep43_E4) { tb = 220; } } + public void f219(int i) { try { f220(i); } catch (Exc_TestClass_excep43_E4) { tb = 219; } } + public void f218(int i) { try { f219(i); } catch (Exc_TestClass_excep43_E4) { tb = 218; } } + public void f217(int i) { try { f218(i); } catch (Exc_TestClass_excep43_E4) { tb = 217; } } + public void f216(int i) { try { f217(i); } catch (Exc_TestClass_excep43_E4) { tb = 216; } } + public void f215(int i) { try { f216(i); } catch (Exc_TestClass_excep43_E4) { tb = 215; } } + public void f214(int i) { try { f215(i); } catch (Exc_TestClass_excep43_E4) { tb = 214; } } + public void f213(int i) { try { f214(i); } catch (Exc_TestClass_excep43_E4) { tb = 213; } } + public void f212(int i) { try { f213(i); } catch (Exc_TestClass_excep43_E4) { tb = 212; } } + public void f211(int i) { try { f212(i); } catch (Exc_TestClass_excep43_E4) { tb = 211; } } + public void f210(int i) { try { f211(i); } catch (Exc_TestClass_excep43_E4) { tb = 210; } } + public void f209(int i) { try { f210(i); } catch (Exc_TestClass_excep43_E4) { tb = 209; } } + public void f208(int i) { try { f209(i); } catch (Exc_TestClass_excep43_E4) { tb = 208; } } + public void f207(int i) { try { f208(i); } catch (Exc_TestClass_excep43_E4) { tb = 207; } } + public void f206(int i) { try { f207(i); } catch (Exc_TestClass_excep43_E4) { tb = 206; } } + public void f205(int i) { try { f206(i); } catch (Exc_TestClass_excep43_E4) { tb = 205; } } + public void f204(int i) { try { f205(i); } catch (Exc_TestClass_excep43_E4) { tb = 204; } } + public void f203(int i) { try { f204(i); } catch (Exc_TestClass_excep43_E4) { tb = 203; } } + public void f202(int i) { try { f203(i); } catch (Exc_TestClass_excep43_E4) { tb = 202; } } + public void f201(int i) { try { f202(i); } catch (Exc_TestClass_excep43_E4) { tb = 201; } } + public void f200(int i) { try { f201(i); } catch (Exc_TestClass_excep43_E4) { tb = 200; } } + public void f199(int i) { try { f200(i); } catch (Exc_TestClass_excep43_E4) { tb = 199; } } + public void f198(int i) { try { f199(i); } catch (Exc_TestClass_excep43_E4) { tb = 198; } } + public void f197(int i) { try { f198(i); } catch (Exc_TestClass_excep43_E4) { tb = 197; } } + public void f196(int i) { try { f197(i); } catch (Exc_TestClass_excep43_E4) { tb = 196; } } + public void f195(int i) { try { f196(i); } catch (Exc_TestClass_excep43_E4) { tb = 195; } } + public void f194(int i) { try { f195(i); } catch (Exc_TestClass_excep43_E4) { tb = 194; } } + public void f193(int i) { try { f194(i); } catch (Exc_TestClass_excep43_E4) { tb = 193; } } + public void f192(int i) { try { f193(i); } catch (Exc_TestClass_excep43_E4) { tb = 192; } } + public void f191(int i) { try { f192(i); } catch (Exc_TestClass_excep43_E4) { tb = 191; } } + public void f190(int i) { try { f191(i); } catch (Exc_TestClass_excep43_E4) { tb = 190; } } + public void f189(int i) { try { f190(i); } catch (Exc_TestClass_excep43_E4) { tb = 189; } } + public void f188(int i) { try { f189(i); } catch (Exc_TestClass_excep43_E4) { tb = 188; } } + public void f187(int i) { try { f188(i); } catch (Exc_TestClass_excep43_E4) { tb = 187; } } + public void f186(int i) { try { f187(i); } catch (Exc_TestClass_excep43_E4) { tb = 186; } } + public void f185(int i) { try { f186(i); } catch (Exc_TestClass_excep43_E4) { tb = 185; } } + public void f184(int i) { try { f185(i); } catch (Exc_TestClass_excep43_E4) { tb = 184; } } + public void f183(int i) { try { f184(i); } catch (Exc_TestClass_excep43_E4) { tb = 183; } } + public void f182(int i) { try { f183(i); } catch (Exc_TestClass_excep43_E4) { tb = 182; } } + public void f181(int i) { try { f182(i); } catch (Exc_TestClass_excep43_E4) { tb = 181; } } + public void f180(int i) { try { f181(i); } catch (Exc_TestClass_excep43_E4) { tb = 180; } } + public void f179(int i) { try { f180(i); } catch (Exc_TestClass_excep43_E4) { tb = 179; } } + public void f178(int i) { try { f179(i); } catch (Exc_TestClass_excep43_E4) { tb = 178; } } + public void f177(int i) { try { f178(i); } catch (Exc_TestClass_excep43_E4) { tb = 177; } } + public void f176(int i) { try { f177(i); } catch (Exc_TestClass_excep43_E4) { tb = 176; } } + public void f175(int i) { try { f176(i); } catch (Exc_TestClass_excep43_E4) { tb = 175; } } + public void f174(int i) { try { f175(i); } catch (Exc_TestClass_excep43_E4) { tb = 174; } } + public void f173(int i) { try { f174(i); } catch (Exc_TestClass_excep43_E4) { tb = 173; } } + public void f172(int i) { try { f173(i); } catch (Exc_TestClass_excep43_E4) { tb = 172; } } + public void f171(int i) { try { f172(i); } catch (Exc_TestClass_excep43_E4) { tb = 171; } } + public void f170(int i) { try { f171(i); } catch (Exc_TestClass_excep43_E4) { tb = 170; } } + public void f169(int i) { try { f170(i); } catch (Exc_TestClass_excep43_E4) { tb = 169; } } + public void f168(int i) { try { f169(i); } catch (Exc_TestClass_excep43_E4) { tb = 168; } } + public void f167(int i) { try { f168(i); } catch (Exc_TestClass_excep43_E4) { tb = 167; } } + public void f166(int i) { try { f167(i); } catch (Exc_TestClass_excep43_E4) { tb = 166; } } + public void f165(int i) { try { f166(i); } catch (Exc_TestClass_excep43_E4) { tb = 165; } } + public void f164(int i) { try { f165(i); } catch (Exc_TestClass_excep43_E4) { tb = 164; } } + public void f163(int i) { try { f164(i); } catch (Exc_TestClass_excep43_E4) { tb = 163; } } + public void f162(int i) { try { f163(i); } catch (Exc_TestClass_excep43_E4) { tb = 162; } } + public void f161(int i) { try { f162(i); } catch (Exc_TestClass_excep43_E4) { tb = 161; } } + public void f160(int i) { try { f161(i); } catch (Exc_TestClass_excep43_E4) { tb = 160; } } + public void f159(int i) { try { f160(i); } catch (Exc_TestClass_excep43_E4) { tb = 159; } } + public void f158(int i) { try { f159(i); } catch (Exc_TestClass_excep43_E4) { tb = 158; } } + public void f157(int i) { try { f158(i); } catch (Exc_TestClass_excep43_E4) { tb = 157; } } + public void f156(int i) { try { f157(i); } catch (Exc_TestClass_excep43_E4) { tb = 156; } } + public void f155(int i) { try { f156(i); } catch (Exc_TestClass_excep43_E4) { tb = 155; } } + public void f154(int i) { try { f155(i); } catch (Exc_TestClass_excep43_E4) { tb = 154; } } + public void f153(int i) { try { f154(i); } catch (Exc_TestClass_excep43_E4) { tb = 153; } } + public void f152(int i) { try { f153(i); } catch (Exc_TestClass_excep43_E4) { tb = 152; } } + public void f151(int i) { try { f152(i); } catch (Exc_TestClass_excep43_E4) { tb = 151; } } + public void f150(int i) { try { f151(i); } catch (Exc_TestClass_excep43_E4) { tb = 150; } } + public void f149(int i) { try { f150(i); } catch (Exc_TestClass_excep43_E4) { tb = 149; } } + public void f148(int i) { try { f149(i); } catch (Exc_TestClass_excep43_E4) { tb = 148; } } + public void f147(int i) { try { f148(i); } catch (Exc_TestClass_excep43_E4) { tb = 147; } } + public void f146(int i) { try { f147(i); } catch (Exc_TestClass_excep43_E4) { tb = 146; } } + public void f145(int i) { try { f146(i); } catch (Exc_TestClass_excep43_E4) { tb = 145; } } + public void f144(int i) { try { f145(i); } catch (Exc_TestClass_excep43_E4) { tb = 144; } } + public void f143(int i) { try { f144(i); } catch (Exc_TestClass_excep43_E4) { tb = 143; } } + public void f142(int i) { try { f143(i); } catch (Exc_TestClass_excep43_E4) { tb = 142; } } + public void f141(int i) { try { f142(i); } catch (Exc_TestClass_excep43_E4) { tb = 141; } } + public void f140(int i) { try { f141(i); } catch (Exc_TestClass_excep43_E4) { tb = 140; } } + public void f139(int i) { try { f140(i); } catch (Exc_TestClass_excep43_E4) { tb = 139; } } + public void f138(int i) { try { f139(i); } catch (Exc_TestClass_excep43_E4) { tb = 138; } } + public void f137(int i) { try { f138(i); } catch (Exc_TestClass_excep43_E4) { tb = 137; } } + public void f136(int i) { try { f137(i); } catch (Exc_TestClass_excep43_E4) { tb = 136; } } + public void f135(int i) { try { f136(i); } catch (Exc_TestClass_excep43_E4) { tb = 135; } } + public void f134(int i) { try { f135(i); } catch (Exc_TestClass_excep43_E4) { tb = 134; } } + public void f133(int i) { try { f134(i); } catch (Exc_TestClass_excep43_E4) { tb = 133; } } + public void f132(int i) { try { f133(i); } catch (Exc_TestClass_excep43_E4) { tb = 132; } } + public void f131(int i) { try { f132(i); } catch (Exc_TestClass_excep43_E4) { tb = 131; } } + public void f130(int i) { try { f131(i); } catch (Exc_TestClass_excep43_E4) { tb = 130; } } + public void f129(int i) { try { f130(i); } catch (Exc_TestClass_excep43_E4) { tb = 129; } } + public void f128(int i) { try { f129(i); } catch (Exc_TestClass_excep43_E4) { tb = 128; } } + public void f127(int i) { try { f128(i); } catch (Exc_TestClass_excep43_E4) { tb = 127; } } + public void f126(int i) { try { f127(i); } catch (Exc_TestClass_excep43_E4) { tb = 126; } } + public void f125(int i) { try { f126(i); } catch (Exc_TestClass_excep43_E4) { tb = 125; } } + public void f124(int i) { try { f125(i); } catch (Exc_TestClass_excep43_E4) { tb = 124; } } + public void f123(int i) { try { f124(i); } catch (Exc_TestClass_excep43_E4) { tb = 123; } } + public void f122(int i) { try { f123(i); } catch (Exc_TestClass_excep43_E4) { tb = 122; } } + public void f121(int i) { try { f122(i); } catch (Exc_TestClass_excep43_E4) { tb = 121; } } + public void f120(int i) { try { f121(i); } catch (Exc_TestClass_excep43_E4) { tb = 120; } } + public void f119(int i) { try { f120(i); } catch (Exc_TestClass_excep43_E4) { tb = 119; } } + public void f118(int i) { try { f119(i); } catch (Exc_TestClass_excep43_E4) { tb = 118; } } + public void f117(int i) { try { f118(i); } catch (Exc_TestClass_excep43_E4) { tb = 117; } } + public void f116(int i) { try { f117(i); } catch (Exc_TestClass_excep43_E4) { tb = 116; } } + public void f115(int i) { try { f116(i); } catch (Exc_TestClass_excep43_E4) { tb = 115; } } + public void f114(int i) { try { f115(i); } catch (Exc_TestClass_excep43_E4) { tb = 114; } } + public void f113(int i) { try { f114(i); } catch (Exc_TestClass_excep43_E4) { tb = 113; } } + public void f112(int i) { try { f113(i); } catch (Exc_TestClass_excep43_E4) { tb = 112; } } + public void f111(int i) { try { f112(i); } catch (Exc_TestClass_excep43_E4) { tb = 111; } } + public void f110(int i) { try { f111(i); } catch (Exc_TestClass_excep43_E4) { tb = 110; } } + public void f109(int i) { try { f110(i); } catch (Exc_TestClass_excep43_E4) { tb = 109; } } + public void f108(int i) { try { f109(i); } catch (Exc_TestClass_excep43_E4) { tb = 108; } } + public void f107(int i) { try { f108(i); } catch (Exc_TestClass_excep43_E4) { tb = 107; } } + public void f106(int i) { try { f107(i); } catch (Exc_TestClass_excep43_E4) { tb = 106; } } + public void f105(int i) { try { f106(i); } catch (Exc_TestClass_excep43_E4) { tb = 105; } } + public void f104(int i) { try { f105(i); } catch (Exc_TestClass_excep43_E4) { tb = 104; } } + public void f103(int i) { try { f104(i); } catch (Exc_TestClass_excep43_E4) { tb = 103; } } + public void f102(int i) { try { f103(i); } catch (Exc_TestClass_excep43_E4) { tb = 102; } } + public void f101(int i) { try { f102(i); } catch (Exc_TestClass_excep43_E4) { tb = 101; } } + public void f100(int i) { try { f101(i); } catch (Exc_TestClass_excep43_E4) { tb = 100; } } + public void f099(int i) { try { f100(i); } catch (Exc_TestClass_excep43_E4) { tb = 99; } } + public void f098(int i) { try { f099(i); } catch (Exc_TestClass_excep43_E4) { tb = 98; } } + public void f097(int i) { try { f098(i); } catch (Exc_TestClass_excep43_E4) { tb = 97; } } + public void f096(int i) { try { f097(i); } catch (Exc_TestClass_excep43_E4) { tb = 96; } } + public void f095(int i) { try { f096(i); } catch (Exc_TestClass_excep43_E4) { tb = 95; } } + public void f094(int i) { try { f095(i); } catch (Exc_TestClass_excep43_E4) { tb = 94; } } + public void f093(int i) { try { f094(i); } catch (Exc_TestClass_excep43_E4) { tb = 93; } } + public void f092(int i) { try { f093(i); } catch (Exc_TestClass_excep43_E4) { tb = 92; } } + public void f091(int i) { try { f092(i); } catch (Exc_TestClass_excep43_E4) { tb = 91; } } + public void f090(int i) { try { f091(i); } catch (Exc_TestClass_excep43_E4) { tb = 90; } } + public void f089(int i) { try { f090(i); } catch (Exc_TestClass_excep43_E4) { tb = 89; } } + public void f088(int i) { try { f089(i); } catch (Exc_TestClass_excep43_E4) { tb = 88; } } + public void f087(int i) { try { f088(i); } catch (Exc_TestClass_excep43_E4) { tb = 87; } } + public void f086(int i) { try { f087(i); } catch (Exc_TestClass_excep43_E4) { tb = 86; } } + public void f085(int i) { try { f086(i); } catch (Exc_TestClass_excep43_E4) { tb = 85; } } + public void f084(int i) { try { f085(i); } catch (Exc_TestClass_excep43_E4) { tb = 84; } } + public void f083(int i) { try { f084(i); } catch (Exc_TestClass_excep43_E4) { tb = 83; } } + public void f082(int i) { try { f083(i); } catch (Exc_TestClass_excep43_E4) { tb = 82; } } + public void f081(int i) { try { f082(i); } catch (Exc_TestClass_excep43_E4) { tb = 81; } } + public void f080(int i) { try { f081(i); } catch (Exc_TestClass_excep43_E4) { tb = 80; } } + public void f079(int i) { try { f080(i); } catch (Exc_TestClass_excep43_E4) { tb = 79; } } + public void f078(int i) { try { f079(i); } catch (Exc_TestClass_excep43_E4) { tb = 78; } } + public void f077(int i) { try { f078(i); } catch (Exc_TestClass_excep43_E4) { tb = 77; } } + public void f076(int i) { try { f077(i); } catch (Exc_TestClass_excep43_E4) { tb = 76; } } + public void f075(int i) { try { f076(i); } catch (Exc_TestClass_excep43_E4) { tb = 75; } } + public void f074(int i) { try { f075(i); } catch (Exc_TestClass_excep43_E4) { tb = 74; } } + public void f073(int i) { try { f074(i); } catch (Exc_TestClass_excep43_E4) { tb = 73; } } + public void f072(int i) { try { f073(i); } catch (Exc_TestClass_excep43_E4) { tb = 72; } } + public void f071(int i) { try { f072(i); } catch (Exc_TestClass_excep43_E4) { tb = 71; } } + public void f070(int i) { try { f071(i); } catch (Exc_TestClass_excep43_E4) { tb = 70; } } + public void f069(int i) { try { f070(i); } catch (Exc_TestClass_excep43_E4) { tb = 69; } } + public void f068(int i) { try { f069(i); } catch (Exc_TestClass_excep43_E4) { tb = 68; } } + public void f067(int i) { try { f068(i); } catch (Exc_TestClass_excep43_E4) { tb = 67; } } + public void f066(int i) { try { f067(i); } catch (Exc_TestClass_excep43_E4) { tb = 66; } } + public void f065(int i) { try { f066(i); } catch (Exc_TestClass_excep43_E4) { tb = 65; } } + public void f064(int i) { try { f065(i); } catch (Exc_TestClass_excep43_E4) { tb = 64; } } + public void f063(int i) { try { f064(i); } catch (Exc_TestClass_excep43_E4) { tb = 63; } } + public void f062(int i) { try { f063(i); } catch (Exc_TestClass_excep43_E4) { tb = 62; } } + public void f061(int i) { try { f062(i); } catch (Exc_TestClass_excep43_E4) { tb = 61; } } + public void f060(int i) { try { f061(i); } catch (Exc_TestClass_excep43_E4) { tb = 60; } } + public void f059(int i) { try { f060(i); } catch (Exc_TestClass_excep43_E4) { tb = 59; } } + public void f058(int i) { try { f059(i); } catch (Exc_TestClass_excep43_E4) { tb = 58; } } + public void f057(int i) { try { f058(i); } catch (Exc_TestClass_excep43_E4) { tb = 57; } } + public void f056(int i) { try { f057(i); } catch (Exc_TestClass_excep43_E4) { tb = 56; } } + public void f055(int i) { try { f056(i); } catch (Exc_TestClass_excep43_E4) { tb = 55; } } + public void f054(int i) { try { f055(i); } catch (Exc_TestClass_excep43_E4) { tb = 54; } } + public void f053(int i) { try { f054(i); } catch (Exc_TestClass_excep43_E4) { tb = 53; } } + public void f052(int i) { try { f053(i); } catch (Exc_TestClass_excep43_E4) { tb = 52; } } + public void f051(int i) { try { f052(i); } catch (Exc_TestClass_excep43_E4) { tb = 51; } } + public void f050(int i) { try { f051(i); } catch (Exc_TestClass_excep43_E4) { tb = 50; } } + public void f049(int i) { try { f050(i); } catch (Exc_TestClass_excep43_E4) { tb = 49; } } + public void f048(int i) { try { f049(i); } catch (Exc_TestClass_excep43_E4) { tb = 48; } } + public void f047(int i) { try { f048(i); } catch (Exc_TestClass_excep43_E4) { tb = 47; } } + public void f046(int i) { try { f047(i); } catch (Exc_TestClass_excep43_E4) { tb = 46; } } + public void f045(int i) { try { f046(i); } catch (Exc_TestClass_excep43_E4) { tb = 45; } } + public void f044(int i) { try { f045(i); } catch (Exc_TestClass_excep43_E4) { tb = 44; } } + public void f043(int i) { try { f044(i); } catch (Exc_TestClass_excep43_E4) { tb = 43; } } + public void f042(int i) { try { f043(i); } catch (Exc_TestClass_excep43_E4) { tb = 42; } } + public void f041(int i) { try { f042(i); } catch (Exc_TestClass_excep43_E4) { tb = 41; } } + public void f040(int i) { try { f041(i); } catch (Exc_TestClass_excep43_E4) { tb = 40; } } + public void f039(int i) { try { f040(i); } catch (Exc_TestClass_excep43_E4) { tb = 39; } } + public void f038(int i) { try { f039(i); } catch (Exc_TestClass_excep43_E4) { tb = 38; } } + public void f037(int i) { try { f038(i); } catch (Exc_TestClass_excep43_E4) { tb = 37; } } + public void f036(int i) { try { f037(i); } catch (Exc_TestClass_excep43_E4) { tb = 36; } } + public void f035(int i) { try { f036(i); } catch (Exc_TestClass_excep43_E4) { tb = 35; } } + public void f034(int i) { try { f035(i); } catch (Exc_TestClass_excep43_E4) { tb = 34; } } + public void f033(int i) { try { f034(i); } catch (Exc_TestClass_excep43_E4) { tb = 33; } } + public void f032(int i) { try { f033(i); } catch (Exc_TestClass_excep43_E4) { tb = 32; } } + public void f031(int i) { try { f032(i); } catch (Exc_TestClass_excep43_E4) { tb = 31; } } + public void f030(int i) { try { f031(i); } catch (Exc_TestClass_excep43_E4) { tb = 30; } } + public void f029(int i) { try { f030(i); } catch (Exc_TestClass_excep43_E4) { tb = 29; } } + public void f028(int i) { try { f029(i); } catch (Exc_TestClass_excep43_E4) { tb = 28; } } + public void f027(int i) { try { f028(i); } catch (Exc_TestClass_excep43_E4) { tb = 27; } } + public void f026(int i) { try { f027(i); } catch (Exc_TestClass_excep43_E4) { tb = 26; } } + public void f025(int i) { try { f026(i); } catch (Exc_TestClass_excep43_E4) { tb = 25; } } + public void f024(int i) { try { f025(i); } catch (Exc_TestClass_excep43_E4) { tb = 24; } } + public void f023(int i) { try { f024(i); } catch (Exc_TestClass_excep43_E4) { tb = 23; } } + public void f022(int i) { try { f023(i); } catch (Exc_TestClass_excep43_E4) { tb = 22; } } + public void f021(int i) { try { f022(i); } catch (Exc_TestClass_excep43_E4) { tb = 21; } } + public void f020(int i) { try { f021(i); } catch (Exc_TestClass_excep43_E4) { tb = 20; } } + public void f019(int i) { try { f020(i); } catch (Exc_TestClass_excep43_E4) { tb = 19; } } + public void f018(int i) { try { f019(i); } catch (Exc_TestClass_excep43_E4) { tb = 18; } } + public void f017(int i) { try { f018(i); } catch (Exc_TestClass_excep43_E4) { tb = 17; } } + public void f016(int i) { try { f017(i); } catch (Exc_TestClass_excep43_E4) { tb = 16; } } + public void f015(int i) { try { f016(i); } catch (Exc_TestClass_excep43_E4) { tb = 15; } } + public void f014(int i) { try { f015(i); } catch (Exc_TestClass_excep43_E4) { tb = 14; } } + public void f013(int i) { try { f014(i); } catch (Exc_TestClass_excep43_E4) { tb = 13; } } + public void f012(int i) { try { f013(i); } catch (Exc_TestClass_excep43_E4) { tb = 12; } } + public void f011(int i) { try { f012(i); } catch (Exc_TestClass_excep43_E4) { tb = 11; } } + public void f010(int i) { try { f011(i); } catch (Exc_TestClass_excep43_E4) { tb = 10; } } + public void f009(int i) { try { f010(i); } catch (Exc_TestClass_excep43_E4) { tb = 9; } } + public void f008(int i) { try { f009(i); } catch (Exc_TestClass_excep43_E4) { tb = 8; } } + public void f007(int i) { try { f008(i); } catch (Exc_TestClass_excep43_E4) { tb = 7; } } + public void f006(int i) { try { f007(i); } catch (Exc_TestClass_excep43_E4) { tb = 6; } } + public void f005(int i) { try { f006(i); } catch (Exc_TestClass_excep43_E4) { tb = 5; } } + public void f004(int i) { try { f005(i); } catch (Exc_TestClass_excep43_E4) { tb = 4; } } + public void f003(int i) { try { f004(i); } catch (Exc_TestClass_excep43_E4) { tb = 3; } } + public void f002(int i) { try { f003(i); } catch (Exc_TestClass_excep43_E4) { tb = 2; } } + public void f001(int i) { try { f002(i); } catch (Exc_TestClass_excep43_E4) { tb = 1; } } + } + public class Exc_TestClass_excep43 + { + private static int retval = 1; + public static int Main_old() + { + Exc_TestClass_excep43_F f = new Exc_TestClass_excep43_F(); + try + { + f.f001(1); + } + catch (Exc_TestClass_excep43_E1) + { + retval += Exc_TestClass_excep43_F.tb; + } + catch (Exc_TestClass_excep43_E3) + { + retval = 0; + } + + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval=={0 }" + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + */ + + public class Exc_TestClass_excep56 + { + private static int retval = 2; + public static int Main_old() + { + try + { + Debug.WriteLine("In try block."); + } + finally + { + goto lab1; //This should cause an error + Debug.WriteLine("Entering finally block"); + retval -= 1; + lab1: + retval -= 2; + } + Debug.WriteLine("Ready to return."); + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval=={0} " + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep57 + { + private static int retval = 5; + public static int Main_old() + { + try + { + Debug.WriteLine("In try block."); + } + finally + { + goto lab4; //This should cause an error + Debug.WriteLine("Entering finally block"); + retval -= 1; + lab1: + retval -= 2; + lab2: + retval -= 3; + lab3: + retval -= 4; + lab4: + retval -= 5; + } + Debug.WriteLine("Ready to return."); + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval=={0}" + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep58_E1 : Exception + { + public Exc_TestClass_excep58_E1(String str) + : base(str) + { } + } + public class Exc_TestClass_excep58 + { + private static int retval = 0x07; + public static int Main_old() + { + try + { + try + { + Debug.WriteLine("In try block, ready to throw."); + throw new Exc_TestClass_excep58_E1("An exception has occurred"); + } + //catch (Exception s){ + // Debug.WriteLine ("In catch block."); + // Debug.WriteLine (s.Message); + //} + finally + { + Debug.WriteLine("In inner finally block"); + retval ^= 0x01; + } + } + catch (Exc_TestClass_excep58_E1 s) + { + if (0 == (retval & 0x01)) + retval ^= 0x02; + Debug.WriteLine("In catch block."); + Debug.WriteLine(s.Message); + } + catch (Exception) + { + Debug.WriteLine("FAIL -- Should not enter catch (Exception) block"); + retval++; + } + finally + { + Debug.WriteLine("In outer finally block"); + if (0 == (retval & 0x03)) + retval ^= 0x04; + } + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval == " + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep59_E1 : Exception + { + public Exc_TestClass_excep59_E1(String str) + : base(str) + { } + } + public class Exc_TestClass_excep59 + { + private static int retval = 0x0F; + public static int Main_old() + { + try + { + try + { + try + { + Debug.WriteLine("In try block, ready to throw."); + throw new Exc_TestClass_excep59_E1("An exception has occurred"); + } + //catch (Exception s) + //{ + // Debug.WriteLine ("In catch block."); + // Debug.WriteLine (s.Message); + //} + finally + { + Debug.WriteLine("In innermost finally block"); + retval ^= 0x01; + } + } + //catch (Exception s){ + // Debug.WriteLine ("In catch block."); + // Debug.WriteLine (s.Message); + //} + finally + { + Debug.WriteLine("In middle finally block"); + if (0 == (retval & 0x01)) + retval ^= 0x02; + } + } + catch (Exc_TestClass_excep59_E1 s) + { + if (0 == (retval & 0x03)) + retval ^= 0x04; + Debug.WriteLine("In catch block."); + Debug.WriteLine(s.Message); + } + catch (Exception) + { + Debug.WriteLine("FAIL -- Should not enter catch (Exception) block"); + retval++; + } + finally + { + Debug.WriteLine("In outer finally block"); + if (0 == (retval & 0x07)) + retval ^= 0x08; + } + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval == " + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep60_E1 : Exception + { + public Exc_TestClass_excep60_E1(String str) + : base(str) + { } + } + public class Exc_TestClass_excep60 + { + private static int retval = 0x3F; + public static int Main_old() + { + try + { + try + { + try + { + Debug.WriteLine("In try block, ready to throw."); + throw new Exc_TestClass_excep60_E1("An exception has occurred"); + } + //catch (Exception s) + //{ + // Debug.WriteLine ("In catch block."); + // Debug.WriteLine (s.Message); + //} + finally + { + Debug.WriteLine("In innermost finally block"); + retval ^= 0x01; + } + } + catch (Exc_TestClass_excep60_E1 s) + { + Debug.WriteLine("In catch block."); + Debug.WriteLine(s.Message); + if (0 == (retval & 0x01)) + retval ^= 0x02; + throw new Exception("Setting InnerException", s); + } + finally + { + Debug.WriteLine("In middle finally block"); + if (0 == (retval & 0x03)) + retval ^= 0x04; + } + } + catch (Exception s) + { + if (0 == (retval & 0x07)) + retval ^= 0x08; + Debug.WriteLine("In outer catch block."); + if (typeof(Exc_TestClass_excep60_E1) == s.InnerException.GetType()) + retval ^= 0x10; + } + //catch (Exception) { + // Debug.WriteLine ("FAIL -- Should not enter catch (Exception) block"); + // retval ++; + //} + finally + { + Debug.WriteLine("In outer finally block"); + if (0 == (retval & 0x1F)) + retval ^= 0x20; + } + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval == 0x" + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep61_E1 : Exception + { + public Exc_TestClass_excep61_E1(String str) + : base(str) + { } + } + public class Exc_TestClass_excep61 + { + private static int retval = 0x7F; + public static int Main_old() + { + try + { + try + { + try + { + Debug.WriteLine("In try block, ready to throw."); + throw new Exc_TestClass_excep61_E1("An exception has occurred"); + } + catch (Exc_TestClass_excep61_E1 s) + { + Debug.WriteLine("In catch block."); + Debug.WriteLine(s.Message); + throw new Exception("Setting InnerException #1", s); + } + finally + { + Debug.WriteLine("In innermost finally block"); + retval ^= 0x01; + } + } + catch (Exception s) + { + Debug.WriteLine("In catch block."); + Debug.WriteLine(s.Message); + if (0 == (retval & 0x01)) + retval ^= 0x02; + throw new Exception("Setting InnerException 2", s); + } + finally + { + Debug.WriteLine("In middle finally block"); + if (0 == (retval & 0x03)) + retval ^= 0x04; + } + } + catch (Exception s) + { + if (0 == (retval & 0x07)) + retval ^= 0x08; + Debug.WriteLine("In outer catch block."); + if (typeof(Exception) == s.InnerException.GetType()) + retval ^= 0x10; + if (typeof(Exc_TestClass_excep61_E1) == s.InnerException.InnerException.GetType()) + retval ^= 0x20; + } + //catch (Exception) { + // Debug.WriteLine ("FAIL -- Should not enter catch (Exception) block"); + // retval ++; + //} + finally + { + Debug.WriteLine("In outer finally block"); + if (0 == (retval & 0x1F)) + retval ^= 0x40; + } + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval == 0x" + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep62_E1 : Exception + { + public Exc_TestClass_excep62_E1(String str) + : base(str) + { } + } + public class Exc_TestClass_excep62 + { + private static int retval = 0x03; + public static int Main_old() + { + try + { + Debug.WriteLine("In try block, ready to throw."); + throw new Exception("An exception has occurred"); + } + catch (Exception s) + { + if (null == s.InnerException) + retval ^= 0x01; + } + //catch (Exception) { + // Debug.WriteLine ("FAIL -- Should not enter catch (Exception) block"); + // retval ++; + //} + finally + { + Debug.WriteLine("In outer finally block"); + if (0 == (retval & 0x01)) + retval ^= 0x02; + } + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval == 0x" + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep63_E1 : Exception + { + public Exc_TestClass_excep63_E1(String str) + : base(str) + { } + } + public class Exc_TestClass_excep63_SC + { + static Exc_TestClass_excep63_SC() + { + InitHelper(); + } + public static void InitHelper() + { + Debug.WriteLine("This is bug number: 21724 Resolved By Design."); + Debug.WriteLine("This is bug number: 21724 If a catch search reaches a static ctor then a Exception is thrown at the point of static ctor invocation. The inner exception is the original exception. "); + Debug.WriteLine("When this bug is fixed change remove the comment below."); + + throw new Exception("Exception in InitHelper"); + } + } + public class Exc_TestClass_excep63 + { + private static int retval = 0x01; + public static int Main_old() + { + try + { + Exc_TestClass_excep63_SC sc = new Exc_TestClass_excep63_SC(); + } + catch (Exception t) + { + if (t.InnerException.GetType() == typeof(Exception)) + retval ^= 0x01; + } + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval == 0x" + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Exc_TestClass_excep64_E1 : Exception + { + public Exc_TestClass_excep64_E1(String str) + : base(str) + { } + } + public class Exc_TestClass_excep64_SC + { + public static int StaticInt = InitHelper(); + public static int InitHelper() + { + Debug.WriteLine("This is bug number: 21724 Resolved By Design."); + Debug.WriteLine("This is bug number: 21724 If a catch search reaches a static ctor then a Exception is thrown at the point of static ctor invocation. The inner exception is the original exception. "); + Debug.WriteLine("When this bug is fixed change this back to pass and chang eht known failure to fail"); + + throw new Exception("Exception in InitHelper"); + return 0; + } + } + public class Exc_TestClass_excep64 + { + private static int retval = 0x01; + public static int Main_old() + { + try + { + Exc_TestClass_excep64_SC sc = new Exc_TestClass_excep64_SC(); + } + catch (Exception t) + { + if (t.InnerException.GetType() == typeof(Exception)) + retval ^= 0x01; + } + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval == 0x" + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + /* + public class Exc_TestClass_excep65_E1 : Exception + { + public Exc_TestClass_excep65_E1(String str) + : base(str) + { } + } + public class Exc_TestClass_excep65_C1 + { + public static int retval = 0x01; + ~Exc_TestClass_excep65_C1() + { + retval ^= 0x01; + Debug.WriteLine("retval == " + retval.ToString()); + Debug.WriteLine("In// Exc_TestClass_excep65_C1()"); + } + } + public class Exc_TestClass_excep65_C2 : Exc_TestClass_excep65_C1 + { + } + public class Derived : Exc_TestClass_excep65_C2 + { + ~Derived() + { + Debug.WriteLine("In ~Derived()"); + DtorHelper(); + Debug.WriteLine("FAIL, did not exit dtor when exception thrown"); + Exc_TestClass_excep65_C1.retval |= 0x02; + } + public static void DtorHelper() + { + throw new Exception("Exception in DtorHelper"); + } + } + public class Exc_TestClass_excep65 + { + public static int Main_old() + { + Derived sc = new Derived(); + sc = null; + Microsoft.SPOT.Debug.GC(true); + System.Threading.Thread.Sleep(100); + return Exc_TestClass_excep65_C1.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + */ + + } +} diff --git a/Tests/NFUnitTestException/nano.runsettings b/Tests/NFUnitTestException/nano.runsettings new file mode 100644 index 00000000..fa881e3a --- /dev/null +++ b/Tests/NFUnitTestException/nano.runsettings @@ -0,0 +1,14 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + False + + \ No newline at end of file diff --git a/Tests/NFUnitTestException/packages.config b/Tests/NFUnitTestException/packages.config new file mode 100644 index 00000000..1adb9284 --- /dev/null +++ b/Tests/NFUnitTestException/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 0b9d08ee..ae376e03 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -39,6 +39,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestInterface", "Test EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestArithmetic", "Tests\NFUnitTestArithmetic\NFUnitTestArithmetic.nfproj", "{6B598666-54C8-4705-A7FB-B2BC75CA00BC}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestException", "Tests\NFUnitTestException\NFUnitTestException.nfproj", "{BDB01244-6EAD-476E-9084-27D0D249E9A6}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -119,6 +121,12 @@ Global {6B598666-54C8-4705-A7FB-B2BC75CA00BC}.Release|Any CPU.ActiveCfg = Release|Any CPU {6B598666-54C8-4705-A7FB-B2BC75CA00BC}.Release|Any CPU.Build.0 = Release|Any CPU {6B598666-54C8-4705-A7FB-B2BC75CA00BC}.Release|Any CPU.Deploy.0 = Release|Any CPU + {BDB01244-6EAD-476E-9084-27D0D249E9A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BDB01244-6EAD-476E-9084-27D0D249E9A6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BDB01244-6EAD-476E-9084-27D0D249E9A6}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {BDB01244-6EAD-476E-9084-27D0D249E9A6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BDB01244-6EAD-476E-9084-27D0D249E9A6}.Release|Any CPU.Build.0 = Release|Any CPU + {BDB01244-6EAD-476E-9084-27D0D249E9A6}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -135,6 +143,7 @@ Global {E0538338-9941-410C-B8C8-0C928F26F8A7} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {89C61C69-A9F3-43BF-B501-5913BE8FE829} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {6B598666-54C8-4705-A7FB-B2BC75CA00BC} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {BDB01244-6EAD-476E-9084-27D0D249E9A6} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From b66f3f0635bae306dea7da3ce4de62c5a60dc310 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 18:03:25 +0300 Subject: [PATCH 35/55] Adding enum tests --- Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj | 60 + .../NFUnitTestEnum/Properties/AssemblyInfo.cs | 33 + Tests/NFUnitTestEnum/UnitTestEnumTests.cs | 2648 +++++++++++++++++ Tests/NFUnitTestEnum/nano.runsettings | 14 + Tests/NFUnitTestEnum/packages.config | 5 + nanoFramework.CoreLibrary.sln | 9 + 6 files changed, 2769 insertions(+) create mode 100644 Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj create mode 100644 Tests/NFUnitTestEnum/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestEnum/UnitTestEnumTests.cs create mode 100644 Tests/NFUnitTestEnum/nano.runsettings create mode 100644 Tests/NFUnitTestEnum/packages.config diff --git a/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj b/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj new file mode 100644 index 00000000..3f9ca252 --- /dev/null +++ b/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj @@ -0,0 +1,60 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 75f5abae-8dee-4f8b-8941-d8e0dfcb1b2e + Library + Properties + 512 + NFUnitTestEnum + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestEnum/Properties/AssemblyInfo.cs b/Tests/NFUnitTestEnum/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestEnum/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestEnum/UnitTestEnumTests.cs b/Tests/NFUnitTestEnum/UnitTestEnumTests.cs new file mode 100644 index 00000000..7a05724c --- /dev/null +++ b/Tests/NFUnitTestEnum/UnitTestEnumTests.cs @@ -0,0 +1,2648 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestEnum +{ + [TestClass] + public class UnitTestEnumTests + { + [TestMethod] + public void Enum_enum01_Test() + { + Debug.WriteLine("Make sure that a basic enum declaration, definition, and assignment work."); + Assert.True(Enum_TestClass_enum01.testMethod()); + } + [TestMethod] + public void Enum_enum02_Test() + { + Debug.WriteLine("Make sure that basic enum-with-base-type declarations, definitions, and assignments work."); + Assert.True(Enum_TestClass_enum02.testMethod()); + } + [TestMethod] + public void Enum_enum07_Test() + { + Debug.WriteLine("Make sure that basic enum-with-base-type declarations, definitions, and assignments work."); + Assert.True(Enum_TestClass_enum07.testMethod()); + } + [TestMethod] + public void Enum_enum09_Test() + { + Debug.WriteLine("Make sure that basic enum-with-base-type declarations, definitions, and assignments work."); + Assert.True(Enum_TestClass_enum09.testMethod()); + } + [TestMethod] + public void Enum_enum10_Test() + { + Debug.WriteLine("Make sure that basic enum-with-base-type declarations, definitions, and assignments work."); + Assert.True(Enum_TestClass_enum10.testMethod()); + } + [TestMethod] + public void Enum_enum11_Test() + { + Debug.WriteLine("Make sure that basic enum-with-base-type declarations, definitions, and assignments work."); + Assert.True(Enum_TestClass_enum11.testMethod()); + } + [TestMethod] + public void Enum_enum27_Test() + { + Debug.WriteLine("Check that enumerator values are initialized as expected"); + Assert.True(Enum_TestClass_enum27.testMethod()); + } + [TestMethod] + public void Enum_enum28_Test() + { + Debug.WriteLine("Check that enumerator values are initialized as expected"); + Assert.True(Enum_TestClass_enum28.testMethod()); + } + [TestMethod] + public void Enum_enum29_Test() + { + Debug.WriteLine("The values of the enumerators need not be distinct"); + Assert.True(Enum_TestClass_enum29.testMethod()); + } + [TestMethod] + public void Enum_enum30_Test() + { + Debug.WriteLine("Check the point of definition of an enumerator"); + Assert.True(Enum_TestClass_enum30.testMethod()); + } + [TestMethod] + public void Enum_enum31_Test() + { + Debug.WriteLine("Check the point of definition of an enumerator"); + Assert.True(Enum_TestClass_enum31.testMethod()); + } + [TestMethod] + public void Enum_enum33_Test() + { + Debug.WriteLine("Enums obey local scope rules. An enum of the same name may be defined in an inner scope."); + Assert.True(Enum_TestClass_enum33.testMethod()); + } + [TestMethod] + public void Enum_enum34_Test() + { + Debug.WriteLine("Enums can be converted to int."); + Assert.True(Enum_TestClass_enum34.testMethod()); + } + [TestMethod] + public void Enum_enum35_Test() + { + Debug.WriteLine("If no enumerator-definitions with = appear, then the"); + Debug.WriteLine(" values of the corresponding constants begin at zero and"); + Assert.True(Enum_TestClass_enum35.testMethod()); + } + [TestMethod] + public void Enum_enum36_Test() + { + Debug.WriteLine("If no enumerator-definitions with = appear, then the"); + Debug.WriteLine(" values of the corresponding constants begin at zero and"); + Assert.True(Enum_TestClass_enum36.testMethod()); + } + [TestMethod] + public void Enum_enum37_Test() + { + Debug.WriteLine("If no enumerator-definitions with = appear, then the"); + Debug.WriteLine(" values of the corresponding constants begin at zero and"); + Assert.True(Enum_TestClass_enum37.testMethod()); + } + [TestMethod] + public void Enum_enum38_Test() + { + Debug.WriteLine("Enums can be declared in any scopt that a class can be declared in."); + Assert.True(Enum_TestClass_enum38.testMethod()); + } + [TestMethod] + public void Enum_enum39_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum39.testMethod()); + } + [TestMethod] + public void Enum_enum40_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum40.testMethod()); + } + [TestMethod] + public void Enum_enum41_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum41.testMethod()); + } + [TestMethod] + public void Enum_enum42_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum42.testMethod()); + } + [TestMethod] + public void Enum_enum43_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum43.testMethod()); + } + [TestMethod] + public void Enum_enum43u_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum43u.testMethod()); + } + [TestMethod] + public void Enum_enum44_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum44.testMethod()); + } + [TestMethod] + public void Enum_enum45_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum45.testMethod()); + } + [TestMethod] + public void Enum_enum46_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum46.testMethod()); + } + [TestMethod] + public void Enum_enum46u_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum46u.testMethod()); + } + [TestMethod] + public void Enum_enum47_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum47.testMethod()); + } + [TestMethod] + public void Enum_enum47u_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum47u.testMethod()); + } + [TestMethod] + public void Enum_enum48_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum48.testMethod()); + } + [TestMethod] + public void Enum_enum48u_Test() + { + Debug.WriteLine("If the constant-expression initilizing an enumerator is of integral type,"); + Debug.WriteLine("it must be within the range of values that can be represented by the underlying type."); + Assert.True(Enum_TestClass_enum48u.testMethod()); + } + [TestMethod] + public void Enum_enum54_Test() + { + Debug.WriteLine("++ and -- operators can be used with objects of enumeration type. Check postfix form."); + Assert.True(Enum_TestClass_enum54.testMethod()); + } + [TestMethod] + public void Enum_enum55_Test() + { + Debug.WriteLine("++ and -- operators can be used with objects of enumeration type. Check postfix form."); + Assert.True(Enum_TestClass_enum55.testMethod()); + } + [TestMethod] + public void Enum_enum56_Test() + { + Debug.WriteLine("++ and -- operators can be used with objects of enumeration type. Check postfix form."); + Assert.True(Enum_TestClass_enum56.testMethod()); + } + [TestMethod] + public void Enum_enum57_Test() + { + Debug.WriteLine("++ and -- operators can be used with objects of enumeration type. Check postfix form."); + Assert.True(Enum_TestClass_enum57.testMethod()); + } + [TestMethod] + public void Enum_enum58_Test() + { + Debug.WriteLine("Bitwise operators AND, OR, XOR, and NOT can be used with objects of enumeration type."); + + Assert.True(Enum_TestClass_enum58.testMethod()); + } + [TestMethod] + public void Enum_enum62_Test() + { + Assert.True(Enum_TestClass_enum62.testMethod()); + } + [TestMethod] + public void Enum_enum63_Test() + { + Debug.WriteLine("Make sure that a basic enum declaration, definition, and assignment work."); + Assert.True(Enum_TestClass_enum63.testMethod()); + } + [TestMethod] + public void Enum_enum64_Test() + { + Debug.WriteLine("Make sure that a basic enum declaration, definition, and assignment work."); + Assert.True(Enum_TestClass_enum64.testMethod()); + } + [TestMethod] + public void Enum_enum65_Test() + { + Debug.WriteLine("Make sure that a basic enum declaration, definition, and assignment work."); + Assert.True(Enum_TestClass_enum65.testMethod()); + } + [TestMethod] + public void Enum_enum66_Test() + { + Debug.WriteLine("Make sure that a basic enum declaration, definition, and assignment work."); + Assert.True(Enum_TestClass_enum66.testMethod()); + } + [TestMethod] + public void Enum_enum67_Test() + { + Debug.WriteLine("Make sure that a basic enum declaration, definition, and assignment work."); + Assert.True(Enum_TestClass_enum67.testMethod()); + } + [TestMethod] + public void Enum_enum68_Test() + { + Debug.WriteLine("Make sure that a basic enum declaration, definition, and assignment work."); + Assert.True(Enum_TestClass_enum68.testMethod()); + } + [TestMethod] + public void Enum_enum69_Test() + { + Debug.WriteLine("Make sure that a basic enum declaration, definition, and assignment work."); + Assert.True(Enum_TestClass_enum69.testMethod()); + } + [TestMethod] + public void Enum_enum70_Test() + { + Debug.WriteLine("Make sure that a basic enum declaration, definition, and assignment work."); + Assert.True(Enum_TestClass_enum70.testMethod()); + } + [TestMethod] + public void Enum_enum71_Test() + { + Debug.WriteLine("Make sure that a basic enum declaration, definition, and assignment work."); + Debug.WriteLine("This test is expeced to fail"); + Assert.False(Enum_TestClass_enum71.testMethod()); + } + [TestMethod] + public void Enum_enum72_Test() + { + Debug.WriteLine("Enum_TestClass_? bitwise and on enums"); + Assert.True(Enum_TestClass_enum72.testMethod()); + } + [TestMethod] + public void Enum_enum73_Test() + { + Debug.WriteLine("Enum_TestClass_? bitwise or on enums"); + Assert.True(Enum_TestClass_enum73.testMethod()); + } + [TestMethod] + public void Enum_enum74_Test() + { + Debug.WriteLine("Enum_TestClass_? bitwise xor on enums"); + Assert.True(Enum_TestClass_enum74.testMethod()); + } + [TestMethod] + public void Enum_enum75_Test() + { + Debug.WriteLine("Enum_TestClass_? bitwise not on enums"); + Assert.True(Enum_TestClass_enum75.testMethod()); + } + [TestMethod] + public void Enum_enum77_Test() + { + Debug.WriteLine("Enum_TestClass_? bitwise not on enums"); + Assert.True(Enum_TestClass_enum77.testMethod()); + } + [TestMethod] + public void Enum_enum78_Test() + { + Assert.True(Enum_TestClass_enum78.testMethod()); + } + [TestMethod] + public void Enum_enum83_Test() + { + Debug.WriteLine("Enum member list can end with a comma"); + Assert.True(Enum_TestClass_enum83.testMethod()); + } + [TestMethod] + public void Enum_enum86_Test() + { + Debug.WriteLine("[Access] modifiers of an enum declaration have the same meaning"); + Debug.WriteLine("as those of a class declaration."); + Assert.True(Enum_TestClass_enum86.testMethod()); + } + [TestMethod] + public void Enum_enum93_Test() + { + Debug.WriteLine("Example from Enums chapter in CLS"); + Assert.True(Enum_TestClass_enum93.testMethod()); + } + [TestMethod] + public void Enum_enum94_Test() + { + Debug.WriteLine("...any value of the underlying type of an enum can be cast to the enum type."); + Assert.True(Enum_TestClass_enum94.testMethod()); + } + [TestMethod] + public void Enum_enum_flags01_Test() + { + Debug.WriteLine("check FlagAttribute with enum"); + Assert.True(Enum_TestClass_enum_flags01.testMethod()); + } + [TestMethod] + public void Enum_enum_flags02_Test() + { + Debug.WriteLine("check FlagAttribute with enum"); + Assert.True(Enum_TestClass_enum_flags02.testMethod()); + } + [TestMethod] + public void Enum_enum_flags03_Test() + { + Debug.WriteLine("check FlagAttribute with enum"); + Assert.True(Enum_TestClass_enum_flags03.testMethod()); + } + [TestMethod] + public void Enum_enum_flags04_Test() + { + Debug.WriteLine("check FlagAttribute with enum with conversion"); + Assert.True(Enum_TestClass_enum_flags04.testMethod()); + } + + //Compiled Test Cases + public class Enum_TestClass_enum01 + { + public enum e1 { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + e1 v_e1 = e1.two; + Debug.WriteLine("v_e1 == "); + Debug.WriteLine(v_e1.ToString()); + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum02 + { + public enum e1 : long { one = 1, two = 2, three = 3 }; + public enum e2 : int { one = 1, two = 2, three = 3 }; + public enum e3 : short { one = 1, two = 2, three = 3 }; + public enum e4 : byte { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + e1 v_e1 = e1.two; + e2 v_e2 = e2.two; + e3 v_e3 = e3.two; + e4 v_e4 = e4.two; + Debug.WriteLine("v_e1 == "); + Debug.WriteLine(v_e1.ToString()); + Debug.WriteLine("v_e2 == "); + Debug.WriteLine(v_e2.ToString()); + Debug.WriteLine("v_e3 == "); + Debug.WriteLine(v_e3.ToString()); + Debug.WriteLine("v_e4 == "); + Debug.WriteLine(v_e4.ToString()); + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public class Enum_TestClass_enum07 + { + public enum e1 { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int i = (int)e1.two; + Debug.WriteLine("i == "); + Debug.WriteLine(i.ToString()); + return i - 2; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + + public class Enum_TestClass_enum09 + { + public enum e1 : int { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int i = (int)e1.two; + Debug.WriteLine("i == "); + Debug.WriteLine(i.ToString()); + return i - 2; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + + public class Enum_TestClass_enum10 + { + public enum e1 : short { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int i = (short)e1.two; + Debug.WriteLine("i == "); + Debug.WriteLine(i.ToString()); + return i - 2; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + + public class Enum_TestClass_enum11 + { + public enum e1 : byte { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int i = (byte)e1.two; + Debug.WriteLine("i == "); + Debug.WriteLine(i.ToString()); + return i - 2; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public class Enum_TestClass_enum27 + { + public static int retval = 0; + + public enum Enum_TestClass_enum27_Enum1 { zero, one, three = 3, four, minus7 = -7, minus6 }; + public static int Main_old() + { + if ((int)Enum_TestClass_enum27_Enum1.zero != 0) + { + Debug.WriteLine("Enumerator zero = "); + Debug.WriteLine((Enum_TestClass_enum27_Enum1.zero).ToString()); + retval |= 0x01; + } + + if ((int)Enum_TestClass_enum27_Enum1.one != 1) + { + Debug.WriteLine("Enumerator one = "); + Debug.WriteLine((Enum_TestClass_enum27_Enum1.one).ToString()); + retval |= 0x02; + } + + if ((int)Enum_TestClass_enum27_Enum1.three != 3) + { + Debug.WriteLine("Enumerator three = "); + Debug.WriteLine((Enum_TestClass_enum27_Enum1.three).ToString()); + retval |= 0x04; + } + + if ((int)Enum_TestClass_enum27_Enum1.four != 4) + { + Debug.WriteLine("Enumerator four = "); + Debug.WriteLine((Enum_TestClass_enum27_Enum1.four).ToString()); + retval |= 0x08; + } + + if ((int)Enum_TestClass_enum27_Enum1.minus7 != -7) + { + Debug.WriteLine("Enumerator minus7 = "); + Debug.WriteLine((Enum_TestClass_enum27_Enum1.minus7).ToString()); + retval |= 0x10; + } + + if ((int)Enum_TestClass_enum27_Enum1.minus6 != -6) + { + Debug.WriteLine("Enumerator minus6 = "); + Debug.WriteLine((Enum_TestClass_enum27_Enum1.minus6).ToString()); + retval |= 0x20; + } + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public class Enum_TestClass_enum28 + { + public static int retval = 0; + + public enum Enum_TestClass_enum28_Enum1 { zero, one, three = 3, four, minus7 = -7, minus6 }; + public static int Main_old() + { + if (!((Enum_TestClass_enum28_Enum1)Enum_TestClass_enum28_Enum1.zero == (Enum_TestClass_enum28_Enum1)0)) + { + Debug.WriteLine("Enumerator zero = "); + Debug.WriteLine((Enum_TestClass_enum28_Enum1.zero).ToString()); + retval |= 0x01; + } + + if (Enum_TestClass_enum28_Enum1.one != (Enum_TestClass_enum28_Enum1)1) + { + Debug.WriteLine("Enumerator one = "); + Debug.WriteLine((Enum_TestClass_enum28_Enum1.one).ToString()); + retval |= 0x02; + } + + if (Enum_TestClass_enum28_Enum1.three != (Enum_TestClass_enum28_Enum1)3) + { + Debug.WriteLine("Enumerator three = "); + Debug.WriteLine((Enum_TestClass_enum28_Enum1.three).ToString()); + retval |= 0x04; + } + + if (Enum_TestClass_enum28_Enum1.four != (Enum_TestClass_enum28_Enum1)4) + { + Debug.WriteLine("Enumerator four = "); + Debug.WriteLine((Enum_TestClass_enum28_Enum1.four).ToString()); + retval |= 0x08; + } + + if (Enum_TestClass_enum28_Enum1.minus7 != (Enum_TestClass_enum28_Enum1)(-7)) + { + Debug.WriteLine("Enumerator minus7 = "); + Debug.WriteLine((Enum_TestClass_enum28_Enum1.minus7).ToString()); + retval |= 0x10; + } + + if (Enum_TestClass_enum28_Enum1.minus6 != (Enum_TestClass_enum28_Enum1)(-6)) + { + Debug.WriteLine("Enumerator minus6 = "); + Debug.WriteLine((Enum_TestClass_enum28_Enum1.minus6).ToString()); + retval |= 0x20; + } + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public class Enum_TestClass_enum29 + { + public static int retval = 0; + + public enum Enum_TestClass_enum29_Enum1 { zero = 0, one = 0 }; + public static int Main_old() + { + if (Enum_TestClass_enum29_Enum1.one != Enum_TestClass_enum29_Enum1.zero) + { + Debug.WriteLine("Enumerator zero and one not synonymous"); + retval = 1; + } + + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public class Enum_TestClass_enum30 + { + public static int retval = 0; + + public enum Enum_TestClass_enum30_Enum1 { zero, three = (int)zero + 3 }; + public static int Main_old() + { + if ((int)Enum_TestClass_enum30_Enum1.three != 3) + { + Debug.WriteLine("Enumerator zero and one not synonymous"); + retval = 1; + } + + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public class Enum_TestClass_enum31 + { + public static int retval = 0; + + public enum Enum_TestClass_enum31_Enum1 { }; + public static int Main_old() + { + Debug.WriteLine("PASS"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + enum Enum_TestClass_enum33_Enum1 { yes = 1, no = yes - 1 }; + + public class Enum_TestClass_enum33 + { + public static int retval = 0; + + public enum Enum_TestClass_enum33_Enum1 { yes = 1, no = yes - 1 }; + public static int Main_old() + { + Debug.WriteLine("PASS"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public class Enum_TestClass_enum34 + { + public static int retval = 0; + public enum color { red, yellow, green = 20, blue }; + + public static int Main_old() + { + int i = (int)color.yellow; //ok: yellow converted to int value 1 + //by integral promotion" + Debug.WriteLine("PASS"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public class Enum_TestClass_enum35 + { + public static int retval = 0x3F; + public enum E { a, b, c, d = 7, e, f = 3 }; + + public static int Main_old() + { + if ((int)E.a == 0) + retval -= 0x20; + if ((int)E.b == 1) + retval -= 0x10; + if ((int)E.c == 2) + retval -= 0x08; + if ((int)E.d == 7) + retval -= 0x04; + if ((int)E.e == 8) + retval -= 0x02; + if ((int)E.f == 3) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public class Enum_TestClass_enum36_Enum + { + public enum E { a, b, c, d = 7, e, f = 3 }; + } + + public class Enum_TestClass_enum36 + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum36_Enum.E.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum36_Enum.E.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum36_Enum.E.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum36_Enum.E.d == 7) + retval -= 0x04; + if ((int)Enum_TestClass_enum36_Enum.E.e == 8) + retval -= 0x02; + if ((int)Enum_TestClass_enum36_Enum.E.f == 3) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public class Enum_TestClass_enum37_Enum + { + public enum E { a, b, c, d = 7, e, f = 3 }; + } + + public class Enum_TestClass_enum37 + { + public static int retval = 0x3F; + + public static int Main_old() + { + Enum_TestClass_enum37_Enum f = new Enum_TestClass_enum37_Enum(); + + if ((int)Enum_TestClass_enum37_Enum.E.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum37_Enum.E.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum37_Enum.E.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum37_Enum.E.d == 7) + retval -= 0x04; + if ((int)Enum_TestClass_enum37_Enum.E.e == 8) + retval -= 0x02; + if ((int)Enum_TestClass_enum37_Enum.E.f == 3) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum38_Enum1 { a, b, c, d = 7, e, f = 3 }; + public class Enum_TestClass_enum38_Enum + { + public enum E { a, b, c, d = 7, e, f = 3 }; + } + + public class Enum_TestClass_enum38 + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum38_Enum1.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum38_Enum1.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum38_Enum1.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum38_Enum1.d == 7) + retval -= 0x04; + if ((int)Enum_TestClass_enum38_Enum1.e == 8) + retval -= 0x02; + if ((int)Enum_TestClass_enum38_Enum1.f == 3) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum39_Enum1 : byte { a, b, c, d = 253, e, f }; + public class Enum_TestClass_enum39 + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum39_Enum1.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum39_Enum1.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum39_Enum1.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum39_Enum1.d == 253) + retval -= 0x04; + if ((int)Enum_TestClass_enum39_Enum1.e == 254) + retval -= 0x02; + if ((int)Enum_TestClass_enum39_Enum1.f == 255) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum40_Enum1 : short { a, b, c, d = 32765, e, f }; + public class Enum_TestClass_enum40 + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum40_Enum1.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum40_Enum1.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum40_Enum1.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum40_Enum1.d == 32765) + retval -= 0x04; + if ((int)Enum_TestClass_enum40_Enum1.e == 32766) + retval -= 0x02; + if ((int)Enum_TestClass_enum40_Enum1.f == 32767) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum41_Enum1 : int { a, b, c, d = (int)0x7FFFFFFD, e, f }; + public class Enum_TestClass_enum41 + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum41_Enum1.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum41_Enum1.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum41_Enum1.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum41_Enum1.d == 0x7FFFFFFD) + retval -= 0x04; + if ((int)Enum_TestClass_enum41_Enum1.e == 0x7FFFFFFE) + retval -= 0x02; + if ((int)Enum_TestClass_enum41_Enum1.f == 0x7FFFFFFF) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum42_Enum1 : long { a, b, c, d = (long)0x7FFFFFFFFFFFFFFDL, e, f }; + public class Enum_TestClass_enum42 + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((long)Enum_TestClass_enum42_Enum1.a == 0) + retval -= 0x20; + if ((long)Enum_TestClass_enum42_Enum1.b == 1) + retval -= 0x10; + if ((long)Enum_TestClass_enum42_Enum1.c == 2) + retval -= 0x08; + if ((long)Enum_TestClass_enum42_Enum1.d == 0x7FFFFFFFFFFFFFFD) + retval -= 0x04; + if ((long)Enum_TestClass_enum42_Enum1.e == 0x7FFFFFFFFFFFFFFE) + retval -= 0x02; + if ((long)Enum_TestClass_enum42_Enum1.f == 0x7FFFFFFFFFFFFFFF) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum43_Enum1 : int { a, b, c, d = (int)0x7FFFFFFD, e, f }; + public enum Enum_TestClass_enum43_Enum2 : short { a = (short)Enum_TestClass_enum43_Enum1.a, b, c, d, e, f }; + public class Enum_TestClass_enum43 + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum43_Enum2.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum43_Enum2.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum43_Enum2.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum43_Enum2.d == 3) + retval -= 0x04; + if ((int)Enum_TestClass_enum43_Enum2.e == 4) + retval -= 0x02; + if ((int)Enum_TestClass_enum43_Enum2.f == 5) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum43u_Enum1 : int { a, b, c, d = (int)0x7FFFFFFD, e, f }; + public enum Enum_TestClass_enum43u_Enum2 : ushort { a = (ushort)Enum_TestClass_enum43u_Enum1.a, b, c, d, e, f }; + public class Enum_TestClass_enum43u + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum43u_Enum2.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum43u_Enum2.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum43u_Enum2.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum43u_Enum2.d == 3) + retval -= 0x04; + if ((int)Enum_TestClass_enum43u_Enum2.e == 4) + retval -= 0x02; + if ((int)Enum_TestClass_enum43u_Enum2.f == 5) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum44_Enum1 : int { a, b, c, d = (int)0x7FFFFFFD, e, f }; + public enum Enum_TestClass_enum44_Enum2 : byte { a = Enum_TestClass_enum44_Enum1.a, b, c, d, e, f }; + public class Enum_TestClass_enum44 + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum44_Enum2.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum44_Enum2.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum44_Enum2.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum44_Enum2.d == 3) + retval -= 0x04; + if ((int)Enum_TestClass_enum44_Enum2.e == 4) + retval -= 0x02; + if ((int)Enum_TestClass_enum44_Enum2.f == 5) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum45_Enum1 : long { a, b, c, d = (long)0x7FFFFFFFFFFFFFFDL, e, f }; + public enum Enum_TestClass_enum45_Enum2 : int { a = (int)Enum_TestClass_enum45_Enum1.a, b, c, d, e, f }; + public class Enum_TestClass_enum45 + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum45_Enum2.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum45_Enum2.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum45_Enum2.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum45_Enum2.d == 3) + retval -= 0x04; + if ((int)Enum_TestClass_enum45_Enum2.e == 4) + retval -= 0x02; + if ((int)Enum_TestClass_enum45_Enum2.f == 5) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum46_Enum2 : short { a = Enum_TestClass_enum46_Enum1.a, b, c, d, e, f }; + public enum Enum_TestClass_enum46_Enum1 : int { a, b, c, d = (int)0x7FFFFFFD, e, f }; + public class Enum_TestClass_enum46 + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum46_Enum2.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum46_Enum2.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum46_Enum2.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum46_Enum2.d == 3) + retval -= 0x04; + if ((int)Enum_TestClass_enum46_Enum2.e == 4) + retval -= 0x02; + if ((int)Enum_TestClass_enum46_Enum2.f == 5) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum46u_Enum1 : uint { a, b, c, d = 0xFFFFFFFD, e, f }; + public class Enum_TestClass_enum46u + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum46u_Enum1.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum46u_Enum1.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum46u_Enum1.c == 2) + retval -= 0x08; + if ((uint)Enum_TestClass_enum46u_Enum1.d == 0xFFFFFFFD) + retval -= 0x04; + if ((uint)Enum_TestClass_enum46u_Enum1.e == 0xFFFFFFFE) + retval -= 0x02; + if ((uint)Enum_TestClass_enum46u_Enum1.f == 0xFFFFFFFF) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum47_Enum2 : byte { a = Enum_TestClass_enum47_Enum1.a, b, c, d, e, f }; + public enum Enum_TestClass_enum47_Enum1 : int { a, b, c, d = (int)0x7FFFFFFD, e, f }; + public class Enum_TestClass_enum47 + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum47_Enum2.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum47_Enum2.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum47_Enum2.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum47_Enum2.d == 3) + retval -= 0x04; + if ((int)Enum_TestClass_enum47_Enum2.e == 4) + retval -= 0x02; + if ((int)Enum_TestClass_enum47_Enum2.f == 5) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum47u_Enum2 : sbyte { a = (sbyte)Enum_TestClass_enum47u_Enum1.a, b, c, d, e, f }; + public enum Enum_TestClass_enum47u_Enum1 : int { a, b, c, d = 0x7FFFFFFD, e, f }; + public class Enum_TestClass_enum47u + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum47u_Enum2.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum47u_Enum2.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum47u_Enum2.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum47u_Enum2.d == 3) + retval -= 0x04; + if ((int)Enum_TestClass_enum47u_Enum2.e == 4) + retval -= 0x02; + if ((int)Enum_TestClass_enum47u_Enum2.f == 5) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum48_Enum2 : int { a = (int)Enum_TestClass_enum48_Enum1.a, b, c, d, e, f }; + public enum Enum_TestClass_enum48_Enum1 : long { a, b, c, d = (long)0x7FFFFFFFFFFFFFFDL, e, f }; + public class Enum_TestClass_enum48 + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((int)Enum_TestClass_enum48_Enum2.a == 0) + retval -= 0x20; + if ((int)Enum_TestClass_enum48_Enum2.b == 1) + retval -= 0x10; + if ((int)Enum_TestClass_enum48_Enum2.c == 2) + retval -= 0x08; + if ((int)Enum_TestClass_enum48_Enum2.d == 3) + retval -= 0x04; + if ((int)Enum_TestClass_enum48_Enum2.e == 4) + retval -= 0x02; + if ((int)Enum_TestClass_enum48_Enum2.f == 5) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL\nretval == "); + Debug.WriteLine((retval).ToString()); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum48u_Enum2 : int { a = (int)Enum_TestClass_enum48u_Enum1.a, b, c, d, e, f }; + public enum Enum_TestClass_enum48u_Enum1 : ulong { a, b, c, d = 0xFFFFFFFFFFFFFFFDL, e, f }; + public class Enum_TestClass_enum48u + { + public static int retval = 0x3F; + + public static int Main_old() + { + if ((ulong)Enum_TestClass_enum48u_Enum1.a == 0) + retval -= 0x20; + if ((ulong)Enum_TestClass_enum48u_Enum1.b == 1) + retval -= 0x10; + if ((ulong)Enum_TestClass_enum48u_Enum1.c == 2) + retval -= 0x08; + if ((ulong)Enum_TestClass_enum48u_Enum1.d == 0xFFFFFFFFFFFFFFFDL) + retval -= 0x04; + if ((ulong)Enum_TestClass_enum48u_Enum1.e == 0xFFFFFFFFFFFFFFFEL) + retval -= 0x02; + if ((ulong)Enum_TestClass_enum48u_Enum1.f == 0xFFFFFFFFFFFFFFFFL) + retval -= 0x01; + + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL\nretval == " + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum54_Enum1 { a, b, c, d, e, f }; + public enum Enum_TestClass_enum54_Enum2 : byte { a, b, c, d, e, f }; + public enum Enum_TestClass_enum54_Enum2sb : sbyte { a, b, c, d, e, f }; + public enum Enum_TestClass_enum54_Enum3 : short { a, b, c, d, e, f }; + public enum Enum_TestClass_enum54_Enum3us : ushort { a, b, c, d, e, f }; + public enum Enum_TestClass_enum54_Enum4 : int { a, b, c, d, e, f }; + public enum Enum_TestClass_enum54_Enum4ui : uint { a, b, c, d, e, f }; + public enum Enum_TestClass_enum54_Enum5 : long { a, b, c, d, e, f }; + public enum Enum_TestClass_enum54_Enum5ul : ulong { a, b, c, d, e, f }; + public class Enum_TestClass_enum54 + { + public static int retval = 0x7FFFFFF; + + public static int Main_old() + { + Enum_TestClass_enum54_Enum1 e1 = Enum_TestClass_enum54_Enum1.a; + e1++; e1++; e1++; e1--; e1--; e1--; e1++; e1--; e1--; e1++; e1++; e1++; e1++; e1++; e1++; e1++; + if ((int)e1 == (int)Enum_TestClass_enum54_Enum1.f + 1) + retval -= 0x01; + e1--; e1--; e1--; e1--; e1--; e1--; + if (e1 == Enum_TestClass_enum54_Enum1.a) + retval -= 0x02; + e1--; + if ((int)e1 == (int)Enum_TestClass_enum54_Enum1.a - 1) + retval -= 0x04; + + Enum_TestClass_enum54_Enum2 e2 = Enum_TestClass_enum54_Enum2.a; + e2++; e2++; e2++; e2--; e2--; e2--; e2++; e2--; e2--; e2++; e2++; e2++; e2++; e2++; e2++; e2++; + if ((int)e2 == (int)Enum_TestClass_enum54_Enum2.f + 1) + retval -= 0x08; + e2--; e2--; e2--; e2--; e2--; e2--; + if (e2 == Enum_TestClass_enum54_Enum2.a) + retval -= 0x10; + e2--; + if ((int)e2 == 255) //This has to be a manifest constant because byte is UNSIGNED + retval -= 0x20; + + Enum_TestClass_enum54_Enum2sb e2sb = Enum_TestClass_enum54_Enum2sb.a; + e2sb++; e2sb++; e2sb++; e2sb--; e2sb--; e2sb--; e2sb++; e2sb--; e2sb--; e2sb++; e2sb++; e2sb++; e2sb++; e2sb++; e2sb++; e2sb++; + if ((int)e2sb == (int)Enum_TestClass_enum54_Enum2sb.f + 1) + retval -= 0x8000; + e2sb--; e2sb--; e2sb--; e2sb--; e2sb--; e2sb--; + if (e2sb == Enum_TestClass_enum54_Enum2sb.a) + retval -= 0x10000; + e2sb--; + if ((int)e2sb == -1) + retval -= 0x20000; + + Enum_TestClass_enum54_Enum3 e3 = Enum_TestClass_enum54_Enum3.a; + e3++; e3++; e3++; e3--; e3--; e3--; e3++; e3--; e3--; e3++; e3++; e3++; e3++; e3++; e3++; e3++; + if ((int)e3 == (int)Enum_TestClass_enum54_Enum3.f + 1) + retval -= 0x40; + e3--; e3--; e3--; e3--; e3--; e3--; + if (e3 == Enum_TestClass_enum54_Enum3.a) + retval -= 0x80; + e3--; + if ((int)e3 == (int)Enum_TestClass_enum54_Enum3.a - 1) + retval -= 0x100; + + Enum_TestClass_enum54_Enum3us e3us = Enum_TestClass_enum54_Enum3us.a; + e3us++; e3us++; e3us++; e3us--; e3us--; e3us--; e3us++; e3us--; e3us--; e3us++; e3us++; e3us++; e3us++; e3us++; e3us++; e3us++; + if ((int)e3us == (int)Enum_TestClass_enum54_Enum3us.f + 1) + retval -= 0x40000; + e3us--; e3us--; e3us--; e3us--; e3us--; e3us--; + if (e3us == Enum_TestClass_enum54_Enum3us.a) + retval -= 0x80000; + e3us--; + if ((int)e3us == 65535) + retval -= 0x100000; + + Enum_TestClass_enum54_Enum4 e4 = Enum_TestClass_enum54_Enum4.a; + e4++; e4++; e4++; e4--; e4--; e4--; e4++; e4--; e4--; e4++; e4++; e4++; e4++; e4++; e4++; e4++; + if ((int)e4 == (int)Enum_TestClass_enum54_Enum4.f + 1) + retval -= 0x200; + e4--; e4--; e4--; e4--; e4--; e4--; + if (e4 == Enum_TestClass_enum54_Enum4.a) + retval -= 0x400; + e4--; + if ((int)e4 == (int)Enum_TestClass_enum54_Enum4.a - 1) + retval -= 0x800; + + Enum_TestClass_enum54_Enum4ui e4ui = Enum_TestClass_enum54_Enum4ui.a; + e4ui++; e4ui++; e4ui++; e4ui--; e4ui--; e4ui--; e4ui++; e4ui--; e4ui--; e4ui++; e4ui++; e4ui++; e4ui++; e4ui++; e4ui++; e4ui++; + if ((int)e4ui == (int)Enum_TestClass_enum54_Enum4ui.f + 1) + retval -= 0x200000; + e4ui--; e4ui--; e4ui--; e4ui--; e4ui--; e4ui--; + if (e4ui == Enum_TestClass_enum54_Enum4ui.a) + retval -= 0x400000; + e4ui--; + if ((int)e4ui == (int)Enum_TestClass_enum54_Enum4ui.a - 1) + retval -= 0x800000; + + Enum_TestClass_enum54_Enum5 e5 = Enum_TestClass_enum54_Enum5.a; + e5++; e5++; e5++; e5--; e5--; e5--; e5++; e5--; e5--; e5++; e5++; e5++; e5++; e5++; e5++; e5++; + if ((int)e5 == (int)Enum_TestClass_enum54_Enum5.f + 1) + retval -= 0x01000; + e5--; e5--; e5--; e5--; e5--; e5--; + if (e5 == Enum_TestClass_enum54_Enum5.a) + retval -= 0x02000; + e5--; + if ((int)e5 == (int)Enum_TestClass_enum54_Enum5.a - 1) + retval -= 0x04000; + Enum_TestClass_enum54_Enum5ul e5ul = Enum_TestClass_enum54_Enum5ul.a; + e5ul++; e5ul++; e5ul++; e5ul--; e5ul--; e5ul--; e5ul++; e5ul--; e5ul--; e5ul++; e5ul++; e5ul++; e5ul++; e5ul++; e5ul++; e5ul++; + if ((int)e5ul == (int)Enum_TestClass_enum54_Enum5ul.f + 1) + retval -= 0x01000000; + e5ul--; e5ul--; e5ul--; e5ul--; e5ul--; e5ul--; + if (e5ul == Enum_TestClass_enum54_Enum5ul.a) + retval -= 0x02000000; + e5ul--; + if ((int)e5ul == (int)Enum_TestClass_enum54_Enum5ul.a - 1) + retval -= 0x04000000; + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, 0x{0:X} " + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum55_Enum1 { a, b, c, d, e, f }; + public enum Enum_TestClass_enum55_Enum2 : byte { a, b, c, d, e, f }; + public enum Enum_TestClass_enum55_Enum2sb : sbyte { a, b, c, d, e, f }; + public enum Enum_TestClass_enum55_Enum3 : short { a, b, c, d, e, f }; + public enum Enum_TestClass_enum55_Enum3us : ushort { a, b, c, d, e, f }; + public enum Enum_TestClass_enum55_Enum4 : int { a, b, c, d, e, f }; + public enum Enum_TestClass_enum55_Enum4ui : uint { a, b, c, d, e, f }; + public enum Enum_TestClass_enum55_Enum5 : long { a, b, c, d, e, f }; + public enum Enum_TestClass_enum55_Enum5ul : ulong { a, b, c, d, e, f }; + public class Enum_TestClass_enum55 + { + public static int retval = 0x7FFFFFF; + + public static int Main_old() + { + Enum_TestClass_enum55_Enum1 e1 = Enum_TestClass_enum55_Enum1.a; + e1++; e1++; e1++; --e1; --e1; --e1; e1++; --e1; --e1; e1++; e1++; e1++; e1++; e1++; e1++; + if ((int)e1-- == (int)Enum_TestClass_enum55_Enum1.f) + retval -= 0x01; + --e1; --e1; --e1; --e1; + if (e1 == Enum_TestClass_enum55_Enum1.a) + retval -= 0x02; + --e1; + if ((int)e1 == (int)Enum_TestClass_enum55_Enum1.a - 1) + retval -= 0x04; + + Enum_TestClass_enum55_Enum2 e2 = Enum_TestClass_enum55_Enum2.a; + e2++; e2++; e2++; --e2; --e2; --e2; e2++; --e2; --e2; e2++; e2++; e2++; e2++; e2++; e2++; e2++; + if ((int)e2-- == (int)Enum_TestClass_enum55_Enum2.f + 1) + retval -= 0x08; + --e2; --e2; --e2; --e2; + if (e2 == Enum_TestClass_enum55_Enum2.b) + retval -= 0x10; + --e2; --e2; + if ((int)e2 == 255) //This has to be a manifest constant because byte is UNSIGNED + retval -= 0x20; + + Enum_TestClass_enum55_Enum2sb e2sb = Enum_TestClass_enum55_Enum2sb.a; + e2sb++; e2sb++; e2sb++; --e2sb; --e2sb; --e2sb; e2sb++; --e2sb; --e2sb; e2sb++; e2sb++; e2sb++; e2sb++; e2sb++; e2sb++; e2sb++; + if ((int)e2sb-- == (int)Enum_TestClass_enum55_Enum2sb.f + 1) + retval -= 0x8000; + --e2sb; --e2sb; --e2sb; --e2sb; + if (e2sb == Enum_TestClass_enum55_Enum2sb.b) + retval -= 0x10000; + --e2sb; --e2sb; + if ((int)e2sb == -1) + retval -= 0x20000; + + Enum_TestClass_enum55_Enum3 e3 = Enum_TestClass_enum55_Enum3.a; + e3++; e3++; e3++; --e3; --e3; --e3; e3++; --e3; --e3; e3++; e3++; e3++; e3++; e3++; e3++; e3++; + if ((int)e3 == (int)Enum_TestClass_enum55_Enum3.f + 1) + retval -= 0x40; + --e3; --e3; --e3; --e3; --e3; --e3; + if (e3 == Enum_TestClass_enum55_Enum3.a) + retval -= 0x80; + --e3; + if ((int)e3 == (int)Enum_TestClass_enum55_Enum3.a - 1) + retval -= 0x100; + + Enum_TestClass_enum55_Enum3us e3us = Enum_TestClass_enum55_Enum3us.a; + e3us++; e3us++; e3us++; --e3us; --e3us; --e3us; e3us++; --e3us; --e3us; e3us++; e3us++; e3us++; e3us++; e3us++; e3us++; e3us++; + if ((int)e3us == (int)Enum_TestClass_enum55_Enum3us.f + 1) + retval -= 0x40000; + --e3us; --e3us; --e3us; --e3us; --e3us; --e3us; + if (e3us == Enum_TestClass_enum55_Enum3us.a) + retval -= 0x80000; + --e3us; + if ((int)e3us == 65535) + retval -= 0x100000; + + Enum_TestClass_enum55_Enum4 e4 = Enum_TestClass_enum55_Enum4.a; + e4++; e4++; e4++; --e4; --e4; --e4; e4++; --e4; --e4; e4++; e4++; e4++; e4++; e4++; e4++; e4++; + if ((int)e4-- == (int)Enum_TestClass_enum55_Enum4.f + 1) + retval -= 0x200; + --e4; --e4; --e4; --e4; --e4; + if (e4 == Enum_TestClass_enum55_Enum4.a) + retval -= 0x400; + --e4; + if ((int)e4 == (int)Enum_TestClass_enum55_Enum4.a - 1) + retval -= 0x800; + + Enum_TestClass_enum55_Enum4ui e4ui = Enum_TestClass_enum55_Enum4ui.a; + e4ui++; e4ui++; e4ui++; --e4ui; --e4ui; --e4ui; e4ui++; --e4ui; --e4ui; e4ui++; e4ui++; e4ui++; e4ui++; e4ui++; e4ui++; e4ui++; + if ((int)e4ui-- == (int)Enum_TestClass_enum55_Enum4ui.f + 1) + retval -= 0x200000; + --e4ui; --e4ui; --e4ui; --e4ui; --e4ui; + if (e4ui == Enum_TestClass_enum55_Enum4ui.a) + retval -= 0x400000; + --e4ui; + if ((int)e4ui == (int)Enum_TestClass_enum55_Enum4ui.a - 1) + retval -= 0x800000; + + Enum_TestClass_enum55_Enum5 e5 = Enum_TestClass_enum55_Enum5.a; + e5++; e5++; e5++; --e5; --e5; --e5; e5++; --e5; --e5; e5++; e5++; e5++; e5++; e5++; e5++; e5++; + if ((int)e5-- == (int)Enum_TestClass_enum55_Enum5.f + 1) + retval -= 0x1000; + --e5; --e5; --e5; --e5; --e5; + if (e5-- == Enum_TestClass_enum55_Enum5.a) + retval -= 0x2000; + --e5; + if ((int)e5 == (int)Enum_TestClass_enum55_Enum5.a - 2) + retval -= 0x4000; + Enum_TestClass_enum55_Enum5ul e5ul = Enum_TestClass_enum55_Enum5ul.a; + e5ul++; e5ul++; e5ul++; --e5ul; --e5ul; --e5ul; e5ul++; --e5ul; --e5ul; e5ul++; e5ul++; e5ul++; e5ul++; e5ul++; e5ul++; e5ul++; + if ((int)e5ul-- == (int)Enum_TestClass_enum55_Enum5ul.f + 1) + retval -= 0x1000000; + --e5ul; --e5ul; --e5ul; --e5ul; --e5ul; + if (e5ul-- == Enum_TestClass_enum55_Enum5ul.a) + retval -= 0x2000000; + --e5ul; + if ((int)e5ul == (int)Enum_TestClass_enum55_Enum5ul.a - 2) + retval -= 0x4000000; + Debug.WriteLine((retval).ToString()); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum56_Enum1 { a, b, c, d, e, f }; + public enum Enum_TestClass_enum56_Enum2 : byte { a, b, c, d, e, f }; + public enum Enum_TestClass_enum56_Enum3 : short { a, b, c, d, e, f }; + public enum Enum_TestClass_enum56_Enum4 : int { a, b, c, d, e, f }; + public enum Enum_TestClass_enum56_Enum5 : long { a, b, c, d, e, f }; + public enum Enum_TestClass_enum56_Enum2sb : sbyte { a, b, c, d, e, f }; + public enum Enum_TestClass_enum56_Enum3us : ushort { a, b, c, d, e, f }; + public enum Enum_TestClass_enum56_Enum4ui : uint { a, b, c, d, e, f }; + public enum Enum_TestClass_enum56_Enum5ul : ulong { a, b, c, d, e, f }; + public class Enum_TestClass_enum56 + { + public static int retval = 0x7FFFFFF; + + public static int Main_old() + { + Enum_TestClass_enum56_Enum1 e1 = Enum_TestClass_enum56_Enum1.a; + ++e1; e1++; ++e1; --e1; --e1; --e1; e1++; --e1; --e1; ++e1; e1++; ++e1; ++e1; ++e1; ++e1; ++e1; + if ((int)e1 == (int)Enum_TestClass_enum56_Enum1.f + 1) + retval -= 0x01; + --e1; --e1; --e1; --e1; + if (e1 == Enum_TestClass_enum56_Enum1.c) + retval -= 0x02; + --e1; --e1; --e1; + if ((int)e1 == (int)Enum_TestClass_enum56_Enum1.a - 1) + retval -= 0x04; + + Enum_TestClass_enum56_Enum2 e2 = Enum_TestClass_enum56_Enum2.a; + ++e2; e2++; ++e2; --e2; --e2; --e2; e2++; --e2; --e2; ++e2; e2++; ++e2; ++e2; ++e2; ++e2; ++e2; + if ((int)e2 == (int)Enum_TestClass_enum56_Enum2.f + 1) + retval -= 0x08; + --e2; --e2; --e2; --e2; + if (e2 == Enum_TestClass_enum56_Enum2.c) + retval -= 0x10; + --e2; --e2; --e2; + if ((int)e2 == 255) //This has to be a manifest constant because byte is UNSIGNED + retval -= 0x20; + + Enum_TestClass_enum56_Enum3 e3 = Enum_TestClass_enum56_Enum3.a; + ++e3; e3++; ++e3; --e3; --e3; --e3; e3++; --e3; --e3; ++e3; e3++; ++e3; ++e3; ++e3; ++e3; ++e3; + if ((int)e3 == (int)Enum_TestClass_enum56_Enum3.f + 1) + retval -= 0x40; + --e3; --e3; --e3; --e3; + if (e3 == Enum_TestClass_enum56_Enum3.c) + retval -= 0x80; + --e3; --e3; --e3; + if ((int)e3 == (int)Enum_TestClass_enum56_Enum3.a - 1) + retval -= 0x100; + + Enum_TestClass_enum56_Enum4 e4 = Enum_TestClass_enum56_Enum4.a; + ++e4; e4++; ++e4; --e4; --e4; --e4; e4++; --e4; --e4; ++e4; e4++; ++e4; ++e4; ++e4; ++e4; ++e4; + if ((int)e4 == (int)Enum_TestClass_enum56_Enum4.f + 1) + retval -= 0x200; + --e4; --e4; --e4; --e4; + if (e4 == Enum_TestClass_enum56_Enum4.c) + retval -= 0x400; + --e4; --e4; --e4; + if ((int)e4 == (int)Enum_TestClass_enum56_Enum4.a - 1) + retval -= 0x800; + + Enum_TestClass_enum56_Enum5 e5 = Enum_TestClass_enum56_Enum5.a; + ++e5; e5++; ++e5; --e5; --e5; --e5; e5++; --e5; --e5; ++e5; e5++; ++e5; ++e5; ++e5; ++e5; ++e5; + if ((int)e5 == (int)Enum_TestClass_enum56_Enum5.f + 1) + retval -= 0x1000; + --e5; --e5; --e5; --e5; + if (e5 == Enum_TestClass_enum56_Enum5.c) + retval -= 0x2000; + --e5; --e5; --e5; + if ((int)e5 == (int)Enum_TestClass_enum56_Enum5.a - 1) + retval -= 0x4000; + + Enum_TestClass_enum56_Enum2sb e2sb = Enum_TestClass_enum56_Enum2sb.a; + ++e2sb; e2sb++; ++e2sb; --e2sb; --e2sb; --e2sb; e2sb++; --e2sb; --e2sb; ++e2sb; e2sb++; ++e2sb; ++e2sb; ++e2sb; ++e2sb; ++e2sb; + if ((int)e2sb == (int)Enum_TestClass_enum56_Enum2sb.f + 1) + retval -= 0x8000; + --e2sb; --e2sb; --e2sb; --e2sb; + if (e2sb == Enum_TestClass_enum56_Enum2sb.c) + retval -= 0x10000; + --e2sb; --e2sb; --e2sb; + if ((int)e2sb == -1) //This has to be a manifest constant because byte is UNSIGNED + retval -= 0x20000; + + Enum_TestClass_enum56_Enum3us e3us = Enum_TestClass_enum56_Enum3us.a; + ++e3us; e3us++; ++e3us; --e3us; --e3us; --e3us; e3us++; --e3us; --e3us; ++e3us; e3us++; ++e3us; ++e3us; ++e3us; ++e3us; ++e3us; + if ((int)e3us == (int)Enum_TestClass_enum56_Enum3us.f + 1) + retval -= 0x40000; + --e3us; --e3us; --e3us; --e3us; + if (e3us == Enum_TestClass_enum56_Enum3us.c) + retval -= 0x80000; + --e3us; --e3us; --e3us; + if ((int)e3us == 65535) + retval -= 0x100000; + + Enum_TestClass_enum56_Enum4ui e4ui = Enum_TestClass_enum56_Enum4ui.a; + ++e4ui; e4ui++; ++e4ui; --e4ui; --e4ui; --e4ui; e4ui++; --e4ui; --e4ui; ++e4ui; e4ui++; ++e4ui; ++e4ui; ++e4ui; ++e4ui; ++e4ui; + if ((int)e4ui == (int)Enum_TestClass_enum56_Enum4ui.f + 1) + retval -= 0x200000; + --e4ui; --e4ui; --e4ui; --e4ui; + if (e4ui == Enum_TestClass_enum56_Enum4ui.c) + retval -= 0x400000; + --e4ui; --e4ui; --e4ui; + if ((int)e4ui == (int)Enum_TestClass_enum56_Enum4ui.a - 1) + retval -= 0x800000; + + Enum_TestClass_enum56_Enum5ul e5ul = Enum_TestClass_enum56_Enum5ul.a; + ++e5ul; e5ul++; ++e5ul; --e5ul; --e5ul; --e5ul; e5ul++; --e5ul; --e5ul; ++e5ul; e5ul++; ++e5ul; ++e5ul; ++e5ul; ++e5ul; ++e5ul; + if ((int)e5ul == (int)Enum_TestClass_enum56_Enum5ul.f + 1) + retval -= 0x1000000; + --e5ul; --e5ul; --e5ul; --e5ul; + if (e5ul == Enum_TestClass_enum56_Enum5ul.c) + retval -= 0x2000000; + --e5ul; --e5ul; --e5ul; + if ((int)e5ul == (int)Enum_TestClass_enum56_Enum5ul.a - 1) + retval -= 0x4000000; + + Debug.WriteLine((retval).ToString()); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum57_Enum1 { a, b, c, d, e, f }; + public enum Enum_TestClass_enum57_Enum2 : byte { a, b, c, d, e, f }; + public enum Enum_TestClass_enum57_Enum3 : short { a, b, c, d, e, f }; + public enum Enum_TestClass_enum57_Enum4 : int { a, b, c, d, e, f }; + public enum Enum_TestClass_enum57_Enum5 : long { a, b, c, d, e, f }; + public enum Enum_TestClass_enum57_Enum2sb : sbyte { a, b, c, d, e, f }; + public enum Enum_TestClass_enum57_Enum3us : ushort { a, b, c, d, e, f }; + public enum Enum_TestClass_enum57_Enum4ui : uint { a, b, c, d, e, f }; + public enum Enum_TestClass_enum57_Enum5ul : ulong { a, b, c, d, e, f }; + public class Enum_TestClass_enum57 + { + public static int retval = 0x7FFFFFF; + + public static int Main_old() + { + Enum_TestClass_enum57_Enum1 e1 = Enum_TestClass_enum57_Enum1.a; + ++e1; e1++; ++e1; e1--; e1--; e1--; e1++; e1--; e1--; ++e1; e1++; ++e1; ++e1; ++e1; e1++; ++e1; + if ((int)e1-- == (int)Enum_TestClass_enum57_Enum1.f + 1) + retval -= 0x01; + e1--; e1--; e1--; + if (e1++ == Enum_TestClass_enum57_Enum1.c) + retval -= 0x02; + e1--; e1--; e1--; e1--; + if ((int)e1 == (int)Enum_TestClass_enum57_Enum1.a - 1) + retval -= 0x04; + + Enum_TestClass_enum57_Enum2 e2 = Enum_TestClass_enum57_Enum2.a; + ++e2; e2++; ++e2; e2--; e2--; e2--; e2++; e2--; e2--; ++e2; e2++; ++e2; ++e2; ++e2; e2++; ++e2; + if ((int)e2-- == (int)Enum_TestClass_enum57_Enum1.f + 1) + retval -= 0x08; + e2--; e2--; e2--; + if (e2++ == Enum_TestClass_enum57_Enum2.c) + retval -= 0x10; + e2--; e2--; e2--; e2--; + if ((int)e2 == 255) //This has to be a manifest constant because byte is UNSIGNED + retval -= 0x20; + + Enum_TestClass_enum57_Enum3 e3 = Enum_TestClass_enum57_Enum3.a; + ++e3; e3++; ++e3; e3--; e3--; e3--; e3++; e3--; e3--; ++e3; e3++; ++e3; ++e3; ++e3; e3++; ++e3; + if ((int)e3-- == (int)Enum_TestClass_enum57_Enum3.f + 1) + retval -= 0x40; + e3--; e3--; e3--; + if (e3++ == Enum_TestClass_enum57_Enum3.c) + retval -= 0x80; + e3--; e3--; e3--; e3--; + if ((int)e3 == (int)Enum_TestClass_enum57_Enum3.a - 1) + retval -= 0x100; + + Enum_TestClass_enum57_Enum4 e4 = Enum_TestClass_enum57_Enum4.a; + ++e4; e4++; ++e4; e4--; e4--; e4--; e4++; e4--; e4--; ++e4; e4++; ++e4; ++e4; ++e4; e4++; ++e4; + if ((int)e4-- == (int)Enum_TestClass_enum57_Enum4.f + 1) + retval -= 0x200; + e4--; e4--; e4--; + if (e4++ == Enum_TestClass_enum57_Enum4.c) + retval -= 0x400; + e4--; e4--; e4--; e4--; + if ((int)e4 == (int)Enum_TestClass_enum57_Enum4.a - 1) + retval -= 0x800; + + Enum_TestClass_enum57_Enum5 e5 = Enum_TestClass_enum57_Enum5.a; + ++e5; e5++; ++e5; e5--; e5--; e5--; e5++; e5--; e5--; ++e5; e5++; ++e5; ++e5; ++e5; e5++; ++e5; + if ((int)e5-- == (int)Enum_TestClass_enum57_Enum5.f + 1) + retval -= 0x1000; + e5--; e5--; e5--; + if (e5++ == Enum_TestClass_enum57_Enum5.c) + retval -= 0x2000; + e5--; e5--; e5--; e5--; + if ((int)e5 == (int)Enum_TestClass_enum57_Enum5.a - 1) + retval -= 0x4000; + Enum_TestClass_enum57_Enum2sb e2sb = Enum_TestClass_enum57_Enum2sb.a; + ++e2sb; e2sb++; ++e2sb; e2sb--; e2sb--; e2sb--; e2sb++; e2sb--; e2sb--; ++e2sb; e2sb++; ++e2sb; ++e2sb; ++e2sb; e2sb++; ++e2sb; + if ((int)e2sb-- == (int)Enum_TestClass_enum57_Enum1.f + 1) + retval -= 0x8000; + e2sb--; e2sb--; e2sb--; + if (e2sb++ == Enum_TestClass_enum57_Enum2sb.c) + retval -= 0x10000; + e2sb--; e2sb--; e2sb--; e2sb--; + if ((int)e2sb == -1) + retval -= 0x20000; + + Enum_TestClass_enum57_Enum3us e3us = Enum_TestClass_enum57_Enum3us.a; + ++e3us; e3us++; ++e3us; e3us--; e3us--; e3us--; e3us++; e3us--; e3us--; ++e3us; e3us++; ++e3us; ++e3us; ++e3us; e3us++; ++e3us; + if ((int)e3us-- == (int)Enum_TestClass_enum57_Enum3us.f + 1) + retval -= 0x40000; + e3us--; e3us--; e3us--; + if (e3us++ == Enum_TestClass_enum57_Enum3us.c) + retval -= 0x80000; + e3us--; e3us--; e3us--; e3us--; + if ((int)e3us == 65535) + retval -= 0x100000; + + Enum_TestClass_enum57_Enum4ui e4ui = Enum_TestClass_enum57_Enum4ui.a; + ++e4ui; e4ui++; ++e4ui; e4ui--; e4ui--; e4ui--; e4ui++; e4ui--; e4ui--; ++e4ui; e4ui++; ++e4ui; ++e4ui; ++e4ui; e4ui++; ++e4ui; + if ((int)e4ui-- == (int)Enum_TestClass_enum57_Enum4ui.f + 1) + retval -= 0x200000; + e4ui--; e4ui--; e4ui--; + if (e4ui++ == Enum_TestClass_enum57_Enum4ui.c) + retval -= 0x400000; + e4ui--; e4ui--; e4ui--; e4ui--; + if ((int)e4ui == (int)Enum_TestClass_enum57_Enum4ui.a - 1) + retval -= 0x800000; + + Enum_TestClass_enum57_Enum5ul e5ul = Enum_TestClass_enum57_Enum5ul.a; + ++e5ul; e5ul++; ++e5ul; e5ul--; e5ul--; e5ul--; e5ul++; e5ul--; e5ul--; ++e5ul; e5ul++; ++e5ul; ++e5ul; ++e5ul; e5ul++; ++e5ul; + if ((int)e5ul-- == (int)Enum_TestClass_enum57_Enum5ul.f + 1) + retval -= 0x1000000; + e5ul--; e5ul--; e5ul--; + if (e5ul++ == Enum_TestClass_enum57_Enum5ul.c) + retval -= 0x2000000; + e5ul--; e5ul--; e5ul--; e5ul--; + if ((int)e5ul == (int)Enum_TestClass_enum57_Enum5ul.a - 1) + retval -= 0x4000000; + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, 0x{0:X} " + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public enum Enum_TestClass_enum58_Enum1 { a = 0x01, b = 0x02, c = 0x04, d = 0x08, e = 0x10, f = 0x20 }; + public enum Enum_TestClass_enum58_Enum2 : byte { a = Enum_TestClass_enum58_Enum1.a, b = Enum_TestClass_enum58_Enum1.b, c = Enum_TestClass_enum58_Enum1.c, d = Enum_TestClass_enum58_Enum1.d, e = Enum_TestClass_enum58_Enum1.e, f = Enum_TestClass_enum58_Enum1.f }; + public enum Enum_TestClass_enum58_Enum3 : short { a = Enum_TestClass_enum58_Enum1.a, b = Enum_TestClass_enum58_Enum1.b, c = Enum_TestClass_enum58_Enum1.c, d = Enum_TestClass_enum58_Enum1.d, e = Enum_TestClass_enum58_Enum1.e, f = Enum_TestClass_enum58_Enum1.f }; + public enum Enum_TestClass_enum58_Enum4 : int { a = Enum_TestClass_enum58_Enum1.a, b = Enum_TestClass_enum58_Enum1.b, c = Enum_TestClass_enum58_Enum1.c, d = Enum_TestClass_enum58_Enum1.d, e = Enum_TestClass_enum58_Enum1.e, f = Enum_TestClass_enum58_Enum1.f }; + public enum Enum_TestClass_enum58_Enum5 : long { a = Enum_TestClass_enum58_Enum1.a, b = Enum_TestClass_enum58_Enum1.b, c = Enum_TestClass_enum58_Enum1.c, d = Enum_TestClass_enum58_Enum1.d, e = Enum_TestClass_enum58_Enum1.e, f = Enum_TestClass_enum58_Enum1.f }; + public enum Enum_TestClass_enum58_Enum2sb : sbyte { a = Enum_TestClass_enum58_Enum1.a, b = Enum_TestClass_enum58_Enum1.b, c = Enum_TestClass_enum58_Enum1.c, d = Enum_TestClass_enum58_Enum1.d, e = Enum_TestClass_enum58_Enum1.e, f = Enum_TestClass_enum58_Enum1.f }; + public enum Enum_TestClass_enum58_Enum3us : ushort { a = Enum_TestClass_enum58_Enum1.a, b = Enum_TestClass_enum58_Enum1.b, c = Enum_TestClass_enum58_Enum1.c, d = Enum_TestClass_enum58_Enum1.d, e = Enum_TestClass_enum58_Enum1.e, f = Enum_TestClass_enum58_Enum1.f }; + public enum Enum_TestClass_enum58_Enum4ui : uint { a = Enum_TestClass_enum58_Enum1.a, b = Enum_TestClass_enum58_Enum1.b, c = Enum_TestClass_enum58_Enum1.c, d = Enum_TestClass_enum58_Enum1.d, e = Enum_TestClass_enum58_Enum1.e, f = Enum_TestClass_enum58_Enum1.f }; + public enum Enum_TestClass_enum58_Enum5ul : ulong { a = Enum_TestClass_enum58_Enum1.a, b = Enum_TestClass_enum58_Enum1.b, c = Enum_TestClass_enum58_Enum1.c, d = Enum_TestClass_enum58_Enum1.d, e = Enum_TestClass_enum58_Enum1.e, f = Enum_TestClass_enum58_Enum1.f }; + public class Enum_TestClass_enum58 + { + public static int retval = 0x1FF; + + public static int Main_old() + { + Enum_TestClass_enum58_Enum1 e1 = Enum_TestClass_enum58_Enum1.a; + e1 = e1 ^ Enum_TestClass_enum58_Enum1.a; + e1 ^= Enum_TestClass_enum58_Enum1.b; + e1 = e1 | Enum_TestClass_enum58_Enum1.f; + e1 |= Enum_TestClass_enum58_Enum1.e; + e1 = e1 & Enum_TestClass_enum58_Enum1.b; + e1 &= ~Enum_TestClass_enum58_Enum1.b; + if ((int)e1 == 0) + retval -= 0x001; + Enum_TestClass_enum58_Enum2 e2 = Enum_TestClass_enum58_Enum2.a; + e2 = e2 ^ Enum_TestClass_enum58_Enum2.a; + e2 ^= Enum_TestClass_enum58_Enum2.b; + e2 = e2 | Enum_TestClass_enum58_Enum2.f; + e2 |= Enum_TestClass_enum58_Enum2.e; + e2 = e2 & Enum_TestClass_enum58_Enum2.b; + e2 &= ~Enum_TestClass_enum58_Enum2.b; + if ((int)e2 == 0) + retval -= 0x002; + Enum_TestClass_enum58_Enum2sb e2sb = Enum_TestClass_enum58_Enum2sb.a; + e2sb = e2sb ^ Enum_TestClass_enum58_Enum2sb.a; + e2sb ^= Enum_TestClass_enum58_Enum2sb.b; + e2sb = e2sb | Enum_TestClass_enum58_Enum2sb.f; + e2sb |= Enum_TestClass_enum58_Enum2sb.e; + e2sb = e2sb & Enum_TestClass_enum58_Enum2sb.b; + e2sb &= ~Enum_TestClass_enum58_Enum2sb.b; + if ((int)e2sb == 0) + retval -= 0x004; + Enum_TestClass_enum58_Enum3 e3 = Enum_TestClass_enum58_Enum3.a; + e3 = e3 ^ Enum_TestClass_enum58_Enum3.a; + e3 ^= Enum_TestClass_enum58_Enum3.b; + e3 = e3 | Enum_TestClass_enum58_Enum3.f; + e3 |= Enum_TestClass_enum58_Enum3.e; + e3 = e3 & Enum_TestClass_enum58_Enum3.b; + e3 &= ~Enum_TestClass_enum58_Enum3.b; + if ((int)e3 == 0) + retval -= 0x008; + Enum_TestClass_enum58_Enum3us e3us = Enum_TestClass_enum58_Enum3us.a; + e3us = e3us ^ Enum_TestClass_enum58_Enum3us.a; + e3us ^= Enum_TestClass_enum58_Enum3us.b; + e3us = e3us | Enum_TestClass_enum58_Enum3us.f; + e3us |= Enum_TestClass_enum58_Enum3us.e; + e3us = e3us & Enum_TestClass_enum58_Enum3us.b; + e3us &= ~Enum_TestClass_enum58_Enum3us.b; + if ((int)e3us == 0) + retval -= 0x010; + Enum_TestClass_enum58_Enum4 e4 = Enum_TestClass_enum58_Enum4.a; + e4 = e4 ^ Enum_TestClass_enum58_Enum4.a; + e4 ^= Enum_TestClass_enum58_Enum4.b; + e4 = e4 | Enum_TestClass_enum58_Enum4.f; + e4 |= Enum_TestClass_enum58_Enum4.e; + e4 = e4 & Enum_TestClass_enum58_Enum4.b; + e4 &= ~Enum_TestClass_enum58_Enum4.b; + if ((int)e4 == 0) + retval -= 0x020; + Enum_TestClass_enum58_Enum4ui e4ui = Enum_TestClass_enum58_Enum4ui.a; + e4ui = e4ui ^ Enum_TestClass_enum58_Enum4ui.a; + e4ui ^= Enum_TestClass_enum58_Enum4ui.b; + e4ui = e4ui | Enum_TestClass_enum58_Enum4ui.f; + e4ui |= Enum_TestClass_enum58_Enum4ui.e; + e4ui = e4ui & Enum_TestClass_enum58_Enum4ui.b; + e4ui &= ~Enum_TestClass_enum58_Enum4ui.b; + if ((int)e4ui == 0) + retval -= 0x040; + Enum_TestClass_enum58_Enum5 e5 = Enum_TestClass_enum58_Enum5.a; + e5 = e5 ^ Enum_TestClass_enum58_Enum5.a; + e5 ^= Enum_TestClass_enum58_Enum5.b; + e5 = e5 | Enum_TestClass_enum58_Enum5.f; + e5 |= Enum_TestClass_enum58_Enum5.e; + e5 = e5 & Enum_TestClass_enum58_Enum5.b; + e5 &= ~Enum_TestClass_enum58_Enum5.b; + if ((int)e5 == 0) + retval -= 0x080; + Enum_TestClass_enum58_Enum5ul e5ul = Enum_TestClass_enum58_Enum5ul.a; + e5ul = e5ul ^ Enum_TestClass_enum58_Enum5ul.a; + e5ul ^= Enum_TestClass_enum58_Enum5ul.b; + e5ul = e5ul | Enum_TestClass_enum58_Enum5ul.f; + e5ul |= Enum_TestClass_enum58_Enum5ul.e; + e5ul = e5ul & Enum_TestClass_enum58_Enum5ul.b; + e5ul &= ~Enum_TestClass_enum58_Enum5ul.b; + if ((int)e5ul == 0) + retval -= 0x100; + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + + public enum Enum_TestClass_enum62_E + { + Type1 = 100, + Type2, + Type3 + } + public class Enum_TestClass_enum62 + { + public static int Main_old() + { + Enum_TestClass_enum62_E[] tt = new Enum_TestClass_enum62_E[2]; + tt[0] = Enum_TestClass_enum62_E.Type1; + tt[1] = Enum_TestClass_enum62_E.Type1; + //Debug.WriteLine(tt[0].ToString()); + //Debug.WriteLine(tt[1].ToString()); + int nInt = (int)tt[1]; + Debug.WriteLine(nInt.ToString()); + int i = (int)tt[0] + (int)tt[1] + nInt - 300; + if (0 == i) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return i; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Enum_TestClass_enum63 + { + public enum e1 { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int retval = 1; + e1 v_e1 = e1.two; + e1 v = e1.three; + Debug.WriteLine("v_e1 == " + ((int)v_e1).ToString() + ", v == " + ((int)v).ToString()); + if (v_e1 < v) + retval = 0; + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum64 + { + public enum e1 { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int retval = 1; + e1 v_e1 = e1.three; + e1 v = e1.two; + Debug.WriteLine("v_e1 == " + ((int)v_e1).ToString() + ", v == " + ((int)v).ToString()); + if (v_e1 > v) + retval = 0; + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum65 + { + public enum e1 { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int retval = 7; + e1 v_e1 = e1.three; + e1 v = e1.two; + Debug.WriteLine("v_e1 == " + ((int)v_e1).ToString() + ", v == " + ((int)v).ToString()); + if (v_e1 >= v) + retval -= 1; + v_e1 = e1.three; + v = e1.three; + Debug.WriteLine("v_e1 == " + ((int)v_e1).ToString() + ", v == " + ((int)v).ToString()); + if (v_e1 >= v) + retval -= 2; + if (v_e1 == v) + retval -= 4; + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum66 + { + public enum e1 { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int retval = 7; + e1 v_e1 = e1.two; + e1 v = e1.three; + Debug.WriteLine("v_e1 == " + ((int)v_e1).ToString() + ", v == " + ((int)v).ToString()); + if (v_e1 <= v) + retval -= 1; + if (v_e1 != v) + retval -= 2; + v_e1 = e1.three; + v = e1.three; + Debug.WriteLine("v_e1 == " + ((int)v_e1).ToString() + ", v == " + ((int)v).ToString()); + if (v_e1 <= v) + retval -= 4; + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum67 + { + public enum e1 { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int retval = 1; + if (e1.two < e1.three) + retval = 0; + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum68 + { + public enum e1 { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int retval = 1; + if (e1.three > e1.two) + retval = 0; + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum69 + { + public enum e1 { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + // check ordering of values with >= operator + if (e1.one >= e1.two + || e1.one >= e1.three + || e1.two >= e1.three + ) + { + Debug.WriteLine("FAIL"); + return -1; + } + + Debug.WriteLine("PASS"); + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum70 + { + public enum e1 { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + // check ordering of values with <= operator + if (e1.three <= e1.two + || e1.three <= e1.one + || e1.two <= e1.one + ) + { + Debug.WriteLine("FAIL"); + return -1; + } + + Debug.WriteLine("PASS"); + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum71 + { + public enum e1 { one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int retval = 1; + e1 v_e1 = e1.two; + e1 v = e1.three; + string s1 = v_e1.ToString(); + string s2 = v.ToString(); + + Debug.WriteLine("v_e1 == " + s1.ToString() + ", v == " + s2.ToString()); + + if (s1.Equals("two") && s2.Equals("three")) + retval = 0; + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum72 + { + public enum e1 { zero, one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int retval = 0x3F; + e1 v_e1 = e1.two; + e1 v = e1.one; + if ((int)(v_e1 & v) == 0) + retval -= 1; + + if ((int)(e1.three & v) == 1) + retval -= 2; + + if ((int)(e1.three & e1.two) == 2) + retval -= 4; + + if ((v_e1 & v) == e1.zero) + retval -= 8; + + if ((e1.three & v) == e1.one) + retval -= 0x10; + + if ((e1.three & e1.two) == e1.two) + retval -= 0x20; + + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum73 + { + public enum e1 { zero, one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int retval = 0x3F; + e1 v_e1 = e1.two; + e1 v = e1.one; + if ((int)(v_e1 | v) == 3) + retval -= 1; + + if ((int)(e1.three | v) == 3) + retval -= 2; + + if ((int)(e1.three | e1.two) == 3) + retval -= 4; + + if ((v_e1 | v) == e1.three) + retval -= 8; + + if ((e1.three | v) == e1.three) + retval -= 0x10; + + if ((e1.three | e1.two) == e1.three) + retval -= 0x20; + + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum74 + { + public enum e1 { zero, one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int retval = 0x3F; + e1 v_e1 = e1.two; + e1 v = e1.one; + if ((int)(v_e1 ^ v) == 3) + retval -= 1; + + if ((int)(e1.three ^ v) == 2) + retval -= 2; + + if ((int)(e1.three ^ e1.two) == 1) + retval -= 4; + + if ((v_e1 ^ v) == e1.three) + retval -= 8; + + if ((e1.three ^ v) == e1.two) + retval -= 0x10; + + if ((e1.three ^ e1.two) == e1.one) + retval -= 0x20; + + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum75 + { + public enum e1 { zero, one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int retval = 7; + e1 v_e1 = e1.two; + if ((int)(~v_e1) == -3) + retval -= 1; + + if ((int)(~e1.three) == -4) + retval -= 2; + + if ((~(e1.one | e1.two) & e1.three) == e1.zero) + retval -= 4; + + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum77 + { + public enum e1 { zero, one = 1, two = 2, three = 3 }; + public static int Main_old() + { + int retval = 0x3F; + e1 v_e1 = e1.two; + e1 v = e1.one; + if ((v + (int)v_e1) == e1.three) + retval -= 1; + + if ((e1.three - e1.two) == 1) + retval -= 2; + + if ((1 + e1.two) == e1.three) + retval -= 4; + + if ((e1.one + 2) == e1.three) + retval -= 8; + + if ((1 + v_e1) == e1.three) + retval -= 0x10; + + if ((v + 2) == e1.three) + retval -= 0x20; + + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + public class Enum_TestClass_enum78 + { + public static int Main_old(String[] s) + { + Enum_TestClass_enum78_Enum f; + + try + { + object[] v = new object[1]; + v[0] = Enum_TestClass_enum78_Enum.Second; + + + f = (Enum_TestClass_enum78_Enum)v[0]; + } + catch (System.Exception e) + { + Debug.WriteLine("Caught System.Exception: Failed"); + Debug.WriteLine(e.ToString()); + return 1; + } + Debug.WriteLine("No System.Exception: Passed"); + return 0; + } + public static bool testMethod() + { + return (Main_old(null) == 0); + } + } + public enum Enum_TestClass_enum78_Enum + { + First = 1, + Second = -1, + Third = -2 + + } + + + public class Enum_TestClass_enum83 + { + public enum Enum_TestClass_enum83_Enum1 { a, b, c, }; + public enum Enum_TestClass_enum83_Enum2 : int { a, b, c, }; + public enum Enum_TestClass_enum83_Enum3 : uint { a, b, c, }; + public enum Enum_TestClass_enum83_Enum4 : byte { a, b, c, }; + public enum Enum_TestClass_enum83_Enum5 : sbyte { a, b, c, }; + public enum Enum_TestClass_enum83_Enum6 : short { a, b, c, }; + public enum Enum_TestClass_enum83_Enum7 : ushort { a, b, c, }; + public enum Enum_TestClass_enum83_Enum8 : long { a, b, c, }; + public enum Enum_TestClass_enum83_Enum9 : ulong { a, b, c, }; + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + + public class Enum_TestClass_enum86_Base + { + public enum Enum_TestClass_enum86_Enum1_1 { a = -1, b = -2, c = -3, }; + public class Enum_TestClass_enum86_Enum1_2 + { + } + public struct Enum_TestClass_enum86_Enum1_3 + { + } + protected enum Enum_TestClass_enum86_Enum3 : uint { a = 1, b = 6, c = 7, }; + internal enum Enum_TestClass_enum86_Enum4 : byte { a = 2, b = 5, c = 8 }; + private enum Enum_TestClass_enum86_Enum5 : sbyte { a = 3, b = 4, c = 9 }; + protected bool CheckE5() + { + return ((int)Enum_TestClass_enum86_Enum5.b == 4); + } + } + + public class Enum_TestClass_enum86 : Enum_TestClass_enum86_Base + { + new enum Enum_TestClass_enum86_Enum1_1 { a, b = 10, c, }; + new enum Enum_TestClass_enum86_Enum1_2 { a, b = 11, c, }; + new enum Enum_TestClass_enum86_Enum1_3 { a, b = 12, c, }; + public static int Main_old() + { + int retval = 0xFF; + + Enum_TestClass_enum86_Base b = new Enum_TestClass_enum86_Base(); + Enum_TestClass_enum86 d = new Enum_TestClass_enum86(); + if ((int)Enum_TestClass_enum86_Base.Enum_TestClass_enum86_Enum1_1.b == -2) + retval -= 0x01; + if ((int)Enum_TestClass_enum86.Enum_TestClass_enum86_Enum1_1.b == 10) + retval -= 0x02; + if ((int)Enum_TestClass_enum86.Enum_TestClass_enum86_Enum1_2.b == 11) + retval -= 0x04; + if ((int)Enum_TestClass_enum86.Enum_TestClass_enum86_Enum1_3.b == 12) + retval -= 0x08; + if ((int)Enum_TestClass_enum86_Enum3.b == 6) + retval -= 0x10; + if ((int)Enum_TestClass_enum86_Enum4.b == 5) + retval -= 0x20; + if ((int)Enum_TestClass_enum86_Base.Enum_TestClass_enum86_Enum4.b == 5) + retval -= 0x40; + if (d.CheckE5()) + retval -= 0x80; + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, 0x{0:X} " + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + }; + enum Enum_TestClass_enum93_Color + { + Red, + Green = 10, + Blue + } + class Enum_TestClass_enum93 + { + static void Main_old() + { + Debug.WriteLine(StringFromColor(Enum_TestClass_enum93_Color.Red)); + Debug.WriteLine(StringFromColor(Enum_TestClass_enum93_Color.Green)); + Debug.WriteLine(StringFromColor(Enum_TestClass_enum93_Color.Blue)); + Debug.WriteLine(StringFromColor(Enum_TestClass_enum93_Color.Blue + 5)); + } + static string StringFromColor(Enum_TestClass_enum93_Color c) + { + return c + " = " + ((int)c).ToString(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + enum Enum_TestClass_enum94_Color + { + Red, + Green = 10, + Blue + } + enum Enum_TestClass_enum94_ColorB : byte + { + Red, + Green = 10, + Blue + } + enum Enum_TestClass_enum94_ColorSB : sbyte + { + Red, + Green = 10, + Blue + } + enum Enum_TestClass_enum94_ColorS : short + { + Red, + Green = 10, + Blue + } + enum Enum_TestClass_enum94_ColorUS : ushort + { + Red, + Green = 10, + Blue + } + enum Enum_TestClass_enum94_ColorI : int + { + Red, + Green = 10, + Blue + } + enum Enum_TestClass_enum94_ColorUI : uint + { + Red, + Green = 10, + Blue + } + enum Enum_TestClass_enum94_ColorL : long + { + Red, + Green = 10, + Blue + } + enum Enum_TestClass_enum94_ColorUL : ulong + { + Red, + Green = 10, + Blue + } + class Enum_TestClass_enum94 + { + static void Main_old() + { + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_Color)(-5))); + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_Color)1000)); + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_ColorB)255)); + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_ColorSB)127)); + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_ColorSB)(-128))); + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_ColorS)(-32768))); + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_ColorS)32767)); + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_ColorUS)65535)); + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_ColorI)(-32768))); + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_ColorI)32767)); + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_ColorUI)65535)); + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_ColorL)(-32768))); + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_ColorL)32767)); + Debug.WriteLine(StringFromColor((Enum_TestClass_enum94_ColorUL)65535)); + } + static string StringFromColor(Enum c) + { + return c + " = " + c.ToString(); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + [Flags] + enum Enum_TestClass_enum_flags01_Flag + { + Zero = 0x0000, + First = 0x0001, + Second = 0x0002, + Third = 0x0004, + Fourth = 0x0008, + } + public class Enum_TestClass_enum_flags01 + { + public static int Main_old() + { + Enum_TestClass_enum_flags01_Flag r = Enum_TestClass_enum_flags01_Flag.First | Enum_TestClass_enum_flags01_Flag.Fourth; + Debug.WriteLine(r.ToString()); + return (int)r == (int)0x0009 ? 0 : 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + [Flags] + enum Enum_TestClass_enum_flags02_Flag + { + Zero = 0x0000, + First = 0x0001, + Second = 0x0002, + Third = 0x0004, + Fourth = 0x0008, + } + public class Enum_TestClass_enum_flags02 + { + public static int Main_old() + { + Enum_TestClass_enum_flags02_Flag r = Enum_TestClass_enum_flags02_Flag.First | Enum_TestClass_enum_flags02_Flag.Fourth; + r = r | Enum_TestClass_enum_flags02_Flag.Second | Enum_TestClass_enum_flags02_Flag.Third; + + Debug.WriteLine(r.ToString()); + return (int)r == (int)0x000f ? 0 : 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + [Flags] + enum Enum_TestClass_enum_flags03_Flag + { + Zero = 0x0000, + First = 0x0001, + Second = 0x0002, + Third = 0x0004, + Fourth = 0x0008, + } + public class Enum_TestClass_enum_flags03 + { + public static int Main_old() + { + Enum_TestClass_enum_flags03_Flag r = Enum_TestClass_enum_flags03_Flag.First | Enum_TestClass_enum_flags03_Flag.Fourth; + r += 0x00f; // out of range + Debug.WriteLine(r.ToString()); + return (int)r == (int)24 ? 0 : 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + [Flags] + enum Enum_TestClass_enum_flags04_Flag + { + Zero = 0x0000, + First = 0x0001, + Second = 0x0002, + Third = 0x0004, + Fourth = 0x0008, + } + public class Enum_TestClass_enum_flags04 + { + public static int Main_old() + { + int i = 0x0f; + Enum_TestClass_enum_flags04_Flag r = (Enum_TestClass_enum_flags04_Flag)i; + Debug.WriteLine(r.ToString()); + return (int)r == (int)0x000f ? 0 : 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + } +} diff --git a/Tests/NFUnitTestEnum/nano.runsettings b/Tests/NFUnitTestEnum/nano.runsettings new file mode 100644 index 00000000..38fae61f --- /dev/null +++ b/Tests/NFUnitTestEnum/nano.runsettings @@ -0,0 +1,14 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + True + + \ No newline at end of file diff --git a/Tests/NFUnitTestEnum/packages.config b/Tests/NFUnitTestEnum/packages.config new file mode 100644 index 00000000..1adb9284 --- /dev/null +++ b/Tests/NFUnitTestEnum/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index ae376e03..45b5623f 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -41,6 +41,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestArithmetic", "Tes EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestException", "Tests\NFUnitTestException\NFUnitTestException.nfproj", "{BDB01244-6EAD-476E-9084-27D0D249E9A6}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestEnum", "Tests\NFUnitTestEnum\NFUnitTestEnum.nfproj", "{75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -127,6 +129,12 @@ Global {BDB01244-6EAD-476E-9084-27D0D249E9A6}.Release|Any CPU.ActiveCfg = Release|Any CPU {BDB01244-6EAD-476E-9084-27D0D249E9A6}.Release|Any CPU.Build.0 = Release|Any CPU {BDB01244-6EAD-476E-9084-27D0D249E9A6}.Release|Any CPU.Deploy.0 = Release|Any CPU + {75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E}.Release|Any CPU.Build.0 = Release|Any CPU + {75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -144,6 +152,7 @@ Global {89C61C69-A9F3-43BF-B501-5913BE8FE829} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {6B598666-54C8-4705-A7FB-B2BC75CA00BC} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {BDB01244-6EAD-476E-9084-27D0D249E9A6} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From d8b74e1afa9b66140b1a36e738bbed2e3d1a6990 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 18:25:29 +0300 Subject: [PATCH 36/55] Adding Delegates tests --- .../NFUnitTestDelegates.nfproj | 60 + .../Properties/AssemblyInfo.cs | 33 + .../UnitTestDelegatesTests.cs | 2595 +++++++++++++++++ Tests/NFUnitTestDelegates/nano.runsettings | 14 + Tests/NFUnitTestDelegates/packages.config | 5 + Tests/NFUnitTestEnum/UnitTestEnumTests.cs | 6 + nanoFramework.CoreLibrary.sln | 9 + 7 files changed, 2722 insertions(+) create mode 100644 Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj create mode 100644 Tests/NFUnitTestDelegates/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestDelegates/UnitTestDelegatesTests.cs create mode 100644 Tests/NFUnitTestDelegates/nano.runsettings create mode 100644 Tests/NFUnitTestDelegates/packages.config diff --git a/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj b/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj new file mode 100644 index 00000000..d7e2cddb --- /dev/null +++ b/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj @@ -0,0 +1,60 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + a8d00e31-5905-4db4-a7f2-f0c00e3560dd + Library + Properties + 512 + NFUnitTestDelegates + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestDelegates/Properties/AssemblyInfo.cs b/Tests/NFUnitTestDelegates/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestDelegates/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestDelegates/UnitTestDelegatesTests.cs b/Tests/NFUnitTestDelegates/UnitTestDelegatesTests.cs new file mode 100644 index 00000000..d13af146 --- /dev/null +++ b/Tests/NFUnitTestDelegates/UnitTestDelegatesTests.cs @@ -0,0 +1,2595 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestDelegates +{ + [TestClass] + public class UnitTestDelegatesTests + { + [TestMethod] + public void Delegate_delegate01_Test() + { + Debug.WriteLine(" Verify that both static and instance methods can be called from delegates."); + Assert.True(Delegate_TestClass_delegate01.testMethod()); + } + [TestMethod] + public void Delegate_delegate02_Test() + { + Debug.WriteLine(" Verify that delegate can be initialized to null."); + Assert.True(Delegate_TestClass_delegate02.testMethod()); + } + [TestMethod] + public void Delegate_delegate03_Test() + { + Debug.WriteLine(" Verify that delegate can be initialized to null."); + Assert.True(Delegate_TestClass_delegate03.testMethod()); + } + [TestMethod] + public void Delegate_delegate04_Test() + { + Debug.WriteLine(" Verify that delegate can be assigned by ternary operator."); + Assert.True(Delegate_TestClass_delegate04.testMethod()); + } + [TestMethod] + public void Delegate_delegate05_Test() + { + Debug.WriteLine(" Verify that delegate can be assigned by ternary operator."); + Assert.True(Delegate_TestClass_delegate05.testMethod()); + } + [TestMethod] + public void Delegate_delegate06_Test() + { + Debug.WriteLine(" Verify that delegate can be assigned by ternary operator. Assign null instead of usable value."); + Assert.True(Delegate_TestClass_delegate06.testMethod()); + } + [TestMethod] + public void Delegate_delegate07_Test() + { + Debug.WriteLine(" Verify that delegate can be assigned by ternary operator. Use null instead of a usable value."); + Assert.True(Delegate_TestClass_delegate07.testMethod()); + } + [TestMethod] + public void Delegate_delegate08_Test() + { + Debug.WriteLine(" Verify that delegate can be assigned by ternary operator. Assign null instead of usable value."); + Assert.True(Delegate_TestClass_delegate08.testMethod()); + } + [TestMethod] + public void Delegate_delegate09_Test() + { + Debug.WriteLine(" Verify that delegates can be compared for equality."); + Assert.True(Delegate_TestClass_delegate09.testMethod()); + } + [TestMethod] + public void Delegate_delegate10_Test() + { + Debug.WriteLine(" Verify that delegates can be aggregated in arrays and compared for equality."); + Assert.True(Delegate_TestClass_delegate10.testMethod()); + } + [TestMethod] + public void Delegate_delegate11_Test() + { + Debug.WriteLine(" Verify that delegates can be members of classes."); + Assert.True(Delegate_TestClass_delegate11.testMethod()); + } + [TestMethod] + public void Delegate_delegate12_Test() + { + Debug.WriteLine(" Verify that both static and instance methods can be called from delegates."); + Assert.True(Delegate_TestClass_delegate12.testMethod()); + } + [TestMethod] + public void Delegate_delegate13_Test() + { + Debug.WriteLine(" Verify that delegate can be initialized to null."); + Assert.True(Delegate_TestClass_delegate13.testMethod()); + } + [TestMethod] + public void Delegate_delegate14_Test() + { + Debug.WriteLine(" Verify that delegate can be initialized to null."); + Assert.True(Delegate_TestClass_delegate14.testMethod()); + } + [TestMethod] + public void Delegate_delegate14a_Test() + { + Debug.WriteLine(" Verify that delegate can be initialized to null."); + Assert.True(Delegate_TestClass_delegate14a.testMethod()); + } + [TestMethod] + public void Delegate_delegate14b_Test() + { + Debug.WriteLine(" Verify that delegate can be initialized to null."); + Assert.True(Delegate_TestClass_delegate14b.testMethod()); + } + [TestMethod] + public void Delegate_delegate14c_Test() + { + Debug.WriteLine(" Verify that delegate can be initialized to null."); + Assert.True(Delegate_TestClass_delegate14c.testMethod()); + } + [TestMethod] + public void Delegate_delegate15_Test() + { + Debug.WriteLine(" Verify that delegate can be assigned by ternary operator."); + Assert.True(Delegate_TestClass_delegate15.testMethod()); + } + [TestMethod] + public void Delegate_delegate16_Test() + { + Debug.WriteLine(" Verify that delegate can be assigned by ternary operator."); + Assert.True(Delegate_TestClass_delegate16.testMethod()); + } + [TestMethod] + public void Delegate_delegate17_Test() + { + Debug.WriteLine(" Verify that delegate can be assigned by ternary operator. Assign null instead of usable value."); + Assert.True(Delegate_TestClass_delegate17.testMethod()); + } + [TestMethod] + public void Delegate_delegate18_Test() + { + Debug.WriteLine(" Make sure a delegate list filled with nulls is detectable as foo == null"); + Assert.True(Delegate_TestClass_delegate18.testMethod()); + } + [TestMethod] + public void Delegate_delegate19_Test() + { + Debug.WriteLine(" Verify that delegates can be aggregated in arrays and compared for equality."); + Assert.True(Delegate_TestClass_delegate19.testMethod()); + } + [TestMethod] + public void Delegate_delegate20_Test() + { + Debug.WriteLine(" Verify that delegates can be compared for equality."); + Assert.True(Delegate_TestClass_delegate20.testMethod()); + } + [TestMethod] + public void Delegate_delegate21_Test() + { + Debug.WriteLine(" Verify that delegates can be aggregated in arrays and compared for equality."); + Assert.True(Delegate_TestClass_delegate21.testMethod()); + } + [TestMethod] + public void Delegate_delegate23_Test() + { + Debug.WriteLine(" Verify that delegates can be aggregated using the + operator;"); + Assert.True(Delegate_TestClass_delegate23.testMethod()); + } + [TestMethod] + public void Delegate_delegate24_Test() + { + Debug.WriteLine(" Verify that delegates can be aggregated using the + operator;"); + Assert.True(Delegate_TestClass_delegate24.testMethod()); + } + [TestMethod] + public void Delegate_delegate25_Test() + { + Debug.WriteLine(" Verify that delegates can be removed using the - operator;"); + Assert.True(Delegate_TestClass_delegate25.testMethod()); + } + + [TestMethod] + public void Delegate_delegate26_Test() + { + Debug.WriteLine("Bug 214780 - async delegates to methods with out parameters don't work"); + Debug.WriteLine("This test is expected to fail."); + Assert.False(Delegate_TestClass_delegate26.testMethod()); + } + /* This test is skipped because it causes a Metadat processor error, it fails in the baseline. + [TestMethod] + public void Delegate_delegate28_Test() + { + Debug.WriteLine("Verify Delegate with 257 args. This is because more than 257 causes the"); + Debug.WriteLine("compiler to take a different code path."); + Assert.True(Delegate_TestClass_delegate28.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + */ + [TestMethod] + public void Delegate_delegate30_Test() + { + Debug.WriteLine(" Verify that both static and instance struct methods can be called from delegates."); + Assert.True(Delegate_TestClass_delegate30.testMethod()); + } + [TestMethod] + public void Delegate_delegate31_Test() + { + Debug.WriteLine(" Verify that virtual struct methods can be called from delegates."); + Assert.True(Delegate_TestClass_delegate31.testMethod()); + } + /*These are skipped due to their use of Volatile variables which are not supported + * + [TestMethod] + public void Delegate_delegate32_Test() + { + Debug.WriteLine("Delegate Invocation using BeginInvoke"); + Assert.True(Delegate_TestClass_delegate32.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Delegate_delegate34_Test() + { + Debug.WriteLine("Delegate Invocation using BeginInvoke"); + Assert.True(Delegate_TestClass_delegate34.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + */ + [TestMethod] + public void Delegate_delegate36_Test() + { + Debug.WriteLine("params modifier should not be considered when matching a delegate with a method"); + Assert.True(Delegate_TestClass_delegate36.testMethod()); + } + [TestMethod] + public void Delegate_delegate60_Test() + { + Debug.WriteLine("A delegate declaration defines a class that derives from System.Delegate"); + Assert.True(Delegate_TestClass_delegate60.testMethod()); + } + [TestMethod] + public void Delegate_delegate62_Test() + { + Debug.WriteLine("The compiler is expected to warn that the new keyword id not rquired as we're not hiding an inherited member"); + Assert.True(Delegate_TestClass_delegate62.testMethod()); + } + [TestMethod] + public void Delegate_delegate64_Test() + { + Debug.WriteLine("Compiler is expected to warn when new is not used when hiding a member delegate of the base class"); + Assert.True(Delegate_TestClass_delegate64.testMethod()); + } + [TestMethod] + public void Delegate_delegate65_Test() + { + Debug.WriteLine("Make sure delegates can be hidden."); + Assert.True(Delegate_TestClass_delegate65.testMethod()); + } + /*These tests are skipped because the use the == operator in an unsupported way + * + [TestMethod] + public void Delegate_delegate66_Test() + { + Debug.WriteLine("Two compatible delegate types can be compared for equality."); + Assert.True(Delegate_TestClass_delegate66.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Delegate_delegate70_Test() + { + Debug.WriteLine("Two compatible delegate types can be compared for equality (or inequality)."); + Assert.True(Delegate_TestClass_delegate70.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + */ + [TestMethod] + public void Delegate_delegate71_Test() + { + Debug.WriteLine("Verify simple +="); + Assert.True(Delegate_TestClass_delegate71.testMethod()); + } + [TestMethod] + public void Delegate_delegate72_Test() + { + Debug.WriteLine(" Verify that delegates can be removed using the -= operator;"); + Assert.True(Delegate_TestClass_delegate72.testMethod()); + } + /* These tests are skipped because they use == in an unsupported way + * + [TestMethod] + public void Delegate_delegate73_Test() + { + Debug.WriteLine("Verify equality and inequality after using += and -= on delegates"); + Assert.True(Delegate_TestClass_delegate73.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Delegate_delegate74_Test() + { + Debug.WriteLine("Verify ability to call members of System.Delegate on delegate types"); + Assert.True(Delegate_TestClass_delegate74.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Delegate_delegate75_Test() + { + Debug.WriteLine("Verify ability to call members of System.Delegate on delegate types"); + Debug.WriteLine("and that ordinality is maintained in concatenated invocation lists"); + Assert.True(Delegate_TestClass_delegate75.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Delegate_delegate76_Test() + { + Debug.WriteLine("Verify ability to call members of System.Delegate on delegate types"); + Debug.WriteLine("and that ordinality is maintained in concatenated invocation lists"); + Assert.True(Delegate_TestClass_delegate76.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + */ + [TestMethod] + public void Delegate_delegate77_Test() + { + Debug.WriteLine("Verify that ordinality is maintained in concatenated invocation lists"); + Debug.WriteLine("and that the invocation list members are called synchronously"); + Assert.True(Delegate_TestClass_delegate77.testMethod()); + } + [TestMethod] + public void Delegate_delegate78_Test() + { + Debug.WriteLine("Verify that ordinality is maintained in concatenated invocation lists"); + Debug.WriteLine("and that the invocation list members are called synchronously and"); + Debug.WriteLine("that ref parameters are modified through the invocation chain."); + Assert.True(Delegate_TestClass_delegate78.testMethod()); + } + [TestMethod] + public void Delegate_delegate79_Test() + { + Debug.WriteLine("Verify that ordinality is maintained in concatenated invocation lists"); + Debug.WriteLine("and that the invocation list members are called synchronously and"); + Debug.WriteLine("that out parameters are set by the last member in the invocation chain."); + Assert.True(Delegate_TestClass_delegate79.testMethod()); + } + [TestMethod] + public void Delegate_delegate80_Test() + { + Debug.WriteLine("Verify that System.Exceptions not caught in invoked method are bubbled up"); + Debug.WriteLine("and the remaining methods in the invocation list are not invoked."); + Assert.True(Delegate_TestClass_delegate80.testMethod()); + } + [TestMethod] + public void Delegate_delegate81_Test() + { + Debug.WriteLine("Sample from section 15.3 of Delegate_TestClass_?_A#LS"); + Assert.True(Delegate_TestClass_delegate81.testMethod()); + } + [TestMethod] + public void Delegate_delegate_modifier09_Test() + { + Debug.WriteLine("only new, public, private, protected and internal are allowed as modifiers"); + Assert.True(Delegate_TestClass_delegate_modifier09.testMethod()); + } + [TestMethod] + public void Delegate_delegate_modifier10_Test() + { + Debug.WriteLine("only new, public, private, protected and internal are allowed as modifiers"); + Assert.True(Delegate_TestClass_delegate_modifier10.testMethod()); + } + [TestMethod] + public void Delegate_delegate_modifier11_Test() + { + Debug.WriteLine("only new, public, private, protected and internal are allowed as modifiers"); + Assert.True(Delegate_TestClass_delegate_modifier11.testMethod()); + } + [TestMethod] + public void Delegate_delegate_modifier12_Test() + { + Debug.WriteLine("only new, public, private, protected and internal are allowed as modifiers"); + Assert.True(Delegate_TestClass_delegate_modifier12.testMethod()); + } + + + + //Compiled Test Cases + delegate int Delegate_TestClass_delegate01_1(); + public class Delegate_TestClass_delegate01_2 + { + public int bar() { Debug.WriteLine("bar"); return 0x01; } + static public int far() + { + Debug.WriteLine("far"); + return 0x02; + } + } + public class Delegate_TestClass_delegate01 + { + static int retval = 0x03; + + static public int Main_old() + { + Delegate_TestClass_delegate01_2 p = new Delegate_TestClass_delegate01_2(); + Delegate_TestClass_delegate01_1 foo = new Delegate_TestClass_delegate01_1(p.bar); + retval -= foo(); + foo = new Delegate_TestClass_delegate01_1(Delegate_TestClass_delegate01_2.far); + retval -= foo(); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate int Delegate_TestClass_delegate02_1(); + public class Delegate_TestClass_delegate02_2 + { + public int bar() { Debug.WriteLine("bar"); return 0x01; } + static public int far() + { + Debug.WriteLine("far"); + return 0x02; + } + } + public class Delegate_TestClass_delegate02 + { + static int retval = 0x03; + + static public int Main_old() + { + Delegate_TestClass_delegate02_2 p = new Delegate_TestClass_delegate02_2(); + Delegate_TestClass_delegate02_1 foo = null; + foo = new Delegate_TestClass_delegate02_1(p.bar); + retval -= foo(); + foo = null; + foo = new Delegate_TestClass_delegate02_1(Delegate_TestClass_delegate02_2.far); + retval -= foo(); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate int Delegate_TestClass_delegate03_1(); + public class Delegate_TestClass_delegate03_2 + { + public static int retval = 0x03; + public int bar() { Debug.WriteLine("bar"); return 0x01; } + static public int far() + { + Debug.WriteLine("far"); + return 0x02; + } + } + public class Delegate_TestClass_delegate03 + { + static public int Main_old() + { + Delegate_TestClass_delegate03_1 foo = null; + try + { + foo(); + } + catch (System.Exception) + { + Delegate_TestClass_delegate03_2.retval -= 0x03; + } + if(Delegate_TestClass_delegate03_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate03_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate int Delegate_TestClass_delegate04_1(); + public class Delegate_TestClass_delegate04_2 + { + public int bar() { Debug.WriteLine("bar"); return 0x01; } + static public int far() + { + Debug.WriteLine("far"); + return 0x02; + } + } + public class Delegate_TestClass_delegate04 + { + static int retval = 0x03; + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate04_2 p = new Delegate_TestClass_delegate04_2(); + Delegate_TestClass_delegate04_1 foo = null; + foo = loo() ? new Delegate_TestClass_delegate04_1(p.bar) : new Delegate_TestClass_delegate04_1(Delegate_TestClass_delegate04_2.far); + retval -= foo(); + foo = !loo() ? new Delegate_TestClass_delegate04_1(p.bar) : new Delegate_TestClass_delegate04_1(Delegate_TestClass_delegate04_2.far); + retval -= foo(); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate int Delegate_TestClass_delegate05_1(); + public class Delegate_TestClass_delegate05_2 + { + public int bar() { Debug.WriteLine("bar"); return 0x01; } + static public int far() + { + Debug.WriteLine("far"); + return 0x02; + } + } + public class Delegate_TestClass_delegate05 + { + static int retval = 0x03; + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate05_2 p = new Delegate_TestClass_delegate05_2(); + Delegate_TestClass_delegate05_1 foo = null; + foo = loo() ? new Delegate_TestClass_delegate05_1(p.bar) : null; + retval -= foo(); + foo = !loo() ? null : new Delegate_TestClass_delegate05_1(Delegate_TestClass_delegate05_2.far); + retval -= foo(); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate int Delegate_TestClass_delegate06_1(); + public class Delegate_TestClass_delegate06_2 + { + public int bar() { Debug.WriteLine("bar"); return 0x01; } + static public int far() + { + Debug.WriteLine("far"); + return 0x02; + } + } + public class Delegate_TestClass_delegate06 + { + static int retval = 0x03; + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate06_2 p = new Delegate_TestClass_delegate06_2(); + Delegate_TestClass_delegate06_1 foo = null; + try + { + foo = loo() ? null : new Delegate_TestClass_delegate06_1(Delegate_TestClass_delegate06_2.far); + retval -= foo(); + } + catch (System.Exception n) + { + retval -= 0x01; + } + try + { + foo = !loo() ? new Delegate_TestClass_delegate06_1(p.bar) : null; + retval -= foo(); + } + catch (System.Exception n) + { + retval -= 0x02; + } + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate int Delegate_TestClass_delegate07_1(); + public class Delegate_TestClass_delegate07_2 + { + public int bar() { Debug.WriteLine("bar"); return 0x01; } + static public int far() + { + Debug.WriteLine("far"); + return 0x02; + } + } + public class Delegate_TestClass_delegate07 + { + static int retval = 0x03; + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate07_2 p = new Delegate_TestClass_delegate07_2(); + Delegate_TestClass_delegate07_1 foo = null; + foo = loo() ? new Delegate_TestClass_delegate07_1(p.bar) : new Delegate_TestClass_delegate07_1(Delegate_TestClass_delegate07_2.far); + retval -= foo(); + try + { + foo = !loo() ? new Delegate_TestClass_delegate07_1(p.bar) : null; + retval -= foo(); + } + catch (System.Exception n) + { + retval -= 0x02; + } + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate int Delegate_TestClass_delegate08_1(); + public class Delegate_TestClass_delegate08_2 + { + public int bar() { Debug.WriteLine("bar"); return 0x01; } + static public int far() + { + Debug.WriteLine("far"); + return 0x02; + } + } + public class Delegate_TestClass_delegate08 + { + static int retval = 0x03; + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate08_2 p = new Delegate_TestClass_delegate08_2(); + Delegate_TestClass_delegate08_1 foo = null; + foo = loo() ? null : new Delegate_TestClass_delegate08_1(Delegate_TestClass_delegate08_2.far); + if (foo == null) + foo = new Delegate_TestClass_delegate08_1(p.bar); + retval -= foo(); + foo = !loo() ? new Delegate_TestClass_delegate08_1(p.bar) : null; + if (foo == null) + foo = new Delegate_TestClass_delegate08_1(Delegate_TestClass_delegate08_2.far); + retval -= foo(); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate int Delegate_TestClass_delegate09_1(); + public class Delegate_TestClass_delegate09_2 + { + public int bar() { Debug.WriteLine("bar"); return 0x01; } + static public int far() + { + Debug.WriteLine("far"); + return 0x02; + } + } + public class Delegate_TestClass_delegate09 + { + static int retval = 0x0F; + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate09_2 p = new Delegate_TestClass_delegate09_2(); + Delegate_TestClass_delegate09_1 foo1 = null; + Delegate_TestClass_delegate09_1 foo2 = null; + foo1 = new Delegate_TestClass_delegate09_1(Delegate_TestClass_delegate09_2.far); + foo2 = new Delegate_TestClass_delegate09_1(Delegate_TestClass_delegate09_2.far); + if (foo1 == foo2) + retval -= 0x04; + retval -= foo1(); + foo1 = new Delegate_TestClass_delegate09_1(p.bar); + foo2 = new Delegate_TestClass_delegate09_1(p.bar); + if (foo1 == foo2) + retval -= 0x08; + retval -= foo2(); + Debug.WriteLine(retval.ToString()); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate int Delegate_TestClass_delegate10_1(); + public class Delegate_TestClass_delegate10_2 + { + public int bar() { Debug.WriteLine("bar"); return 0x01; } + static public int far() + { + Debug.WriteLine("far"); + return 0x02; + } + } + public class Delegate_TestClass_delegate10 + { + static int retval = 0x0F; + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate10_2 p = new Delegate_TestClass_delegate10_2(); + Delegate_TestClass_delegate10_1[] foo = { new Delegate_TestClass_delegate10_1(Delegate_TestClass_delegate10_2.far), new Delegate_TestClass_delegate10_1(Delegate_TestClass_delegate10_2.far) }; + if (foo[0] == foo[1]) + retval -= 0x04; + retval -= foo[1](); + foo[0] = new Delegate_TestClass_delegate10_1(p.bar); + foo[1] = new Delegate_TestClass_delegate10_1(p.bar); + if (foo[0] == foo[1]) + retval -= 0x08; + retval -= foo[0](); + Debug.WriteLine(retval.ToString()); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public delegate int Delegate_TestClass_delegate11_1(); + public class Delegate_TestClass_delegate11_2 + { + public int bar() { Debug.WriteLine("bar"); return 0x01; } + static public int far() + { + Debug.WriteLine("far"); + return 0x02; + } + public Delegate_TestClass_delegate11_1 foo = null; + } + public class Delegate_TestClass_delegate11 + { + static int retval = 0x03; + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate11_2 p = new Delegate_TestClass_delegate11_2(); + p.foo = new Delegate_TestClass_delegate11_1(Delegate_TestClass_delegate11_2.far); + retval -= p.foo(); + p.foo = new Delegate_TestClass_delegate11_1(p.bar); + retval -= p.foo(); + Debug.WriteLine(retval.ToString()); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate12_1(); + public class Delegate_TestClass_delegate12_2 + { + public static int retval = 0x06; + public void bar() { Debug.WriteLine("bar"); retval -= 0x01; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 0x02; + } + } + public class Delegate_TestClass_delegate12 + { + + + static public int Main_old() + { + Delegate_TestClass_delegate12_2 p = new Delegate_TestClass_delegate12_2(); + Delegate_TestClass_delegate12_1 foo = new Delegate_TestClass_delegate12_1(p.bar); + Delegate_TestClass_delegate12_1 multifoo = foo; + multifoo += new Delegate_TestClass_delegate12_1(Delegate_TestClass_delegate12_2.far); + multifoo(); + multifoo = new Delegate_TestClass_delegate12_1(Delegate_TestClass_delegate12_2.far); + multifoo += foo; + multifoo(); + if(Delegate_TestClass_delegate12_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate12_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate13_1(); + public class Delegate_TestClass_delegate13_2 + { + public static int retval = 0x04; + public void bar() { Debug.WriteLine("bar"); retval -= 0x01; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 0x02; + } + } + public class Delegate_TestClass_delegate13 + { + + static public int Main_old() + { + Delegate_TestClass_delegate13_2 p = new Delegate_TestClass_delegate13_2(); + Delegate_TestClass_delegate13_1 foo = null; + foo = new Delegate_TestClass_delegate13_1(p.bar); + foo(); + foo = new Delegate_TestClass_delegate13_1(Delegate_TestClass_delegate13_2.far); + foo += new Delegate_TestClass_delegate13_1(p.bar); + foo(); + if(Delegate_TestClass_delegate13_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate13_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate14_1(); + public class Delegate_TestClass_delegate14_2 + { + public static int retval = 0x03; + public void bar() { Debug.WriteLine("bar"); retval += 0x10; } + static public void far() + { + Debug.WriteLine("far"); + retval += 0x20; + } + } + public class Delegate_TestClass_delegate14 + { + static public int Main_old() + { + Delegate_TestClass_delegate14_1 foo = null; + try + { + foo(); + } + catch (System.Exception) + { + Delegate_TestClass_delegate14_2.retval -= 0x03; + } + if(Delegate_TestClass_delegate14_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate14_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate14a_1(); + public class Delegate_TestClass_delegate14a_2 + { + public static int retval = 0x02; + public void bar() { Debug.WriteLine("bar"); retval -= 0x01; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 0x02; + } + } + public class Delegate_TestClass_delegate14a + { + static public int Main_old() + { + Delegate_TestClass_delegate14a_1 foo = new Delegate_TestClass_delegate14a_1(Delegate_TestClass_delegate14a_2.far); + foo += (Delegate_TestClass_delegate14a_1)null; + foo(); + if(Delegate_TestClass_delegate14a_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate14a_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate14b_1(); + public class Delegate_TestClass_delegate14b_2 + { + public static int retval = 0x02; + public void bar() { Debug.WriteLine("bar"); retval -= 0x01; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 0x02; + } + } + public class Delegate_TestClass_delegate14b + { + static public int Main_old() + { + Delegate_TestClass_delegate14b_1 foo = null; + foo += new Delegate_TestClass_delegate14b_1(Delegate_TestClass_delegate14b_2.far); + foo(); + if(Delegate_TestClass_delegate14b_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate14b_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate14c_1(); + public class Delegate_TestClass_delegate14c_2 + { + public static int retval = 0x03; + public void bar() { Debug.WriteLine("bar"); retval -= 0x01; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 0x02; + } + } + public class Delegate_TestClass_delegate14c + { + static public int Main_old() + { + Delegate_TestClass_delegate14c_2 p = new Delegate_TestClass_delegate14c_2(); + Delegate_TestClass_delegate14c_1 foo = new Delegate_TestClass_delegate14c_1(p.bar); + foo += (Delegate_TestClass_delegate14c_1)null; + foo += new Delegate_TestClass_delegate14c_1(Delegate_TestClass_delegate14c_2.far); + foo(); + if(Delegate_TestClass_delegate14c_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate14c_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate15_1(); + public class Delegate_TestClass_delegate15_2 + { + public static int retval = 63; + public void bar1() { Debug.WriteLine("bar1"); retval -= 0x01; } + static public void far1() + { + Debug.WriteLine("far1"); + retval -= 0x02; + } + public void bar2() { Debug.WriteLine("bar2"); retval -= 10; } + static public void far2() + { + Debug.WriteLine("far2"); + retval -= 20; + } + } + public class Delegate_TestClass_delegate15 + { + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate15_2 p = new Delegate_TestClass_delegate15_2(); + Delegate_TestClass_delegate15_1 foo = null; + Delegate_TestClass_delegate15_1 left = null; + Delegate_TestClass_delegate15_1 right = null; + foo = loo() ? new Delegate_TestClass_delegate15_1(p.bar1) : new Delegate_TestClass_delegate15_1(Delegate_TestClass_delegate15_2.far1); + foo(); + foo = !loo() ? new Delegate_TestClass_delegate15_1(p.bar1) : new Delegate_TestClass_delegate15_1(Delegate_TestClass_delegate15_2.far1); + foo(); + left = new Delegate_TestClass_delegate15_1(p.bar1); + right = new Delegate_TestClass_delegate15_1(Delegate_TestClass_delegate15_2.far2); + foo = !loo() ? left += new Delegate_TestClass_delegate15_1(Delegate_TestClass_delegate15_2.far1) : right += new Delegate_TestClass_delegate15_1(p.bar2); + foo(); + right = new Delegate_TestClass_delegate15_1(p.bar1); + left = new Delegate_TestClass_delegate15_1(Delegate_TestClass_delegate15_2.far2); + foo = loo() ? left += new Delegate_TestClass_delegate15_1(p.bar2) : right += new Delegate_TestClass_delegate15_1(Delegate_TestClass_delegate15_2.far1); + foo(); + if(Delegate_TestClass_delegate15_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate15_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate16_1(); + public class Delegate_TestClass_delegate16_2 + { + public static int retval = 0x09; + public void bar() { Debug.WriteLine("bar"); retval -= 0x01; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 0x02; + } + } + public class Delegate_TestClass_delegate16 + { + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate16_2 p = new Delegate_TestClass_delegate16_2(); + Delegate_TestClass_delegate16_1 foo = null; + Delegate_TestClass_delegate16_1 left = null; + Delegate_TestClass_delegate16_1 right = null; + foo = loo() ? new Delegate_TestClass_delegate16_1(p.bar) : null; + foo(); + foo = !loo() ? null : new Delegate_TestClass_delegate16_1(Delegate_TestClass_delegate16_2.far); + foo(); + left = new Delegate_TestClass_delegate16_1(p.bar); + foo = loo() ? left += new Delegate_TestClass_delegate16_1(Delegate_TestClass_delegate16_2.far) : null; + foo(); + right = new Delegate_TestClass_delegate16_1(Delegate_TestClass_delegate16_2.far); + foo = !loo() ? null : right += new Delegate_TestClass_delegate16_1(p.bar); + foo(); + if(Delegate_TestClass_delegate16_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate16_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate17_1(); + public class Delegate_TestClass_delegate17_2 + { + public static int retval = 13; + public void bar() { Debug.WriteLine("bar"); retval -= 0x01; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 0x02; + } + public void bar2() { Debug.WriteLine("bar2"); retval -= 10; } + static public void far2() + { + Debug.WriteLine("far2"); + retval -= 20; + } + } + public class Delegate_TestClass_delegate17 + { + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate17_2 p = new Delegate_TestClass_delegate17_2(); + Delegate_TestClass_delegate17_1 foo = null; + try + { + foo = loo() ? null : new Delegate_TestClass_delegate17_1(Delegate_TestClass_delegate17_2.far); + foo(); + } + catch (System.Exception n) + { + Delegate_TestClass_delegate17_2.retval -= 0x01; + } + try + { + foo = !loo() ? new Delegate_TestClass_delegate17_1(p.bar) : null; + foo(); + } + catch (System.Exception n) + { + Delegate_TestClass_delegate17_2.retval -= 0x02; + } + try + { + foo = null; + foo += (Delegate_TestClass_delegate17_1)null; + foo(); + } + catch (System.Exception n) + { + Delegate_TestClass_delegate17_2.retval -= 10; + } + if(Delegate_TestClass_delegate17_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate17_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate18_1(); + public class Delegate_TestClass_delegate18_2 + { + public static int retval = 23; + public void bar() { Debug.WriteLine("bar"); retval -= 0x01; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 0x02; + } + public void bar1() { Debug.WriteLine("bar1"); retval -= 10; } + static public void far1() + { + Debug.WriteLine("far1"); + retval -= 20; + } + } + public class Delegate_TestClass_delegate18 + { + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate18_2 p = new Delegate_TestClass_delegate18_2(); + Delegate_TestClass_delegate18_1 foo = null; + foo = loo() ? null : new Delegate_TestClass_delegate18_1(Delegate_TestClass_delegate18_2.far); + if (foo == null) + { + foo += new Delegate_TestClass_delegate18_1(p.bar); + foo += new Delegate_TestClass_delegate18_1(Delegate_TestClass_delegate18_2.far); + } + foo(); + foo = null; + foo += (Delegate_TestClass_delegate18_1)null; + if (foo == null) + { + foo += new Delegate_TestClass_delegate18_1(Delegate_TestClass_delegate18_2.far1); + } + + foo(); + if(Delegate_TestClass_delegate18_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate18_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate19_1(); + public class Delegate_TestClass_delegate19_2 + { + public static int retval = 33; + public void bar() { Debug.WriteLine("bar"); retval -= 1; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 2; + } + } + public class Delegate_TestClass_delegate19 + { + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate19_2 p = new Delegate_TestClass_delegate19_2(); + Delegate_TestClass_delegate19_1[] foo = new Delegate_TestClass_delegate19_1[3]; + foo[1] = new Delegate_TestClass_delegate19_1(Delegate_TestClass_delegate19_2.far); + foo[2] = new Delegate_TestClass_delegate19_1(p.bar); + Delegate_TestClass_delegate19_1 foo1 = null; + foreach (Delegate_TestClass_delegate19_1 b in foo) + { + foo1 += b; + } + Delegate_TestClass_delegate19_1 foo2 = new Delegate_TestClass_delegate19_1(Delegate_TestClass_delegate19_2.far); + foo2 += new Delegate_TestClass_delegate19_1(p.bar); + if (foo1 == foo2) + Delegate_TestClass_delegate19_2.retval -= 10; + foo[1] = foo1; + foo[2] = foo2; + if (foo[1] == foo[2]) + Delegate_TestClass_delegate19_2.retval -= 20; + foo[1](); + if(Delegate_TestClass_delegate19_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate19_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate20_1(); + public class Delegate_TestClass_delegate20_2 + { + public static int retval = 1333; + public void bar() { Debug.WriteLine("bar"); retval -= 1; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 2; + } + public void bar1() { Debug.WriteLine("bar1"); retval -= 10; } + static public void far1() + { + Debug.WriteLine("far1"); + retval -= 20; + } + } + public class Delegate_TestClass_delegate20 + { + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate20_2 p = new Delegate_TestClass_delegate20_2(); + Delegate_TestClass_delegate20_1 foo1 = null; + Delegate_TestClass_delegate20_1 foo2 = null; + foo1 = new Delegate_TestClass_delegate20_1(Delegate_TestClass_delegate20_2.far); + foo2 = new Delegate_TestClass_delegate20_1(Delegate_TestClass_delegate20_2.far); + if (foo1 == foo2) + Delegate_TestClass_delegate20_2.retval -= 100; + foo1(); + foo1 = new Delegate_TestClass_delegate20_1(p.bar); + foo2 = new Delegate_TestClass_delegate20_1(p.bar); + if (foo1 == foo2) + Delegate_TestClass_delegate20_2.retval -= 200; + foo2(); + foo1 = new Delegate_TestClass_delegate20_1(Delegate_TestClass_delegate20_2.far1); + foo2 = new Delegate_TestClass_delegate20_1(p.bar1); + Delegate_TestClass_delegate20_1 foo3 = foo1; + foo3 += foo2; + Delegate_TestClass_delegate20_1 foo4 = new Delegate_TestClass_delegate20_1(Delegate_TestClass_delegate20_2.far1); + foo4 += new Delegate_TestClass_delegate20_1(p.bar1); + if (foo3 == foo4) + Delegate_TestClass_delegate20_2.retval -= 1000; + foo3(); + if(Delegate_TestClass_delegate20_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate20_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate21_1(); + public class Delegate_TestClass_delegate21_2 + { + public static int retval = 33; + public void bar() { Debug.WriteLine("bar"); retval -= 1; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 2; + } + } + public class Delegate_TestClass_delegate21 + { + static bool loo() { return true; } + + static public int Main_old() + { + Delegate_TestClass_delegate21_2 p = new Delegate_TestClass_delegate21_2(); + Delegate_TestClass_delegate21_1[] foo = { new Delegate_TestClass_delegate21_1(Delegate_TestClass_delegate21_2.far), new Delegate_TestClass_delegate21_1(p.bar) }; + Delegate_TestClass_delegate21_1 foo1 = null; + foreach (Delegate_TestClass_delegate21_1 b in foo) + { + foo1 += b; + } + Delegate_TestClass_delegate21_1 foo2 = new Delegate_TestClass_delegate21_1(Delegate_TestClass_delegate21_2.far); + foo2 += new Delegate_TestClass_delegate21_1(p.bar); + if (foo1 == foo2) + Delegate_TestClass_delegate21_2.retval -= 10; + foo[0] = foo1; + foo[1] = foo2; + if (foo[0] == foo[1]) + Delegate_TestClass_delegate21_2.retval -= 20; + foo[0](); + if(Delegate_TestClass_delegate21_2.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return Delegate_TestClass_delegate21_2.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate23_Del(); + public class Delegate_TestClass_delegate23_A + { + public static int retval = 3; + public void bar() { Debug.WriteLine("bar"); retval -= 1; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 2; + } + } + public class Delegate_TestClass_delegate23 + { + static bool loo() { return true; } + static public int Main_old() + { + Delegate_TestClass_delegate23_A p = new Delegate_TestClass_delegate23_A(); + Delegate_TestClass_delegate23_Del foo1 = new Delegate_TestClass_delegate23_Del(Delegate_TestClass_delegate23_A.far); + Delegate_TestClass_delegate23_Del foo2 = new Delegate_TestClass_delegate23_Del(p.bar); + Delegate_TestClass_delegate23_Del foo3 = foo1 + foo2; + foo3(); + if(Delegate_TestClass_delegate23_A.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval==" + Delegate_TestClass_delegate23_A.retval.ToString()); + return Delegate_TestClass_delegate23_A.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate24_Del(); + public class Delegate_TestClass_delegate24_A + { + public static int retval = 0x0F; + public void bar() { Debug.WriteLine("bar"); retval -= 1; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 2; + } + public void bar2() { Debug.WriteLine("bar2"); retval -= 4; } + static public void far2() + { + Debug.WriteLine("far2"); + retval -= 8; + } + } + public class Delegate_TestClass_delegate24 + { + static bool loo() { return true; } + static public int Main_old() + { + Delegate_TestClass_delegate24_A p = new Delegate_TestClass_delegate24_A(); + Delegate_TestClass_delegate24_Del foo1 = new Delegate_TestClass_delegate24_Del(Delegate_TestClass_delegate24_A.far) + new Delegate_TestClass_delegate24_Del(p.bar); + Delegate_TestClass_delegate24_Del foo2 = new Delegate_TestClass_delegate24_Del(p.bar2) + new Delegate_TestClass_delegate24_Del(Delegate_TestClass_delegate24_A.far2); + Delegate_TestClass_delegate24_Del foo3 = foo1 + foo2; + foo3(); + if(Delegate_TestClass_delegate24_A.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval==" + Delegate_TestClass_delegate24_A.retval.ToString()); + return Delegate_TestClass_delegate24_A.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate25_Del(); + public class Delegate_TestClass_delegate25_A + { + public static int retval = 0x3F; + public void bar() { Debug.WriteLine("bar"); retval -= 1; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 2; + } + public void bar2() { Debug.WriteLine("bar2"); retval -= 4; } + static public void far2() + { + Debug.WriteLine("far2"); + retval -= 8; + } + } + public class Delegate_TestClass_delegate25 + { + static bool loo() { return true; } + static public int Main_old() + { + Delegate_TestClass_delegate25_A p = new Delegate_TestClass_delegate25_A(); + Delegate_TestClass_delegate25_Del foo1 = new Delegate_TestClass_delegate25_Del(Delegate_TestClass_delegate25_A.far) + new Delegate_TestClass_delegate25_Del(p.bar); + Delegate_TestClass_delegate25_Del foo2 = new Delegate_TestClass_delegate25_Del(p.bar2) + new Delegate_TestClass_delegate25_Del(Delegate_TestClass_delegate25_A.far2); + Delegate_TestClass_delegate25_Del foo3 = foo1 + foo2; + foo3(); + Delegate_TestClass_delegate25_Del foo4 = foo3 - foo2; //Should be the same as foo1 + if (foo4 == foo1) + Delegate_TestClass_delegate25_A.retval -= 0x10; + Delegate_TestClass_delegate25_A.retval += 3; + foo4(); + foo4 = foo3 - foo1; //Should be the same as foo2 + if (foo4 == foo2) + Delegate_TestClass_delegate25_A.retval -= 0x20; + Delegate_TestClass_delegate25_A.retval += 0x0C; + foo4(); + if(Delegate_TestClass_delegate25_A.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval==" + Delegate_TestClass_delegate25_A.retval.ToString()); + return Delegate_TestClass_delegate25_A.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + public class Delegate_TestClass_delegate26 + { + public static int Main_old(String[] args) + { + try + { + HD hd = new HD(Delegate_TestClass_delegate26.Hello); + int i = 1; + IAsyncResult ar = hd.BeginInvoke(out i, null, null); + i = 1; + hd.EndInvoke(out i, ar); + if (0 == i) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, i==" + i.ToString()); + return i; + } + catch (System.Exception) + { + return 1; + } + return 0; + } + public delegate void HD(out int i); + public static void Hello(out int i) + { + i = 0; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + /* + public class Delegate_TestClass_delegate28 + { + public static int Main_old(String[] args) + { + HD hd = new HD(Delegate_TestClass_delegate28.Hello); + int i = 1; + i = hd(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257); + if (0 == i) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, i==" + i.ToString()); + return i; + } + public delegate int HD(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15, int i16, int i17, int i18, int i19, int i20, int i21, int i22, int i23, int i24, int i25, int i26, int i27, int i28, int i29, int i30, int i31, int i32, int i33, int i34, int i35, int i36, int i37, int i38, int i39, int i40, int i41, int i42, int i43, int i44, int i45, int i46, int i47, int i48, int i49, int i50, int i51, int i52, int i53, int i54, int i55, int i56, int i57, int i58, int i59, int i60, int i61, int i62, int i63, int i64, int i65, int i66, int i67, int i68, int i69, int i70, int i71, int i72, int i73, int i74, int i75, int i76, int i77, int i78, int i79, int i80, int i81, int i82, int i83, int i84, int i85, int i86, int i87, int i88, int i89, int i90, int i91, int i92, int i93, int i94, int i95, int i96, int i97, int i98, int i99, int i100, int i101, int i102, int i103, int i104, int i105, int i106, int i107, int i108, int i109, int i110, int i111, int i112, int i113, int i114, int i115, int i116, int i117, int i118, int i119, int i120, int i121, int i122, int i123, int i124, int i125, int i126, int i127, int i128, int i129, int i130, int i131, int i132, int i133, int i134, int i135, int i136, int i137, int i138, int i139, int i140, int i141, int i142, int i143, int i144, int i145, int i146, int i147, int i148, int i149, int i150, int i151, int i152, int i153, int i154, int i155, int i156, int i157, int i158, int i159, int i160, int i161, int i162, int i163, int i164, int i165, int i166, int i167, int i168, int i169, int i170, int i171, int i172, int i173, int i174, int i175, int i176, int i177, int i178, int i179, int i180, int i181, int i182, int i183, int i184, int i185, int i186, int i187, int i188, int i189, int i190, int i191, int i192, int i193, int i194, int i195, int i196, int i197, int i198, int i199, int i200, int i201, int i202, int i203, int i204, int i205, int i206, int i207, int i208, int i209, int i210, int i211, int i212, + int i213, int i214, int i215, int i216, int i217, int i218, int i219, int i220, int i221, int i222, int i223, int i224, int i225, int i226, int i227, int i228, int i229, int i230, int i231, int i232, int i233, int i234, int i235, int i236, int i237, int i238, int i239, int i240, int i241, int i242, int i243, int i244, int i245, int i246, int i247, int i248, int i249, int i250, int i251, int i252, int i253, int i254, int i255, int i256, int i257); + public static int Hello(int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10, int i11, int i12, int i13, int i14, int i15, int i16, int i17, int i18, int i19, int i20, int i21, int i22, int i23, int i24, int i25, int i26, int i27, int i28, int i29, int i30, int i31, int i32, int i33, int i34, int i35, int i36, int i37, int i38, int i39, int i40, int i41, int i42, int i43, int i44, int i45, int i46, int i47, int i48, int i49, int i50, int i51, int i52, int i53, int i54, int i55, int i56, int i57, int i58, int i59, int i60, int i61, int i62, int i63, int i64, int i65, int i66, int i67, int i68, int i69, int i70, int i71, int i72, int i73, int i74, int i75, int i76, int i77, int i78, int i79, int i80, int i81, int i82, int i83, int i84, int i85, int i86, int i87, int i88, int i89, int i90, int i91, int i92, int i93, int i94, int i95, int i96, int i97, int i98, int i99, int i100, int i101, int i102, int i103, int i104, int i105, int i106, int i107, int i108, int i109, int i110, int i111, int i112, int i113, int i114, int i115, int i116, int i117, int i118, int i119, int i120, int i121, int i122, int i123, int i124, int i125, int i126, int i127, int i128, int i129, int i130, int i131, int i132, int i133, int i134, int i135, int i136, int i137, int i138, int i139, int i140, int i141, int i142, int i143, int i144, int i145, int i146, int i147, int i148, int i149, int i150, int i151, int i152, int i153, int i154, int i155, int i156, int i157, int i158, int i159, int i160, int i161, int i162, int i163, int i164, int i165, int i166, int i167, int i168, int i169, int i170, int i171, int i172, int i173, int i174, int i175, int i176, int i177, int i178, int i179, int i180, int i181, int i182, int i183, int i184, int i185, int i186, int i187, int i188, int i189, int i190, int i191, int i192, int i193, int i194, int i195, int i196, int i197, int i198, int i199, int i200, int i201, int i202, int i203, int i204, int i205, int i206, int i207, int i208, int i209, int i210, int i211, int i212, + int i213, int i214, int i215, int i216, int i217, int i218, int i219, int i220, int i221, int i222, int i223, int i224, int i225, int i226, int i227, int i228, int i229, int i230, int i231, int i232, int i233, int i234, int i235, int i236, int i237, int i238, int i239, int i240, int i241, int i242, int i243, int i244, int i245, int i246, int i247, int i248, int i249, int i250, int i251, int i252, int i253, int i254, int i255, int i256, int i257) + { + return i257 - 257; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + */ + delegate int Delegate_TestClass_delegate30_1(); + public struct Delegate_TestClass_delegate30_2 + { + public int bar() { Debug.WriteLine("bar"); return 0x01; } + static public int far() + { + Debug.WriteLine("far"); + return 0x02; + } + } + public class Delegate_TestClass_delegate30 + { + static int retval = 0x03; + + static public int Main_old() + { + + Delegate_TestClass_delegate30_2 p = new Delegate_TestClass_delegate30_2(); + Delegate_TestClass_delegate30_1 foo = new Delegate_TestClass_delegate30_1(p.bar); + retval -= foo(); + foo = new Delegate_TestClass_delegate30_1(Delegate_TestClass_delegate30_2.far); + retval -= foo(); + if (retval == 0) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate int Delegate_TestClass_delegate31_1(); + interface I + { + int bar(); + } + public struct Delegate_TestClass_delegate31_2 : I + { + public int bar() { Debug.WriteLine("bar"); return 0x01; } + } + public class Delegate_TestClass_delegate31 + { + static int retval = 0x01; + + static public int Main_old() + { + Delegate_TestClass_delegate31_2 p = new Delegate_TestClass_delegate31_2(); + Delegate_TestClass_delegate31_1 foo = new Delegate_TestClass_delegate31_1(p.bar); + retval -= foo(); + if (retval == 0) + { + Debug.WriteLine("PASS"); + } + else + { + Debug.WriteLine("FAIL"); + } + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + /* + delegate void Delegate_TestClass_delegate32_Del(int i, params string[] p); + class Delegate_TestClass_delegate32 + { + static volatile int res; + + void m1(int i, params string[] p) + { + res = p.Length; + } + + + public static int Main_old() + { + Delegate_TestClass_delegate32 t = new Delegate_TestClass_delegate32(); + Delegate_TestClass_delegate32_Del d = new Delegate_TestClass_delegate32_Del(t.m1); + int i = 7; + string[] strArr = { "foo", "bar" }; + IAsyncResult ar = d.BeginInvoke(i, strArr, null, null); + ar.AsyncWaitHandle.WaitOne(); + if (res == 2) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void Delegate_TestClass_delegate34_Del(int i, params object[] p); + class Delegate_TestClass_delegate34 + { + static volatile int res; + + void m1(int i, params object[] p) + { + res = p.Length; + } + + + public static int Main_old() + { + Delegate_TestClass_delegate34 t = new Delegate_TestClass_delegate34(); + Delegate_TestClass_delegate34_Del d = new Delegate_TestClass_delegate34_Del(t.m1); + int i = 7; + object[] objArr = { 1, 2 }; + IAsyncResult ar = d.BeginInvoke(i, objArr, null, null); + ar.AsyncWaitHandle.WaitOne(); + if (res == 2) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + */ + class Delegate_TestClass_delegate36 + { + public delegate int BarDelegate(int[] Arr); + public static int Bar(params int[] Arr) { return Arr[0]; } + public static int Main_old() + { + BarDelegate Delegate_TestClass_delegate36_B = new BarDelegate(Bar); + return Delegate_TestClass_delegate36_B(new int[] { 1, 2, 3 }) - Delegate_TestClass_delegate36_B(new int[] { 1, 2 }); + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public delegate double Delegate_TestClass_delegate60_Del(int integerPortion, float fraction); + public class Delegate_TestClass_delegate60 + { + private delegate double ClassDelegate(int integerPortion, float fraction); + double DelegatedMethod(int intPart, float frac) + { + return intPart + frac; + } + public static int Main_old(String[] args) + { + int retval = 0x0F; + + Delegate_TestClass_delegate60 c = new Delegate_TestClass_delegate60(); + Delegate_TestClass_delegate60_Del nsd = new Delegate_TestClass_delegate60_Del(c.DelegatedMethod); + if (nsd is System.Delegate) + retval -= 0x01; + if (nsd is System.MulticastDelegate) + retval -= 0x02; + ClassDelegate cd = new ClassDelegate(c.DelegatedMethod); + if (cd is System.Delegate) + retval -= 0x04; + if (cd is System.MulticastDelegate) + retval -= 0x08; + if (0 == retval) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL, 0x{0:X}"); + Debug.WriteLine(retval.ToString()); + } + return retval; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + delegate double Delegate_TestClass_delegate62_Del(int integerPortion, float fraction); + public class Delegate_TestClass_delegate62 + { + new delegate double Delegate_TestClass_delegate62_Del(int integerPortion, float fraction); + double DelegatedMethod(int intPart, float frac) + { + return intPart + frac; + } + public static int Main_old(String[] args) + { + return 0; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + delegate double Delegate_TestClass_delegate64_Del(int integerPortion, float fraction); + public class Delegate_TestClass_delegate64_1 + { + public delegate double Delegate_TestClass_delegate64_Del(int integerPortion, float fraction); + double DelegatedMethod(int intPart, float frac) + { + return intPart + frac; + } + } + public class Delegate_TestClass_delegate64 : Delegate_TestClass_delegate64_1 + { + public delegate double Delegate_TestClass_delegate64_Del(int integerPortion, float fraction); + public static int Main_old(String[] args) + { + return 0; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + delegate double Delegate_TestClass_delegate65_Del(int integerPortion, float fraction); + public class Delegate_TestClass_delegate65_1 + { + public delegate double Delegate_TestClass_delegate65_Del(int integerPortion, float fraction); + public double DelegatedMethod(int intPart, float frac) + { + return intPart + frac; + } + } + public class Delegate_TestClass_delegate65 : Delegate_TestClass_delegate65_1 + { + new public delegate double Delegate_TestClass_delegate65_Del(int integerPortion, float fraction); + public new double DelegatedMethod(int intPart, float frac) + { + return intPart + frac + 5; + } + public static int Main_old(String[] args) + { + int retval = 0x07; + + Delegate_TestClass_delegate65 dc = new Delegate_TestClass_delegate65(); + Delegate_TestClass_delegate65_Del md = new Delegate_TestClass_delegate65_Del(dc.DelegatedMethod); + if (md(2, 0.5f) == 7.5) + retval -= 0x01; + Delegate_TestClass_delegate65_1.Delegate_TestClass_delegate65_Del bmd = new Delegate_TestClass_delegate65_1.Delegate_TestClass_delegate65_Del(((Delegate_TestClass_delegate65_1)dc).DelegatedMethod); + if (md(2, 0.5f) == 7.5) + retval -= 0x02; + Delegate_TestClass_delegate65_1 bc = new Delegate_TestClass_delegate65_1(); + bmd = new Delegate_TestClass_delegate65_1.Delegate_TestClass_delegate65_Del(bc.DelegatedMethod); + if (bmd(2, 0.5f) == 2.5) + retval -= 0x04; + if (0 == retval) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL, 0x{0:X}"); + Debug.WriteLine(retval.ToString()); + } + return retval; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + /* + delegate double Delegate_TestClass_delegate66_Del(int integerPortion, float fraction); + public class Delegate_TestClass_delegate66 + { + public delegate double MyDelegate2(int integerPortion, float fraction); + public double DelegatedMethod(int intPart, float frac) + { + return intPart + frac + 5; + } + public static int Main_old(String[] args) + { + int retval = 0x03; + + Delegate_TestClass_delegate66 mc = new Delegate_TestClass_delegate66(); + Delegate_TestClass_delegate66_Del md1 = new Delegate_TestClass_delegate66_Del(mc.DelegatedMethod); + MyDelegate2 md2 = new MyDelegate2(mc.DelegatedMethod); + if (md1 == md2) + retval -= 0x01; + if (md2 == md1) + retval -= 0x02; + if (0 == retval) Debug.WriteLine("PASS"); + else {Debug.WriteLine("FAIL, 0x{0:X}"); + return retval; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + delegate double Delegate_TestClass_delegate70_Del(int integerPortion, float fraction); + public class Delegate_TestClass_delegate70 + { + public delegate double MyDelegate2(int integerPortion, float fraction); + public double DelegatedMethod1(int intPart, float frac) + { + return intPart + frac + 5; + } + public double DelegatedMethod2(int intPart, float frac) + { + return intPart + frac + 10; + } + public static int Main_old(String[] args) + { + int retval = 0x03; + + Delegate_TestClass_delegate70 mc = new Delegate_TestClass_delegate70(); + Delegate_TestClass_delegate70_Del md1 = new Delegate_TestClass_delegate70_Del(mc.DelegatedMethod1); + MyDelegate2 md2 = new MyDelegate2(mc.DelegatedMethod2); + if (md1 != md2) + retval -= 0x01; + if (md2 != md1) + retval -= 0x02; + if (0 == retval) Debug.WriteLine("PASS"); + else {Debug.WriteLine("FAIL, 0x{0:X}"); + return retval; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + */ + delegate double Delegate_TestClass_delegate71_Del(int integerPortion, float fraction); + public class Delegate_TestClass_delegate71 + { + public delegate double MyDelegate2(int integerPortion, float fraction); + public double DelegatedMethod1(int intPart, float frac) + { + if (5 == intPart) + throw new System.Exception("My System.Exception"); + return intPart + frac + 5; + } + public double DelegatedMethod2(int intPart, float frac) + { + return intPart + frac + 10; + } + public static int Main_old(String[] args) + { + int retval = 0x01; + + Delegate_TestClass_delegate71 mc = new Delegate_TestClass_delegate71(); + Delegate_TestClass_delegate71_Del md1 = new Delegate_TestClass_delegate71_Del(mc.DelegatedMethod1); + md1 += new Delegate_TestClass_delegate71_Del(mc.DelegatedMethod2); + try + { + double d = md1(5, .5f); + retval ^= 0x02; + } + catch (System.Exception) + { + retval -= 0x01; + } + if (0 == retval) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL, 0x{0:X}"); + Debug.WriteLine(retval.ToString()); + } + return retval; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + delegate void Delegate_TestClass_delegate72_Del(); + public class Delegate_TestClass_delegate72_A + { + public static int retval = 0x3F; + public void bar() { Debug.WriteLine("bar"); retval -= 1; } + static public void far() + { + Debug.WriteLine("far"); + retval -= 2; + } + public void bar2() { Debug.WriteLine("bar2"); retval -= 4; } + static public void far2() + { + Debug.WriteLine("far2"); + retval -= 8; + } + } + public class Delegate_TestClass_delegate72 + { + static bool loo() { return true; } + static public int Main_old() + { + Delegate_TestClass_delegate72_A p = new Delegate_TestClass_delegate72_A(); + Delegate_TestClass_delegate72_Del foo1 = new Delegate_TestClass_delegate72_Del(Delegate_TestClass_delegate72_A.far) + new Delegate_TestClass_delegate72_Del(p.bar); + Delegate_TestClass_delegate72_Del foo2 = new Delegate_TestClass_delegate72_Del(p.bar2) + new Delegate_TestClass_delegate72_Del(Delegate_TestClass_delegate72_A.far2); + Delegate_TestClass_delegate72_Del foo3 = foo1 + foo2; + foo3(); + Delegate_TestClass_delegate72_Del foo4 = foo3; + foo4 -= foo2; //Should be the same as foo1 + if (foo4 == foo1) + Delegate_TestClass_delegate72_A.retval -= 0x10; + Delegate_TestClass_delegate72_A.retval += 3; + foo4(); + foo4 = foo3 - foo1; //Should be the same as foo2 + if (foo4 == foo2) + Delegate_TestClass_delegate72_A.retval -= 0x20; + Delegate_TestClass_delegate72_A.retval += 0x0C; + foo4(); + if(Delegate_TestClass_delegate72_A.retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval==" + Delegate_TestClass_delegate72_A.retval.ToString()); + return Delegate_TestClass_delegate72_A.retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + /* + delegate double Delegate_TestClass_delegate73_Del(int integerPortion, float fraction); + public class Delegate_TestClass_delegate73 + { + public delegate double MyDelegate2(int integerPortion, float fraction); + public double DelegatedMethod1(int intPart, float frac) + { + return intPart + frac + 5; + } + public double DelegatedMethod2(int intPart, float frac) + { + return intPart + frac + 10; + } + public static int Main_old(String[] args) + { + int retval = 0x01; + + Delegate_TestClass_delegate73 mc = null; + try + { + Delegate_TestClass_delegate73_Del md1 = new Delegate_TestClass_delegate73_Del(mc.DelegatedMethod1); + md1 += new Delegate_TestClass_delegate73_Del(mc.DelegatedMethod2); + MyDelegate2 md2 = new MyDelegate2(mc.DelegatedMethod1); + md2 += new MyDelegate2(mc.DelegatedMethod2); + if (md1 == md2) + retval ^= 0x01; + if (md2 == md1) + retval ^= 0x02; + md2 -= new MyDelegate2(mc.DelegatedMethod1); //Remove from front of list... + md2 += new MyDelegate2(mc.DelegatedMethod1); //Add back to list at end + if (md1 != md2) + retval ^= 0x04; + if (md2 != md1) + retval ^= 0x08; + } + catch (System.Exception) + { + retval -= 0x01; + } + if (0 == retval) Debug.WriteLine("PASS"); + else {Debug.WriteLine("FAIL, 0x{0:X}"); + return retval; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + delegate double Delegate_TestClass_delegate74_Del(int integerPortion, float fraction); + public class Delegate_TestClass_delegate74 + { + public delegate double MyDelegate2(int integerPortion, float fraction); + public double DelegatedMethod1(int intPart, float frac) + { + return intPart + frac + 5; + } + public double DelegatedMethod2(int intPart, float frac) + { + return intPart + frac + 10; + } + public static int Main_old(String[] args) + { + int retval = 0x03; + + Delegate_TestClass_delegate74 mc = new Delegate_TestClass_delegate74(); + try + { + Delegate_TestClass_delegate74_Del md1 = new Delegate_TestClass_delegate74_Del(mc.DelegatedMethod1); + md1 += new Delegate_TestClass_delegate74_Del(mc.DelegatedMethod2); + MyDelegate2 md2 = new MyDelegate2(mc.DelegatedMethod1); + md2 += new MyDelegate2(mc.DelegatedMethod2); + Delegate[] da1 = md1.GetInvocationList(); + Delegate[] da2 = md2.GetInvocationList(); + if (da1[1].Method == da2[1].Method) + retval ^= 0x01; + if (da1[0].Method == da2[0].Method) + retval ^= 0x02; + } + catch (System.Exception) + { + retval -= 0x01; + } + if (0 == retval) Debug.WriteLine("PASS"); + else {Debug.WriteLine("FAIL, 0x{0:X}"); + return retval; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + delegate double Delegate_TestClass_delegate75_Del(int integerPortion, float fraction); + public class Delegate_TestClass_delegate75 + { + public delegate double MyDelegate2(int integerPortion, float fraction); + public double DelegatedMethod1(int intPart, float frac) + { + return intPart + frac + 5; + } + public double DelegatedMethod2(int intPart, float frac) + { + return intPart + frac + 10; + } + public double DelegatedMethod3(int intPart, float frac) + { + return intPart + frac + 15; + } + public double DelegatedMethod4(int intPart, float frac) + { + return intPart + frac + 20; + } + public static int Main_old(String[] args) + { + int retval = 0x3F; + + Delegate_TestClass_delegate75 mc = new Delegate_TestClass_delegate75(); + try + { + Delegate_TestClass_delegate75_Del md1 = new Delegate_TestClass_delegate75_Del(mc.DelegatedMethod1); + md1 += new Delegate_TestClass_delegate75_Del(mc.DelegatedMethod2); + MyDelegate2 md2 = new MyDelegate2(mc.DelegatedMethod1); + md2 += new MyDelegate2(mc.DelegatedMethod2); + Delegate[] da1 = md1.GetInvocationList(); + Delegate[] da2 = md2.GetInvocationList(); + if (da1[1].Method == da2[1].Method) + retval ^= 0x01; + if (da1[0].Method == da2[0].Method) + retval ^= 0x02; + md2 = new MyDelegate2(mc.DelegatedMethod4); + md2 += new MyDelegate2(mc.DelegatedMethod3); + Delegate_TestClass_delegate75_Del md3 = new Delegate_TestClass_delegate75_Del(mc.DelegatedMethod4) + new Delegate_TestClass_delegate75_Del(mc.DelegatedMethod3); + Delegate_TestClass_delegate75_Del md4 = md1 + md3; + Delegate[] da3 = md4.GetInvocationList(); + if (da3[0].Method == mc.GetType().GetMethod("DelegatedMethod1")) + retval ^= 0x04; + if (da3[1].Method == mc.GetType().GetMethod("DelegatedMethod2")) + retval ^= 0x08; + if (da3[2].Method == mc.GetType().GetMethod("DelegatedMethod4")) + retval ^= 0x10; + if (da3[3].Method == mc.GetType().GetMethod("DelegatedMethod3")) + retval ^= 0x20; + } + catch (System.Exception) + { + retval -= 0x01; + } + if (0 == retval) Debug.WriteLine("PASS"); + else {Debug.WriteLine("FAIL, 0x{0:X}"); + return retval; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + delegate double Delegate_TestClass_delegate76_Del(int integerPortion, float fraction); + public class Delegate_TestClass_delegate76 + { + public delegate double MyDelegate2(int integerPortion, float fraction); + public double DelegatedMethod1(int intPart, float frac) + { + Debug.WriteLine("DelegatedMethod1"); + return intPart + frac + 5; + } + public double DelegatedMethod2(int intPart, float frac) + { + Debug.WriteLine("DelegatedMethod2"); + return intPart + frac + 10; + } + public double DelegatedMethod3(int intPart, float frac) + { + Debug.WriteLine("DelegatedMethod3"); + return intPart + frac + 15; + } + public double DelegatedMethod4(int intPart, float frac) + { + Debug.WriteLine("DelegatedMethod4"); + return intPart + frac + 20; + } + public static int Main_old(String[] args) + { + int retval = 0x1F; + + Delegate_TestClass_delegate76 mc = new Delegate_TestClass_delegate76(); + try + { + Delegate_TestClass_delegate76_Del md1 = new Delegate_TestClass_delegate76_Del(mc.DelegatedMethod1); + md1 += new Delegate_TestClass_delegate76_Del(mc.DelegatedMethod2); + MyDelegate2 md2 = new MyDelegate2(mc.DelegatedMethod1); + md2 += new MyDelegate2(mc.DelegatedMethod2); + Delegate[] da1 = md1.GetInvocationList(); + Delegate[] da2 = md2.GetInvocationList(); + if (da1[1].Method == da2[1].Method) + retval ^= 0x01; + if (da1[0].Method == da2[0].Method) + retval ^= 0x02; + md2 = new MyDelegate2(mc.DelegatedMethod4); + md2 += new MyDelegate2(mc.DelegatedMethod3); + Delegate_TestClass_delegate76_Del md3 = new Delegate_TestClass_delegate76_Del(mc.DelegatedMethod4) + new Delegate_TestClass_delegate76_Del(mc.DelegatedMethod3); + Delegate_TestClass_delegate76_Del md4 = new Delegate_TestClass_delegate76_Del(md1) + md3; + Delegate[] da3 = md4.GetInvocationList(); + if (da3[0].Method.Name == "Invoke") //This is because was constructed by copying another delegate + retval ^= 0x04; + if (da3[1].Method.Name == mc.GetType().GetMethod("DelegatedMethod4").Name) + retval ^= 0x08; + if (da3[2].Method.Name == mc.GetType().GetMethod("DelegatedMethod3").Name) + retval ^= 0x10; + } + catch (System.Exception) + { + retval -= 0x01; + } + if (0 == retval) Debug.WriteLine("PASS"); + else {Debug.WriteLine("FAIL, 0x{0:X}"); + return retval; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + */ + delegate bool Delegate_TestClass_delegate77_Del(int integerPortion, float fraction); + public class Delegate_TestClass_delegate77 + { + public delegate bool MyDelegate2(int integerPortion, float fraction); + private static int synchro = 31; + private static int retval = 0x0F; + public bool DelegatedMethod1(int intPart, float frac) + { + if ((31 == synchro++) && (5 == intPart) && (.25 == frac)) + { + retval ^= 0x01; + return true; + } + return false; + } + public bool DelegatedMethod2(int intPart, float frac) + { + if ((32 == synchro++) && (5 == intPart) && (.25 == frac)) + { + retval ^= 0x02; + return true; + } + return false; + } + public bool DelegatedMethod3(int intPart, float frac) + { + if ((34 == synchro++) && (5 == intPart) && (.25 == frac)) + { + retval ^= 0x08; + return true; + } + return false; + } + public bool DelegatedMethod4(int intPart, float frac) + { + if ((33 == synchro++) && (5 == intPart) && (.25 == frac)) + { + retval ^= 0x04; + return true; + } + return false; + } + public static int Main_old(String[] args) + { + Delegate_TestClass_delegate77 mc = new Delegate_TestClass_delegate77(); + try + { + Delegate_TestClass_delegate77_Del md1 = new Delegate_TestClass_delegate77_Del(mc.DelegatedMethod1); + md1 += new Delegate_TestClass_delegate77_Del(mc.DelegatedMethod2); + MyDelegate2 md2 = new MyDelegate2(mc.DelegatedMethod4); + md2 += new MyDelegate2(mc.DelegatedMethod3); + Delegate_TestClass_delegate77_Del md3 = new Delegate_TestClass_delegate77_Del(mc.DelegatedMethod4) + new Delegate_TestClass_delegate77_Del(mc.DelegatedMethod3); + Delegate_TestClass_delegate77_Del md4 = new Delegate_TestClass_delegate77_Del(md1) + md3; + md4(5, .25f); + } + catch (System.Exception) + { + retval -= 0x01; + } + if (0 == retval) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL, 0x{0:X}"); + Debug.WriteLine(retval.ToString()); + } + return retval; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + delegate bool Delegate_TestClass_delegate78_Del(ref int integerPortion, float fraction); + public class Delegate_TestClass_delegate78 + { + public delegate bool MyDelegate2(ref int integerPortion, float fraction); + private static int synchro = 31; + private static int retval = 0x1F; + public bool DelegatedMethod1(ref int intPart, float frac) + { + if ((31 == synchro++) && (5 == intPart++) && (.25 == frac)) + { + retval ^= 0x01; + return true; + } + return false; + } + public bool DelegatedMethod2(ref int intPart, float frac) + { + if ((32 == synchro++) && (6 == intPart++) && (.25 == frac)) + { + retval ^= 0x02; + return true; + } + return false; + } + public bool DelegatedMethod3(ref int intPart, float frac) + { + if ((34 == synchro++) && (8 == intPart++) && (.25 == frac)) + { + retval ^= 0x08; + return true; + } + return false; + } + public bool DelegatedMethod4(ref int intPart, float frac) + { + if ((33 == synchro++) && (7 == intPart++) && (.25 == frac)) + { + retval ^= 0x04; + return true; + } + return false; + } + public static int Main_old(String[] args) + { + Delegate_TestClass_delegate78 mc = new Delegate_TestClass_delegate78(); + try + { + Delegate_TestClass_delegate78_Del md1 = new Delegate_TestClass_delegate78_Del(mc.DelegatedMethod1); + md1 += new Delegate_TestClass_delegate78_Del(mc.DelegatedMethod2); + MyDelegate2 md2 = new MyDelegate2(mc.DelegatedMethod4); + md2 += new MyDelegate2(mc.DelegatedMethod3); + Delegate_TestClass_delegate78_Del md3 = new Delegate_TestClass_delegate78_Del(mc.DelegatedMethod4) + new Delegate_TestClass_delegate78_Del(mc.DelegatedMethod3); + Delegate_TestClass_delegate78_Del md4 = new Delegate_TestClass_delegate78_Del(md1) + md3; + int i = 5; + md4(ref i, .25f); + if (9 == i) + retval ^= 0x10; + } + catch (System.Exception) + { + retval -= 0x01; + } + if (0 == retval) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL, 0x{0:X}"); + Debug.WriteLine(retval.ToString()); + } + return retval; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + delegate bool Delegate_TestClass_delegate79_Del(out int integerPortion, float fraction); + public class Delegate_TestClass_delegate79 + { + public delegate bool MyDelegate2(out int integerPortion, float fraction); + private static int synchro = 31; + private static int retval = 0x1F; + public bool DelegatedMethod1(out int intPart, float frac) + { + intPart = 5; + if ((31 == synchro++) && (.25 == frac)) + { + retval ^= 0x01; + return true; + } + return false; + } + public bool DelegatedMethod2(out int intPart, float frac) + { + intPart = 6; + if ((32 == synchro++) && (.25 == frac)) + { + retval ^= 0x02; + return true; + } + return false; + } + public bool DelegatedMethod3(out int intPart, float frac) + { + intPart = 8; + if ((34 == synchro++) && (.25 == frac)) + { + retval ^= 0x08; + return true; + } + return false; + } + public bool DelegatedMethod4(out int intPart, float frac) + { + intPart = 7; + if ((33 == synchro++) && (.25 == frac)) + { + retval ^= 0x04; + return true; + } + return false; + } + public static int Main_old(String[] args) + { + Delegate_TestClass_delegate79 mc = new Delegate_TestClass_delegate79(); + try + { + Delegate_TestClass_delegate79_Del md1 = new Delegate_TestClass_delegate79_Del(mc.DelegatedMethod1); + md1 += new Delegate_TestClass_delegate79_Del(mc.DelegatedMethod2); + MyDelegate2 md2 = new MyDelegate2(mc.DelegatedMethod4); + md2 += new MyDelegate2(mc.DelegatedMethod3); + Delegate_TestClass_delegate79_Del md3 = new Delegate_TestClass_delegate79_Del(mc.DelegatedMethod4) + new Delegate_TestClass_delegate79_Del(mc.DelegatedMethod3); + Delegate_TestClass_delegate79_Del md4 = new Delegate_TestClass_delegate79_Del(md1) + md3; + int i = 5; + md4(out i, .25f); + if (8 == i) + retval ^= 0x10; + } + catch (System.Exception) + { + retval -= 0x01; + } + if (0 == retval) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL, 0x{0:X}"); + Debug.WriteLine(retval.ToString()); + } + return retval; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + delegate bool Delegate_TestClass_delegate80_Del(out int integerPortion, float fraction); + public class Delegate_TestClass_delegate80 + { + public delegate bool MyDelegate2(out int integerPortion, float fraction); + private static int synchro = 31; + private static int retval = 0x23; + public bool DelegatedMethod1(out int intPart, float frac) + { + intPart = 5; + if ((31 == synchro++) && (.25 == frac)) + { + retval ^= 0x01; + return true; + } + return false; + } + public bool DelegatedMethod2(out int intPart, float frac) + { + intPart = 6; + if ((32 == synchro++) && (.25 == frac)) + { + retval ^= 0x02; + throw new System.Exception(); + return true; + } + return false; + } + public bool DelegatedMethod3(out int intPart, float frac) + { + intPart = 8; + if ((34 == synchro++) && (.25 == frac)) + { + retval ^= 0x08; + return true; + } + return false; + } + public bool DelegatedMethod4(out int intPart, float frac) + { + intPart = 7; + if ((33 == synchro++) && (.25 == frac)) + { + retval ^= 0x04; + return true; + } + return false; + } + public static int Main_old(String[] args) + { + Delegate_TestClass_delegate80 mc = new Delegate_TestClass_delegate80(); + try + { + Delegate_TestClass_delegate80_Del md1 = new Delegate_TestClass_delegate80_Del(mc.DelegatedMethod1); + md1 += new Delegate_TestClass_delegate80_Del(mc.DelegatedMethod2); + MyDelegate2 md2 = new MyDelegate2(mc.DelegatedMethod4); + md2 += new MyDelegate2(mc.DelegatedMethod3); + Delegate_TestClass_delegate80_Del md3 = new Delegate_TestClass_delegate80_Del(mc.DelegatedMethod4) + new Delegate_TestClass_delegate80_Del(mc.DelegatedMethod3); + Delegate_TestClass_delegate80_Del md4 = new Delegate_TestClass_delegate80_Del(md1) + md3; + int i = 5; + md4(out i, .25f); + if (8 == i) + retval ^= 0x10; + } + catch (System.Exception) + { + retval ^= 0x20; + } + if (0 == retval) Debug.WriteLine("PASS"); + else + { + Debug.WriteLine("FAIL, 0x{0:X}"); + Debug.WriteLine(retval.ToString()); + } + return retval; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + delegate void Delegate_TestClass_delegate81_B(int x); + class Delegate_TestClass_delegate81_A + { + public static void M1(int i) + { + Debug.WriteLine("Delegate_TestClass_delegate81_A.M1: " + i); + } + public static void M2(int i) + { + Debug.WriteLine("Delegate_TestClass_delegate81_A.M2: " + i); + } + public void M3(int i) + { + Debug.WriteLine("Delegate_TestClass_delegate81_A.M3: " + i); + } + } + class Delegate_TestClass_delegate81 + { + static void Main_old() + { + Delegate_TestClass_delegate81_B cd1 = new Delegate_TestClass_delegate81_B(Delegate_TestClass_delegate81_A.M1); + cd1(-1); // call M1 + Delegate_TestClass_delegate81_B cd2 = new Delegate_TestClass_delegate81_B(Delegate_TestClass_delegate81_A.M2); + cd2(-2); // call M2 + Delegate_TestClass_delegate81_B cd3 = cd1 + cd2; + cd3(10); // call M1 then M2 + cd3 += cd1; + cd3(20); // call M1, M2, then M1 + Delegate_TestClass_delegate81_A c = new Delegate_TestClass_delegate81_A(); + Delegate_TestClass_delegate81_B cd4 = new Delegate_TestClass_delegate81_B(c.M3); + cd3 += cd4; + cd3(30); // call M1, M2, M1, then M3 + cd3 -= cd1; // remove last M1 + cd3(40); // call M1, M2, then M3 + cd3 -= cd4; + cd3(50); // call M1 then M2 + cd3 -= cd2; + cd3(60); // call M1 + cd3 -= cd2; // impossible removal is benign + cd3(60); // call M1 + cd3 -= cd1; // invocation list is empty + cd3 -= cd1; // impossible removal is benign + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + public class Delegate_TestClass_delegate_modifier09 + { + public delegate void Delegate_TestClass_delegate_modifier09_B(); + + public static int Main_old(String[] args) + { + return 0; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Delegate_TestClass_delegate_modifier10 + { + protected delegate void Delegate_TestClass_delegate_modifier10_B(); + + public static int Main_old(String[] args) + { + return 0; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Delegate_TestClass_delegate_modifier11 + { + private delegate void Delegate_TestClass_delegate_modifier11_B(); + + public static int Main_old(String[] args) + { + return 0; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + public class Delegate_TestClass_delegate_modifier12 + { + internal delegate void Delegate_TestClass_delegate_modifier12_B(); + + public static int Main_old(String[] args) + { + return 0; + } + public static bool testMethod() + { + if (Main_old(null) != 0) + return false; + else + return true; + } + } + + } +} diff --git a/Tests/NFUnitTestDelegates/nano.runsettings b/Tests/NFUnitTestDelegates/nano.runsettings new file mode 100644 index 00000000..fa881e3a --- /dev/null +++ b/Tests/NFUnitTestDelegates/nano.runsettings @@ -0,0 +1,14 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + False + + \ No newline at end of file diff --git a/Tests/NFUnitTestDelegates/packages.config b/Tests/NFUnitTestDelegates/packages.config new file mode 100644 index 00000000..1adb9284 --- /dev/null +++ b/Tests/NFUnitTestDelegates/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestEnum/UnitTestEnumTests.cs b/Tests/NFUnitTestEnum/UnitTestEnumTests.cs index 7a05724c..35cbff8a 100644 --- a/Tests/NFUnitTestEnum/UnitTestEnumTests.cs +++ b/Tests/NFUnitTestEnum/UnitTestEnumTests.cs @@ -1,3 +1,9 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 45b5623f..02378248 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -43,6 +43,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestException", "Test EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestEnum", "Tests\NFUnitTestEnum\NFUnitTestEnum.nfproj", "{75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestDelegates", "Tests\NFUnitTestDelegates\NFUnitTestDelegates.nfproj", "{A8D00E31-5905-4DB4-A7F2-F0C00E3560DD}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -135,6 +137,12 @@ Global {75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E}.Release|Any CPU.ActiveCfg = Release|Any CPU {75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E}.Release|Any CPU.Build.0 = Release|Any CPU {75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E}.Release|Any CPU.Deploy.0 = Release|Any CPU + {A8D00E31-5905-4DB4-A7F2-F0C00E3560DD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A8D00E31-5905-4DB4-A7F2-F0C00E3560DD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A8D00E31-5905-4DB4-A7F2-F0C00E3560DD}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {A8D00E31-5905-4DB4-A7F2-F0C00E3560DD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A8D00E31-5905-4DB4-A7F2-F0C00E3560DD}.Release|Any CPU.Build.0 = Release|Any CPU + {A8D00E31-5905-4DB4-A7F2-F0C00E3560DD}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -153,6 +161,7 @@ Global {6B598666-54C8-4705-A7FB-B2BC75CA00BC} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {BDB01244-6EAD-476E-9084-27D0D249E9A6} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {A8D00E31-5905-4DB4-A7F2-F0C00E3560DD} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From c7f023a568375f50d3c28db05cb28097f0fb3400 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 19:09:22 +0300 Subject: [PATCH 37/55] Adding conversions --- .../NFUnitTestConversions.nfproj | 62 ++ .../Properties/AssemblyInfo.cs | 33 + .../UnitTestBoxingTests.cs | 314 ++++++ .../UnitTestConvertTests.cs | 361 +++++++ .../UnitTestExprefTests.cs | 926 ++++++++++++++++++ Tests/NFUnitTestConversions/nano.runsettings | 14 + Tests/NFUnitTestConversions/packages.config | 5 + nanoFramework.CoreLibrary.sln | 9 + 8 files changed, 1724 insertions(+) create mode 100644 Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj create mode 100644 Tests/NFUnitTestConversions/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestConversions/UnitTestBoxingTests.cs create mode 100644 Tests/NFUnitTestConversions/UnitTestConvertTests.cs create mode 100644 Tests/NFUnitTestConversions/UnitTestExprefTests.cs create mode 100644 Tests/NFUnitTestConversions/nano.runsettings create mode 100644 Tests/NFUnitTestConversions/packages.config diff --git a/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj b/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj new file mode 100644 index 00000000..baae64f3 --- /dev/null +++ b/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj @@ -0,0 +1,62 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4ef6d81d-0dbb-41bb-b55b-a37b0b630adb + Library + Properties + 512 + NFUnitTestConversions + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestConversions/Properties/AssemblyInfo.cs b/Tests/NFUnitTestConversions/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestConversions/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestConversions/UnitTestBoxingTests.cs b/Tests/NFUnitTestConversions/UnitTestBoxingTests.cs new file mode 100644 index 00000000..d1c616bc --- /dev/null +++ b/Tests/NFUnitTestConversions/UnitTestBoxingTests.cs @@ -0,0 +1,314 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; + +namespace NFUnitTestConversions +{ + [TestClass] + public class UnitTestBoxingTests + { + [TestMethod] + public void Boxingbyte_Test() + { + Assert.True(BoxingTestClassbyte.testMethod()); + } + + [TestMethod] + public void Boxingchar_Test() + { + Assert.True(BoxingTestClasschar.testMethod()); + } + + [TestMethod] + public void Boxingdouble_Test() + { + Assert.True(BoxingTestClassdouble.testMethod()); + } + + [TestMethod] + public void Boxingfloat_Test() + { + Assert.True(BoxingTestClassfloat.testMethod()); + } + + [TestMethod] + public void Boxingint_Test() + { + Assert.True(BoxingTestClassint.testMethod()); + } + + [TestMethod] + public void Boxinglong_Test() + { + Assert.True(BoxingTestClasslong.testMethod()); + } + + [TestMethod] + public void Boxingsbyte_Test() + { + Assert.True(BoxingTestClasssbyte.testMethod()); + } + + [TestMethod] + public void Boxingshort_Test() + { + Assert.True(BoxingTestClassshort.testMethod()); + } + + [TestMethod] + public void Boxinguint_Test() + { + Assert.True(BoxingTestClassuint.testMethod()); + } + + [TestMethod] + public void Boxingulong_Test() + { + Assert.True(BoxingTestClassulong.testMethod()); + } + + [TestMethod] + public void Boxingushort_Test() + { + Assert.True(BoxingTestClassushort.testMethod()); + } + + [TestMethod] + public void Boxingstruct_to_ValType_Test() + { + Assert.True(BoxingTestClassStruct_to_ValType.testMethod()); + } + + [TestMethod] + public void BoxingValType_to_struct_Test() + { + Assert.True(BoxingTestClassValType_to_struct.testMethod()); + } + + + //Compiled Test Cases + + public class BoxingTestClassbyte + { + public static bool testMethod() + { + byte value = 1; + object obj; + obj = value; // box + byte value2; + value2 = (byte)obj; // unbox + if (value2 == value) + return true; + else + return false; + + } + } + + + public class BoxingTestClasschar + { + public static bool testMethod() + { + char value = '\x1'; + object obj; + obj = value; // box + char value2; + value2 = (char)obj; // unbox + if (value2 == value) + return true; + else + return false; + + } + } + + + public class BoxingTestClassdouble + { + public static bool testMethod() + { + double value = 1.0; + object obj; + obj = value; // box + double value2; + value2 = (double)obj; // unbox + if (value2 == value) + return true; + else + return false; + + } + } + + + public class BoxingTestClassfloat + { + public static bool testMethod() + { + float value = 1F; + object obj; + obj = value; // box + float value2; + value2 = (float)obj; // unbox + if (value2 == value) + return true; + else + return false; + + } + } + + + public class BoxingTestClassint + { + public static bool testMethod() + { + int value = 1; + object obj; + obj = value; // box + int value2; + value2 = (int)obj; // unbox + if (value2 == value) + return true; + else + return false; + + } + } + + + public class BoxingTestClasslong + { + public static bool testMethod() + { + long value = 1; + object obj; + obj = value; // box + long value2; + value2 = (long)obj; // unbox + if (value2 == value) + return true; + else + return false; + + } + } + + + public class BoxingTestClasssbyte + { + public static bool testMethod() + { + sbyte value = 1; + object obj; + obj = value; // box + sbyte value2; + value2 = (sbyte)obj; // unbox + if (value2 == value) + return true; + else + return false; + + } + } + + + public class BoxingTestClassshort + { + public static bool testMethod() + { + short value = 1; + object obj; + obj = value; // box + short value2; + value2 = (short)obj; // unbox + if (value2 == value) + return true; + else + return false; + + } + } + + + public class BoxingTestClassuint + { + public static bool testMethod() + { + uint value = 1; + object obj; + obj = value; // box + uint value2; + value2 = (uint)obj; // unbox + if (value2 == value) + return true; + else + return false; + + } + } + + + public class BoxingTestClassulong + { + public static bool testMethod() + { + ulong value = 1; + object obj; + obj = value; // box + ulong value2; + value2 = (ulong)obj; // unbox + if (value2 == value) + return true; + else + return false; + } + } + + + public class BoxingTestClassushort + { + public static bool testMethod() + { + ushort value = 1; + object obj; + obj = value; // box + ushort value2; + value2 = (ushort)obj; // unbox + if (value2 == value) + return true; + else + return false; + } + } + + struct BoxingTestClassStruct_to_ValTypeTest_struct { } + class BoxingTestClassStruct_to_ValType + { + public static bool testMethod() + { + BoxingTestClassStruct_to_ValTypeTest_struct src = new BoxingTestClassStruct_to_ValTypeTest_struct(); + System.ValueType dst = src; + return true; + } + } + + struct BoxingTestClassValType_to_struct_struct { } + class BoxingTestClassValType_to_struct + { + public static bool testMethod() + { + System.ValueType src = new BoxingTestClassValType_to_struct_struct(); + BoxingTestClassValType_to_struct_struct dst = (BoxingTestClassValType_to_struct_struct)src; + return true; + } + } + + } +} diff --git a/Tests/NFUnitTestConversions/UnitTestConvertTests.cs b/Tests/NFUnitTestConversions/UnitTestConvertTests.cs new file mode 100644 index 00000000..39aee2d0 --- /dev/null +++ b/Tests/NFUnitTestConversions/UnitTestConvertTests.cs @@ -0,0 +1,361 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestConversions +{ + [TestClass] + class UnitTestConvertTests + { + [TestMethod] + public void Cast_FloatingPoint() + { + uint u1; + uint u2; + double d1; + float f1; + long l1; + long l2; + double d2; + Random rand = new Random(); + + for (int i = 0; i < 100; i++) + { + u1 = (uint)rand.Next(); + + d1 = (double)u1; // Does not work correctly (d1 is close to 0) + u2 = (uint)d1; + Assert.Equal(d1, u1); + Assert.Equal(u2, u1); + + f1 = (float)u1; // Same problem + Assert.Equal(f1, u1); + + l1 = (long)u1; + u2 = (uint)l1; + Assert.Equal(l1, u1); + Assert.Equal(u2, u1); + + d2 = l1; // Same problem + l2 = (long)d2; + Assert.Equal(d2, l1); + Assert.Equal(l2, l1); + } + } + + [TestMethod] + public void Convert_Positive() + { + string number = "12"; + int actualNumber = 12; + SByte value_sb = Convert.ToSByte(number); + Assert.Equal(value_sb, (byte)12); + Byte value_b = Convert.ToByte(number); + Assert.Equal(value_b, (byte)12); + Int16 value_s16 = Convert.ToInt16(number); + Assert.Equal(value_s16, (short)12); + UInt16 value_u16 = Convert.ToUInt16(number); + Assert.Equal(value_u16, (ushort)12); + Int32 value_s32 = Convert.ToInt32(number); + Assert.Equal(value_s32, (int)12); + UInt32 value_u32 = Convert.ToUInt32(number); + Assert.Equal(value_u32, (uint)12); + Int64 value_s64 = Convert.ToInt32(number); + Assert.Equal(value_s64, (long)12); + UInt64 value_u64 = Convert.ToUInt64(number); + Assert.Equal(value_u64, (ulong)12); + } + + [TestMethod] + public void Convert_PositivePlus() + { + string number = "+12"; + int actualNumber = 12; + SByte value_sb = Convert.ToSByte(number); + Assert.Equal(value_sb, (byte)12); + Byte value_b = Convert.ToByte(number); + Assert.Equal(value_b, (byte)12); + Int16 value_s16 = Convert.ToInt16(number); + Assert.Equal(value_s16, (short)12); + UInt16 value_u16 = Convert.ToUInt16(number); + Assert.Equal(value_u16, (ushort)12); + Int32 value_s32 = Convert.ToInt32(number); + Assert.Equal(value_s32, (int)12); + UInt32 value_u32 = Convert.ToUInt32(number); + Assert.Equal(value_u32, (uint)12); + Int64 value_s64 = Convert.ToInt32(number); + Assert.Equal(value_s64, (long)12); + UInt64 value_u64 = Convert.ToUInt64(number); + Assert.Equal(value_u64, (ulong)12); + } + + + [TestMethod] + public void Convert_Negative() + { + string number = "-12"; + int actualNumber = -12; + + SByte value_sb = Convert.ToSByte(number); + Assert.Equal(value_sb, (sbyte)actualNumber); + Assert.Trows(typeof(ArgumentOutOfRangeException), () => { Byte value_b = Convert.ToByte(number); }); + Int16 value_s16 = Convert.ToInt16(number); + Assert.Equal(value_s16, (short)actualNumber); + Assert.Trows(typeof(ArgumentOutOfRangeException), () => { UInt16 value_u16 = Convert.ToUInt16(number); }); + Int32 value_s32 = Convert.ToInt32(number); + Assert.Equal(value_s32, (int)actualNumber); + Assert.Trows(typeof(ArgumentOutOfRangeException), () => { UInt32 value_u32 = Convert.ToUInt32(number); }); + Int64 value_s64 = Convert.ToInt32(number); + Assert.Equal(value_s64, (long)actualNumber); + Assert.Trows(typeof(ArgumentOutOfRangeException), () => { UInt64 value_u64 = Convert.ToUInt64(number); }); + } + + [TestMethod] + public void Convert_Double() + { + string number = "36.123456"; + double actualNumber = 36.123456; + + double value_dd = Convert.ToDouble(number); + Assert.Equal(value_dd, actualNumber); + } + + [TestMethod] + public void Convert_Plus() + { + string number = "+36.123456"; + double actualNumber = 36.123456; + + double value_dd = Convert.ToDouble(number); + Assert.Equal(value_dd, actualNumber); + } + + [TestMethod] + public void Convert_Neg() + { + string number = "-36.123456"; + double actualNumber = -36.123456; + + double value_dd = Convert.ToDouble(number); + + Assert.Equal(value_dd, actualNumber); + } + + [TestMethod] + public void Convert_Whitespace() + { + string intnum = " -3484 "; + string number = " +36.123456 "; + long actualInt = -3484; + double actualNumber = 36.123456; + + Assert.Equal(actualInt, Convert.ToInt16(intnum)); + Assert.Equal(actualInt, Convert.ToInt32(intnum)); + Assert.Equal(actualInt, Convert.ToInt64(intnum)); + double value_dd = Convert.ToDouble(number); + Assert.Equal(value_dd, actualNumber); + } + + [TestMethod] + public void Convert_DoubleNormalizeNeg() + { + string number = "-3600030383448481.123456"; + double actualNumber = -3600030383448481.123456; + + double value_dd = Convert.ToDouble(number); + + Assert.Equal(value_dd, actualNumber); + number = "+0.00000000484874758559e-3"; + actualNumber = 4.84874758559e-12; + Assert.Equal(actualNumber, Convert.ToDouble(number)); + } + + [TestMethod] + public void Convert_HexInt() + { + string number = "0x01234567"; + int actualNumber = 0x01234567; + + int value = Convert.ToInt32(number, 16); + + Assert.Equal(value, actualNumber); + number = "0x89abcdef"; + unchecked + { + actualNumber = (int)0x89abcdef; + } + Assert.Equal(actualNumber, Convert.ToInt32(number, 16)); + number = "0x0AbF83C"; + actualNumber = 0xAbF83C; + + Assert.Equal(actualNumber, Convert.ToInt32(number, 16)); + } + + [TestMethod] + public void Convert_BoundaryValues() + { + double valMax = double.MaxValue; + string numMax = valMax.ToString(); + double valMin = double.MinValue; + string numMin = valMin.ToString(); + + Assert.Equal(valMax, Convert.ToDouble(numMax)); + Assert.Equal(valMin, Convert.ToDouble(numMin)); + + valMax = float.MaxValue; + numMax = valMax.ToString(); + valMin = float.MinValue; + numMin = valMin.ToString(); + + Assert.Equal(valMax, Convert.ToDouble(numMax)); + Assert.Equal(valMin, Convert.ToDouble(numMin)); + + long lMax = long.MaxValue; + numMax = lMax.ToString(); + long lMin = long.MinValue; + numMin = lMin.ToString(); + + Assert.Equal(lMax, Convert.ToInt64(numMax)); + Assert.Equal(lMin, Convert.ToInt64(numMin)); + + ulong ulMax = ulong.MaxValue; + numMax = ulMax.ToString(); + ulong ulMin = ulong.MinValue; + numMin = ulMin.ToString(); + + Assert.Equal(ulMax, Convert.ToUInt64(numMax)); + Assert.Equal(ulMin, Convert.ToUInt64(numMin)); + + + long iMax = int.MaxValue; + numMax = iMax.ToString(); + long iMin = int.MinValue; + numMin = iMin.ToString(); + + Assert.Equal(iMax, Convert.ToInt32(numMax)); + Assert.Equal(iMin, Convert.ToInt32(numMin)); + + uint uiMax = uint.MaxValue; + numMax = uiMax.ToString(); + uint uiMin = uint.MinValue; + numMin = uiMin.ToString(); + + Assert.Equal(uiMax, Convert.ToUInt32(numMax)); + Assert.Equal(uiMin, Convert.ToUInt32(numMin)); + + short sMax = short.MaxValue; + numMax = sMax.ToString(); + short sMin = short.MinValue; + numMin = sMin.ToString(); + + Assert.Equal(sMax, Convert.ToInt16(numMax)); + Assert.Equal(sMin, Convert.ToInt16(numMin)); + + ushort usMax = ushort.MaxValue; + numMax = usMax.ToString(); + ushort usMin = ushort.MinValue; + numMin = usMin.ToString(); + + Assert.Equal(usMax, Convert.ToUInt16(numMax)); + Assert.Equal(usMin, Convert.ToUInt16(numMin)); + + sbyte sbMax = sbyte.MaxValue; + numMax = sbMax.ToString(); + sbyte sbMin = sbyte.MinValue; + numMin = sbMin.ToString(); + + Assert.Equal(sbMax, Convert.ToSByte(numMax)); + Assert.Equal(sbMin, Convert.ToSByte(numMin)); + + byte bMax = byte.MaxValue; + numMax = bMax.ToString(); + byte bMin = byte.MinValue; + numMin = bMin.ToString(); + + Assert.Equal(bMax, Convert.ToByte(numMax)); + Assert.Equal(bMin, Convert.ToByte(numMin)); + } + + + [TestMethod] + public void Convert_LeadingZeroValues() + { + string number = "00000000"; + + Assert.Equal((short)0, Convert.ToInt16(number)); + Assert.Equal(0, Convert.ToInt32(number)); + Assert.Equal(0, Convert.ToInt64(number)); + + number = "+00000000000"; + + Assert.Equal((short)0, Convert.ToInt16(number)); + Assert.Equal(0, Convert.ToInt32(number)); + Assert.Equal(0, Convert.ToInt64(number)); + + number = "-00000000000"; + + Assert.Equal((short)0, Convert.ToInt16(number)); + Assert.Equal(0, Convert.ToInt32(number)); + Assert.Equal(0, Convert.ToInt64(number)); + } + + [TestMethod] + public void Convert_LeadingZeros() + { + string number = "000003984"; + int actualNumber = 3984; + + Assert.Equal((short)actualNumber, Convert.ToInt16(number)); + Assert.Equal(actualNumber, Convert.ToInt32(number)); + Assert.Equal(actualNumber, Convert.ToInt64(number)); + number = "-00000003489"; + actualNumber = -3489; + + Assert.Equal((short)actualNumber, Convert.ToInt16(number)); + Assert.Equal(actualNumber, Convert.ToInt32(number)); + Assert.Equal(actualNumber, Convert.ToInt64(number)); + number = "+00000003489"; + actualNumber = 3489; + + Assert.Equal((short)actualNumber, Convert.ToInt16(number)); + Assert.Equal(actualNumber, Convert.ToInt32(number)); + Assert.Equal(actualNumber, Convert.ToInt64(number)); + + number = "+000000043984.00048850000"; + double numD = 4.39840004885; + + Assert.NotEqual(numD, Convert.ToDouble(number)); + number = "-000000043984.00048850000"; + numD = -4.39840004885; + + Assert.NotEqual(numD, Convert.ToDouble(number)); + number = "000000043984.000488500e-006"; + numD = 4.39840004885e2; + + Assert.NotEqual(numD, Convert.ToDouble(number)); + } + + [TestMethod] + public void Convert_64ParsePerf() + { + string number = "-7446744073709551615"; + long val = 0; + + DateTime start = DateTime.UtcNow; + for (int i = 0; i < 0x1000; i++) + { + val = Convert.ToInt64(number); + } + Debug.WriteLine("Time: " + (DateTime.UtcNow - start).ToString()); + + Assert.Equal(val, -7446744073709551615L); + } + + } +} diff --git a/Tests/NFUnitTestConversions/UnitTestExprefTests.cs b/Tests/NFUnitTestConversions/UnitTestExprefTests.cs new file mode 100644 index 00000000..cb227a32 --- /dev/null +++ b/Tests/NFUnitTestConversions/UnitTestExprefTests.cs @@ -0,0 +1,926 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestConversions +{ + [TestClass] + class UnitTestExprefTests + { + [TestMethod] + public void Expref_obj_ref_Test() + { + Debug.WriteLine(" Converting from 'object' to a reference object. "); + Assert.True(ExprefTestClass_obj_ref.testMethod()); + } + + [TestMethod] + public void Expref_obj_ref_exc_Test() + { + + Debug.WriteLine(" Converting from 'object' to a reference object. "); + Assert.True(ExprefTestClass_obj_ref_exc.testMethod()); + } + + [TestMethod] + public void Expref_class_class_Test() + { + + Debug.WriteLine(" Tests that you can convert from a base class to a derived class"); + Assert.True(ExprefTestClass_class_class.testMethod()); + } + + [TestMethod] + public void Expref_class_class_exc_Test() + { + + Debug.WriteLine(" Tests that you can convert from a base class to a derived class"); + Assert.True(ExprefTestClass_class_class_exc.testMethod()); + } + + [TestMethod] + public void Expref_inter_struct_exc_Test() + { + + Debug.WriteLine(" Tests that you can convert from an interface to a struct that implements it."); + Assert.True(ExprefTestClass_inter_struct_exc.testMethod()); + } + + [TestMethod] + public void Expref_class_inter_Test() + { + Debug.WriteLine(" Tests converting from a class to an interface that the class does not implement (but a derived class might)."); + Assert.True(ExprefTestClass_class_inter.testMethod()); + } + + [TestMethod] + public void Expref_class_inter_exc_Test() + { + Debug.WriteLine(" Tests converting from a class to an interface that the class does not implement (but a derived class might)."); + Assert.True(ExprefTestClass_class_inter_exc.testMethod()); + } + + [TestMethod] + public void Expref_inter_class_Test() + { + Debug.WriteLine(" Tests converting from an interface to a class"); + Debug.WriteLine("From any interface-type S to any class-type T, provided T is not sealed, or provided T implements S."); + Debug.WriteLine("If T implements S:"); + Assert.True(ExprefTestClass_inter_class.testMethod()); + } + + [TestMethod] + public void Expref_inter_class2_Test() + { + Debug.WriteLine(" Tests converting from an interface to a class"); + Assert.True(ExprefTestClass_inter_class2.testMethod()); + } + + [TestMethod] + public void Expref_inter_class2_exc1_Test() + { + Debug.WriteLine(" Tests converting from an interface to a class"); + Assert.True(ExprefTestClass_inter_class2_exc1.testMethod()); + } + + [TestMethod] + public void Expref_inter_class2_exc2_Test() + { + + Debug.WriteLine(" Tests converting from an interface to a class"); + Assert.True(ExprefTestClass_inter_class2_exc2.testMethod()); + } + + [TestMethod] + public void Expref_inter_class_exc_Test() + { + + Debug.WriteLine(" Tests converting from an interface to a class"); + Assert.True(ExprefTestClass_inter_class_exc.testMethod()); + } + + [TestMethod] + public void Expref_inter_class_sealed_Test() + { + Debug.WriteLine(" Tests converting from an interface to a class"); + Assert.True(ExprefTestClass_inter_class_sealed.testMethod()); + } + + [TestMethod] + public void Expref_inter_class_sealed_exc_Test() + { + Debug.WriteLine(" Tests converting from an interface to a class"); + Assert.True(ExprefTestClass_inter_class_sealed_exc.testMethod()); + } + + [TestMethod] + public void Expref_inter_inter_Test() + { + Debug.WriteLine(" Tests converting from an interface to an interface"); + Assert.True(ExprefTestClass_inter_inter.testMethod()); + } + + [TestMethod] + public void Expref_inter_inter_exc_Test() + { + Debug.WriteLine(" Tests converting from an interface to an interface"); + Assert.True(ExprefTestClass_inter_inter_exc.testMethod()); + } + + [TestMethod] + public void Impenum_zero_Test() + { + Debug.WriteLine("Tests whether 0 can be converted to various enum types..."); + Assert.True(ImpenumTestClass_zero.testMethod()); + } + + [TestMethod] + public void Impref_ref_obj_Test() + { + Debug.WriteLine(" Converting from a reference object to 'object'"); + Assert.True(ImprefTestClass_ref_obj.testMethod()); + } + + [TestMethod] + public void Impref_class_class_Test() + { + Debug.WriteLine(" Tests that you can convert from a class to a base class. "); + Assert.True(ImprefTestClass_class_class.testMethod()); + } + + [TestMethod] + public void Impref_class_inter_Test() + { + Debug.WriteLine(" Tests that you can convert from a class to an interface that it implements. "); + Assert.True(ImprefTestClass_class_inter.testMethod()); + } + + [TestMethod] + public void Impref_struct_inter_Test() + { + Debug.WriteLine(" Tests that you can convert from a struct to an interface that it implements. "); + Assert.True(ImprefTestClass_struct_inter.testMethod()); + } + + [TestMethod] + public void Impref_array_array_Test() + { + Debug.WriteLine(" Tests that you can convert from an array of one class to an array of another class..."); + Assert.True(ImprefTestClass_array_array.testMethod()); + } + + [TestMethod] + public void Impref_array_cloneable_Test() + { + Debug.WriteLine(" Tests that you can convert from an array to System.ICloneable;"); + Assert.True(ImprefTestClass_array_cloneable.testMethod()); + } + + [TestMethod] + public void Impref_null_ref_Test() + { + Debug.WriteLine(" Tests that you can convert from null to several reference types"); + Assert.True(ImprefTestClass_null_ref.testMethod()); + } + + [TestMethod] + public void Impref_delegate_to_SystemDotDelegate_Test() + { + Debug.WriteLine(" Tests that you can convert from a delegate type to System.Delegate"); + Assert.True(ImprefTestClass_delegate_to_SystemDotDelegate.testMethod()); + } + + + //Compiled Test Cases + public class ImprefTestClass_ref_obj_Sub + { + int func() { return (1); } + } + public class ImprefTestClass_ref_obj + { + public static bool testMethod() + { + ImprefTestClass_ref_obj_Sub test = new ImprefTestClass_ref_obj_Sub(); + object obj; + obj = test; + return true; + } + } + + class ImprefTestClass_class_class_Der1 + { + void i() { } + } + + class ImprefTestClass_class_class_Der2 : ImprefTestClass_class_class_Der1 + { + void j() { } + } + public class ImprefTestClass_class_class + { + public static bool testMethod() + { + ImprefTestClass_class_class_Der2 derivedClass = new ImprefTestClass_class_class_Der2(); + + ImprefTestClass_class_class_Der1 ImprefTestClass_class_class_Base; + ImprefTestClass_class_class_Base = derivedClass; + return true; + } + } + + interface ImprefTestClass_class_inter_Interface1 + { + void i(); + } + interface ImprefTestClass_class_inter_Interface2 + { + void j(); + } + + class ImprefTestClass_class_inter_Sub : ImprefTestClass_class_inter_Interface1, ImprefTestClass_class_inter_Interface2 + { + public void i() { } + public void j() { } + } + public class ImprefTestClass_class_inter + { + public static bool testMethod() + { + ImprefTestClass_class_inter_Sub ImprefTestClass_class_inter_Sub = new ImprefTestClass_class_inter_Sub(); + ImprefTestClass_class_inter_Interface2 inter2; + ImprefTestClass_class_inter_Interface1 inter1; + inter1 = ImprefTestClass_class_inter_Sub; + inter2 = ImprefTestClass_class_inter_Sub; + return true; + } + + } + + interface ImprefTestClass_struct_inter_Interface1 + { + void i(); + } + interface ImprefTestClass_struct_inter_Interface2 + { + void j(); + } + + struct ImprefTestClass_struct_inter_Sub : ImprefTestClass_struct_inter_Interface1, ImprefTestClass_struct_inter_Interface2 + { + public void i() { } + public void j() { } + } + public class ImprefTestClass_struct_inter + { + public static bool testMethod() + { + ImprefTestClass_struct_inter_Sub ImprefTestClass_struct_inter_Sub = new ImprefTestClass_struct_inter_Sub(); + ImprefTestClass_struct_inter_Interface2 inter2; + ImprefTestClass_struct_inter_Interface1 inter1; + inter2 = ImprefTestClass_struct_inter_Sub; + inter1 = ImprefTestClass_struct_inter_Sub; + return true; + } + } + + class ImprefTestClass_array_array_Base1 + { + public void i() { } + } + + class ImprefTestClass_array_array_Base2 : ImprefTestClass_array_array_Base1 + { + public void j() { } + } + public class ImprefTestClass_array_array + { + public static bool testMethod() + { + ImprefTestClass_array_array_Base2[] arrDer = new ImprefTestClass_array_array_Base2[1]; + ImprefTestClass_array_array_Base2 element = new ImprefTestClass_array_array_Base2(); + arrDer[0] = element; + ImprefTestClass_array_array_Base1[] arrBase = new ImprefTestClass_array_array_Base1[1]; + arrBase = arrDer; + element.j(); + arrBase[0].i(); + return true; + } + } + + class ImprefTestClass_array_cloneable_Derived + { + public void i() { } + } + + public class ImprefTestClass_array_cloneable + { + public static bool testMethod() + { + ImprefTestClass_array_cloneable_Derived[] arrBase = new ImprefTestClass_array_cloneable_Derived[1]; + ICloneable clone; + clone = arrBase; + return true; + } + } + + class ImprefTestClass_null_ref_Derived + { + public void i() { } + } + public class ImprefTestClass_null_ref + { + public static bool testMethod() + { + ImprefTestClass_null_ref_Derived classDer1; + String string1; + classDer1 = null; + string1 = null; + return true; + } + } + + delegate void ImprefTestClass_delegate_to_SystemDotDelegate_Delegate(); + class ImprefTestClass_delegate_to_SystemDotDelegate + { + public static void DoNothing() { } + public static bool testMethod() + { + ImprefTestClass_delegate_to_SystemDotDelegate_Delegate src = new ImprefTestClass_delegate_to_SystemDotDelegate_Delegate(ImprefTestClass_delegate_to_SystemDotDelegate.DoNothing); + System.Delegate dst = src; + src(); + return true; + } + } + + + enum ImpenumTestClass_zero_Test1 : int + { + a, + b, + c + } + enum ImpenumTestClass_zero_Test2 : short + { + a, + b, + c + } + enum ImpenumTestClass_zero_Test3 : long + { + a, + b, + c + } + public class ImpenumTestClass_zero + { + public static bool testMethod() + { + ImpenumTestClass_zero_Test1 t1 = 0; + ImpenumTestClass_zero_Test2 t2 = 0; + ImpenumTestClass_zero_Test3 t3 = 0; + return true; + } + } + + + //Compiled Test Cases + public class ExprefTestClass_obj_ref_Sub1 + { + public void func() {/*Old Print*/} + } + public class ExprefTestClass_obj_ref_Sub2 + { + public void func() {/*Old Print*/} + } + public class ExprefTestClass_obj_ref + { + public static bool testMethod() + { + ExprefTestClass_obj_ref_Sub1 test = new ExprefTestClass_obj_ref_Sub1(); + object obj; + obj = test; // implicit setup + test = (ExprefTestClass_obj_ref_Sub1)obj; + test.func(); + return true; + } + } + + public class ExprefTestClass_obj_ref_exc_Sub1 + { + int func() { return (1); } + } + public class ExprefTestClass_obj_ref_exc_Sub2 + { + int func() { return (1); } + } + public class ExprefTestClass_obj_ref_exc + { + public static bool testMethod() + { + ExprefTestClass_obj_ref_exc_Sub1 test = new ExprefTestClass_obj_ref_exc_Sub1(); + ExprefTestClass_obj_ref_exc_Sub2 test2; + object obj; + obj = test; // implicit setup + try + { + test2 = (ExprefTestClass_obj_ref_exc_Sub2)obj; // obj is *not* a test2 + } + catch (System.Exception e) + { + //Old Print + } + return true; + } + } + + class ExprefTestClass_class_class_Base1 + { + void i() { } + } + + class ExprefTestClass_class_class_Base2 : ExprefTestClass_class_class_Base1 + { + void j() { } + } + public class ExprefTestClass_class_class + { + public static bool testMethod() + { + ExprefTestClass_class_class_Base2 derivedClass = new ExprefTestClass_class_class_Base2(); + + ExprefTestClass_class_class_Base1 myBase; + myBase = derivedClass; // implicit conversion + derivedClass = (ExprefTestClass_class_class_Base2)myBase; // test conversion + return true; + } + } + + class ExprefTestClass_class_class_exc_Base + { + void i() { } + } + + class ExprefTestClass_class_class_exc_Der1 : ExprefTestClass_class_class_exc_Base + { + void j() { } + } + class ExprefTestClass_class_class_exc_Der2 : ExprefTestClass_class_class_exc_Base + { + void k() { } + } + public class ExprefTestClass_class_class_exc + { + public static bool testMethod() + { + ExprefTestClass_class_class_exc_Der1 derivedClass = new ExprefTestClass_class_class_exc_Der1(); + + ExprefTestClass_class_class_exc_Base myBase; + ExprefTestClass_class_class_exc_Der2 derivedClass3; + myBase = derivedClass; // implicit conversion + try + { + derivedClass3 = (ExprefTestClass_class_class_exc_Der2)myBase; // test conversion + } + catch (System.Exception e) + { + //Old Print + } + return true; + } + } + + interface ExprefTestClass_inter_struct_exc_Interface1 + { + void i(); + } + public interface ExprefTestClass_inter_struct_exc_Interface2 + { + void j(); + } + + struct ExprefTestClass_inter_struct_exc_struct1 : ExprefTestClass_inter_struct_exc_Interface1 + { + public void i() + {//Old Print + } + } + struct TheStruct2 : ExprefTestClass_inter_struct_exc_Interface1 + { + public void i() + {//Old Print + } + } + + public class ExprefTestClass_inter_struct_exc + { + public static bool testMethod() + { + //Old Print + ExprefTestClass_inter_struct_exc_struct1 theStruct1 = new ExprefTestClass_inter_struct_exc_struct1(); + //Old Print + return true; + theStruct1.i(); + ExprefTestClass_inter_struct_exc_Interface1 ExprefTestClass_inter_struct_exc_Interface1; + ExprefTestClass_inter_struct_exc_Interface1 = theStruct1; + theStruct1 = (ExprefTestClass_inter_struct_exc_struct1)ExprefTestClass_inter_struct_exc_Interface1; + theStruct1.i(); + TheStruct2 theStruct2; + theStruct2 = (TheStruct2)ExprefTestClass_inter_struct_exc_Interface1; + theStruct2.i(); + //ExprefTestClass_inter_struct_exc.TestRoutine(ExprefTestClass_inter_struct_exc_Interface1); + // NOTE: Currently detects this during compile time; try passing ExprefTestClass_inter_struct_exc_Interface1 to a method + // to see if that will defeat the compile-time flow analysis. + } + } + interface ExprefTestClass_class_inter_I1 + { + void i(); + } + interface ExprefTestClass_class_inter_I2 + { + void j(); + } + + class ExprefTestClass_class_inter_C1 : ExprefTestClass_class_inter_I1 + { + public void i() + {//Old Print + } + } + class ExprefTestClass_class_inter_C2 : ExprefTestClass_class_inter_C1, ExprefTestClass_class_inter_I2 + { + public void j() + {//Old Print + } + } + public class ExprefTestClass_class_inter + { + public static bool testMethod() + { + ExprefTestClass_class_inter_C1 thebase = new ExprefTestClass_class_inter_C2(); + try + { + ExprefTestClass_class_inter_I2 i2 = (ExprefTestClass_class_inter_I2)thebase; + i2.j(); + } + catch (System.Exception e) + { + //Old Print + } + return true; + } + } + interface ExprefTestClass_class_inter_exc_I1 + { + void i(); + } + interface ExprefTestClass_class_inter_exc_I2 + { + void j(); + } + + class ExprefTestClass_class_inter_exc_C1 : ExprefTestClass_class_inter_exc_I1 + { + public void i() + {//Old Print + } + } + class ExprefTestClass_class_inter_exc_C2 : ExprefTestClass_class_inter_exc_C1 + { + } + public class ExprefTestClass_class_inter_exc + { + public static bool testMethod() + { + ExprefTestClass_class_inter_exc_C1 thebase = new ExprefTestClass_class_inter_exc_C2(); + try + { + ExprefTestClass_class_inter_exc_I2 i2 = (ExprefTestClass_class_inter_exc_I2)thebase; + i2.j(); + } + catch (System.Exception e) + { + //Old Print + } + return true; + } + } + interface ExprefTestClass_inter_class_I1 + { + void i(); + } + class ExprefTestClass_inter_class_C1 : ExprefTestClass_inter_class_I1 + { + public void i() {/*Old Print*/} + } + class ExprefTestClass_inter_class_C2 : ExprefTestClass_inter_class_I1 + { + public void i() {/*Old Print*/} + } + public class ExprefTestClass_inter_class + { + public static bool testMethod() + { + ExprefTestClass_inter_class_I1 inter = new ExprefTestClass_inter_class_C1(); + try + { + ExprefTestClass_inter_class_C1 c1 = (ExprefTestClass_inter_class_C1)inter; + c1.i(); + } + catch (System.Exception) + { + //Old Print + } + return true; + } + } + interface ExprefTestClass_inter_class2_I1 + { + void i(); + } + interface ExprefTestClass_inter_class2_I2 + { + void j(); + } + class ExprefTestClass_inter_class2_C1 : ExprefTestClass_inter_class2_I1 + { + public void i() + {//Old Print + } + } + class ExprefTestClass_inter_class2_C2 : ExprefTestClass_inter_class2_I1 + { + public void i() + {//Old Print + } + } + class ExprefTestClass_inter_class2_C3 : ExprefTestClass_inter_class2_C1, ExprefTestClass_inter_class2_I2 + { + public void j() + {//Old Print + } + } + public class ExprefTestClass_inter_class2 + { + public static bool testMethod() + { + ExprefTestClass_inter_class2_I2 inter = new ExprefTestClass_inter_class2_C3(); + try + { + ExprefTestClass_inter_class2_C1 c1 = (ExprefTestClass_inter_class2_C1)inter; + c1.i(); + } + catch (System.Exception e) + { + //Old Print + } + return true; + } + } + interface ExprefTestClass_inter_class2_exc1_I1 + { + void i(); + } + interface ExprefTestClass_inter_class2_exc1_I2 + { + void j(); + } + class ExprefTestClass_inter_class2_exc1_C1 : ExprefTestClass_inter_class2_exc1_I1 + { + public void i() + {//Old Print + } + } + class ExprefTestClass_inter_class2_exc1_C2 : ExprefTestClass_inter_class2_exc1_I2 + { + public void j() + {//Old Print + } + } + public class ExprefTestClass_inter_class2_exc1 + { + public static bool testMethod() + { + ExprefTestClass_inter_class2_exc1_I2 inter = new ExprefTestClass_inter_class2_exc1_C2(); + try + { + ExprefTestClass_inter_class2_exc1_C1 c1 = (ExprefTestClass_inter_class2_exc1_C1)inter; + c1.i(); + } + catch (System.Exception e) + { + //Old Print + } + return true; + } + } + interface ExprefTestClass_inter_class2_exc2_I1 + { + void i(); + } + interface ExprefTestClass_inter_class2_exc2_I2 + { + void j(); + } + class ExprefTestClass_inter_class2_exc2_C1 : ExprefTestClass_inter_class2_exc2_I1 + { + public void i() + {//Old Print + } + } + class ExprefTestClass_inter_class2_exc2_C2 : ExprefTestClass_inter_class2_exc2_I2 + { + public void j() + {//Old Print + } + } + class ExprefTestClass_inter_class2_exc2_C3 : ExprefTestClass_inter_class2_exc2_C1 + { + } + public class ExprefTestClass_inter_class2_exc2 + { + public static bool testMethod() + { + ExprefTestClass_inter_class2_exc2_I2 inter = new ExprefTestClass_inter_class2_exc2_C2(); + try + { + ExprefTestClass_inter_class2_exc2_C1 c1 = (ExprefTestClass_inter_class2_exc2_C1)inter; + c1.i(); + } + catch (System.Exception e) + { + //Old Print + } + return true; + } + } + interface ExprefTestClass_inter_class_exc_I1 + { + void i(); + } + class ExprefTestClass_inter_class_exc_C1 : ExprefTestClass_inter_class_exc_I1 + { + public void i() + {//Old Print + } + } + class ExprefTestClass_inter_class_exc_C2 : ExprefTestClass_inter_class_exc_I1 + { + public void i() + {//Old Print + } + } + public class ExprefTestClass_inter_class_exc + { + public static bool testMethod() + { + ExprefTestClass_inter_class_exc_I1 inter = new ExprefTestClass_inter_class_exc_C1(); + try + { + ExprefTestClass_inter_class_exc_C2 c2 = (ExprefTestClass_inter_class_exc_C2)inter; + } + catch (System.Exception e) + { + //Old Print + } + return true; + } + } + interface ExprefTestClass_inter_class_sealed_I1 + { + void i(); + } + sealed class ExprefTestClass_inter_class_sealed_C1 : ExprefTestClass_inter_class_sealed_I1 + { + public void i() {/*Old Print*/} + } + class ExprefTestClass_inter_class_sealed_C2 : ExprefTestClass_inter_class_sealed_I1 + { + public void i() {/*Old Print*/} + } + public class ExprefTestClass_inter_class_sealed + { + public static bool testMethod() + { + ExprefTestClass_inter_class_sealed_I1 inter = new ExprefTestClass_inter_class_sealed_C1(); + try + { + ExprefTestClass_inter_class_sealed_C1 c1 = (ExprefTestClass_inter_class_sealed_C1)inter; + c1.i(); + } + catch (System.Exception e) + { + //Old Print + } + return true; + } + } + interface ExprefTestClass_inter_class_sealed_exc_I1 + { + void i(); + } + sealed class ExprefTestClass_inter_class_sealed_exc_C1 : ExprefTestClass_inter_class_sealed_exc_I1 + { + public void i() {/*Old Print*/} + } + class ExprefTestClass_inter_class_sealed_exc_C2 : ExprefTestClass_inter_class_sealed_exc_I1 + { + public void i() {/*Old Print*/} + } + public class ExprefTestClass_inter_class_sealed_exc + { + public static bool testMethod() + { + ExprefTestClass_inter_class_sealed_exc_I1 inter = new ExprefTestClass_inter_class_sealed_exc_C1(); + try + { + ExprefTestClass_inter_class_sealed_exc_C2 c2 = (ExprefTestClass_inter_class_sealed_exc_C2)inter; + } + catch (System.Exception e) + { + //Old Print + } + return true; + } + } + interface ExprefTestClass_inter_inter_I1 + { + void i(); + } + interface ExprefTestClass_inter_inter_I2 + { + void j(); + } + + class ExprefTestClass_inter_inter_C1 : ExprefTestClass_inter_inter_I1 + { + public void i() {/*Old Print*/} + } + class ExprefTestClass_inter_inter_C2 : ExprefTestClass_inter_inter_C1, ExprefTestClass_inter_inter_I2 + { + public void j() {/*Old Print*/} + } + public class ExprefTestClass_inter_inter + { + public static bool testMethod() + { + ExprefTestClass_inter_inter_I2 i2 = (ExprefTestClass_inter_inter_I2)new ExprefTestClass_inter_inter_C2(); + try + { + ExprefTestClass_inter_inter_I1 i1 = (ExprefTestClass_inter_inter_I1)i2; + i1.i(); + } + catch (System.Exception e) + { + //Old Print + } + return true; + + } + } + interface ExprefTestClass_inter_inter_exc_I1 + { + void i(); + } + interface ExprefTestClass_inter_inter_exc_I2 + { + void j(); + } + interface ExprefTestClass_inter_inter_exc_I3 + { + void k(); + } + + class ExprefTestClass_inter_inter_exc_C1 : ExprefTestClass_inter_inter_exc_I1 + { + public void i() {/*Old Print*/} + } + class ExprefTestClass_inter_inter_exc_C2 : ExprefTestClass_inter_inter_exc_C1, ExprefTestClass_inter_inter_exc_I2 + { + public void j() {/*Old Print*/} + } + public class ExprefTestClass_inter_inter_exc + { + public static bool testMethod() + { + ExprefTestClass_inter_inter_exc_I2 i2 = (ExprefTestClass_inter_inter_exc_I2)new ExprefTestClass_inter_inter_exc_C2(); + try + { + ExprefTestClass_inter_inter_exc_I3 i3 = (ExprefTestClass_inter_inter_exc_I3)i2; + } + catch (System.Exception e) + { + //Old Print + } + return true; + } + } + + } +} diff --git a/Tests/NFUnitTestConversions/nano.runsettings b/Tests/NFUnitTestConversions/nano.runsettings new file mode 100644 index 00000000..fa881e3a --- /dev/null +++ b/Tests/NFUnitTestConversions/nano.runsettings @@ -0,0 +1,14 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + False + + \ No newline at end of file diff --git a/Tests/NFUnitTestConversions/packages.config b/Tests/NFUnitTestConversions/packages.config new file mode 100644 index 00000000..1adb9284 --- /dev/null +++ b/Tests/NFUnitTestConversions/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 02378248..c952af4b 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -45,6 +45,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestEnum", "Tests\NFU EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestDelegates", "Tests\NFUnitTestDelegates\NFUnitTestDelegates.nfproj", "{A8D00E31-5905-4DB4-A7F2-F0C00E3560DD}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestConversions", "Tests\NFUnitTestConversions\NFUnitTestConversions.nfproj", "{4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -143,6 +145,12 @@ Global {A8D00E31-5905-4DB4-A7F2-F0C00E3560DD}.Release|Any CPU.ActiveCfg = Release|Any CPU {A8D00E31-5905-4DB4-A7F2-F0C00E3560DD}.Release|Any CPU.Build.0 = Release|Any CPU {A8D00E31-5905-4DB4-A7F2-F0C00E3560DD}.Release|Any CPU.Deploy.0 = Release|Any CPU + {4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB}.Release|Any CPU.Build.0 = Release|Any CPU + {4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -162,6 +170,7 @@ Global {BDB01244-6EAD-476E-9084-27D0D249E9A6} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {A8D00E31-5905-4DB4-A7F2-F0C00E3560DD} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From c4b77e3fce504bcdf8c6d47fdfe1b05329e15e8c Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 22:37:43 +0300 Subject: [PATCH 38/55] Adding Classes tests --- .../NFUnitTestArithmetic.nfproj | 6 +- Tests/NFUnitTestArithmetic/packages.config | 2 +- .../NFUnitTestClasses.nfproj | 76 + .../Properties/AssemblyInfo.cs | 33 + .../UnitTestConstructorTest.cs | 1571 ++++++ .../NFUnitTestClasses/UnitTestConstsTests.cs | 1098 ++++ .../UnitTestDeclarationTests.cs | 834 ++++ .../UnitTestDestructorTests.cs | 174 + Tests/NFUnitTestClasses/UnitTestEventTests.cs | 71 + Tests/NFUnitTestClasses/UnitTestFieldTests.cs | 1332 +++++ .../NFUnitTestClasses/UnitTestIndexerTests.cs | 1461 ++++++ .../NFUnitTestClasses/UnitTestMembersTests.cs | 2260 +++++++++ .../NFUnitTestClasses/UnitTestMethodsTests.cs | 4401 +++++++++++++++++ .../UnitTestOperatorTests.cs | 1537 ++++++ .../UnitTestPropertiesTests.cs | 1965 ++++++++ .../NFUnitTestClasses/UnitTestStaticTests.cs | 328 ++ Tests/NFUnitTestClasses/nano.runsettings | 14 + Tests/NFUnitTestClasses/packages.config | 6 + .../NFUnitTestConversions.nfproj | 6 +- Tests/NFUnitTestConversions/packages.config | 2 +- .../NFUnitTestBitConverter.nfproj | 6 +- Tests/NFUnitTestCoreLibrary/packages.config | 2 +- .../NFUnitTestDelegates.nfproj | 6 +- Tests/NFUnitTestDelegates/packages.config | 2 +- Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj | 6 +- Tests/NFUnitTestEnum/packages.config | 2 +- .../NFUnitTestException.nfproj | 6 +- Tests/NFUnitTestException/packages.config | 2 +- .../NFUnitTestInterface.nfproj | 6 +- Tests/NFUnitTestInterface/nano.runsettings | 3 +- Tests/NFUnitTestInterface/packages.config | 2 +- .../NFUnitTestLexical.nfproj | 6 +- Tests/NFUnitTestLexical/nano.runsettings | 3 +- Tests/NFUnitTestLexical/packages.config | 2 +- .../NFUnitTestNamespace.nfproj | 6 +- Tests/NFUnitTestNamespace/packages.config | 2 +- .../NFUnitTestStatements.nfproj | 6 +- .../nano.runsettings | 3 +- .../NFUnitTestStatementsTests/packages.config | 2 +- .../NFUnitTestStruct/NFUnitTestStruct.nfproj | 6 +- Tests/NFUnitTestStruct/packages.config | 2 +- .../NFUnitTestSystemLib.nfproj | 11 +- .../UnitTestWeakReferenceTests.cs | 4 +- Tests/NFUnitTestSystemLib/packages.config | 3 +- .../NFUnitTestThread/NFUnitTestThread.nfproj | 6 +- Tests/NFUnitTestThread/packages.config | 2 +- Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj | 6 +- Tests/NFUnitTestTypes/packages.config | 2 +- .../NFUnitTestVariables.nfproj | 6 +- Tests/NFUnitTestVariables/packages.config | 2 +- nanoFramework.CoreLibrary.sln | 9 + 51 files changed, 17244 insertions(+), 65 deletions(-) create mode 100644 Tests/NFUnitTestClasses/NFUnitTestClasses.nfproj create mode 100644 Tests/NFUnitTestClasses/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestClasses/UnitTestConstructorTest.cs create mode 100644 Tests/NFUnitTestClasses/UnitTestConstsTests.cs create mode 100644 Tests/NFUnitTestClasses/UnitTestDeclarationTests.cs create mode 100644 Tests/NFUnitTestClasses/UnitTestDestructorTests.cs create mode 100644 Tests/NFUnitTestClasses/UnitTestEventTests.cs create mode 100644 Tests/NFUnitTestClasses/UnitTestFieldTests.cs create mode 100644 Tests/NFUnitTestClasses/UnitTestIndexerTests.cs create mode 100644 Tests/NFUnitTestClasses/UnitTestMembersTests.cs create mode 100644 Tests/NFUnitTestClasses/UnitTestMethodsTests.cs create mode 100644 Tests/NFUnitTestClasses/UnitTestOperatorTests.cs create mode 100644 Tests/NFUnitTestClasses/UnitTestPropertiesTests.cs create mode 100644 Tests/NFUnitTestClasses/UnitTestStaticTests.cs create mode 100644 Tests/NFUnitTestClasses/nano.runsettings create mode 100644 Tests/NFUnitTestClasses/packages.config diff --git a/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj index fe8bedac..0fc6cacc 100644 --- a/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj +++ b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj @@ -39,13 +39,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestArithmetic/packages.config b/Tests/NFUnitTestArithmetic/packages.config index 1adb9284..33fb2695 100644 --- a/Tests/NFUnitTestArithmetic/packages.config +++ b/Tests/NFUnitTestArithmetic/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestClasses/NFUnitTestClasses.nfproj b/Tests/NFUnitTestClasses/NFUnitTestClasses.nfproj new file mode 100644 index 00000000..2da27aa7 --- /dev/null +++ b/Tests/NFUnitTestClasses/NFUnitTestClasses.nfproj @@ -0,0 +1,76 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + a4baf1fb-27eb-4d4f-9780-1e399fb7c6eb + Library + Properties + 512 + NFUnitTestClasses + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + + + + + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.Runtime.Native.1.5.1-preview.25\lib\nanoFramework.Runtime.Native.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestClasses/Properties/AssemblyInfo.cs b/Tests/NFUnitTestClasses/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestClasses/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestClasses/UnitTestConstructorTest.cs b/Tests/NFUnitTestClasses/UnitTestConstructorTest.cs new file mode 100644 index 00000000..763ea1b6 --- /dev/null +++ b/Tests/NFUnitTestClasses/UnitTestConstructorTest.cs @@ -0,0 +1,1571 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using System.Reflection; + +namespace NFUnitTestClasses +{ + [TestClass] + public class UnitTestConstructorTest + { + [TestMethod] + public void Constructors1_Test() + { + Debug.WriteLine("Tests if assignments in a constructor function."); + Assert.True(ConstructorsTestClass1.testMethod()); + } + + [TestMethod] + public void Constructors2_Test() + { + //Ported from Const2.cs + Debug.WriteLine("Tests if assignments in a constructor function, when constructor is public."); + Assert.True(ConstructorsTestClass2.testMethod()); + } + + [TestMethod] + public void Constructors3_Test() + { + //Ported from Const3.cs + Debug.WriteLine("Tests if assignments in a constructor function, when constructor is protected."); + Assert.True(ConstructorsTestClass3.testMethod()); + } + + [TestMethod] + public void Constructors5_Test() + { + //Ported from Const5.cs + Debug.WriteLine("Tests if assignments in a constructor function, when constructor is internal."); + Assert.True(ConstructorsTestClass5.testMethod()); + } + + [TestMethod] + public void Constructors6_Test() + { + //Ported from Const6.cs + Debug.WriteLine("Tests if assignments in a constructor function, when constructor is private."); + Assert.True(ConstructorsTestClass6.testMethod()); + } + + [TestMethod] + public void Constructors8_Test() + { + //Ported from Const8.cs + Debug.WriteLine("Tests if assignments in a constructor function, when constructor has one parameter."); + Assert.True(ConstructorsTestClass8.testMethod()); + } + + [TestMethod] + public void Constructors10_Test() + { + //Ported from Const10.cs + + Debug.WriteLine("Tests if assignments in a constructor function, when constructor is called with one parameter"); + Debug.WriteLine("and is overloaded with an un-called zero parameter version"); + Assert.True(ConstructorsTestClass10.testMethod()); + } + + [TestMethod] + public void Constructors11_Test() + { + //Ported from Const11.cs + Debug.WriteLine("Tests if assignments in a constructor function, when constructor has two parameters."); + Assert.True(ConstructorsTestClass11.testMethod()); + } + + [TestMethod] + public void Constructors13_Test() + { + //Ported from Const13.cs + Debug.WriteLine("Tests if assignments in a constructor function, when constructor has ten parameters."); + Assert.True(ConstructorsTestClass13.testMethod()); + } + + [TestMethod] + public void Constructors16_Test() + { + //Ported from Const16.cs + Debug.WriteLine("Tests if assignments in a constructor function, when test class inherits constructor"); + + Debug.WriteLine("and extends it with base"); + Assert.True(ConstructorsTestClass16.testMethod()); + } + + [TestMethod] + public void Constructors17_Test() + { + //Ported from Const17.cs + Debug.WriteLine("Tests if assignments in a constructor function, when test class inherits 2 constructors"); + Debug.WriteLine("and extends one of them with base"); + Assert.True(ConstructorsTestClass17.testMethod()); + } + + [TestMethod] + public void Constructors20_Test() + { + //Ported from Const20.cs + Debug.WriteLine("Tests if assignments in a constructor and its base are both functional"); + Assert.True(ConstructorsTestClass20.testMethod()); + } + + [TestMethod] + public void Constructors21_Test() + { + //Ported from Const21.cs + Debug.WriteLine("Tests if assignments in a constructor and its base, and its base's base are all functional"); + Assert.True(ConstructorsTestClass21.testMethod()); + } + + [TestMethod] + public void Constructors22_Test() + { + //Ported from Const22.cs + Debug.WriteLine("Tests if assignments in both a class' constructors are functional when a parametered constructor extends"); + Debug.WriteLine("a not-parametered one with 'this'"); + Assert.True(ConstructorsTestClass22.testMethod()); + } + + [TestMethod] + public void Constructors23_Test() + { + //Ported from Const23.cs + Debug.WriteLine("Tests if assignments in both a class' constructors are functional when a not-parametered constructor extends"); + Debug.WriteLine("a parametered one with 'this'"); + Assert.True(ConstructorsTestClass23.testMethod()); + } + + [TestMethod] + public void Constructors24_Test() + { + //Ported from Const24.cs + Debug.WriteLine("Tests if assignments in all a class' constructors are functional in a chain of extension using 'this'"); + Assert.True(ConstructorsTestClass24.testMethod()); + } + + [TestMethod] + public void Constructors25_Test() + { + //Ported from Const25.cs + + Debug.WriteLine("Tests if assignments in all a class' constructors are functional when a parametered one extends a"); + Debug.WriteLine("not-parametered one, which in turn extends the class' base class constructor"); + Assert.True(ConstructorsTestClass25.testMethod()); + } + + [TestMethod] + public void Constructors26_Test() + { + //Ported from Const26.cs + Debug.WriteLine("Tests if assignments in all a class' constructors are functional when a not-parametered one extends a"); + Debug.WriteLine("not-parametered one in its base class, which in turn extends a parametered one in the base class"); + Assert.True(ConstructorsTestClass26.testMethod()); + } + + [TestMethod] + public void Constructors27_Test() + { + //Ported from Const27.cs + Debug.WriteLine("Tests if assignments in both a class' constructors are functional when a two-parametered constructor extends"); + Debug.WriteLine("a one-parametered one with 'this'"); + Assert.True(ConstructorsTestClass27.testMethod()); + } + + [TestMethod] + public void Constructors28_Test() + { + //Ported from Const28.cs + Debug.WriteLine("Tests if assignments in both a class' constructors are functional when a two-parametered constructor extends"); + Debug.WriteLine("a one-parametered one with 'this' and calls that constructor with a static arg"); + Assert.True(ConstructorsTestClass28.testMethod()); + } + + [TestMethod] + public void Constructors31_Test() + { + //Ported from Const31.cs + Debug.WriteLine("Tests if assignments in both a class' constructors are functional when a not-parametered constructor extends"); + Debug.WriteLine("a two-parametered one with 'this'"); + Assert.True(ConstructorsTestClass31.testMethod()); + } + + [TestMethod] + public void Constructors32_Test() + { + //Ported from Const32.cs + + Debug.WriteLine("Tests if assignments in both a class' constructors are functional when a parametered constructor extends"); + Debug.WriteLine("a not-parametered one that is private with 'this'"); + Assert.True(ConstructorsTestClass32.testMethod()); + } + + [TestMethod] + public void Constructors33_Test() + { + //Ported from Const33.cs + + Debug.WriteLine("Tests if assignments in a class' constructor are functional when the constructor is static"); + Assert.True(ConstructorsTestClass33.testMethod()); + } + + [TestMethod] + public void Constructors34_Test() + { + //Ported from Const34.cs + Debug.WriteLine("Tests if assignments in a class' constructor are functional when one constructor is static"); + Debug.WriteLine("and the other isn't"); + Assert.True(ConstructorsTestClass34.testMethod()); + } + + [TestMethod] + public void Constructors35_Test() + { + //From Bug# 16354/16719 + Debug.WriteLine("Tests if handled exceptions in constructors continues execution"); + Assert.True(ConstructorsTestClass35.testMethod()); + } + + [TestMethod] + public void Constructors44_Test() + { + //Ported from Const44.cs + Debug.WriteLine("Section 10.9.5"); + Debug.WriteLine("When a class declares only private constructors it "); + Debug.WriteLine("is not possible for other classes to derive from"); + Debug.WriteLine("the class or create instances of the class (an System.Exception"); + Debug.WriteLine("being classes nested within the class)."); + Assert.True(ConstructorsTestClass44.testMethod()); + } + + [TestMethod] + public void Constructors45_Test() + { + //Ported from Const45.cs + Debug.WriteLine("Section 10.11."); + Debug.WriteLine("It is possible to construct circular dependencies that"); + Debug.WriteLine("allow static fields with variable initializers to be"); + Debug.WriteLine("observed in their default value state."); + Assert.True(ConstructorsTestClass45.testMethod()); + } + + //We initialize static constructors on load rather when enumerated, so order is not guaranteed (unlike desktop) + + //[TestMethod] + //public void Constructors46_Test() + //{ + // //Ported from Const46.cs + // Debug.WriteLine("Section 10.11."); + // Debug.WriteLine("It is possible to construct circular dependencies that"); + // Debug.WriteLine("allow static fields with variable initializers to be"); + // Debug.WriteLine("observed in their default value state."); + // Assert.True(ConstructorsTestClass46.testMethod()) + // { + // return MFTestResults.Pass; + // } + // return MFTestResults.Fail; + //} + + //[TestMethod] + //public void Constructors47_Test() + //{ + // //Ported from Const47.cs + // Debug.WriteLine("Section 10.11."); + // Debug.WriteLine("It is possible to construct circular dependencies that"); + // Debug.WriteLine("allow static fields with variable initializers to be"); + // Debug.WriteLine("observed in their default value state."); + // Debug.WriteLine("This test is expected to fail."); + // Assert.True(ConstructorsTestClass47.testMethod()) + // { + // return MFTestResults.Fail; + // } + // return MFTestResults.Pass; + //} + + [TestMethod] + public void Constructors50_Test() + { + //Ported from Const50.cs + Debug.WriteLine("The scope of the parameters given by the formal"); + Debug.WriteLine("parameter list of a constructor includes the"); + Debug.WriteLine("constructor initializer of that declaration."); + Debug.WriteLine("Thus, a constructor initializer is permitted to"); + Debug.WriteLine("access the parameters of the constructor."); + Assert.True(ConstructorsTestClass50.testMethod()); + } + + [TestMethod] + public void Constructors51_Test() + { + //Ported from Const51.cs + Debug.WriteLine("Section 10.9"); + Debug.WriteLine("The scope of the parameters given by the formal"); + Debug.WriteLine("parameter list of a constructor includes the"); + Debug.WriteLine("constructor initializer of that declaration."); + Debug.WriteLine("Thus, a constructor initializer is permitted to"); + Debug.WriteLine("access the parameters of the constructor."); + Assert.True(ConstructorsTestClass51.testMethod()); + } + + [TestMethod] + public void Constructors52_Test() + { + Debug.WriteLine("Testing a constructor with a '(params int[] values)' prototype, called with 3 ints"); + //Ported from Const52.cs + Assert.True(ConstructorsTestClass52.testMethod()); + } + + [TestMethod] + public void Constructors54_Test() + { + //Ported from Const54.cs + Debug.WriteLine("Testing a constructor with a '(params int[] values)' prototype, called with 3 ints from its derived class"); + Assert.True(ConstructorsTestClass54.testMethod()); + } + + [TestMethod] + public void Constructors55_Test() + { + //Ported from Const55.cs + + Debug.WriteLine("Testing a constructor with a '(params int[] values)' prototype, called with 3 ints"); + Debug.WriteLine(" from its derived class, and both constructors are 'protected internal'"); + Assert.True(ConstructorsTestClass55.testMethod()); + } + + [TestMethod] + public void Constructors56_Test() + { + Debug.WriteLine("Testing a constructor with a '(params int[] values)' prototype, called with 3 ints"); + Debug.WriteLine(" from its derived class implicitly, and both constructors are 'internal'"); + //Ported from Const56.cs + Assert.True(ConstructorsTestClass56.testMethod()); + } + + [TestMethod] + public void Constructors57_Test() + { + //Ported from Const57.cs + Debug.WriteLine("Testing a 'private' constructor with a '(params int[] values)' prototype, called with 3 ints"); + Assert.True(ConstructorsTestClass57.testMethod()); + } + + [TestMethod] + public void Constructors64_Test() + { + //Ported from Const64.cs + Debug.WriteLine("Instance constructors, destructors, and static constructors are not inherited"); + Assert.True(ConstructorsTestClass64.testMethod()); + } + + //Constructors Test Classes + class ConstructorsTestClass1 + { + + //no modifier + ConstructorsTestClass1() + { + intI = 2; + } + + int intI; + + public static bool testMethod() + { + ConstructorsTestClass1 test = new ConstructorsTestClass1(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass2 + { + //public + public ConstructorsTestClass2() + { + intI = 2; + } + + int intI; + + public static bool testMethod() + { + ConstructorsTestClass2 test = new ConstructorsTestClass2(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass3 + { + + //protected + protected ConstructorsTestClass3() + { + intI = 2; + } + + int intI; + + public static bool testMethod() + { + ConstructorsTestClass3 test = new ConstructorsTestClass3(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass5 + { + + //internal + internal ConstructorsTestClass5() + { + intI = 2; + } + + int intI; + + public static bool testMethod() + { + ConstructorsTestClass5 test = new ConstructorsTestClass5(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass6 + { + + //private + private ConstructorsTestClass6() + { + intI = 2; + } + + int intI; + + public static bool testMethod() + { + ConstructorsTestClass6 test = new ConstructorsTestClass6(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + + class ConstructorsTestClass8 + { + + //one parameter + ConstructorsTestClass8(int intX) + { + intI = intX; + } + + int intI; + + public static bool testMethod() + { + ConstructorsTestClass8 test = new ConstructorsTestClass8(3); + if (test.intI == 3) + { + return true; + } + else + { + return false; + } + } + } + + + class ConstructorsTestClass10 + { + + ConstructorsTestClass10() + { + intI = 2; + } + + ConstructorsTestClass10(int intX) + { + intI = intX; + } + + int intI; + + public static bool testMethod() + { + + ConstructorsTestClass10 test = new ConstructorsTestClass10(3); //calling constructor with parameter + if (test.intI == 3) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass11 + { + + //multiple parameters + ConstructorsTestClass11(int intX, int intY) + { + intI = intX + intY; + } + + int intI; + + public static bool testMethod() + { + ConstructorsTestClass11 test = new ConstructorsTestClass11(3, 4); + if (test.intI == 7) + { + return true; + } + else + { + return false; + } + } + } + + + class ConstructorsTestClass13 + { + + //multiple parameters + ConstructorsTestClass13(int int1, int int2, int int3, int int4, int int5, int int6, int int7, int int8, int int9, int int10) + { + intI = int1 + int2 + int3 + int4 + int5 + int6 + int7 + int8 + int9 + int10; + } + + int intI; + + public static bool testMethod() + { + ConstructorsTestClass13 test = new ConstructorsTestClass13(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); + if (test.intI == 55) + { + return true; + } + else + { + return false; + } + } + } + + + + + class ConstructorsTestClass16_Base + { + + public int intI = 1; + + protected ConstructorsTestClass16_Base() + { + intI = 2; + } + } + + class ConstructorsTestClass16 : ConstructorsTestClass16_Base + { + + //base constructor initializer + ConstructorsTestClass16() : base() + { + intI = intI * 2; + } + + public static bool testMethod() + { + + ConstructorsTestClass16 Test = new ConstructorsTestClass16(); + + if (Test.intI == 4) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass17_Base + { + + public int intI = 1; + + protected ConstructorsTestClass17_Base() + { + intI = 2; + } + protected ConstructorsTestClass17_Base(int intJ) + { + intI = intJ; + } + } + + class ConstructorsTestClass17 : ConstructorsTestClass17_Base + { + //base constructor initializer + ConstructorsTestClass17() : base(3) + { + intI = intI * 2; + } + + public static bool testMethod() + { + + ConstructorsTestClass17 Test = new ConstructorsTestClass17(); + + if (Test.intI == 6) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass20_Base + { + + public int intI = 1; + + protected ConstructorsTestClass20_Base(int intJ, int intK) + { + intI = intJ + intK; + } + } + + class ConstructorsTestClass20 : ConstructorsTestClass20_Base + { + + //base constructor initializer + ConstructorsTestClass20() + : base(3, 4) + { + intI = intI * 2; + } + + public static bool testMethod() + { + + ConstructorsTestClass20 Test = new ConstructorsTestClass20(); + + if (Test.intI == 14) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass21_Base1 + { + public int intI = 1; + + protected ConstructorsTestClass21_Base1() + { + intI = 2; + } + } + + class ConstructorsTestClass21_Base2 : ConstructorsTestClass21_Base1 + { + + protected ConstructorsTestClass21_Base2() + : base() + { + intI = intI * 2; + } + + } + + class ConstructorsTestClass21 : ConstructorsTestClass21_Base2 + { + + //base constructor initializer + ConstructorsTestClass21() + : base() + { + intI = intI * 2; + } + + public static bool testMethod() + { + ConstructorsTestClass21 test = new ConstructorsTestClass21(); + if (test.intI == 8) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass22 + { + + int intI = 1; + + ConstructorsTestClass22() + { + intI = 2; + } + + + //this constructor initializer + ConstructorsTestClass22(int intJ) + : this() + { + intI = intI * intJ; + } + + public static bool testMethod() + { + + ConstructorsTestClass22 Test = new ConstructorsTestClass22(2); + + if (Test.intI == 4) + { + return true; + } + else + { + return false; + } + } + } + + + class ConstructorsTestClass23 + { + + int intI = 1; + + ConstructorsTestClass23() + : this(3) + { + intI = intI * 2; + } + + //this constructor initializer + ConstructorsTestClass23(int intJ) + { + intI = intJ; + } + + public static bool testMethod() + { + + ConstructorsTestClass23 Test = new ConstructorsTestClass23(); + + if (Test.intI == 6) + { + return true; + } + else + { + return false; + } + } + } + + + class ConstructorsTestClass24 + { + + int intI = 1; + + ConstructorsTestClass24() + { + intI = 2; + } + + + //this constructor initializer + ConstructorsTestClass24(int intJ) + : this() + { + intI = intI * intJ; + } + + //this constructor initializer + ConstructorsTestClass24(int intK, int intL) + : this(3) + { + intI = (intI + intK) * intL; + } + + + + public static bool testMethod() + { + + ConstructorsTestClass24 Test = new ConstructorsTestClass24(3, 4); + + if (Test.intI == 36) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass25_Base + { + + public int intI = 1; + + protected ConstructorsTestClass25_Base() + { + intI = 2; + } + } + + class ConstructorsTestClass25 : ConstructorsTestClass25_Base + { + + //base constructor initializer + ConstructorsTestClass25() + : base() + { + intI = intI * 2; + } + + //this constructor initializer + ConstructorsTestClass25(int intJ) + : this() + { + intI = intI + intJ; + } + + public static bool testMethod() + { + + ConstructorsTestClass25 Test = new ConstructorsTestClass25(3); + + if (Test.intI == 7) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass26_Base + { + + public int intI = 1; + + //this constructor initializer + protected ConstructorsTestClass26_Base() + : this(3) + { + intI = intI * 2; + } + + protected ConstructorsTestClass26_Base(int intJ) + { + intI = intJ; + } + + } + + class ConstructorsTestClass26 : ConstructorsTestClass26_Base + { + + //base constructor initializer + ConstructorsTestClass26() + : base() + { + intI = intI * 2; + } + + public static bool testMethod() + { + + ConstructorsTestClass26 Test = new ConstructorsTestClass26(); + + if (Test.intI == 12) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass27 + { + + int intI = 1; + + ConstructorsTestClass27(int intJ) + { + intI = intJ; + } + + //this constructor initializer + ConstructorsTestClass27(int intK, int intL) + : this(intL) + { + intI = intI + intK; + } + + + + public static bool testMethod() + { + + ConstructorsTestClass27 Test = new ConstructorsTestClass27(3, 4); + + if (Test.intI == 7) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass28 + { + + static int int3 = 3; + + int intI = 1; + + ConstructorsTestClass28(int intJ) + { + intI = intJ; + } + + //this constructor initializer + ConstructorsTestClass28(int intK, int intL) + : this(ConstructorsTestClass28.int3) + { + intI = (intI + intK) * intL; + } + + + + public static bool testMethod() + { + + ConstructorsTestClass28 Test = new ConstructorsTestClass28(3, 4); + + if (Test.intI == 24) + { + return true; + } + else + { + return false; + } + } + } + + + class ConstructorsTestClass31 + { + + int intI = 1; + + ConstructorsTestClass31() + : this(3, 4) + { + intI = intI * 2; + } + + //this constructor initializer + ConstructorsTestClass31(int intK, int intL) + { + intI = intK + intL; + } + + + + public static bool testMethod() + { + + ConstructorsTestClass31 Test = new ConstructorsTestClass31(); + + if (Test.intI == 14) + { + return true; + } + else + { + return false; + } + } + } + + + class ConstructorsTestClass32 + { + + int intI = 1; + + private ConstructorsTestClass32() + { + intI = 2; + } + + + //this constructor initializer + ConstructorsTestClass32(int intJ) + : this() + { + intI = intI * intJ; + } + + public static bool testMethod() + { + + ConstructorsTestClass32 Test = new ConstructorsTestClass32(2); + + if (Test.intI == 4) + { + return true; + } + else + { + return false; + } + } + } + + + class ConstructorsTestClass33 + { + + //static constructor + static ConstructorsTestClass33() + { + intI = 2; + } + + static int intI = 1; + + public static bool testMethod() + { + if (intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass34 + { + + //static constructor + static ConstructorsTestClass34() + { + intI = 2; + } + + ConstructorsTestClass34() + { + intI = 3; + } + + static int intI = 1; + + public static bool testMethod() + { + + bool RetVal = true; + + if (intI != 2) + { + RetVal = false; + } + + ConstructorsTestClass34 Test = new ConstructorsTestClass34(); + + if (intI != 3) + { + RetVal = false; + } + + return RetVal; + } + } + + class ConstructorsTestClass35 + { + + // static constructor - with Exception + static ConstructorsTestClass35() + { + try { throw new Exception(); } + catch { } + intI = 5; + } + + static int intI = 1; + + public static bool testMethod() + { + return (intI == 5); + } + } + + + class ConstructorsTestClass44_Base + { + + protected int MyInt = 2; + + private ConstructorsTestClass44_Base() { } + public ConstructorsTestClass44_Base(int intI) + { + MyInt = intI; + } + } + + class ConstructorsTestClass44 : ConstructorsTestClass44_Base + { + + public ConstructorsTestClass44() : base(1) { } + + public static bool testMethod() + { + ConstructorsTestClass44 test = new ConstructorsTestClass44(); + if (test.MyInt == 1) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass45 + { + + int intI; + + private ConstructorsTestClass45() + { + intI = 1; + } + + public static bool testMethod() + { + return InnerClass.testMethod(); + } + + class InnerClass + { + public static bool testMethod() + { + ConstructorsTestClass45 test = new ConstructorsTestClass45(); + if (test.intI == 1) + { + return true; + } + else + { + return false; + } + } + } + } + + class ConstructorsTestClass46_sub + { + public static int X = ConstructorsTestClass46.Y + 1; + } + + class ConstructorsTestClass46 + { + public static int Y = ConstructorsTestClass46_sub.X + 1; + public static bool testMethod() + { + if ((ConstructorsTestClass46_sub.X == 1) && (ConstructorsTestClass46.Y == 2)) + { + return true; + } + else + { + Debug.WriteLine("Expected X==1, got X=" + ConstructorsTestClass46_sub.X); + Debug.WriteLine("Expected Y==2, got Y=" + ConstructorsTestClass46.Y); + return false; + } + } + } + + class ConstructorsTestClass47 + { + public static int X = ConstructorsTestClass47_sub.Y + 1; + public static bool testMethod() + { + if ((ConstructorsTestClass47.X == 2) && (ConstructorsTestClass47_sub.Y == 1)) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass47_sub + { + public static int Y = ConstructorsTestClass47.X + 1; + } + + class ConstructorsTestClass50_Base + { + public int intI; + public ConstructorsTestClass50_Base(int x, int y) + { + intI = x * 2 + y * 3; + } + } + + class ConstructorsTestClass50 : ConstructorsTestClass50_Base + { + public ConstructorsTestClass50(int x, int y) : base(x + y, x - y) { } + public static bool testMethod() + { + ConstructorsTestClass50 test = new ConstructorsTestClass50(5, 3); + if (test.intI == 22) + { + return true; + } + else + { + return false; + } + } + } + + + class ConstructorsTestClass51 + { + + int intI; + public ConstructorsTestClass51(int x, int y, int z) + { + intI = x * 2 + y * 3; + } + public ConstructorsTestClass51(int x, int y) : this(x + y, x - y, 0) { } + + public static bool testMethod() + { + ConstructorsTestClass51 test = new ConstructorsTestClass51(5, 3); + if (test.intI == 22) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass52 + { + + int intTest; + + public ConstructorsTestClass52(params int[] values) + { + intTest = values[0] + values[1] + values[2]; + } + + public static bool testMethod() + { + + int intI = 1; + int intJ = 2; + int intK = 3; + + ConstructorsTestClass52 mc = new ConstructorsTestClass52(intI, intJ, intK); + if (mc.intTest == 6) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass53 + { + + int intTest; + + public ConstructorsTestClass53(params int[] values) + { + intTest = values[0] + values[1] + values[2]; + } + + public static bool testMethod() + { + + int intI = 1; + int intJ = 2; + int intK = 3; + + ConstructorsTestClass53 mc = new ConstructorsTestClass53(intI, intJ, intK); + if (mc.intTest == 6) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass54_base + { + + public int intTest; + + protected ConstructorsTestClass54_base(params int[] values) + { + intTest = values[0] + values[1] + values[2]; + } + } + + class ConstructorsTestClass54 : ConstructorsTestClass54_base + { + + protected ConstructorsTestClass54(params int[] values) : base(values) { } + + public static bool testMethod() + { + + int intI = 1; + int intJ = 2; + int intK = 3; + + ConstructorsTestClass54 mc = new ConstructorsTestClass54(intI, intJ, intK); + + if (mc.intTest == 6) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass55_Base + { + + public int intTest; + + protected internal ConstructorsTestClass55_Base(params int[] values) + { + intTest = values[0] + values[1] + values[2]; + } + } + + class ConstructorsTestClass55 : ConstructorsTestClass55_Base + { + + protected internal ConstructorsTestClass55(params int[] values) : base(values) { } + + public static bool testMethod() + { + + int intI = 1; + int intJ = 2; + int intK = 3; + + ConstructorsTestClass55 mc = new ConstructorsTestClass55(intI, intJ, intK); + + if (mc.intTest == 6) + { + return true; + } + else + { + return false; + } + } + } + + class ConstructorsTestClass56_Sub + { + + public int intTest; + + internal ConstructorsTestClass56_Sub(params int[] values) + { + intTest = values[0] + values[1] + values[2]; + } + + + } + + class ConstructorsTestClass56 + { + + public static bool testMethod() + { + + int intI = 1; + int intJ = 2; + int intK = 3; + + ConstructorsTestClass56_Sub mc = new ConstructorsTestClass56_Sub(intI, intJ, intK); + if (mc.intTest == 6) + { + return true; + } + else + { + return false; + } + } + + } + + class ConstructorsTestClass57 + { + + int intTest; + + private ConstructorsTestClass57(params int[] values) + { + intTest = values[0] + values[1] + values[2]; + } + + public static bool testMethod() + { + + int intI = 1; + int intJ = 2; + int intK = 3; + + ConstructorsTestClass57 mc = new ConstructorsTestClass57(intI, intJ, intK); + if (mc.intTest == 6) + { + return true; + } + else + { + return false; + } + } + } + + + public class ConstructorsTestClass64_Base + { + public ConstructorsTestClass64_Base() + { + } + ~ConstructorsTestClass64_Base() + { + } + } + + class ConstructorsTestClass64_Derived : ConstructorsTestClass64_Base + { + } + + class ConstructorsTestClass64 + { + + public static bool testMethod() + { + ConstructorsTestClass64_Derived d = new ConstructorsTestClass64_Derived(); + + MethodInfo mi = d.GetType().GetMethod("Finalize", BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static); + + if (null != mi) + { + + return false; + } + + return true; + } + } + } +} diff --git a/Tests/NFUnitTestClasses/UnitTestConstsTests.cs b/Tests/NFUnitTestClasses/UnitTestConstsTests.cs new file mode 100644 index 00000000..eb86141f --- /dev/null +++ b/Tests/NFUnitTestClasses/UnitTestConstsTests.cs @@ -0,0 +1,1098 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using System.Reflection; + +namespace NFUnitTestClasses +{ + [TestClass] + class UnitTestConstsTests + { + [TestMethod] + public void Const1_Test() + { + //Ported from const1.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant-declaration may include a set of attributes,"); + Debug.WriteLine("a new modifier, and one of four access modifiers. The"); + Debug.WriteLine("attributes and modifiers apply to all of the members "); + Debug.WriteLine("declared by the constant declaration."); + Assert.True(ConstTestClass1.test()); + } + + [TestMethod] + public void Const2_Test() + { + //Ported from const2.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant-declaration may include a set of attributes,"); + Debug.WriteLine("a new modifier, and one of four access modifiers. The"); + Debug.WriteLine("attributes and modifiers apply to all of the members "); + Debug.WriteLine("declared by the constant declaration."); + Assert.True(ConstTestClass2.test()); + } + + [TestMethod] + public void Const3_Test() + { + //Ported from const3.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant-declaration may include a set of attributes,"); + Debug.WriteLine("a new modifier, and one of four access modifiers. The"); + Debug.WriteLine("attributes and modifiers apply to all of the members "); + Debug.WriteLine("declared by the constant declaration."); + Assert.True(ConstTestClass3.test()); + + } + + [TestMethod] + public void Const4_Test() + { + //Ported from const4.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant-declaration may include a set of attributes,"); + Debug.WriteLine("a new modifier, and one of four access modifiers. The"); + Debug.WriteLine("attributes and modifiers apply to all of the members "); + Debug.WriteLine("declared by the constant declaration."); + Assert.True(ConstTestClass4.test()); + } + + [TestMethod] + public void Const5_Test() + { + //Ported from const5.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant-declaration may include a set of attributes,"); + Debug.WriteLine("a new modifier, and one of four access modifiers. The"); + Debug.WriteLine("attributes and modifiers apply to all of the members "); + Debug.WriteLine("declared by the constant declaration."); + Assert.True(ConstTestClass5.test()); + } + + [TestMethod] + public void Const6_Test() + { + //Ported from const6.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant-declaration may include a set of attributes,"); + Debug.WriteLine("a new modifier, and one of four access modifiers. The"); + Debug.WriteLine("attributes and modifiers apply to all of the members "); + Debug.WriteLine("declared by the constant declaration."); + Assert.True(ConstTestClass6.test()); + } + + + [TestMethod] + public void Const9_Test() + { + //Ported from const9.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant-declaration may include a set of attributes,"); + Debug.WriteLine("a new modifier, and one of four access modifiers. The"); + Debug.WriteLine("attributes and modifiers apply to all of the members "); + Debug.WriteLine("declared by the constant declaration."); + Assert.True(ConstTestClass9.test()); + } + + + [TestMethod] + public void Const11_Test() + { + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + //Ported from const11.cs + Assert.True(ConstTestClass11.test()); + } + + [TestMethod] + public void Const12_Test() + { + //Ported from const12.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass12.test()); + } + + [TestMethod] + public void Const13_Test() + { + //Ported from const13.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass13.test()); + } + + [TestMethod] + public void Const14_Test() + { + //Ported from const14.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass14.test()); + } + + [TestMethod] + public void Const15_Test() + { + //Ported from const15.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass15.test()); + } + + [TestMethod] + public void Const16_Test() + { + //Ported from const16.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass16.test()); + } + + [TestMethod] + public void Const17_Test() + { + //Ported from const17.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass17.test()); + } + + [TestMethod] + public void Const18_Test() + { + //Ported from const18.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass18.test()); + } + + [TestMethod] + public void Const19_Test() + { + //Ported from const19.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass19.test()); + } + + [TestMethod] + public void Const20_Test() + { + //Ported from const20.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass20.test()); + } + + [TestMethod] + public void Const21_Test() + { + //Ported from const21.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass21.test()); + } + + [TestMethod] + public void Const24_Test() + { + //Ported from const24.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass24.test()); + } + + [TestMethod] + public void Const25_Test() + { + //Ported from const25.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant itself can participate in a constant-expression."); + Debug.WriteLine("Thus, a constant may be used in any construct that requires"); + Debug.WriteLine("a constant-expression. Examples of such constructs include"); + Debug.WriteLine("case labels, goto case statements, enum member declarations,"); + Debug.WriteLine("attributes, and other constant declarations."); + Assert.True(ConstTestClass25.test()); + } + + [TestMethod] + public void Const26_Test() + { + //Ported from const26.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant itself can participate in a constant-expression."); + Debug.WriteLine("Thus, a constant may be used in any construct that requires"); + Debug.WriteLine("a constant-expression. Examples of such constructs include"); + Debug.WriteLine("case labels, goto case statements, enum member declarations,"); + Debug.WriteLine("attributes, and other constant declarations."); + Assert.True(ConstTestClass26.test()); + } + + [TestMethod] + public void Const27_Test() + { + //Ported from const27.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant itself can participate in a constant-expression."); + Debug.WriteLine("Thus, a constant may be used in any construct that requires"); + Debug.WriteLine("a constant-expression. Examples of such constructs include"); + Debug.WriteLine("case labels, goto case statements, enum member declarations,"); + Debug.WriteLine("attributes, and other constant declarations."); + Assert.True(ConstTestClass27.test()); + } + + [TestMethod] + public void Const28_Test() + { + //Ported from const28.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant itself can participate in a constant-expression."); + Debug.WriteLine("Thus, a constant may be used in any construct that requires"); + Debug.WriteLine("a constant-expression. Examples of such constructs include"); + Debug.WriteLine("case labels, goto case statements, enum member declarations,"); + Debug.WriteLine("attributes, and other constant declarations."); + Assert.True(ConstTestClass28.test()); + } + + [TestMethod] + public void Const30_Test() + { + //Ported from const30.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("Constants are permitted to depend on other constants"); + Debug.WriteLine("within the same project as long as the dependencies"); + Debug.WriteLine("are not of a circular nature. The compiler automatically"); + Debug.WriteLine("arranges to evaluate the constant declarations in the"); + Debug.WriteLine("appropriate order."); + Assert.True(ConstTestClass30.test()); + } + + [TestMethod] + public void Const32_Test() + { + //Ported from const32.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass32.test()); + } + + [TestMethod] + public void Const33_Test() + { + //Ported from const33.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass33.test()); + } + + [TestMethod] + public void Const34_Test() + { + //Ported from const34.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass34.test()); + } + + [TestMethod] + public void Const35_Test() + { + //Ported from const35.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type specified in a constant declaration"); + Debug.WriteLine("must be byte, char, short, int, long, float,"); + Debug.WriteLine("double, double, bool, string, an enum-type,"); + Debug.WriteLine("or a reference type. Each constant-expression"); + Debug.WriteLine("must yield a value of the target type or of a "); + Debug.WriteLine("type that can be converted to the target type"); + Debug.WriteLine("by implicit conversion."); + Assert.True(ConstTestClass35.test()); + } + + [TestMethod] + public void Const42_Test() + { + //Ported from const42.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant declarator introduces a new member"); + Debug.WriteLine("This test is expected to fail"); + Assert.False(ConstTestClass42.test()); + { + Debug.WriteLine("This failure indicates a test is now passing that previously failed by design."); + Debug.WriteLine("It previously marked as known failure because of bug # 17246"); + Debug.WriteLine("The Test owner needs to verify that the change was intentional and remove the known failure."); + } + } + + [TestMethod] + public void Const43_Test() + { + //Ported from const43.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant declarator introduces a new member"); + Debug.WriteLine("This test is expected to fail"); + Assert.False(ConstTestClass43.test()); + { + Debug.WriteLine("This failure indicates a test is now passing that previously failed by design."); + Debug.WriteLine("It previously marked as known failure because of bug # 17246"); + Debug.WriteLine("The Test owner needs to verify that the change was intentional and remove the known failure."); + } + } + + [TestMethod] + public void Const44_Test() + { + //Ported from const44.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("The type of a constant must be at least as acccessible as the constant itself."); + Assert.True(ConstTestClass44.test()); + } + + + [TestMethod] + public void Const56_Test() + { + //Ported from const56.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("...the only possible value for constants of reference-types other than "); + Debug.WriteLine("string is null"); + Assert.True(ConstTestClass56.test()); + } + + [TestMethod] + public void Const57_Test() + { + //Ported from const57.cs + Debug.WriteLine("Section 10.3"); + Debug.WriteLine("A constant declaration that declares multiple constants is equivalent to "); + Debug.WriteLine("multiple declarations of single constants with the same attributes, "); + Debug.WriteLine("modifiers, and type. "); + Assert.True(ConstTestClass57.test()); + } + + //Const test classes + class ConstTestClass1 + { + const int intI = 2; + + public static bool test() + { + if (intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass2_base + { + public const int intI = 1; + } + + class ConstTestClass2 : ConstTestClass2_base + { + new const int intI = 2; + + public static bool test() + { + if (intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass3 + { + public const int intI = 2; + + public static bool test() + { + if (intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass4 + { + protected const int intI = 2; + + public static bool test() + { + if (intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass5 + { + internal const int intI = 2; + + public static bool test() + { + if (intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass6 + { + + private const int intI = 2; + + public static bool test() + { + if (intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass7_sub + { + protected const int intI = 2; + } + + class ConstTestClass9_sub + { + public const int intI = 2, intJ = 3; + } + + class ConstTestClass9 + { + + public static bool test() + { + if ((ConstTestClass9_sub.intI == 2) && (ConstTestClass9_sub.intJ == 3)) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass11 + { + + const byte byteB = 2; + + public static bool test() + { + if (byteB == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass12 + { + + const char charC = 'b'; + + public static bool test() + { + if (charC == 'b') + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass13 + { + + const short shortS = 2; + + public static bool test() + { + if (shortS == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass14 + { + //This appears to be a duplicate of Test 1 + const int IntI = 2; + + public static bool test() + { + if (IntI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass15 + { + + const long longL = 2L; + + public static bool test() + { + if (longL == 2L) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass16 + { + + const float floatF = 2.0F; + + public static bool test() + { + if (floatF == 2.0F) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass17 + { + + const double doubleD = 2.0D; + + public static bool test() + { + if (doubleD == 2.0D) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass18 + { + //Is this OK to cast? + const double doubleD = (double)2.0; + + public static bool test() + { + if (doubleD == (double)2.0) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass19 + { + + const bool boolB = true; + + public static bool test() + { + if (boolB) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass20 + { + + const string stringS = "mytest"; + + public static bool test() + { + if (stringS.Equals("mytest")) + { + return true; + } + else + { + return false; + } + } + } + + enum ConstTestClass21Enum { a = 1, b = 2 } + + class ConstTestClass21 + { + + const ConstTestClass21Enum enumE = ConstTestClass21Enum.a; + + public static bool test() + { + if (enumE == ConstTestClass21Enum.a) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass24 + { + + const double doubleD = 2.0F; + + public static bool test() + { + if (doubleD == 2.0D) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass25 + { + + const int MyInt = 1; + + public static bool test() + { + + int intI = 1; + + switch (intI) + { + case MyInt: + return true; + default: + return false; + } + } + } + + class ConstTestClass26 + { + + const int MyInt = 1; + + public static bool test() + { + + int intI = 2; + + switch (intI) + { + case 1: + return true; + case 2: + goto case MyInt; + default: + return false; + } + } + } + + class ConstTestClass27 + { + const int MyInt = 2; + + enum MyEnum { a = 1, b = MyInt } + + public static bool test() + { + if (MyEnum.b == (MyEnum)2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass28 + { + + const int MyInt = 2; + const int MyTest = MyInt; + + public static bool test() + { + if (MyTest == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass30_sub + { + public const int X = ConstTestClass30.Z + 1; + public const int Y = 10; + } + class ConstTestClass30 + { + public const int Z = ConstTestClass30_sub.Y + 1; + public static bool test() + { + if ((ConstTestClass30_sub.Y == 10) && (ConstTestClass30.Z == 11) && (ConstTestClass30_sub.X == 12)) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass32 + { + + const sbyte sbyteS = 2; + + public static bool test() + { + if (sbyteS == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass33 + { + + const ushort ushortU = 2; + + public static bool test() + { + if (ushortU == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass34 + { + + const uint uintU = 2; + + public static bool test() + { + if (uintU == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass35 + { + + const ulong ulongU = 2; + + public static bool test() + { + if (ulongU == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ConstTestClass42 + { + const int intI = 10; + + public static bool test() + { + bool retval = false; + FieldInfo fi = typeof(ConstTestClass42).GetField("intI", BindingFlags.NonPublic | BindingFlags.Static); + if (null != fi) + retval = true; + return retval; + } + } + + class ConstTestClass43 + { + + const int intI = 10; + + public static bool test() + { + bool retval = false; + FieldInfo fi = typeof(ConstTestClass43).GetField("intI", BindingFlags.NonPublic | BindingFlags.Static); + if (null != fi) + if ((int)fi.GetValue(ConstTestClass43.intI) == 10) + retval = true; + return retval; + } + } + + class ConstTestClass44 + { + + enum E { zero, one, two, three }; + const E enumE = E.two; + + public static bool test() + { + bool retval = false; + + if (enumE == E.two) + retval = true; + return retval; + } + } + + class ConstTestClass55_sub + { + int _i; + public ConstTestClass55_sub(int i) { _i = i; } + public int GetI() { return _i; } + } + + class ConstTestClass56_sub + { + int _i; + public ConstTestClass56_sub(int i) { _i = i; } + public int GetI() { return _i; } + } + + class ConstTestClass56 + { + + public readonly ConstTestClass56_sub mc = new ConstTestClass56_sub(10); + + public static bool test() + { + bool retval = false; + ConstTestClass56 mmc = new ConstTestClass56(); + if (mmc.mc.GetI() == 10) + retval = true; + return retval; + } + } + + class ConstTestClass57_sub_A + { + public const double X = 1.0, Y = 2.0, Z = 3.0; + } + + class ConstTestClass57_sub_B + { + public const double X = 1.0; + public const double Y = 2.0; + public const double Z = 3.0; + } + + class ConstTestClass57 + { + public static bool test() + { + bool retval = false; + ConstTestClass57 mmc = new ConstTestClass57(); + if ((ConstTestClass57_sub_A.X == ConstTestClass57_sub_B.X) + && (ConstTestClass57_sub_A.Y == ConstTestClass57_sub_B.Y) + && (ConstTestClass57_sub_A.Z == ConstTestClass57_sub_B.Z)) + retval = true; + return retval; + } + } + + } +} diff --git a/Tests/NFUnitTestClasses/UnitTestDeclarationTests.cs b/Tests/NFUnitTestClasses/UnitTestDeclarationTests.cs new file mode 100644 index 00000000..ae4559ad --- /dev/null +++ b/Tests/NFUnitTestClasses/UnitTestDeclarationTests.cs @@ -0,0 +1,834 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestClasses +{ + [TestClass] + class UnitTestDeclarationTests + { + [TestMethod] + public void BaseClass1_Test() + { + Debug.WriteLine("Tests an int declaration with assignment in a base class"); + Assert.True(BaseClassTestClass1.testMethod()); + } + + [TestMethod] + public void BaseClass2_Test() + { + + Debug.WriteLine("Tests a function declaration in a implementing class still"); + Debug.WriteLine("works after child is cast as an implemented interface"); + Assert.True(BaseClassTestClass2.testMethod()); + } + + [TestMethod] + public void BaseClass3_Test() + { + + Debug.WriteLine("Tests a function declaration in an implementing class still works after child is cast as"); + Debug.WriteLine("each of two implemented interfaces"); + Assert.True(BaseClassTestClass3.testMethod()); + } + + [TestMethod] + public void BaseClass4_Test() + { + Debug.WriteLine("Tests a function declaration in a child class still works after child is cast as"); + Debug.WriteLine("its parent class and an interface it implements"); + Assert.True(BaseClassTestClass4.testMethod()); + } + + [TestMethod] + public void BaseClass10_Test() + { + Debug.WriteLine("Section 10.1"); + Debug.WriteLine("The base classes of a class are the direct base"); + Debug.WriteLine("class and its base classes. In other words, the"); + Debug.WriteLine("set of base classes is the transitive closure of the "); + Debug.WriteLine("direct base class relatationship."); + Assert.True(BaseClassTestClass10.testMethod()); + } + + [TestMethod] + public void BaseClass13_Test() + { + Debug.WriteLine("Section 10.1"); + Debug.WriteLine("Note that a class does not depend on the"); + Debug.WriteLine("classes that are nested within it. "); + Assert.True(BaseClassTestClass13.testMethod()); + } + + [TestMethod] + public void BaseClass25_Test() + { + Debug.WriteLine("10.1.2.1 "); + Debug.WriteLine("inheriting from nested types"); + Assert.True(BaseClassTestClass25.testMethod()); + } + + [TestMethod] + public void BaseClass29_Test() + { + Debug.WriteLine("10.1.2.1 "); + Debug.WriteLine("inheriting from nested types"); + + Assert.True(BaseClassTestClass29.testMethod()); + } + + [TestMethod] + public void Modifiers2_Test() + { + Debug.WriteLine("Testing a public int inside an inner class with modifier 'new' "); + + Assert.True(ModifiersTestClass2.testMethod()); + } + + [TestMethod] + public void Modifiers3_Test() + { + + Debug.WriteLine("Testing a public int directly inside a public class"); + Assert.True(ModifiersTestClass3.testMethod()); + } + + [TestMethod] + public void Modifiers4_Test() + { + + Debug.WriteLine("Testing a public int inside an inner class with modifier 'public' "); + Assert.True(ModifiersTestClass4.testMethod()); + } + + [TestMethod] + public void Modifiers6_Test() + { + + Debug.WriteLine("Testing a public int inside an inner class with modifier 'protected' "); + Assert.True(ModifiersTestClass6.testMethod()); + } + + [TestMethod] + public void Modifiers7_Test() + { + + Debug.WriteLine("Testing a public int directly inside an internal class"); + Assert.True(ModifiersTestClass7.testMethod()); + } + + [TestMethod] + public void Modifiers8_Test() + { + Debug.WriteLine("Testing a public int inside an inner class with modifier 'internal' "); + Assert.True(ModifiersTestClass8.testMethod()); + } + + [TestMethod] + public void Modifiers10_Test() + { + + Debug.WriteLine("Testing a public int inside an inner class with modifier 'private' "); + Assert.True(ModifiersTestClass10.testMethod()); + } + + [TestMethod] + public void Modifiers11_Test() + { + + Debug.WriteLine("Testing a public int inside an abstract class that is implemented"); + Assert.True(ModifiersTestClass11.testMethod()); + } + + [TestMethod] + public void Modifiers12_Test() + { + + Debug.WriteLine("Testing a public int inside an inner abstract class that is implemented"); + Assert.True(ModifiersTestClass12.testMethod()); + } + + [TestMethod] + public void Modifiers13_Test() + { + Debug.WriteLine("Testing a public int directly inside a sealed class"); + Assert.True(ModifiersTestClass13.testMethod()); + } + + [TestMethod] + public void Modifiers14_Test() + { + + Debug.WriteLine("Testing a public int inside an inner sealed class"); + Assert.True(ModifiersTestClass14.testMethod()); + } + + [TestMethod] + public void Modifiers23_Test() + { + Debug.WriteLine("An abstract class cannot be instantiated, and it is"); + Debug.WriteLine("an error to use the new operator on an abstract class."); + Debug.WriteLine("While it is possible to have variables and values whose"); + Debug.WriteLine("compile-time types are abstract, such variables and values"); + Debug.WriteLine("will necessarily either be null or contain references"); + Debug.WriteLine("to instances of non-abstract classes derived from the "); + Debug.WriteLine("abstract types."); + Assert.True(ModifiersTestClass23.testMethod()); + } + + [TestMethod] + public void Modifiers24_Test() + { + Debug.WriteLine("An abstract class cannot be instantiated, and it is"); + Debug.WriteLine("an error to use the new operator on an abstract class."); + Debug.WriteLine("While it is possible to have variables and values whose"); + Debug.WriteLine("compile-time types are abstract, such variables and values"); + Debug.WriteLine("will necessarily either be null or contain references"); + Debug.WriteLine("to instances of non-abstract classes derived from the "); + Debug.WriteLine("abstract types."); + Assert.True(ModifiersTestClass24.testMethod()); + } + + [TestMethod] + public void Modifiers25_Test() + { + Debug.WriteLine("Section 10.1"); + Debug.WriteLine("An abstract class is permitted (but not required)"); + Debug.WriteLine("to contain abstract methods and accessors."); + Assert.True(ModifiersTestClass25.testMethod()); + } + + [TestMethod] + public void Modifiers26_Test() + { + Debug.WriteLine("Section 10.1"); + Debug.WriteLine("An abstract class is permitted (but not required)"); + Debug.WriteLine("to contain abstract methods and accessors."); + Assert.True(ModifiersTestClass26.testMethod()); + } + + [TestMethod] + public void Modifiers31_Test() + { + + Debug.WriteLine("Section 10.1"); + Debug.WriteLine("When a non-abstract class is derived from"); + Debug.WriteLine("an abstract class, the non-abstract class must"); + Debug.WriteLine("be include actual implementations of all inherited "); + Debug.WriteLine("abstract methods and accessors. Such implementations"); + Debug.WriteLine("are provided by overriding the abstract methods"); + Debug.WriteLine("and accessors."); + Assert.True(ModifiersTestClass31.testMethod()); + } + + class BaseClassTestClass1_Base + { + public int intI = 2; + } + + class BaseClassTestClass1 : BaseClassTestClass1_Base + { + public static bool testMethod() + { + BaseClassTestClass1 MC = new BaseClassTestClass1(); + if (MC.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + + interface BaseClassTestClass2_Base + { + int RetInt(); + } + + class BaseClassTestClass2 : BaseClassTestClass2_Base + { + + public int RetInt() + { + return 2; + } + + public static bool testMethod() + { + BaseClassTestClass2 MC = new BaseClassTestClass2(); + BaseClassTestClass2_Base Test = (BaseClassTestClass2_Base)MC; + if (Test.RetInt() == 2) + { + return true; + } + else + { + return false; + } + } + } + + + interface BaseClassTestClass3_Base1 + { + int RetInt(); + } + + interface BaseClassTestClass3_Base2 + { + int RetInt2(); + } + + class BaseClassTestClass3 : BaseClassTestClass3_Base1, BaseClassTestClass3_Base2 + { + + public int RetInt() + { + return 2; + } + + public int RetInt2() + { + return 3; + } + + public static bool testMethod() + { + BaseClassTestClass3 MC = new BaseClassTestClass3(); + BaseClassTestClass3_Base1 Test1 = (BaseClassTestClass3_Base1)MC; + BaseClassTestClass3_Base2 Test2 = (BaseClassTestClass3_Base2)MC; + if ((Test1.RetInt() == 2) && (Test2.RetInt2() == 3)) + { + return true; + } + else + { + return false; + } + } + } + + + + class BaseClassTestClass4_Base1 + { + public int RetInt() + { + return 2; + } + } + + interface BaseClassTestClass4_Base2 + { + int RetInt2(); + } + + class BaseClassTestClass4 : BaseClassTestClass4_Base1, BaseClassTestClass4_Base2 + { + + public int RetInt2() + { + return 3; + } + + public static bool testMethod() + { + BaseClassTestClass4 MC = new BaseClassTestClass4(); + BaseClassTestClass4_Base1 Test1 = (BaseClassTestClass4_Base1)MC; + BaseClassTestClass4_Base2 Test2 = (BaseClassTestClass4_Base2)MC; + if ((Test1.RetInt() == 2) && (Test2.RetInt2() == 3)) + { + return true; + } + else + { + return false; + } + } + } + + + class BaseClassTestClass10_Base1 + { + public int intI = 2; + } + + class BaseClassTestClass10_Base2 : BaseClassTestClass10_Base1 + { + public int intJ = 3; + } + + class BaseClassTestClass10 : BaseClassTestClass10_Base2 + { + public static bool testMethod() + { + BaseClassTestClass10 MC = new BaseClassTestClass10(); + if ((MC.intI == 2) && (MC.intJ == 3)) + { + return true; + } + else + { + return false; + } + } + } + + class BaseClassTestClass13 + { + class BaseClassTestClass13_Sub : BaseClassTestClass13 + { + public int intI = 2; + } + + public static bool testMethod() + { + BaseClassTestClass13_Sub test = new BaseClassTestClass13_Sub(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class BaseClassTestClass25_Base1 + { + public class BaseClassTestClass25_Sub1 : BaseClassTestClass25_Base1 { } + public interface BaseClassTestClass25_Interface1 { } + public class BaseClassTestClass25_Sub2 : BaseClassTestClass25_Sub1, BaseClassTestClass25_Interface1 + { } + } + + class BaseClassTestClass25 : BaseClassTestClass25_Base1.BaseClassTestClass25_Sub2, BaseClassTestClass25_Base1.BaseClassTestClass25_Interface1 + { + public static bool testMethod() + { + BaseClassTestClass25 m = new BaseClassTestClass25(); + if ((BaseClassTestClass25_Base1.BaseClassTestClass25_Sub2)m == null) + return false; + + if ((BaseClassTestClass25_Base1.BaseClassTestClass25_Interface1)m == null) + return false; + return true; + } + } + + public class BaseClassTestClass29_SubC : BaseClassTestClass29_SubA.BaseClassTestClass29_SubB { } + class BaseClassTestClass29_SubG : BaseClassTestClass29_SubC { } + class BaseClassTestClass29_SubGG : BaseClassTestClass29_SubA.D { } + class BaseClassTestClass29_SubGGG : BaseClassTestClass29_SubD, BaseClassTestClass29_SubA.BaseClassTestClass29_SubC.II, BaseClassTestClass29_SubA.BaseClassTestClass29_SubB.I { } + + public class BaseClassTestClass29_SubA + { + public class BaseClassTestClass29_SubB : BaseClassTestClass29_SubC.I + { + public interface I { } + } + public class BaseClassTestClass29_SubC + { + public interface I { } + public interface II : I { } + } + + public class D : BaseClassTestClass29_SubC.II + { + public class DD : D, BaseClassTestClass29_SubC.I, BaseClassTestClass29_SubC.II + { + public interface I : BaseClassTestClass29_SubC.II { } + } + } + } + + class BaseClassTestClass29_SubD : BaseClassTestClass29_SubC { } + class BaseClassTestClass29_SubDD : BaseClassTestClass29_SubA.D { } + class BaseClassTestClass29_SubDDD : BaseClassTestClass29_SubD, BaseClassTestClass29_SubA.BaseClassTestClass29_SubC.II, BaseClassTestClass29_SubA.BaseClassTestClass29_SubB.I { } + + class BaseClassTestClass29 + { + public static bool testMethod() + { + return true; + } + } + + + class ModifiersTestClass2_Base1 + { + public class Inner + { + public int IntI = 1; + } + } + + class ModifiersTestClass2 : ModifiersTestClass2_Base1 + { + + // new + new class Inner + { + public int IntI = 2; + } + + public static bool testMethod() + { + Inner Test = new Inner(); + if (Test.IntI == 2) + { + return true; + } + else + { + return false; + } + } + } + + public class ModifiersTestClass3 + { + + public int IntI = 2; + + public static bool testMethod() + { + ModifiersTestClass3 Test = new ModifiersTestClass3(); + if (Test.IntI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ModifiersTestClass4 + { + + //public + public class Inner + { + public int IntI = 2; + } + + public static bool testMethod() + { + Inner Test = new Inner(); + if (Test.IntI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ModifiersTestClass6 + { + protected class Inner + { + public int IntI = 2; + } + public static bool testMethod() + { + Inner Test = new Inner(); + if (Test.IntI == 2) + { + return true; + } + else + { + return false; + } + } + } + + internal class ModifiersTestClass7 + { + + public int IntI = 2; + + public static bool testMethod() + { + ModifiersTestClass7 Test = new ModifiersTestClass7(); + if (Test.IntI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ModifiersTestClass8 + { + + // internal + internal class Inner + { + public int IntI = 2; + } + + public static bool testMethod() + { + Inner Test = new Inner(); + if (Test.IntI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ModifiersTestClass10 + { + + // private + private class Inner + { + public int IntI = 2; + } + + public static bool testMethod() + { + Inner Test = new Inner(); + if (Test.IntI == 2) + { + return true; + } + else + { + return false; + } + } + } + + public abstract class ModifiersTestClass11_Base + { + public int IntI = 2; + } + + public class ModifiersTestClass11 : ModifiersTestClass11_Base + { + public static bool testMethod() + { + ModifiersTestClass11 Test = new ModifiersTestClass11(); + if (Test.IntI == 2) + { + return true; + } + else + { + return false; + } + } + } + + public class ModifiersTestClass12 + { + + // abstract + abstract class BaseClass + { + public int IntI = 2; + } + + class Inner : BaseClass { } + + public static bool testMethod() + { + Inner Test = new Inner(); + if (Test.IntI == 2) + { + return true; + } + else + { + return false; + } + } + } + + sealed class ModifiersTestClass13 + { + + public int IntI = 2; + + public static bool testMethod() + { + ModifiersTestClass13 Test = new ModifiersTestClass13(); + if (Test.IntI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class ModifiersTestClass14 + { + + //sealed + sealed class Inner + { + public int IntI = 2; + } + + public static bool testMethod() + { + Inner Test = new Inner(); + if (Test.IntI == 2) + { + return true; + } + else + { + return false; + } + } + } + + abstract class ModifiersTestClass23_Sub1 { } + + class ModifiersTestClass23 + { + + ModifiersTestClass23_Sub1 A; + + public static bool testMethod() + { + ModifiersTestClass23 test = new ModifiersTestClass23(); + if (test.A == null) + { + return true; + } + else + { + return false; + } + } + } + + abstract class ModifiersTestClass24_Abstract1 + { + public abstract int retInt(); + } + + class ModifiersTestClass24_Derived1 : ModifiersTestClass24_Abstract1 + { + override public int retInt() + { + return 2; + } + } + + class ModifiersTestClass24 + { + + ModifiersTestClass24_Abstract1 A = new ModifiersTestClass24_Derived1(); + + public static bool testMethod() + { + + ModifiersTestClass24 test = new ModifiersTestClass24(); + + if (test.A.retInt() == 2) + { + return true; + } + else + { + return false; + } + } + } + + abstract class ModifiersTestClass25_Abstract1 { } + + class ModifiersTestClass25 : ModifiersTestClass25_Abstract1 + { + public static bool testMethod() + { + return true; + } + } + + abstract class ModifiersTestClass26_Abstract1 + { + public abstract void foo(); + public abstract int intI + { + get; + set; + } + } + + class ModifiersTestClass26 + { + public static bool testMethod() + { + return true; + } + } + + abstract class ModifiersTestClass31_SubA + { + public abstract void F(); + } + + abstract class ModifiersTestClass31_SubB : ModifiersTestClass31_SubA + { + public void G() { } + } + + class ModifiersTestClass31 : ModifiersTestClass31_SubB + { + + int MyInt = 0; + + public override void F() + { + MyInt = 1; + } + + public static bool testMethod() + { + ModifiersTestClass31 test = new ModifiersTestClass31(); + ModifiersTestClass31_SubA abstest = test; + abstest.F(); + if (test.MyInt == 1) + { + return true; + } + else + { + return false; + } + } + } + + } +} diff --git a/Tests/NFUnitTestClasses/UnitTestDestructorTests.cs b/Tests/NFUnitTestClasses/UnitTestDestructorTests.cs new file mode 100644 index 00000000..53f8ca3c --- /dev/null +++ b/Tests/NFUnitTestClasses/UnitTestDestructorTests.cs @@ -0,0 +1,174 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using System.Reflection; + +namespace NFUnitTestClasses +{ + [TestClass] + class UnitTestDestructorTests + { + [TestMethod] + public void Destructors3_Test() + { + //Ported from Destructors3.cs + Debug.WriteLine(" Section 10.11"); + Debug.WriteLine(" Destructors implement the actions required to "); + Debug.WriteLine(" destruct the instances of a class."); + Debug.WriteLine(""); + Debug.WriteLine("Note: This test may fail due to lengthy garbage collection, look for Destructor messages in later logs"); + Assert.True(DestructorsTestClass3.testMethod()); + } + + [TestMethod] + public void Destructors4_Test() + { + //Ported from Destructors4.cs + Debug.WriteLine(" Section 10.11"); + Debug.WriteLine(" Destructors implement the actions required to "); + Debug.WriteLine(" destruct the instances of a class."); + Debug.WriteLine(""); + Debug.WriteLine("Note: This test may fail due to lengthy garbage collection, look for Destructor messages in later logs"); + Assert.True(DestructorsTestClass4.testMethod()); + } + + [TestMethod] + public void Destructors7_Test() + { + //Ported from Destructors7.cs + Debug.WriteLine(" Section 10.12"); + Debug.WriteLine(" Destructors are not inherited. Thus, a class"); + Debug.WriteLine(" has no other destructors than those that are "); + Debug.WriteLine(" actually declared in the class."); + Debug.WriteLine(""); + Debug.WriteLine("Note: This test may fail due to lengthy garbage collection, look for Destructor messages in later logs"); + Assert.True(DestructorsTestClass7.testMethod()); + } + + class DestructorsTestClass3 + { + + static int intI = 1; + + ~DestructorsTestClass3() + { + //Debug.WriteLine("Calling Destructor for Test Class 3"); + intI = 2; + } + + public static bool testMethod() + { + DestructorsTestClass3 mc = new DestructorsTestClass3(); + mc = null; + nanoFramework.Runtime.Native.GC.Run(true); + int sleepTime = 5000; + int slept = 0; + while (intI != 2 && slept < sleepTime) + { + System.Threading.Thread.Sleep(10); + slept += 10; + } + Debug.WriteLine("Thread has slept for"); + Debug.WriteLine(slept.ToString()); + if (intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + + class DestructorsTestClass4_Base + { + public static int intI = 2; + ~DestructorsTestClass4_Base() + { + intI = intI * 2; + //Debug.WriteLine("Calling Destructor for Test Class 4 Base"); + } + } + + class DestructorsTestClass4 : DestructorsTestClass4_Base + { + + ~DestructorsTestClass4() + { + intI = intI + 2; + //Debug.WriteLine("Calling Destructor for Test Class 4"); + } + + public static bool testMethod() + { + DestructorsTestClass4 mc = new DestructorsTestClass4(); + mc = null; + nanoFramework.Runtime.Native.GC.Run(true); + int sleepTime = 5000; + int slept = 0; + while (intI != 8 && slept < sleepTime) + { + System.Threading.Thread.Sleep(10); + slept += 10; + } + Debug.WriteLine("Thread has slept for"); + Debug.WriteLine(slept.ToString()); + if (intI == 8) + { + return true; + } + else + { + return false; + } + } + } + + class DestructorsTestClass7_Base + { + public static int intI = 2; + } + + class DestructorsTestClass7 : DestructorsTestClass7_Base + { + + ~DestructorsTestClass7() + { + intI = 3; + //Debug.WriteLine("Calling Destructor for Test Class 7"); + } + + public static bool testMethod() + { + DestructorsTestClass7 mc = new DestructorsTestClass7(); + mc = null; + nanoFramework.Runtime.Native.GC.Run(true); + int sleepTime = 5000; + int slept = 0; + while (intI != 3 && slept < sleepTime) + { + System.Threading.Thread.Sleep(10); + slept += 10; + } + Debug.WriteLine("Thread has slept for"); + Debug.WriteLine(slept.ToString()); + if (intI == 3) + { + return true; + } + else + { + return false; + } + } + } + } +} diff --git a/Tests/NFUnitTestClasses/UnitTestEventTests.cs b/Tests/NFUnitTestClasses/UnitTestEventTests.cs new file mode 100644 index 00000000..d7fbf5b4 --- /dev/null +++ b/Tests/NFUnitTestClasses/UnitTestEventTests.cs @@ -0,0 +1,71 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestClasses +{ + [TestClass] + class UnitTestEventTests + { + [TestMethod] + public void Events1_Test() + { + Debug.WriteLine("This is testing an obsolete event structure, but should pass."); + Assert.True(EventsTestClass1.testMethod()); + } + + + public delegate void EventsTestClass1_EventHandler1(); + + public class EventsTestClass1_Event1 + { + + [Obsolete("This is Obsolete")] + public event EventsTestClass1_EventHandler1 CMyEvent; + + public void Fire() + { + if (CMyEvent != null) CMyEvent(); + } + } + + public class EventsTestClass1_Sub1 + { + + + public static void MyMeth() { } + + public static void Main_old() + { + EventsTestClass1_Event1 mc = new EventsTestClass1_Event1(); + mc.CMyEvent += new EventsTestClass1_EventHandler1(MyMeth); + mc.Fire(); + } + } + + class EventsTestClass1 + { + public static bool testMethod() + { + try + { + EventsTestClass1_Sub1.Main_old(); + } + catch + { + return false; + } + return true; + + } + } + + + } +} diff --git a/Tests/NFUnitTestClasses/UnitTestFieldTests.cs b/Tests/NFUnitTestClasses/UnitTestFieldTests.cs new file mode 100644 index 00000000..db891d85 --- /dev/null +++ b/Tests/NFUnitTestClasses/UnitTestFieldTests.cs @@ -0,0 +1,1332 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestClasses +{ + [TestClass] + class UnitTestFieldTests + { + [TestMethod] + public void Fields1_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" A field-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers, a"); + Debug.WriteLine(" static modifier, and a readonly modifier. The "); + Debug.WriteLine(" attributes and modifiers apply to all of the "); + Debug.WriteLine(" members declared by the field-declaration."); + Assert.True(FieldsTestClass1.testMethod()); + } + + [TestMethod] + public void Fields2_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" A field-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers, a"); + Debug.WriteLine(" static modifier, and a readonly modifier. The "); + Debug.WriteLine(" attributes and modifiers apply to all of the "); + Debug.WriteLine(" members declared by the field-declaration."); + Assert.True(FieldsTestClass2.testMethod()); + } + + [TestMethod] + public void Fields3_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" A field-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers, a"); + Debug.WriteLine(" static modifier, and a readonly modifier. The "); + Debug.WriteLine(" attributes and modifiers apply to all of the "); + Debug.WriteLine(" members declared by the field-declaration."); + Assert.True(FieldsTestClass3.testMethod()); + } + + [TestMethod] + public void Fields4_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" A field-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers, a"); + Debug.WriteLine(" static modifier, and a readonly modifier. The "); + Debug.WriteLine(" attributes and modifiers apply to all of the "); + Debug.WriteLine(" members declared by the field-declaration."); + Assert.True(FieldsTestClass4.testMethod()); + } + + [TestMethod] + public void Fields5_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" A field-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers, a"); + Debug.WriteLine(" static modifier, and a readonly modifier. The "); + Debug.WriteLine(" attributes and modifiers apply to all of the "); + Debug.WriteLine(" members declared by the field-declaration."); + Assert.True(FieldsTestClass5.testMethod()); + } + + [TestMethod] + public void Fields6_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" A field-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers, a"); + Debug.WriteLine(" static modifier, and a readonly modifier. The "); + Debug.WriteLine(" attributes and modifiers apply to all of the "); + Debug.WriteLine(" members declared by the field-declaration."); + Assert.True(FieldsTestClass6.testMethod()); + } + + [TestMethod] + public void Fields7_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" A field-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers, a"); + Debug.WriteLine(" static modifier, and a readonly modifier. The "); + Debug.WriteLine(" attributes and modifiers apply to all of the "); + Debug.WriteLine(" members declared by the field-declaration."); + Assert.True(FieldsTestClass7.testMethod()); + } + + [TestMethod] + public void Fields8_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" A field-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers, a"); + Debug.WriteLine(" static modifier, and a readonly modifier. The "); + Debug.WriteLine(" attributes and modifiers apply to all of the "); + Debug.WriteLine(" members declared by the field-declaration."); + Assert.True(FieldsTestClass8.testMethod()); + } + + [TestMethod] + public void Fields13_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" A field-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers, a"); + Debug.WriteLine(" static modifier, and a readonly modifier. The "); + Debug.WriteLine(" attributes and modifiers apply to all of the "); + Debug.WriteLine(" members declared by the field-declaration."); + Debug.WriteLine(""); + Debug.WriteLine(" A field declaration that declares multiple fields"); + Debug.WriteLine(" is equivalent to multiple declarations of single "); + Debug.WriteLine(" fields with the same attributes, modifiers, and type."); + Assert.True(FieldsTestClass13.testMethod()); + } + + [TestMethod] + public void Fields14_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" A static field identifies exactly on storage location."); + Debug.WriteLine(" No matter how many instances of a class are created,"); + Debug.WriteLine(" there is only ever one copy of a static field."); + Assert.True(FieldsTestClass14.testMethod()); + } + + [TestMethod] + public void Fields15_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" A static field comes into existence when the "); + Debug.WriteLine(" type in which it is declared is loaded, and "); + Debug.WriteLine(" ceases to exist when the type in which it "); + Debug.WriteLine(" is declared in unloaded."); + Assert.True(FieldsTestClass15.testMethod()); + } + + [TestMethod] + public void Fields16_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" Every instance of a class contains a separate copy"); + Debug.WriteLine(" of all instance fields of the class. An instance "); + Debug.WriteLine(" field comes into existence when a new instance of "); + Debug.WriteLine(" its class is created, and ceases to exist when there "); + Debug.WriteLine(" are no references to that instance and the destructor"); + Debug.WriteLine(" of the instance has executed."); + Assert.True(FieldsTestClass16.testMethod()); + } + + [TestMethod] + public void Fields17_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" Every instance of a class contains a separate copy"); + Debug.WriteLine(" of all instance fields of the class. An instance "); + Debug.WriteLine(" field comes into existence when a new instance of "); + Debug.WriteLine(" its class is created, and ceases to exist when there "); + Debug.WriteLine(" are no references to that instance and the destructor"); + Debug.WriteLine(" of the instance has executed."); + Assert.True(FieldsTestClass17.testMethod()); + } + + [TestMethod] + public void Fields18_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" When a field is referenced in a member-access of"); + Debug.WriteLine(" the form E.M, if M is a static field, E must denote"); + Debug.WriteLine(" a type, and if M is an instance field, E must "); + Debug.WriteLine(" denote an instance."); + Assert.True(FieldsTestClass18.testMethod()); + } + + [TestMethod] + public void Fields20_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" When a field is referenced in a member-access of"); + Debug.WriteLine(" the form E.M, if M is a static field, E must denote"); + Debug.WriteLine(" a type, and if M is an instance field, E must "); + Debug.WriteLine(" denote an instance."); + Assert.True(FieldsTestClass20.testMethod()); + } + + [TestMethod] + public void Fields22_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" When a field-declaration includes a readonly"); + Debug.WriteLine(" modifier, assignments to the fields introduced"); + Debug.WriteLine(" by the declaration can only occur as part of"); + Debug.WriteLine(" the declaration or in a constructor in the"); + Debug.WriteLine(" same class."); + Assert.True(FieldsTestClass22.testMethod()); + } + + [TestMethod] + public void Fields23_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" When a field-declaration includes a readonly"); + Debug.WriteLine(" modifier, assignments to the fields introduced"); + Debug.WriteLine(" by the declaration can only occur as part of"); + Debug.WriteLine(" the declaration or in a constructor in the"); + Debug.WriteLine(" same class."); + Assert.True(FieldsTestClass23.testMethod()); + } + + [TestMethod] + public void Fields24_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" When a field-declaration includes a readonly"); + Debug.WriteLine(" modifier, assignments to the fields introduced"); + Debug.WriteLine(" by the declaration can only occur as part of"); + Debug.WriteLine(" the declaration or in a constructor in the"); + Debug.WriteLine(" same class."); + Assert.True(FieldsTestClass24.testMethod()); + } + + [TestMethod] + public void Fields41_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" A static readonly field is useful when a symbolic"); + Debug.WriteLine(" name for a constant value is desired, but when the "); + Debug.WriteLine(" type of the value is not permitted in a const declaration"); + Debug.WriteLine(" or when the value cannot be computed at compile-time"); + Debug.WriteLine(" by a constant expression."); + Assert.True(FieldsTestClass41.testMethod()); + } + + [TestMethod] + public void Fields42_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" Field declarations may include variable-initializers."); + Debug.WriteLine(" For static fields, varaible initializers correspond to"); + Debug.WriteLine(" assignment statements that are executed when the class"); + Debug.WriteLine(" is loaded. For instance fields, variable initializers"); + Debug.WriteLine(" correspond to assignment statements that are executed"); + Debug.WriteLine(" when an instance of the class is created."); + Debug.WriteLine("This test has been rewritten to avoid use of the Math.Abs function which the MF does not support"); + Assert.True(FieldsTestClass42.testMethod()); + } + + [TestMethod] + public void Fields43_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" The static field variable initializers of a class"); + Debug.WriteLine(" correspond to a sequence of assignments that are "); + Debug.WriteLine(" executed immediately upon entry to the static"); + Debug.WriteLine(" constructor of a class. The variable initializers"); + Debug.WriteLine(" are executed in the textual order they appear"); + Debug.WriteLine(" in the class declaration."); + Assert.True(FieldsTestClass43.testMethod()); + } + + [TestMethod] + public void Fields44_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" The static field variable initializers of a class"); + Debug.WriteLine(" correspond to a sequence of assignments that are "); + Debug.WriteLine(" executed immediately upon entry to the static"); + Debug.WriteLine(" constructor of a class. The variable initializers"); + Debug.WriteLine(" are executed in the textual order they appear"); + Debug.WriteLine(" in the class declaration."); + Assert.True(FieldsTestClass44.testMethod()); + } + + [TestMethod] + public void Fields45_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" The static field variable initializers of a class"); + Debug.WriteLine(" correspond to a sequence of assignments that are "); + Debug.WriteLine(" executed immediately upon entry to the static"); + Debug.WriteLine(" constructor of a class. The variable initializers"); + Debug.WriteLine(" are executed in the textual order they appear"); + Debug.WriteLine(" in the class declaration."); + Assert.True(FieldsTestClass45.testMethod()); + } + + [TestMethod] + public void Fields46_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" The instance field variable initializers of a class"); + Debug.WriteLine(" correspond to a sequence of assignments that are "); + Debug.WriteLine(" executed immediately upon entry to one of the instance"); + Debug.WriteLine(" constructors of the class."); + Assert.True(FieldsTestClass46.testMethod()); + } + + [TestMethod] + public void Fields49_testMethod() + { + Debug.WriteLine(" A variable initializer for an instance field"); + Debug.WriteLine(" cannot reference the instance being created."); + Debug.WriteLine(" Thus, it is an error to reference this in a "); + Debug.WriteLine(" variable initializer, as it is an error for"); + Debug.WriteLine(" a variable initialzer to reference any instance"); + Debug.WriteLine(" member through a simple-name."); + Assert.True(FieldsTestClass49.testMethod()); + } + + [TestMethod] + public void Fields51_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" Specifically, assignments to a readonly field"); + Debug.WriteLine(" are permitted only in the following context."); + Debug.WriteLine(" ..."); + Debug.WriteLine(" For an instance field, in the instance constructors"); + Debug.WriteLine(" of the class that contains the field declaration, or"); + Debug.WriteLine(" for a static field, in the static constructor of the"); + Debug.WriteLine(" class the contains the field declaration. These are also"); + Debug.WriteLine(" contexts in which it is valid to pass a readonly field"); + Debug.WriteLine(" as an out or ref parameter."); + Assert.True(FieldsTestClass51.testMethod()); + } + + [TestMethod] + public void Fields52_testMethod() + { + Debug.WriteLine(" Section 10.4"); + Debug.WriteLine(" Specifically, assignments to a readonly field"); + Debug.WriteLine(" are permitted only in the following context."); + Debug.WriteLine(" ..."); + Debug.WriteLine(" For an instance field, in the instance constructors"); + Debug.WriteLine(" of the class that contains the field declaration, or"); + Debug.WriteLine(" for a static field, in the static constructor of the"); + Debug.WriteLine(" class the contains the field declaration. These are also"); + Debug.WriteLine(" contexts in which it is valid to pass a readonly field"); + Debug.WriteLine(" as an out or ref parameter."); + Assert.True(FieldsTestClass52.testMethod()); + } + + [TestMethod] + public void Fields53_testMethod() + { + Debug.WriteLine("Testing bools assigned with (x == y)"); + Assert.True(FieldsTestClass53.testMethod()); + } + + [TestMethod] + public void Fields54_testMethod() + { + Debug.WriteLine("Testing bools assigned with function calls"); + Assert.True(FieldsTestClass54.testMethod()); + } + + [TestMethod] + public void Fields55_testMethod() + { + Debug.WriteLine("Testing bools assigned with conditionals"); + Assert.True(FieldsTestClass55.testMethod()); + } + + [TestMethod] + public void Fields56_testMethod() + { + Debug.WriteLine("Testing ints assigned with function calls"); + Assert.True(FieldsTestClass56.testMethod()); + } + + [TestMethod] + public void Fields57_testMethod() + { + Debug.WriteLine("Testing strings assigned with \"x\" + \"y\""); + Assert.True(FieldsTestClass57.testMethod()); + } + + [TestMethod] + public void Fields58_testMethod() + { + Debug.WriteLine("Testing strings assigned with function calls"); + Assert.True(FieldsTestClass58.testMethod()); + } + + class FieldsTestClass1 + { + + int intI = 2; + + public static bool testMethod() + { + + FieldsTestClass1 test = new FieldsTestClass1(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass2_Base + { + public int intI = 1; + } + + class FieldsTestClass2 : FieldsTestClass2_Base + { + + new int intI = 2; + + public static bool testMethod() + { + + FieldsTestClass2 test = new FieldsTestClass2(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass3 + { + + public int intI = 2; + + public static bool testMethod() + { + + FieldsTestClass3 test = new FieldsTestClass3(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass4 + { + + protected int intI = 2; + + public static bool testMethod() + { + + FieldsTestClass4 test = new FieldsTestClass4(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass5 + { + + internal int intI = 2; + + public static bool testMethod() + { + + FieldsTestClass5 test = new FieldsTestClass5(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass6 + { + + private int intI = 2; + + public static bool testMethod() + { + + FieldsTestClass6 test = new FieldsTestClass6(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass7 + { + + static int intI = 2; + + public static bool testMethod() + { + + if (intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass8 + { + + readonly int intI = 2; + + public static bool testMethod() + { + + FieldsTestClass8 test = new FieldsTestClass8(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass13_Base + { + public int intI = 2, intJ = 3; + } + + class FieldsTestClass13 + { + + public static bool testMethod() + { + + FieldsTestClass13_Base test = new FieldsTestClass13_Base(); + if ((test.intI == 2) && (test.intJ == 3)) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass14 + { + + static int intI = 1; + + public void ChangeInt(int intJ) + { + intI = intJ; + } + + + public static bool testMethod() + { + + FieldsTestClass14 c1 = new FieldsTestClass14(); + c1.ChangeInt(2); + FieldsTestClass14 c2 = new FieldsTestClass14(); + c1.ChangeInt(3); + FieldsTestClass14 c3 = new FieldsTestClass14(); + c1.ChangeInt(4); + + if (intI == 4) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass15_Base + { + public static int intI = 1; + } + + class FieldsTestClass15 + { + + public static bool testMethod() + { + + if (FieldsTestClass15_Base.intI == 1) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass16 + { + + + int intI = 1; + + public void ChangeInt(int intJ) + { + intI = intJ; + } + + public static bool testMethod() + { + + FieldsTestClass16 c1 = new FieldsTestClass16(); + c1.ChangeInt(2); + FieldsTestClass16 c2 = new FieldsTestClass16(); + c2.ChangeInt(3); + FieldsTestClass16 c3 = new FieldsTestClass16(); + c3.ChangeInt(4); + + if ((c1.intI == 2) && (c2.intI == 3) && (c3.intI == 4)) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass17_Base + { + public int intI = 1; + } + + class FieldsTestClass17 + { + + FieldsTestClass17_Base tc; + + public static bool testMethod() + { + try + { + bool RetVal = false; + + FieldsTestClass17 test = new FieldsTestClass17(); + + try + { + int intJ = test.tc.intI; //MyTest hasn't been instantiated + } + catch (System.Exception e) + { + RetVal = true; + } + return RetVal; + } + catch { return false; } + } + } + + class FieldsTestClass18 + { + + static int intI = 2; + + public static bool testMethod() + { + if (FieldsTestClass18.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass20 + { + + int intI = 2; + + public static bool testMethod() + { + FieldsTestClass20 test = new FieldsTestClass20(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + enum FieldsTestClass22_Enum { a = 1, b = 2 } + + struct FieldsTestClass22_Struct + { + public FieldsTestClass22_Struct(int intI) + { + Test = intI; + } + public int Test; + } + + struct FieldsTestClass22_Sub + { + public FieldsTestClass22_Sub(int intI) + { + Test = intI; + } + public int Test; + } + + class FieldsTestClass22 + { + + readonly int intI = 2; + readonly string strS = "MyString"; + readonly FieldsTestClass22_Enum enuE = FieldsTestClass22_Enum.a; + readonly FieldsTestClass22_Struct sctS = new FieldsTestClass22_Struct(3); + readonly FieldsTestClass22_Sub clsC = new FieldsTestClass22_Sub(4); + + public static bool testMethod() + { + + FieldsTestClass22 MC = new FieldsTestClass22(); + + if ((MC.intI == 2) && (MC.strS.Equals("MyString")) && (MC.enuE == FieldsTestClass22_Enum.a) && (MC.sctS.Test == 3) && (MC.clsC.Test == 4)) + { + return true; + } + else + { + return false; + } + } + } + + enum FieldsTestClass23_Enum { a = 1, b = 2 } + + struct FieldsTestClass23_Struct + { + public FieldsTestClass23_Struct(int intI) + { + Test = intI; + } + public int Test; + } + + struct FieldsTestClass23_Sub + { + public FieldsTestClass23_Sub(int intI) + { + Test = intI; + } + public int Test; + } + + class FieldsTestClass23 + { + + public FieldsTestClass23() + { + intI = 2; + strS = "MyString"; + enuE = FieldsTestClass23_Enum.a; + sctS = new FieldsTestClass23_Struct(3); + clsC = new FieldsTestClass23_Sub(4); + } + + readonly int intI; + readonly string strS; + readonly FieldsTestClass23_Enum enuE; + readonly FieldsTestClass23_Struct sctS; + readonly FieldsTestClass23_Sub clsC; + + public static bool testMethod() + { + + FieldsTestClass23 MC = new FieldsTestClass23(); + + if ((MC.intI == 2) && (MC.strS.Equals("MyString")) && (MC.enuE == FieldsTestClass23_Enum.a) && (MC.sctS.Test == 3) && (MC.clsC.Test == 4)) + { + return true; + } + else + { + return false; + } + } + } + + enum FieldsTestClass24_Enum { a = 1, b = 2 } + + struct FieldsTestClass24_Struct + { + public FieldsTestClass24_Struct(int intI) + { + Test = intI; + } + public int Test; + } + + struct FieldsTestClass24_Sub + { + public FieldsTestClass24_Sub(int intI) + { + Test = intI; + } + public int Test; + } + + class FieldsTestClass24 + { + + public FieldsTestClass24() + { + intI = 2; + strS = "MyString"; + enuE = FieldsTestClass24_Enum.a; + sctS = new FieldsTestClass24_Struct(3); + clsC = new FieldsTestClass24_Sub(4); + } + + readonly int intI = 3; + readonly string strS = "FooBar"; + readonly FieldsTestClass24_Enum enuE = FieldsTestClass24_Enum.b; + readonly FieldsTestClass24_Struct sctS = new FieldsTestClass24_Struct(2); + readonly FieldsTestClass24_Sub clsC = new FieldsTestClass24_Sub(5); + + public static bool testMethod() + { + + FieldsTestClass24 MC = new FieldsTestClass24(); + + if ((MC.intI == 2) && (MC.strS.Equals("MyString")) && (MC.enuE == FieldsTestClass24_Enum.a) && (MC.sctS.Test == 3) && (MC.clsC.Test == 4)) + { + return true; + } + else + { + return false; + } + } + } + + + public class FieldsTestClass41 + { + + public static readonly FieldsTestClass41 Black = new FieldsTestClass41(0, 0, 0); + public static readonly FieldsTestClass41 White = new FieldsTestClass41(255, 255, 255); + public static readonly FieldsTestClass41 Red = new FieldsTestClass41(255, 0, 0); + public static readonly FieldsTestClass41 Green = new FieldsTestClass41(0, 255, 0); + public static readonly FieldsTestClass41 Blue = new FieldsTestClass41(0, 0, 255); + + private byte red, green, blue; + + public FieldsTestClass41(byte r, byte g, byte b) + { + red = r; + green = g; + blue = b; + } + + public void getRGB(out byte r1, out byte g1, out byte b1) + { + r1 = red; + g1 = green; + b1 = blue; + } + + public static bool testMethod() + { + FieldsTestClass41 wht = FieldsTestClass41.White; + byte r2, g2, b2; + wht.getRGB(out r2, out g2, out b2); + if ((r2 == 255) && (g2 == 255) && (b2 == 255)) + { + return true; + } + else + { + return false; + } + } + } + public class FieldsTestClass42 + { + static int x = (int)0.99939082701909573000624344004393; + int i = 100; + string s = "Hello"; + + public static bool testMethod() + { + try + { + FieldsTestClass42 t = new FieldsTestClass42(); + if ((x == (int)0.99939082701909573000624344004393) && (t.i == 100) && (t.s.Equals("Hello"))) + { + return true; + } + else + { + return false; + } + } + catch + { + return false; + } + } + } + public class FieldsTestClass43 + { + + static int intI; + static int intJ = 2; + + //intJ should be initialized before we enter the static constructor + static FieldsTestClass43() + { + intI = intJ; + } + + public static bool testMethod() + { + if (intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + public class FieldsTestClass44 + { + + static int intI = 2; + //intI is initialized before intJ + static int intJ = intI + 3; + + public static bool testMethod() + { + if (intJ == 5) + { + return true; + } + else + { + return false; + } + } + } + + + public class FieldsTestClass45 + { + + //intI is initialized after intJ + static int intJ = intI + 3; + static int intI = 2; + + public static bool testMethod() + { + if (intJ == 3) + { + return true; + } + else + { + return false; + } + } + } + + + public class FieldsTestClass46 + { + + int intI = 2; + int intJ; + int intK; + + public FieldsTestClass46() + { + //int I should already be initialized + intJ = intI; + } + + public FieldsTestClass46(int DummyInt) + { + //int I should already be initialized + intK = intI; + } + + public static bool testMethod() + { + FieldsTestClass46 test1 = new FieldsTestClass46(); + FieldsTestClass46 test2 = new FieldsTestClass46(0); + if ((test1.intJ == 2) && (test2.intK == 2)) + { + return true; + } + else + { + return false; + } + } + } + + + public class FieldsTestClass49 + { + + public static int intI = 2; + public int intK = intI; + + public static bool testMethod() + { + FieldsTestClass49 test = new FieldsTestClass49(); + if (test.intK == 2) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass51 + { + + FieldsTestClass51() + { + MyMeth1(ref intI); + MyMeth2(out intJ); + } + + public static void MyMeth1(ref int i) + { + i = 2; + } + + public static void MyMeth2(out int j) + { + j = 3; + } + + + public readonly int intI; + public readonly int intJ; + + + public static bool testMethod() + { + FieldsTestClass51 mc = new FieldsTestClass51(); + if ((mc.intI == 2) && (mc.intJ == 3)) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass52 + { + + static FieldsTestClass52() + { + MyMeth1(ref intI); + MyMeth2(out intJ); + } + + public static void MyMeth1(ref int i) + { + i = 2; + } + + public static void MyMeth2(out int j) + { + j = 3; + } + + + public static readonly int intI; + public static readonly int intJ; + + + public static bool testMethod() + { + if ((FieldsTestClass52.intI == 2) && (FieldsTestClass52.intJ == 3)) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass53 + { + + public static bool b1 = (3 == 3); + public static bool b2 = (3 == 4); + public bool b3 = (3 == 3); + public bool b4 = (3 == 4); + + public static bool testMethod() + { + + FieldsTestClass53 mc = new FieldsTestClass53(); + + if ((b1 == true) && (b2 == false) && (mc.b3 == true) && (mc.b4 == false)) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass54 + { + + public static bool b1 = RetTrue(); + public static bool b2 = RetFalse(); + public bool b3 = RetTrue(); + public bool b4 = RetFalse(); + + public static bool RetTrue() + { + return true; + } + public static bool RetFalse() + { + return false; + } + + public static bool testMethod() + { + + FieldsTestClass54 mc = new FieldsTestClass54(); + + if ((b1 == true) && (b2 == false) && (mc.b3 == true) && (mc.b4 == false)) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass55 + { + + public static int i1 = (3 & 6); + public static int i2 = (3 | 6); + public int i3 = (3 & 6); + public int i4 = (3 | 6); + + public static bool testMethod() + { + + FieldsTestClass55 mc = new FieldsTestClass55(); + + if ((i1 == 2) && (i2 == 7) && (mc.i3 == 2) && (mc.i4 == 7)) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass56 + { + + public static int i1 = Ret2(); + public static int i2 = Ret7(); + public int i3 = Ret2(); + public int i4 = Ret7(); + + public static int Ret2() + { + return 2; + } + + public static int Ret7() + { + return 7; + } + + public static bool testMethod() + { + + FieldsTestClass56 mc = new FieldsTestClass56(); + + if ((i1 == 2) && (i2 == 7) && (mc.i3 == 2) && (mc.i4 == 7)) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass57 + { + + public static string s1 = "foo" + "bar"; + public static string s2 = "bar" + "foo"; + public string s3 = "foo" + "bar"; + public string s4 = "bar" + "foo"; + + public static bool testMethod() + { + + FieldsTestClass57 mc = new FieldsTestClass57(); + + if ((s1 == "foobar") && (s2 == "barfoo") && (mc.s3 == "foobar") && (mc.s4 == "barfoo")) + { + return true; + } + else + { + return false; + } + } + } + + class FieldsTestClass58 + { + + public static string s1 = Ret1(); + public static string s2 = Ret2(); + public string s3 = Ret1(); + public string s4 = Ret2(); + + public static string Ret1() + { + return "foobar"; + } + + public static string Ret2() + { + return "barfoo"; + } + + public static bool testMethod() + { + try + { + FieldsTestClass58 mc = new FieldsTestClass58(); + + if ((s1 == "foobar") && (s2 == "barfoo") && (mc.s3 == "foobar") && (mc.s4 == "barfoo")) + { + return true; + } + else + { + return false; + } + } + catch { return false; } + } + } + + } +} + diff --git a/Tests/NFUnitTestClasses/UnitTestIndexerTests.cs b/Tests/NFUnitTestClasses/UnitTestIndexerTests.cs new file mode 100644 index 00000000..ee445acc --- /dev/null +++ b/Tests/NFUnitTestClasses/UnitTestIndexerTests.cs @@ -0,0 +1,1461 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestClasses +{ + [TestClass] + class UnitTestIndexerTests + { + [TestMethod] + public void Indexers1_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" An indexer-declaration may include set of"); + Debug.WriteLine(" attributes, a new modifier, and a valid combination"); + Debug.WriteLine(" of the four access modifiers."); + Assert.True(IndexersTestClass1.testMethod()); + } + + [TestMethod] + public void Indexers2_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" An indexer-declaration may include set of"); + Debug.WriteLine(" attributes, a new modifier, and a valid combination"); + Debug.WriteLine(" of the four access modifiers."); + Assert.True(IndexersTestClass2.testMethod()); + } + + [TestMethod] + public void Indexers3_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" An indexer-declaration may include set of"); + Debug.WriteLine(" attributes, a new modifier, and a valid combination"); + Debug.WriteLine(" of the four access modifiers."); + Assert.True(IndexersTestClass3.testMethod()); + + } + + [TestMethod] + public void Indexers4_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" An indexer-declaration may include set of"); + Debug.WriteLine(" attributes, a new modifier, and a valid combination"); + Debug.WriteLine(" of the four access modifiers."); + Assert.True(IndexersTestClass4.testMethod()); + } + + [TestMethod] + public void Indexers5_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" An indexer-declaration may include set of"); + Debug.WriteLine(" attributes, a new modifier, and a valid combination"); + Debug.WriteLine(" of the four access modifiers."); + Assert.True(IndexersTestClass5.testMethod()); + } + + [TestMethod] + public void Indexers6_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" An indexer-declaration may include set of"); + Debug.WriteLine(" attributes, a new modifier, and a valid combination"); + Debug.WriteLine(" of the four access modifiers."); + Assert.True(IndexersTestClass6.testMethod()); + } + + [TestMethod] + public void Indexers10_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" An indexer-declaration may include set of"); + Debug.WriteLine(" attributes, a new modifier, and a valid combination"); + Debug.WriteLine(" of the four access modifiers."); + Assert.True(IndexersTestClass10.testMethod()); + } + + [TestMethod] + public void Indexers11_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" An indexer-declaration may include set of"); + Debug.WriteLine(" attributes, a new modifier, and a valid combination"); + Debug.WriteLine(" of the four access modifiers."); + Assert.True(IndexersTestClass11.testMethod()); + } + + [TestMethod] + public void Indexers12_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" The type on an indexer declaration specifies"); + Debug.WriteLine(" the element type of the indexer introduced"); + Debug.WriteLine(" by the declaration"); + Assert.True(IndexersTestClass12.testMethod()); + } + + [TestMethod] + public void Indexers14_Test() + { + Debug.WriteLine(" Unless the indexer is an explicit interface"); + Debug.WriteLine(" member implementation, the type is followed"); + Debug.WriteLine(" by the keyword this. For an explicit "); + Debug.WriteLine(" interface member implementation, the type is "); + Debug.WriteLine(" followed by an interface-type, a . and the "); + Debug.WriteLine(" keyword this."); + Debug.WriteLine("This is currently an expected fail, but is resolved in 3.0 see Bug 16341 for details"); + Assert.True(IndexersTestClass14.testMethod()); + } + + [TestMethod] + public void Indexers18_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" The formal-index-parameter-list specifies"); + Debug.WriteLine(" the parameters of the indexer. The formal"); + Debug.WriteLine(" parameter list of an indexer corresponds"); + Debug.WriteLine(" to that of a method, except that at least"); + Debug.WriteLine(" one parameter must be specified, and that the"); + Debug.WriteLine(" ref and out parameter modifiers are not"); + Debug.WriteLine(" permitted."); + Assert.True(IndexersTestClass18.testMethod()); + } + + [TestMethod] + public void Indexers23_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" The type of an indexer declaration and each "); + Debug.WriteLine(" of the types referenced in the formal-index"); + Debug.WriteLine(" parameter list must be at least as accessible"); + Debug.WriteLine(" as the indexer itself."); + Assert.True(IndexersTestClass23.testMethod()); + } + + [TestMethod] + public void Indexers29_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" The formal parameter list of an indexer defines"); + Debug.WriteLine(" the signature of the indexer. Specifically, the"); + Debug.WriteLine(" signature of an indexer consists of the number and"); + Debug.WriteLine(" types of its formal parameters. The element type"); + Debug.WriteLine(" is not a part of an index signature, nor are the"); + Debug.WriteLine(" names of the formal parameters."); + Assert.True(IndexersTestClass29.testMethod()); + } + + [TestMethod] + public void Indexers32_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" The formal parameter list of an indexer defines"); + Debug.WriteLine(" the signature of the indexer. Specifically, the"); + Debug.WriteLine(" signature of an indexer consists of the number and"); + Debug.WriteLine(" types of its formal parameters. The element type"); + Debug.WriteLine(" is not a part of an index signature, nor are the"); + Debug.WriteLine(" names of the formal parameters."); + Assert.True(IndexersTestClass32.testMethod()); + } + + [TestMethod] + public void Indexers33_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" The formal parameter list of an indexer defines"); + Debug.WriteLine(" the signature of the indexer. Specifically, the"); + Debug.WriteLine(" signature of an indexer consists of the number and"); + Debug.WriteLine(" types of its formal parameters. The element type"); + Debug.WriteLine(" is not a part of an index signature, nor are the"); + Debug.WriteLine(" names of the formal parameters."); + Assert.True(IndexersTestClass33.testMethod()); + } + + [TestMethod] + public void Indexers37_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" With these differences in mind, all rules"); + Debug.WriteLine(" defined in 10.6.2 and 10.6.3 apply to indexer"); + Debug.WriteLine(" accessors as well as property accessors."); + Assert.True(IndexersTestClass37.testMethod()); + } + + [TestMethod] + public void Indexers38_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" With these differences in mind, all rules"); + Debug.WriteLine(" defined in 10.6.2 and 10.6.3 apply to indexer"); + Debug.WriteLine(" accessors as well as property accessors."); + Assert.True(IndexersTestClass38.testMethod()); + } + [TestMethod] + public void Indexers39_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" With these differences in mind, all rules"); + Debug.WriteLine(" defined in 10.6.2 and 10.6.3 apply to indexer"); + Debug.WriteLine(" accessors as well as property accessors."); + Assert.True(IndexersTestClass39.testMethod()); + } + + [TestMethod] + public void Indexers42_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" With these differences in mind, all rules"); + Debug.WriteLine(" defined in 10.6.2 and 10.6.3 apply to indexer"); + Debug.WriteLine(" accessors as well as property accessors."); + Assert.True(IndexersTestClass42.testMethod()); + } + + [TestMethod] + public void Indexers43_Test() + { + Debug.WriteLine(" Section 10.8"); + Debug.WriteLine(" With these differences in mind, all rules"); + Debug.WriteLine(" defined in 10.6.2 and 10.6.3 apply to indexer"); + Debug.WriteLine(" accessors as well as property accessors."); + Assert.True(IndexersTestClass43.testMethod()); + } + + [TestMethod] + public void Indexers46_Test() + { + Debug.WriteLine("Testing multiple comma seperated indexers"); + Assert.True(IndexersTestClass46.testMethod()); + } + + [TestMethod] + public void Indexers47_Test() + { + Debug.WriteLine("Testing multiple comma seperated indexers to a public variable"); + Assert.True(IndexersTestClass47.testMethod()); + } + + [TestMethod] + public void Indexers48_Test() + { + Debug.WriteLine("Testing multiple comma seperated indexers with a protected internal get and set"); + Assert.True(IndexersTestClass48.testMethod()); + } + + [TestMethod] + public void Indexers49_Test() + { + Debug.WriteLine("Testing multiple comma seperated indexers with an internal get and set"); + Assert.True(IndexersTestClass49.testMethod()); + } + + [TestMethod] + public void Indexers50_Test() + { + Debug.WriteLine("Testing multiple comma seperated indexers with a private get and set"); + Assert.True(IndexersTestClass50.testMethod()); + } + + [TestMethod] + public void Indexers51_Test() + { + Debug.WriteLine("Testing multiple comma seperated indexers with a public virtual get and set"); + Assert.True(IndexersTestClass51.testMethod()); + } + + [TestMethod] + public void Indexers52_Test() + { + Debug.WriteLine("Testing multiple comma seperated indexers with an overridden public virtual get and set"); + Debug.WriteLine("This test is expected to fail"); + Assert.False(IndexersTestClass52.testMethod()); + } + + [TestMethod] + public void Indexers53_Test() + { + Debug.WriteLine("Testing multiple comma seperated indexers with an overridden public abstract get and set"); + Assert.True(IndexersTestClass53.testMethod()); + } + + [TestMethod] + public void Indexers55_Test() + { + Debug.WriteLine("Testing 10 explicitly specified indexers"); + Assert.True(IndexersTestClass55.testMethod()); + } + + [TestMethod] + public void Indexers56_Test() + { + Debug.WriteLine("Testing a single indexers with an overridden public abstract get"); + Assert.True(IndexersTestClass56.testMethod()); + } + + + public class IndexersTestClass1 + { + + int intJ; + + int this[int intI] + { + get + { + return intI + intJ; + } + set + { + intJ = intI + 1; + } + } + + + public static bool testMethod() + { + try + { + IndexersTestClass1 test = new IndexersTestClass1(); + test[1] = 1; + if (test[2] == 4) + { + return true; + } + else + { + return false; + } + } + catch { return false; } + } + } + + public class IndexersTestClass2 + { + + int intJ; + + public int this[int intI] + { + get + { + return intI + intJ; + } + set + { + intJ = intI + 1; + } + } + + + public static bool testMethod() + { + IndexersTestClass2 test = new IndexersTestClass2(); + test[1] = 1; + if (test[2] == 4) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass3 + { + + int intJ; + + protected int this[int intI] + { + get + { + return intI + intJ; + } + set + { + intJ = intI + 1; + } + } + + + public static bool testMethod() + { + try + { + IndexersTestClass3 test = new IndexersTestClass3(); + test[1] = 1; + if (test[2] == 4) + { + return true; + } + else + { + return false; + } + } + catch { return false; } + } + } + + public class IndexersTestClass4 + { + + int intJ; + + internal int this[int intI] + { + get + { + return intI + intJ; + } + set + { + intJ = intI + 1; + } + } + + + public static bool testMethod() + { + IndexersTestClass4 test = new IndexersTestClass4(); + test[1] = 1; + if (test[2] == 4) + { + return true; + } + else + { + return false; + } + } + } + + + public class IndexersTestClass5 + { + + int intJ; + + private int this[int intI] + { + get + { + return intI + intJ; + } + set + { + intJ = intI + 1; + } + } + + + public static bool testMethod() + { + IndexersTestClass5 test = new IndexersTestClass5(); + test[1] = 1; + if (test[2] == 4) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass6 + { + + int intJ; + + protected internal int this[int intI] + { + get + { + return intI + intJ; + } + set + { + intJ = intI + 1; + } + } + + + public static bool testMethod() + { + IndexersTestClass6 test = new IndexersTestClass6(); + test[1] = 1; + if (test[2] == 4) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass7_Sub + { + + int intJ; + + protected int this[int intI] + { + get + { + return intI + intJ; + } + set + { + intJ = intI + 1; + } + } + } + + public class IndexersTestClass10_Base + { + + int intJ; + + protected int this[int intI] + { + get + { + return intI + intJ; + } + set + { + intJ = intI + 1; + } + } + } + + + public class IndexersTestClass10 : IndexersTestClass10_Base + { + public static bool testMethod() + { + IndexersTestClass10 test = new IndexersTestClass10(); + test[1] = 1; + if (test[1] == 3) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass11_Base + { + + protected int intJ; + + protected int this[int intI] + { + get + { + return -1; + } + set + { + intJ = -1; + } + } + } + + + public class IndexersTestClass11 : IndexersTestClass11_Base + { + + new protected int this[int intI] + { + get + { + return intI + intJ; + } + set + { + intJ = intI + 1; + } + } + + public static bool testMethod() + { + IndexersTestClass11 test = new IndexersTestClass11(); + test[1] = 1; + if (test[2] == 4) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass12_Sub + { + public int intI = 2; + } + + + public class IndexersTestClass12 + { + + IndexersTestClass12_Sub TC; + + IndexersTestClass12_Sub this[int i] + { + get + { + return TC; + } + set + { + TC = value; + TC.intI = TC.intI + i; + } + } + + public static bool testMethod() + { + IndexersTestClass12 test = new IndexersTestClass12(); + test[1] = new IndexersTestClass12_Sub(); + if (test[2].intI == 3) + { + return true; + } + else + { + return false; + } + } + } + + public interface IndexersTestClass14_Base + { + int this[int i] + { + get; + set; + } + } + + public class IndexersTestClass14 : IndexersTestClass14_Base + { + int intI; + int this[int i] + { + get + { + return intI; + } + set + { + intI = value; + } + } + + int IndexersTestClass14_Base.this[int i] + { + get + { + return intI + 1; + } + set + { + intI = value + 1; + } + } + public static bool testMethod() + { + IndexersTestClass14 test1 = new IndexersTestClass14(); + IndexersTestClass14_Base test2 = new IndexersTestClass14(); + test1[1] = 2; + test2[2] = 2; + if ((test1[1] == 2) && (test2[2] == 4)) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass18 + { + + int this[int int1, int int2, int int3, + int int4, int int5, int int6, + int int7, int int8, int int9, + int int10] + { + + get + { + return int1 + int2 + int3 + int4 + int5 + + int6 + int7 + int8 + int9 + int10; + } + } + + public static bool testMethod() + { + IndexersTestClass18 test = new IndexersTestClass18(); + if (test[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] == 55) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass23 + { + + private class TestClass + { + public int intI = 1; + } + + private TestClass this[TestClass t] + { + get + { + return t; + } + } + + public static bool testMethod() + { + IndexersTestClass23 test = new IndexersTestClass23(); + TestClass TC = new TestClass(); + if (test[TC] == TC) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass29 + { + + public int this[int intI] + { + get + { + return intI; + } + } + + public int this[long lngL] + { + get + { + return (int)lngL + 1; + } + } + + public static bool testMethod() + { + IndexersTestClass29 test = new IndexersTestClass29(); + int i = 1; + long j = 2; + + if ((test[i] == 1) && (test[j] == 3)) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass32 + { + + public int this[int intI] + { + get + { + return intI; + } + } + + public int this[int intI, int intJ] + { + get + { + return intI + intJ; + } + } + + public static bool testMethod() + { + IndexersTestClass32 test = new IndexersTestClass32(); + int i = 1; + int j = 2; + + if ((test[i] == 1) && (test[i, j] == 3)) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass33_Base + { + public int this[int intI] + { + get + { + return intI; + } + } + } + + public class IndexersTestClass33 : IndexersTestClass33_Base + { + + public int this[int intI, int intJ] + { + get + { + return intI + intJ; + } + } + + public static bool testMethod() + { + IndexersTestClass33 test = new IndexersTestClass33(); + int i = 1; + int j = 2; + + if ((test[i] == 1) && (test[i, j] == 3)) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass37 + { + + public int TestInt; + + public virtual int this[int intI] + { + set + { + TestInt = intI + value; + } + get + { + return TestInt + intI; + } + } + + public static bool testMethod() + { + IndexersTestClass37 test = new IndexersTestClass37(); + test[2] = 2; + if (test[2] == 6) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass38_Base + { + + + public int TestInt; + + public virtual int this[int intI] + { + set + { + TestInt = -1; + } + get + { + return -1; + } + } + } + + public class IndexersTestClass38 : IndexersTestClass38_Base + { + + public override int this[int intI] + { + set + { + TestInt = intI + value; + } + get + { + return TestInt + intI; + } + } + + public static bool testMethod() + { + IndexersTestClass38_Base test = new IndexersTestClass38(); + test[2] = 2; + if (test[2] == 6) + { + return true; + } + else + { + return false; + } + } + } + + public abstract class IndexersTestClass39_Base + { + + + public int TestInt; + + public abstract int this[int intI] + { + set; + get; + } + } + + public class IndexersTestClass39 : IndexersTestClass39_Base + { + + public override int this[int intI] + { + set + { + TestInt = intI + value; + } + get + { + return TestInt + intI; + } + } + + public static bool testMethod() + { + IndexersTestClass39_Base test = new IndexersTestClass39(); + test[2] = 2; + if (test[2] == 6) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass42_Base + { + + public int TestInt; + + public virtual int this[int intI] + { + set + { + TestInt = intI + value; + } + get + { + return -1; + } + } + } + public class IndexersTestClass42 : IndexersTestClass42_Base + { + + public override int this[int intI] + { + get + { + return TestInt + intI; + } + } + + public static bool testMethod() + { + IndexersTestClass42_Base test = new IndexersTestClass42(); + test[2] = 2; + if (test[2] == 6) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass43_Base + { + + public int TestInt; + + public virtual int this[int intI] + { + set + { + TestInt = -1; + } + get + { + return TestInt + intI; + } + } + } + public class IndexersTestClass43 : IndexersTestClass43_Base + { + + public override int this[int intI] + { + set + { + TestInt = intI + value; + } + } + + public static bool testMethod() + { + IndexersTestClass43_Base test = new IndexersTestClass43(); + test[2] = 2; + if (test[2] == 6) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass46 + { + + int intTest; + + public int this[params int[] values] + { + get + { + return intTest; + } + set + { + intTest = values[0] + values[1] + values[2]; + } + } + + public static bool testMethod() + { + IndexersTestClass46 mc = new IndexersTestClass46(); + mc[1, 2, 3] = 0; + if (mc[1, 2, 3] == 6) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass47_Base + { + + public int intTest; + + protected int this[params int[] values] + { + get + { + return intTest; + } + set + { + intTest = values[0] + values[1] + values[2]; + } + } + } + + public class IndexersTestClass47 : IndexersTestClass47_Base + { + + public static bool testMethod() + { + IndexersTestClass47 mc = new IndexersTestClass47(); + mc[1, 2, 3] = 0; + if (mc[1, 2, 3] == 6) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass48_Base + { + + public int intTest; + + protected internal int this[params int[] values] + { + get + { + return intTest; + } + set + { + intTest = values[0] + values[1] + values[2]; + } + } + } + + public class IndexersTestClass48 : IndexersTestClass48_Base + { + + public static bool testMethod() + { + IndexersTestClass48 mc = new IndexersTestClass48(); + mc[1, 2, 3] = 0; + if (mc[1, 2, 3] == 6) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass49_Sub + { + + public int intTest; + + internal int this[params int[] values] + { + get + { + return intTest; + } + set + { + intTest = values[0] + values[1] + values[2]; + } + } + } + + public class IndexersTestClass49 + { + + public static bool testMethod() + { + IndexersTestClass49_Sub mc = new IndexersTestClass49_Sub(); + mc[1, 2, 3] = 0; + if (mc[1, 2, 3] == 6) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass50 + { + + int intTest; + + private int this[params int[] values] + { + get + { + return intTest; + } + set + { + intTest = values[0] + values[1] + values[2]; + } + } + + public static bool testMethod() + { + IndexersTestClass50 mc = new IndexersTestClass50(); + mc[1, 2, 3] = 0; + if (mc[1, 2, 3] == 6) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass51_Base + { + + public int intTest; + + public virtual int this[params int[] values] + { + get + { + return intTest + 1; + } + set + { + intTest = 0; + } + } + } + + public class IndexersTestClass51 : IndexersTestClass51_Base + { + + public override int this[params int[] values] + { + get + { + return intTest; + } + set + { + intTest = values[0] + values[1] + values[2]; + } + } + + public static bool testMethod() + { + IndexersTestClass51_Base mc = new IndexersTestClass51(); + mc[1, 2, 3] = 0; + if (mc[1, 2, 3] == 6) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass52_Base + { + + public int intTest; + + public virtual int this[params int[] values] + { + get + { + return intTest; + } + set + { + intTest = values[0] + values[1] + values[2]; + } + } + } + + public class IndexersTestClass52 : IndexersTestClass52_Base + { + + public new int this[params int[] values] + { + get + { + return intTest + 1; + } + set + { + intTest = 0; + } + } + + public static bool testMethod() + { + IndexersTestClass52_Base mc = new IndexersTestClass52(); + mc[1, 2, 3] = 0; + if (mc[1, 2, 3] == 6) + { + return true; + } + else + { + return false; + } + } + } + + + public abstract class IndexersTestClass53_Base + { + + public int intTest; + + public abstract int this[params int[] values] + { + get; + set; + } + } + + public class IndexersTestClass53 : IndexersTestClass53_Base + { + + public override int this[params int[] values] + { + get + { + return intTest; + } + set + { + intTest = values[0] + values[1] + values[2]; + } + } + + public static bool testMethod() + { + IndexersTestClass53_Base mc = new IndexersTestClass53(); + mc[1, 2, 3] = 0; + if (mc[1, 2, 3] == 6) + { + return true; + } + else + { + return false; + } + } + } + + public class IndexersTestClass55 + { + + public int this[int i1, int i2, int i3, int i4, int i5, int i6, int i7, int i8, int i9, int i10] + { + get + { + return (i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8 + i9 + i10); + } + } + + public static bool testMethod() + { + + IndexersTestClass55 MC = new IndexersTestClass55(); + + if (MC[1, 2, 3, 4, 5, 6, 7, 8, 9, 10] == 55) + { + return true; + } + else + { + return false; + } + } + } + public abstract class IndexersTestClass56_Base + { + protected int this[int intI] + { + get + { + return (intI + 1); + } + } + } + + public class IndexersTestClass56 : IndexersTestClass56_Base + { + + public int RetInt(int j) + { + return base[j]; + } + + public static bool testMethod() + { + + IndexersTestClass56 MC = new IndexersTestClass56(); + + if (MC.RetInt(2) == 3) + { + return true; + } + else + { + return false; + } + } + } + + } +} diff --git a/Tests/NFUnitTestClasses/UnitTestMembersTests.cs b/Tests/NFUnitTestClasses/UnitTestMembersTests.cs new file mode 100644 index 00000000..2cec5b02 --- /dev/null +++ b/Tests/NFUnitTestClasses/UnitTestMembersTests.cs @@ -0,0 +1,2260 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestClasses +{ + [TestClass] + class UnitTestMembersTests + { + [TestMethod] + public void Members23_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" The inherited members of a class are specifically"); + Debug.WriteLine(" not part of the declaration space of a class. Thus, a "); + Debug.WriteLine(" derived class is allowed to declare a member with the same "); + Debug.WriteLine(" name or signature as an inherited member (which in effect"); + Debug.WriteLine(" hides the inherited member)."); + Assert.True(MembersTestClass023.testMethod()); + } + + [TestMethod] + public void Members24_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" The inherited members of a class are specifically"); + Debug.WriteLine(" not part of the declaration space of a class. Thus, a "); + Debug.WriteLine(" derived class is allowed to declare a member with the same "); + Debug.WriteLine(" name or signature as an inherited member (which in effect"); + Debug.WriteLine(" hides the inherited member)."); + Assert.True(MembersTestClass024.testMethod()); + } + + [TestMethod] + public void Members25_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" The inherited members of a class are specifically"); + Debug.WriteLine(" not part of the declaration space of a class. Thus, a "); + Debug.WriteLine(" derived class is allowed to declare a member with the same "); + Debug.WriteLine(" name or signature as an inherited member (which in effect"); + Debug.WriteLine(" hides the inherited member)."); + Assert.True(MembersTestClass025.testMethod()); + } + + [TestMethod] + public void Members26_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" The inherited members of a class are specifically"); + Debug.WriteLine(" not part of the declaration space of a class. Thus, a "); + Debug.WriteLine(" derived class is allowed to declare a member with the same "); + Debug.WriteLine(" name or signature as an inherited member (which in effect"); + Debug.WriteLine(" hides the inherited member)."); + Assert.True(MembersTestClass026.testMethod()); + } + + [TestMethod] + public void Members27_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" The inherited members of a class are specifically"); + Debug.WriteLine(" not part of the declaration space of a class. Thus, a "); + Debug.WriteLine(" derived class is allowed to declare a member with the same "); + Debug.WriteLine(" name or signature as an inherited member (which in effect"); + Debug.WriteLine(" hides the inherited member)."); + Assert.True(MembersTestClass027.testMethod()); + } + + [TestMethod] + public void Members28_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" The inherited members of a class are specifically"); + Debug.WriteLine(" not part of the declaration space of a class. Thus, a "); + Debug.WriteLine(" derived class is allowed to declare a member with the same "); + Debug.WriteLine(" name or signature as an inherited member (which in effect"); + Debug.WriteLine(" hides the inherited member)."); + Assert.True(MembersTestClass028.testMethod()); + } + + //Test Case Calls + [TestMethod] + public void MembersInheritance001_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Inheritance is transitive. If C is derived from"); + Debug.WriteLine(" B, and B is derived from A, then C inherits the"); + Debug.WriteLine(" members declared in B as well as the members"); + Assert.True(MembersInheritanceTestClass001.testMethod()); + } + [TestMethod] + public void MembersInheritance002_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Inheritance is transitive. If C is derived from"); + Debug.WriteLine(" B, and B is derived from A, then C inherits the"); + Debug.WriteLine(" members declared in B as well as the members"); + Assert.True(MembersInheritanceTestClass002.testMethod()); + } + [TestMethod] + public void MembersInheritance003_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Inheritance is transitive. If C is derived from"); + Debug.WriteLine(" B, and B is derived from A, then C inherits the"); + Debug.WriteLine(" members declared in B as well as the members"); + Assert.True(MembersInheritanceTestClass003.testMethod()); + } + [TestMethod] + public void MembersInheritance004_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Inheritance is transitive. If C is derived from"); + Debug.WriteLine(" B, and B is derived from A, then C inherits the"); + Debug.WriteLine(" members declared in B as well as the members"); + Assert.True(MembersInheritanceTestClass004.testMethod()); + } + [TestMethod] + public void MembersInheritance005_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Inheritance is transitive. If C is derived from"); + Debug.WriteLine(" B, and B is derived from A, then C inherits the"); + Debug.WriteLine(" members declared in B as well as the members"); + Assert.True(MembersInheritanceTestClass005.testMethod()); + } + [TestMethod] + public void MembersInheritance006_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Inheritance is transitive. If C is derived from"); + Debug.WriteLine(" B, and B is derived from A, then C inherits the"); + Debug.WriteLine(" members declared in B as well as the members"); + Assert.True(MembersInheritanceTestClass006.testMethod()); + } + [TestMethod] + public void MembersInheritance007_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Inheritance is transitive. If C is derived from"); + Debug.WriteLine(" B, and B is derived from A, then C inherits the"); + Debug.WriteLine(" members declared in B as well as the members"); + Assert.True(MembersInheritanceTestClass007.testMethod()); + } + [TestMethod] + public void MembersInheritance008_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Inheritance is transitive. If C is derived from"); + Debug.WriteLine(" B, and B is derived from A, then C inherits the"); + Debug.WriteLine(" members declared in B as well as the members"); + Assert.True(MembersInheritanceTestClass008.testMethod()); + } + [TestMethod] + public void MembersInheritance018_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Constructors and destructors are not inherited, but all"); + Debug.WriteLine(" other members are, regardless of their declared accessibility."); + Debug.WriteLine(" However, depending on their declared accessibility, inherited"); + Debug.WriteLine(" members may not be accessible in the derived class."); + Assert.True(MembersInheritanceTestClass018.testMethod()); + } + [TestMethod] + public void MembersInheritance019_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Constructors and destructors are not inherited, but all"); + Debug.WriteLine(" other members are, regardless of their declared accessibility."); + Debug.WriteLine(" However, depending on their declared accessibility, inherited"); + Debug.WriteLine(" members may not be accessible in the derived class."); + Assert.True(MembersInheritanceTestClass019.testMethod()); + } + [TestMethod] + public void MembersInheritance020_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Constructors and destructors are not inherited, but all"); + Debug.WriteLine(" other members are, regardless of their declared accessibility."); + Debug.WriteLine(" However, depending on their declared accessibility, inherited"); + Debug.WriteLine(" members may not be accessible in the derived class."); + Assert.True(MembersInheritanceTestClass020.testMethod()); + } + [TestMethod] + public void MembersInheritance021_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Constructors and destructors are not inherited, but all"); + Debug.WriteLine(" other members are, regardless of their declared accessibility."); + Debug.WriteLine(" However, depending on their declared accessibility, inherited"); + Debug.WriteLine(" members may not be accessible in the derived class."); + Assert.True(MembersInheritanceTestClass021.testMethod()); + } + [TestMethod] + public void MembersInheritance022_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Constructors and destructors are not inherited, but all"); + Debug.WriteLine(" other members are, regardless of their declared accessibility."); + Debug.WriteLine(" However, depending on their declared accessibility, inherited"); + Debug.WriteLine(" members may not be accessible in the derived class."); + Assert.True(MembersInheritanceTestClass022.testMethod()); + } + [TestMethod] + public void MembersInheritance023_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Constructors and destructors are not inherited, but all"); + Debug.WriteLine(" other members are, regardless of their declared accessibility."); + Debug.WriteLine(" However, depending on their declared accessibility, inherited"); + Debug.WriteLine(" members may not be accessible in the derived class."); + Assert.True(MembersInheritanceTestClass023.testMethod()); + } + [TestMethod] + public void MembersInheritance024_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Constructors and destructors are not inherited, but all"); + Debug.WriteLine(" other members are, regardless of their declared accessibility."); + Debug.WriteLine(" However, depending on their declared accessibility, inherited"); + Debug.WriteLine(" members may not be accessible in the derived class."); + Assert.True(MembersInheritanceTestClass024.testMethod()); + } + [TestMethod] + public void MembersInheritance025_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" Constructors and destructors are not inherited, but all"); + Debug.WriteLine(" other members are, regardless of their declared accessibility."); + Debug.WriteLine(" However, depending on their declared accessibility, inherited"); + Debug.WriteLine(" members may not be accessible in the derived class."); + Assert.True(MembersInheritanceTestClass025.testMethod()); + } + [TestMethod] + public void MembersInheritance026_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" An instance of a class contains a copy of all instance fields"); + Debug.WriteLine(" declared in the class and its base classes, and an implicit"); + Debug.WriteLine(" conversion exists from a derived class type to any of its base "); + Debug.WriteLine(" class types. Thus, a reference to a derived class instance"); + Debug.WriteLine(" can be treated as a reference to a base class instance."); + Assert.True(MembersInheritanceTestClass026.testMethod()); + } + [TestMethod] + public void MembersInheritance027_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" An instance of a class contains a copy of all instance fields"); + Debug.WriteLine(" declared in the class and its base classes, and an implicit"); + Debug.WriteLine(" conversion exists from a derived class type to any of its base "); + Debug.WriteLine(" class types. Thus, a reference to a derived class instance"); + Debug.WriteLine(" can be treated as a reference to a base class instance."); + Assert.True(MembersInheritanceTestClass027.testMethod()); + } + [TestMethod] + public void MembersInheritance028_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class can declare virtual methods, properties,"); + Debug.WriteLine(" and indexers, and derived classes can override the "); + Debug.WriteLine(" implementation of these function members. This enables"); + Debug.WriteLine(" classes to exhibit polymorphic behavior wherein the "); + Debug.WriteLine(" actions performed by a function member invocation"); + Debug.WriteLine(" varies depending on the run-time type of the instance"); + Debug.WriteLine(" through which the member is invoked."); + Assert.True(MembersInheritanceTestClass028.testMethod()); + } + [TestMethod] + public void MembersInheritance029_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class can declare virtual methods, properties,"); + Debug.WriteLine(" and indexers, and derived classes can override the "); + Debug.WriteLine(" implementation of these function members. This enables"); + Debug.WriteLine(" classes to exhibit polymorphic behavior wherein the "); + Debug.WriteLine(" actions performed by a function member invocation"); + Debug.WriteLine(" varies depending on the run-time type of the instance"); + Debug.WriteLine(" through which the member is invoked."); + Assert.True(MembersInheritanceTestClass029.testMethod()); + } + [TestMethod] + public void MembersInheritance030_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class can declare virtual methods, properties,"); + Debug.WriteLine(" and indexers, and derived classes can override the "); + Debug.WriteLine(" implementation of these function members. This enables"); + Debug.WriteLine(" classes to exhibit polymorphic behavior wherein the "); + Debug.WriteLine(" actions performed by a function member invocation"); + Debug.WriteLine(" varies depending on the run-time type of the instance"); + Debug.WriteLine(" through which the member is invoked."); + Assert.True(MembersInheritanceTestClass030.testMethod()); + } + [TestMethod] + public void MembersInheritance031_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class can declare virtual methods, properties,"); + Debug.WriteLine(" and indexers, and derived classes can override the "); + Debug.WriteLine(" implementation of these function members. This enables"); + Debug.WriteLine(" classes to exhibit polymorphic behavior wherein the "); + Debug.WriteLine(" actions performed by a function member invocation"); + Debug.WriteLine(" varies depending on the run-time type of the instance"); + Debug.WriteLine(" through which the member is invoked."); + Assert.True(MembersInheritanceTestClass031.testMethod()); + } + [TestMethod] + public void MembersInheritance032_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class can declare virtual methods, properties,"); + Debug.WriteLine(" and indexers, and derived classes can override the "); + Debug.WriteLine(" implementation of these function members. This enables"); + Debug.WriteLine(" classes to exhibit polymorphic behavior wherein the "); + Debug.WriteLine(" actions performed by a function member invocation"); + Debug.WriteLine(" varies depending on the run-time type of the instance"); + Debug.WriteLine(" through which the member is invoked."); + Assert.False(MembersInheritanceTestClass032.testMethod()); + Debug.WriteLine("This failure indicates a test is now passing that previously failed by design."); + Debug.WriteLine("It previously marked as known failure because of bug # 21562"); + Debug.WriteLine("The Test owner needs to verify that the change was intentional and remove the known failure."); + + } + [TestMethod] + public void MembersInheritance033_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class can declare virtual methods, properties,"); + Debug.WriteLine(" and indexers, and derived classes can override the "); + Debug.WriteLine(" implementation of these function members. This enables"); + Debug.WriteLine(" classes to exhibit polymorphic behavior wherein the "); + Debug.WriteLine(" actions performed by a function member invocation"); + Debug.WriteLine(" varies depending on the run-time type of the instance"); + Debug.WriteLine(" through which the member is invoked."); + Assert.True(MembersInheritanceTestClass033.testMethod()); + } + [TestMethod] + public void MembersInheritance034_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class can declare virtual methods, properties,"); + Debug.WriteLine(" and indexers, and derived classes can override the "); + Debug.WriteLine(" implementation of these function members. This enables"); + Debug.WriteLine(" classes to exhibit polymorphic behavior wherein the "); + Debug.WriteLine(" actions performed by a function member invocation"); + Debug.WriteLine(" varies depending on the run-time type of the instance"); + Debug.WriteLine(" through which the member is invoked."); + Assert.True(MembersInheritanceTestClass034.testMethod()); + } + [TestMethod] + public void MembersInheritance035_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class can declare virtual methods, properties,"); + Debug.WriteLine(" and indexers, and derived classes can override the "); + Debug.WriteLine(" implementation of these function members. This enables"); + Debug.WriteLine(" classes to exhibit polymorphic behavior wherein the "); + Debug.WriteLine(" actions performed by a function member invocation"); + Debug.WriteLine(" varies depending on the run-time type of the instance"); + Debug.WriteLine(" through which the member is invoked."); + Assert.True(MembersInheritanceTestClass035.testMethod()); + } + [TestMethod] + public void MembersInheritance036_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class can declare virtual methods, properties,"); + Debug.WriteLine(" and indexers, and derived classes can override the "); + Debug.WriteLine(" implementation of these function members. This enables"); + Debug.WriteLine(" classes to exhibit polymorphic behavior wherein the "); + Debug.WriteLine(" actions performed by a function member invocation"); + Debug.WriteLine(" varies depending on the run-time type of the instance"); + Debug.WriteLine(" through which the member is invoked."); + Assert.False(MembersInheritanceTestClass036.testMethod()); + Debug.WriteLine("This failure indicates a test is now passing that previously failed by design."); + Debug.WriteLine("It previously marked as known failure because of bug # 21562"); + Debug.WriteLine("The Test owner needs to verify that the change was intentional and remove the known failure."); + } + [TestMethod] + public void MembersInheritance037_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class-member-declaration is permitted to declare"); + Debug.WriteLine(" a member with the same name or signature as an "); + Debug.WriteLine(" inherited member. When this occurs, the derived"); + Debug.WriteLine(" class member is said to hide the base class member."); + Assert.True(MembersInheritanceTestClass037.testMethod()); + } + [TestMethod] + public void MembersInheritance038_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class-member-declaration is permitted to declare"); + Debug.WriteLine(" a member with the same name or signature as an "); + Debug.WriteLine(" inherited member. When this occurs, the derived"); + Debug.WriteLine(" class member is said to hide the base class member."); + Assert.True(MembersInheritanceTestClass038.testMethod()); + } + [TestMethod] + public void MembersInheritance039_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class-member-declaration is permitted to declare"); + Debug.WriteLine(" a member with the same name or signature as an "); + Debug.WriteLine(" inherited member. When this occurs, the derived"); + Debug.WriteLine(" class member is said to hide the base class member."); + Assert.True(MembersInheritanceTestClass039.testMethod()); + } + [TestMethod] + public void MembersInheritance040_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class-member-declaration is permitted to declare"); + Debug.WriteLine(" a member with the same name or signature as an "); + Debug.WriteLine(" inherited member. When this occurs, the derived"); + Debug.WriteLine(" class member is said to hide the base class member."); + Assert.True(MembersInheritanceTestClass040.testMethod()); + } + [TestMethod] + public void MembersInheritance041_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" If a new modifier is included in a declaration"); + Debug.WriteLine(" that doesn't hide an inherited member, a warning "); + Debug.WriteLine(" is issued to that effect."); + Assert.True(MembersInheritanceTestClass041.testMethod()); + } + [TestMethod] + public void MembersInheritance042_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" If a new modifier is included in a declaration"); + Debug.WriteLine(" that doesn't hide an inherited member, a warning "); + Debug.WriteLine(" is issued to that effect."); + Assert.True(MembersInheritanceTestClass042.testMethod()); + } + [TestMethod] + public void MembersInheritance043_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" If a new modifier is included in a declaration"); + Debug.WriteLine(" that doesn't hide an inherited member, a warning "); + Debug.WriteLine(" is issued to that effect."); + Assert.True(MembersInheritanceTestClass043.testMethod()); + } + [TestMethod] + public void MembersInheritance044_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" If a new modifier is included in a declaration"); + Debug.WriteLine(" that doesn't hide an inherited member, a warning "); + Debug.WriteLine(" is issued to that effect."); + Assert.True(MembersInheritanceTestClass044.testMethod()); + } + [TestMethod] + public void MembersInheritance045_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" If a new modifier is included in a declaration"); + Debug.WriteLine(" that doesn't hide an inherited member, a warning "); + Debug.WriteLine(" is issued to that effect."); + Assert.True(MembersInheritanceTestClass045.testMethod()); + } + [TestMethod] + public void MembersInheritance046_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" If a new modifier is included in a declaration"); + Debug.WriteLine(" that doesn't hide an inherited member, a warning "); + Debug.WriteLine(" is issued to that effect."); + Assert.True(MembersInheritanceTestClass046.testMethod()); + } + [TestMethod] + public void MembersInheritance047_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" If a new modifier is included in a declaration"); + Debug.WriteLine(" that doesn't hide an inherited member, a warning "); + Debug.WriteLine(" is issued to that effect."); + Assert.True(MembersInheritanceTestClass047.testMethod()); + } + [TestMethod] + public void MembersInheritance053_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" If a new modifier is included in a declaration"); + Debug.WriteLine(" that doesn't hide an inherited member, a warning "); + Debug.WriteLine(" is issued to that effect."); + Assert.True(MembersInheritanceTestClass053.testMethod()); + } + [TestMethod] + public void MembersInheritance054_Test() + { + Debug.WriteLine("Testing that protected members can be passed to a grandchild class"); + Assert.True(MembersInheritanceTestClass054.testMethod()); + } + [TestMethod] + public void MembersInheritance057_Test() + { + Debug.WriteLine("Testing that you can inherit from a member class"); + + Assert.True(MembersInheritanceTestClass057.testMethod()); + } + [TestMethod] + public void MembersInheritance058_Test() + { + Debug.WriteLine("Testing that you can inherit from a class declared later in the file"); + Assert.True(MembersInheritanceTestClass058.testMethod()); + } + [TestMethod] + public void MembersInheritance059_Test() + { + Debug.WriteLine("Testing that an inner class inherit from another class"); + Assert.True(MembersInheritanceTestClass059.testMethod()); + } + + //Test Case Calls + [TestMethod] + public void MembersModifiers01_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class-member-declaration may include one of the "); + Debug.WriteLine(" four access modifiers: public, protected, internal,"); + Debug.WriteLine(" or private. It is an error to specify more than one"); + Debug.WriteLine(" access modifier. When a class-member-declaration "); + Debug.WriteLine(" does not include an access modifier, the declaration"); + Debug.WriteLine(" defaults to private."); + Assert.True(MembersModifiersTestClass01.testMethod()); + } + [TestMethod] + public void MembersModifiers02_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class-member-declaration may include one of the "); + Debug.WriteLine(" four access modifiers: public, protected, internal,"); + Debug.WriteLine(" or private. It is an error to specify more than one"); + Debug.WriteLine(" access modifier. When a class-member-declaration "); + Debug.WriteLine(" does not include an access modifier, the declaration"); + Debug.WriteLine(" defaults to private."); + Assert.True(MembersModifiersTestClass02.testMethod()); + } + [TestMethod] + public void MembersModifiers03_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class-member-declaration may include one of the "); + Debug.WriteLine(" four access modifiers: public, protected, internal,"); + Debug.WriteLine(" or private. It is an error to specify more than one"); + Debug.WriteLine(" access modifier. When a class-member-declaration "); + Debug.WriteLine(" does not include an access modifier, the declaration"); + Debug.WriteLine(" defaults to private."); + Assert.True(MembersModifiersTestClass03.testMethod()); + } + [TestMethod] + public void MembersModifiers04_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class-member-declaration may include one of the "); + Debug.WriteLine(" four access modifiers: public, protected, internal,"); + Debug.WriteLine(" or private. It is an error to specify more than one"); + Debug.WriteLine(" access modifier. When a class-member-declaration "); + Debug.WriteLine(" does not include an access modifier, the declaration"); + Debug.WriteLine(" defaults to private."); + Assert.True(MembersModifiersTestClass04.testMethod()); + } + [TestMethod] + public void MembersModifiers05_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class-member-declaration may include one of the "); + Debug.WriteLine(" four access modifiers: public, protected, internal,"); + Debug.WriteLine(" or private. It is an error to specify more than one"); + Debug.WriteLine(" access modifier. When a class-member-declaration "); + Debug.WriteLine(" does not include an access modifier, the declaration"); + Debug.WriteLine(" defaults to private."); + Assert.True(MembersModifiersTestClass05.testMethod()); + } + [TestMethod] + public void MembersModifiers06_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class-member-declaration may include one of the "); + Debug.WriteLine(" four access modifiers: public, protected, internal,"); + Debug.WriteLine(" or private. It is an error to specify more than one"); + Debug.WriteLine(" access modifier. When a class-member-declaration "); + Debug.WriteLine(" does not include an access modifier, the declaration"); + Debug.WriteLine(" defaults to private."); + Assert.True(MembersModifiersTestClass06.testMethod()); + } + [TestMethod] + public void MembersModifiers07_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class-member-declaration may include one of the "); + Debug.WriteLine(" four access modifiers: public, protected, internal,"); + Debug.WriteLine(" or private. It is an error to specify more than one"); + Debug.WriteLine(" access modifier. When a class-member-declaration "); + Debug.WriteLine(" does not include an access modifier, the declaration"); + Debug.WriteLine(" defaults to private."); + Assert.True(MembersModifiersTestClass07.testMethod()); + } + [TestMethod] + public void MembersModifiers08_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class-member-declaration may include one of the "); + Debug.WriteLine(" four access modifiers: public, protected, internal,"); + Debug.WriteLine(" or private. It is an error to specify more than one"); + Debug.WriteLine(" access modifier. When a class-member-declaration "); + Debug.WriteLine(" does not include an access modifier, the declaration"); + Debug.WriteLine(" defaults to private."); + Assert.True(MembersModifiersTestClass08.testMethod()); + } + [TestMethod] + public void MembersModifiers12_Test() + { + Debug.WriteLine(" Section 10.2"); + Debug.WriteLine(" A class-member-declaration may include one of the "); + Debug.WriteLine(" four access modifiers: public, protected, internal,"); + Debug.WriteLine(" or private. It is an error to specify more than one"); + Debug.WriteLine(" access modifier. When a class-member-declaration "); + Debug.WriteLine(" does not include an access modifier, the declaration"); + Debug.WriteLine(" defaults to private."); + Assert.True(MembersModifiersTestClass12.testMethod()); + } + [TestMethod] + public void MembersModifiers23_Test() + { + Assert.True(MembersModifiersTestClass23.testMethod()); + } + [TestMethod] + public void MembersModifiers24_Test() + { + Assert.True(MembersModifiersTestClass24.testMethod()); + } + [TestMethod] + public void MembersModifiers25_Test() + { + Assert.True(MembersModifiersTestClass25.testMethod()); + } + [TestMethod] + public void MembersModifiers26_Test() + { + Assert.True(MembersModifiersTestClass26.testMethod()); + } + [TestMethod] + public void MembersModifiers27_Test() + { + Assert.True(MembersModifiersTestClass27.testMethod()); + } + + //Compiled Test Cases + class MembersTestClass_Base023 + { + public const int intI = 1; + } + class MembersTestClass023 : MembersTestClass_Base023 + { + public const int intI = 2; + public static bool testMethod() + { + if (intI == 2) + { + return true; + } + else + { + return false; + } + } + } + class MembersTestClass_Base024 + { + public int intI = 1; + } + class MembersTestClass024 : MembersTestClass_Base024 + { + public int intI = 2; + public static bool testMethod() + { + MembersTestClass024 test = new MembersTestClass024(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + class MembersTestClass_Base025 + { + public int intI + { + get + { + return 1; + } + } + } + class MembersTestClass025 : MembersTestClass_Base025 + { + public int intI + { + get + { + return 2; + } + } + public static bool testMethod() + { + MembersTestClass025 test = new MembersTestClass025(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + class MembersTestClass_Base026 + { + public class MyInner + { + public static int intI = 1; + } + } + class MembersTestClass026 : MembersTestClass_Base026 + { + public class MyInner + { + public static int intI = 2; + } + public static bool testMethod() + { + if (MyInner.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + class MembersTestClass_Base027 + { + public int intI() + { + return 1; + } + } + class MembersTestClass027 : MembersTestClass_Base027 + { + public int intI() + { + return 2; + } + public static bool testMethod() + { + MembersTestClass027 test = new MembersTestClass027(); + if (test.intI() == 2) + { + return true; + } + else + { + return false; + } + } + } + class MembersTestClass_Base028 + { + public int this[int I] + { + get + { + return 1; + } + } + } + class MembersTestClass028 : MembersTestClass_Base028 + { + public int this[int I] + { + get + { + return 2; + } + } + public static bool testMethod() + { + MembersTestClass028 test = new MembersTestClass028(); + if (test[9] == 2) + { + return true; + } + else + { + return false; + } + } + } + + + //Compiled Test Cases + + class MembersInheritanceTestClass001_SubA + { + } + class MembersInheritanceTestClass001_SubB : MembersInheritanceTestClass001_SubA + { + public int intI = 1; + protected String strS = "Class B"; + protected int intJ() { return 2; } + public static int intK = 3; + } + class MembersInheritanceTestClass001 : MembersInheritanceTestClass001_SubB + { + public static bool testMethod() + { + MembersInheritanceTestClass001 test = new MembersInheritanceTestClass001(); + if ((test.intI == 1) && (test.intJ() == 2) && (intK == 3) && (test.strS.Equals("Class B"))) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass002_SubA + { + public int intI = 1; + protected int intJ() { return 2; } + public static int intK = 3; + protected String strS = "Class A"; + } + class MembersInheritanceTestClass002_SubB : MembersInheritanceTestClass002_SubA + { + } + class MembersInheritanceTestClass002 : MembersInheritanceTestClass002_SubB + { + public static bool testMethod() + { + MembersInheritanceTestClass002 test = new MembersInheritanceTestClass002(); + if ((test.intI == 1) && (test.intJ() == 2) && (intK == 3) && (test.strS.Equals("Class A"))) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass003_SubA + { + } + class MembersInheritanceTestClass003_SubB : MembersInheritanceTestClass003_SubA + { + protected struct MyStruct + { + public int intI; + public MyStruct(int intJ) + { + intI = intJ; + } + } + } + class MembersInheritanceTestClass003 : MembersInheritanceTestClass003_SubB + { + public static bool testMethod() + { + MyStruct test = new MyStruct(3); + if (test.intI == 3) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass004_SubA + { + protected struct MyStruct + { + public int intI; + public MyStruct(int intJ) + { + intI = intJ; + } + } + } + class MembersInheritanceTestClass004_SubB : MembersInheritanceTestClass004_SubA + { + } + class MembersInheritanceTestClass004 : MembersInheritanceTestClass004_SubB + { + public static bool testMethod() + { + MyStruct test = new MyStruct(3); + if (test.intI == 3) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass005_SubA + { + } + class MembersInheritanceTestClass005_SubB : MembersInheritanceTestClass005_SubA + { + protected enum AA { zero, one } + } + class MembersInheritanceTestClass005 : MembersInheritanceTestClass005_SubB + { + public static bool testMethod() + { + AA MyEnum = AA.one; + if ((int)MyEnum == 1) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass006_SubA + { + protected enum AA { zero, one } + } + class MembersInheritanceTestClass006_SubB : MembersInheritanceTestClass006_SubA + { + } + class MembersInheritanceTestClass006 : MembersInheritanceTestClass006_SubB + { + public static bool testMethod() + { + AA MyEnum = AA.one; + if ((int)MyEnum == 1) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass007_SubA + { + } + class MembersInheritanceTestClass007_SubB : MembersInheritanceTestClass007_SubA + { + protected class MembersInheritanceTestClass007 + { + public int intI; + public MembersInheritanceTestClass007(int intJ) + { + intI = intJ; + } + } + } + class MembersInheritanceTestClass007 : MembersInheritanceTestClass007_SubB + { + public static bool testMethod() + { + MembersInheritanceTestClass007 test = new MembersInheritanceTestClass007(3); + if (test.intI == 3) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass008_SubA + { + protected class MembersInheritanceTestClass008 + { + public int intI; + public MembersInheritanceTestClass008(int intJ) + { + intI = intJ; + } + } + } + class MembersInheritanceTestClass008_SubB : MembersInheritanceTestClass008_SubA + { + } + class MembersInheritanceTestClass008 : MembersInheritanceTestClass008_SubB + { + public static bool testMethod() + { + MembersInheritanceTestClass008 test = new MembersInheritanceTestClass008(3); + if (test.intI == 3) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass018_Base + { + public int intI = 1; + protected String strS = "MembersInheritanceTestClass018_Base"; + protected int intJ() { return 2; } + public static int intK = 3; + } + class MembersInheritanceTestClass018 : MembersInheritanceTestClass018_Base + { + public static bool testMethod() + { + MembersInheritanceTestClass018 test = new MembersInheritanceTestClass018(); + if ((test.intI == 1) && (test.intJ() == 2) && (intK == 3) && (test.strS.Equals("MembersInheritanceTestClass018_Base"))) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass019_Base + { + public int intI = 1; + } + class MembersInheritanceTestClass019 : MembersInheritanceTestClass019_Base + { + new public int intI = 2; + public static bool testMethod() + { + MembersInheritanceTestClass019 test = new MembersInheritanceTestClass019(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass020_Base + { + protected int intI() { return 2; } + } + class MembersInheritanceTestClass020 : MembersInheritanceTestClass020_Base + { + new protected int intI() { return 3; } + public static bool testMethod() + { + MembersInheritanceTestClass020 test = new MembersInheritanceTestClass020(); + if (test.intI() == 3) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass021_Base + { + public static int intI = 1; + } + class MembersInheritanceTestClass021 : MembersInheritanceTestClass021_Base + { + new public static int intI = 2; + public static bool testMethod() + { + MembersInheritanceTestClass021 test = new MembersInheritanceTestClass021(); + if (intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass022_Base + { + public String strS = "MembersInheritanceTestClass022_Base"; + } + class MembersInheritanceTestClass022 : MembersInheritanceTestClass022_Base + { + new public static String strS = "MembersInheritanceTestClass022"; + public static bool testMethod() + { + MembersInheritanceTestClass022 test = new MembersInheritanceTestClass022(); + if (strS.Equals("MembersInheritanceTestClass022")) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass023_Base + { + public struct MyStruct + { + public static int intI = 1; + } + } + class MembersInheritanceTestClass023 : MembersInheritanceTestClass023_Base + { + new struct MyStruct + { + public static int intI = 2; + } + public static bool testMethod() + { + if (MyStruct.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass024_Base + { + public enum AA { one, two } + } + class MembersInheritanceTestClass024 : MembersInheritanceTestClass024_Base + { + new public enum AA { zero, one } + public static bool testMethod() + { + + AA MyEnum = AA.one; + if ((int)MyEnum == 1) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass025_Base + { + public class MyInner + { + public static int intI = 1; + } + } + class MembersInheritanceTestClass025 : MembersInheritanceTestClass025_Base + { + new class MyInner + { + public static int intI = 2; + } + public static bool testMethod() + { + if (MyInner.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass026_Base + { + public int intI = 1; + } + class MembersInheritanceTestClass026 : MembersInheritanceTestClass026_Base + { + public static bool testMethod() + { + MembersInheritanceTestClass026_Base test = new MembersInheritanceTestClass026(); + if (test.intI == 1) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass027_Base1 + { + public int intI = 1; + } + class MembersInheritanceTestClass027_Base2 : MembersInheritanceTestClass027_Base1 + { + } + class MembersInheritanceTestClass027 : MembersInheritanceTestClass027_Base2 + { + public static bool testMethod() + { + MembersInheritanceTestClass027_Base1 test = new MembersInheritanceTestClass027(); + if (test.intI == 1) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass028_Base + { + public virtual int retInt() + { + return 1; + } + } + class MembersInheritanceTestClass028 : MembersInheritanceTestClass028_Base + { + public override int retInt() + { + return 2; + } + public static bool testMethod() + { + MembersInheritanceTestClass028_Base test = new MembersInheritanceTestClass028(); + if (test.retInt() == 2) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass029_Base + { + public int intI = 0; + public virtual int retInt + { + get + { + return -2; + } + set + { + intI = -1; + } + } + } + class MembersInheritanceTestClass029 : MembersInheritanceTestClass029_Base + { + public override int retInt + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static bool testMethod() + { + MembersInheritanceTestClass029_Base test = new MembersInheritanceTestClass029(); + test.retInt = 2; + if (test.retInt == 2) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass030_Base + { + public int intI = 0; + public virtual int retInt + { + get + { + return -2; + } + set + { + intI = -1; + } + } + } + class MembersInheritanceTestClass030 : MembersInheritanceTestClass030_Base + { + public override int retInt + { + set + { + intI = value; + } + } + public static bool testMethod() + { + MembersInheritanceTestClass030_Base test = new MembersInheritanceTestClass030(); + test.retInt = 2; + if ((test.intI == 2) && (test.retInt == -2)) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass031_Base + { + public int intI = 0; + public virtual int retInt + { + get + { + return -2; + } + set + { + intI = -1; + } + } + } + class MembersInheritanceTestClass031 : MembersInheritanceTestClass031_Base + { + public override int retInt + { + get + { + return intI; + } + } + public static bool testMethod() + { + MembersInheritanceTestClass031_Base test = new MembersInheritanceTestClass031(); + test.retInt = 2; + if ((test.intI == -1) && (test.retInt == -1)) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass032_Base + { + public int intI = 0; + public virtual int retInt + { + get + { + return -2; + } + set + { + intI = -1; + } + } + } + class MembersInheritanceTestClass032 : MembersInheritanceTestClass032_Base + { + public new int retInt + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static bool testMethod() + { + MembersInheritanceTestClass032_Base test = new MembersInheritanceTestClass032(); + test.retInt = 2; + if ((test.intI == -1) && (test.retInt == -2)) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass033_Base + { + public int intI = 0; + public virtual int this[int i] + { + get + { + return -2; + } + set + { + intI = -1; + } + } + } + class MembersInheritanceTestClass033 : MembersInheritanceTestClass033_Base + { + public override int this[int i] + { + get + { + return intI; + } + set + { + intI = i + value; + } + } + public static bool testMethod() + { + MembersInheritanceTestClass033_Base test = new MembersInheritanceTestClass033(); + test[2] = 2; + + if (test[2] == 4) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass034_Base + { + public int intI = 0; + public virtual int this[int i] + { + get + { + return -2; + } + set + { + intI = -1; + } + } + } + class MembersInheritanceTestClass034 : MembersInheritanceTestClass034_Base + { + public override int this[int i] + { + set + { + intI = i + value; + } + } + public static bool testMethod() + { + MembersInheritanceTestClass034_Base test = new MembersInheritanceTestClass034(); + test[2] = 2; + + if ((test[2] == -2) && (test.intI == 4)) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass035_Base + { + public int intI = 0; + public virtual int this[int i] + { + get + { + return -2; + } + set + { + intI = -1; + } + } + } + class MembersInheritanceTestClass035 : MembersInheritanceTestClass035_Base + { + public override int this[int i] + { + get + { + return intI; + } + } + public static bool testMethod() + { + MembersInheritanceTestClass035_Base test = new MembersInheritanceTestClass035(); + test[2] = 2; + + if ((test[2] == -1) && (test.intI == -1)) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass036_Base + { + public int intI = 0; + public virtual int this[int i] + { + get + { + return -2; + } + set + { + intI = -1; + } + } + } + class MembersInheritanceTestClass036 : MembersInheritanceTestClass036_Base + { + public new int this[int i] + { + get + { + return intI; + } + set + { + intI = i + value; + } + } + public static bool testMethod() + { + MembersInheritanceTestClass036_Base test = new MembersInheritanceTestClass036(); + test[2] = 2; + + if ((test[2] == -2) && (test.intI == -1)) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass037_Base + { + public int intI = 1; + public String strS = "MembersInheritanceTestClass037_Base"; + public int intJ() { return 2; } + public static int intK = 3; + } + class MembersInheritanceTestClass037 : MembersInheritanceTestClass037_Base + { + new public int intI = 4; + new public String strS = "MembersInheritanceTestClass037"; + new public int intJ() { return 5; } + new public static int intK = 6; + public static bool testMethod() + { + MembersInheritanceTestClass037 testc = new MembersInheritanceTestClass037(); + MembersInheritanceTestClass037_Base testb = (MembersInheritanceTestClass037_Base)testc; + + if (testb.intI != 1) return false; + if (testb.strS.Equals("MembersInheritanceTestClass037_Base") != true) return false; + if (testb.intJ() != 2) return false; + if (MembersInheritanceTestClass037_Base.intK != 3) return false; + if (testc.intI != 4) return false; + if (testc.strS.Equals("MembersInheritanceTestClass037") != true) return false; + if (testc.intJ() != 5) return false; + if (MembersInheritanceTestClass037.intK != 6) return false; + + return true; + } + } + + class MembersInheritanceTestClass038_Base + { + public struct MyStruct + { + public int retInt() + { + return 1; + } + } + } + class MembersInheritanceTestClass038 : MembersInheritanceTestClass038_Base + { + new public struct MyStruct + { + public int retInt() + { + return 2; + } + } + public static bool testMethod() + { + MyStruct test = new MyStruct(); + if (test.retInt() == 2) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass039_Base + { + public enum MyEnum { zero, one } + } + class MembersInheritanceTestClass039 : MembersInheritanceTestClass039_Base + { + new public enum MyEnum { one, two } + public static bool testMethod() + { + MyEnum test = MyEnum.one; + if ((int)test == 0) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass040_Base + { + public class MyInner + { + public int retInt() + { + return 1; + } + } + } + class MembersInheritanceTestClass040 : MembersInheritanceTestClass040_Base + { + new public class MyInner + { + public int retInt() + { + return 2; + } + } + public static bool testMethod() + { + MyInner test = new MyInner(); + if (test.retInt() == 2) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass041_Base { } + class MembersInheritanceTestClass041 : MembersInheritanceTestClass041_Base + { + + new public int intI = 1; + public static bool testMethod() + { + MembersInheritanceTestClass041 test = new MembersInheritanceTestClass041(); + if (test.intI == 1) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass042_Base { } + class MembersInheritanceTestClass042 : MembersInheritanceTestClass042_Base + { + + new public String strS = "MembersInheritanceTestClass042"; + public static bool testMethod() + { + MembersInheritanceTestClass042 test = new MembersInheritanceTestClass042(); + if (test.strS.Equals("MembersInheritanceTestClass042")) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass043_Base { } + class MembersInheritanceTestClass043 : MembersInheritanceTestClass043_Base + { + + new public int intJ() { return 2; } + public static bool testMethod() + { + MembersInheritanceTestClass043 test = new MembersInheritanceTestClass043(); + if (test.intJ() == 2) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass044_Base { } + class MembersInheritanceTestClass044 : MembersInheritanceTestClass044_Base + { + + new public static int intK = 3; + public static bool testMethod() + { + if (MembersInheritanceTestClass044.intK == 3) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass045_Base { } + class MembersInheritanceTestClass045 : MembersInheritanceTestClass045_Base + { + + new public struct MyStruct + { + public int intRet() { return 1; } + } + public static bool testMethod() + { + MyStruct test = new MyStruct(); + if (test.intRet() == 1) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass046_Base { } + class MembersInheritanceTestClass046 : MembersInheritanceTestClass046_Base + { + + new enum MyEnum { one, two } + public static bool testMethod() + { + MyEnum test = MyEnum.one; + if ((int)test == 0) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass047_Base { } + class MembersInheritanceTestClass047 : MembersInheritanceTestClass047_Base + { + + new public class MyInner + { + public int intRet() { return 1; } + } + public static bool testMethod() + { + MyInner test = new MyInner(); + if (test.intRet() == 1) + { + return true; + } + else + { + return false; + } + } + } + + public class MembersInheritanceTestClass053_Base + { + protected int intI = 2; + protected int MyMeth() + { + return 4; + } + int intJ; + + protected int PropInt + { + get + { + return intJ; + } + set + { + intJ = value; + } + } + } + public class MembersInheritanceTestClass053_Derived : MembersInheritanceTestClass053_Base + { + } + class MembersInheritanceTestClass053 : MembersInheritanceTestClass053_Derived + { + public int Test() + { + PropInt = 3; + if ((intI == 2) && (PropInt == 3) && (MyMeth() == 4)) + { + return 0; + } + else + { + return 1; + } + } + + public static bool testMethod() + { + MembersInheritanceTestClass053 mc = new MembersInheritanceTestClass053(); + + return (mc.Test() == 0); + } + } + + public class MembersInheritanceTestClass054_Base + { + protected int intI = 2; + protected int MyMeth() + { + return 4; + } + int intJ; + + protected int PropInt + { + get + { + return intJ; + } + set + { + intJ = value; + } + } + } + public class MembersInheritanceTestClass054_Derived : MembersInheritanceTestClass054_Base + { + } + class MembersInheritanceTestClass054 : MembersInheritanceTestClass054_Derived + { + + public static bool testMethod() + { + MembersInheritanceTestClass054 mc = new MembersInheritanceTestClass054(); + mc.PropInt = 3; + if ((mc.intI == 2) && (mc.PropInt == 3) && (mc.MyMeth() == 4)) + { + return true; + } + else + { + return false; + } + } + } + + class MembersInheritanceTestClass057 : MembersInheritanceTestClass057_SubB.N + { + public static bool testMethod() + { + MembersInheritanceTestClass057 MC = new MembersInheritanceTestClass057(); + if (MC.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass057_SubB + { + internal class N + { + internal int intI = 2; + } + } + + class MembersInheritanceTestClass058 : MembersInheritanceTestClass058_SubB + { + public static bool testMethod() + { + MembersInheritanceTestClass058 MC = new MembersInheritanceTestClass058(); + if (MC.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + class MembersInheritanceTestClass058_SubB + { + public int intI = 2; + } + + public class MembersInheritanceTestClass059 + { + public int intI = 2; + public class MyInner : MembersInheritanceTestClass059 { } + public static bool testMethod() + { + MyInner MI = new MyInner(); + if (MI.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + class MembersModifiersTestClass01 + { + //public + public int intI = 1; + public String strS = "MembersModifiersTestClass01"; + public int intJ() { return 2; } + public static int intK = 3; + public static bool testMethod() + { + MembersModifiersTestClass01 test = new MembersModifiersTestClass01(); + if ((test.intI == 1) && (test.intJ() == 2) && (intK == 3) && (test.strS.Equals("MembersModifiersTestClass01"))) + { + return true; + } + else + { + return false; + } + } + } + class MembersModifiersTestClass02 + { + //protected + protected int intI = 1; + protected String strS = "MembersModifiersTestClass02"; + protected int intJ() { return 2; } + protected static int intK = 3; + public static bool testMethod() + { + MembersModifiersTestClass02 test = new MembersModifiersTestClass02(); + if ((test.intI == 1) && (test.intJ() == 2) && (intK == 3) && (test.strS.Equals("MembersModifiersTestClass02"))) + { + return true; + } + else + { + return false; + } + } + } + class MembersModifiersTestClass03 + { + //internal + internal int intI = 1; + internal String strS = "MembersModifiersTestClass03"; + internal int intJ() { return 2; } + internal static int intK = 3; + public static bool testMethod() + { + MembersModifiersTestClass03 test = new MembersModifiersTestClass03(); + if ((test.intI == 1) && (test.intJ() == 2) && (intK == 3) && (test.strS.Equals("MembersModifiersTestClass03"))) + { + return true; + } + else + { + return false; + } + } + } + class MembersModifiersTestClass04 + { + //private + private int intI = 1; + private String strS = "MembersModifiersTestClass04"; + private int intJ() { return 2; } + private static int intK = 3; + public static bool testMethod() + { + MembersModifiersTestClass04 test = new MembersModifiersTestClass04(); + if ((test.intI == 1) && (test.intJ() == 2) && (intK == 3) && (test.strS.Equals("MembersModifiersTestClass04"))) + { + return true; + } + else + { + return false; + } + } + } + class MembersModifiersTestClass05 + { + //public + public struct MyStruct + { + public static int intI = 1; + } + public enum AA { zero, one } + public class MyInner + { + public static int intI = 2; + } + public static bool testMethod() + { + AA MyEnum = AA.zero; + if ((MyStruct.intI == 1) && (MyEnum == AA.zero) && (MyInner.intI == 2)) + { + return true; + } + else + { + return false; + } + } + } + class MembersModifiersTestClass06 + { + //protected + protected struct MyStruct + { + public static int intI = 1; + } + protected enum AA { zero, one } + protected class MyInner + { + public static int intI = 2; + } + public static bool testMethod() + { + AA MyEnum = AA.zero; + if ((MyStruct.intI == 1) && (MyEnum == AA.zero) && (MyInner.intI == 2)) + { + return true; + } + else + { + return false; + } + } + } + class MembersModifiersTestClass07 + { + //internal + internal struct MyStruct + { + public static int intI = 1; + } + internal enum AA { zero, one } + internal class MyInner + { + public static int intI = 2; + } + public static bool testMethod() + { + AA MyEnum = AA.zero; + if ((MyStruct.intI == 1) && (MyEnum == AA.zero) && (MyInner.intI == 2)) + { + return true; + } + else + { + return false; + } + } + } + class MembersModifiersTestClass08 + { + //private + private struct MyStruct + { + public static int intI = 1; + } + private enum AA { zero, one } + private class MyInner + { + public static int intI = 2; + } + public static bool testMethod() + { + AA MyEnum = AA.zero; + if ((MyStruct.intI == 1) && (MyEnum == AA.zero) && (MyInner.intI == 2)) + { + return true; + } + else + { + return false; + } + } + } + class MembersModifiersTestClass12 + { + protected internal int intI = 1; + public static bool testMethod() + { + MembersModifiersTestClass12 test = new MembersModifiersTestClass12(); + if (test.intI == 1) + { + return true; + } + else + { + return false; + } + } + } + sealed class MembersModifiersTestClass23 + { + protected int intI = 0; + + public static bool testMethod() + { + return true; + } + } + sealed class MembersModifiersTestClass24 + { + protected int intI + { + get { return 1; } + set { } + } + + public static bool testMethod() + { + return true; + } + } + sealed class MembersModifiersTestClass25 + { + protected void MyMeth() { } + + public static bool testMethod() + { + return true; + } + } + sealed class MembersModifiersTestClass26 + { + protected int this[int intI] + { + get + { + return 1; + } + set { } + } + + public static bool testMethod() + { + return true; + } + } + sealed class MembersModifiersTestClass27 + { + protected class MyNested { } + + public static bool testMethod() + { + return true; + } + } + + } +} diff --git a/Tests/NFUnitTestClasses/UnitTestMethodsTests.cs b/Tests/NFUnitTestClasses/UnitTestMethodsTests.cs new file mode 100644 index 00000000..86213440 --- /dev/null +++ b/Tests/NFUnitTestClasses/UnitTestMethodsTests.cs @@ -0,0 +1,4401 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestClasses +{ + [TestClass] + class UnitTestMethodsTests + { + [TestMethod] + public void Methods1_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers,"); + Debug.WriteLine(" one of the static, virtual, override, or abstract "); + Debug.WriteLine(" modifiers, and an extern modifier."); + Assert.True(MethodsTestClass1.testMethod()); + } + + [TestMethod] + public void Methods2_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers,"); + Debug.WriteLine(" one of the static, virtual, override, or abstract "); + Debug.WriteLine(" modifiers, and an extern modifier."); + Assert.True(MethodsTestClass2.testMethod()); + } + + [TestMethod] + public void Methods3_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers,"); + Debug.WriteLine(" one of the static, virtual, override, or abstract "); + Debug.WriteLine(" modifiers, and an extern modifier."); + Assert.True(MethodsTestClass3.testMethod()); + } + + [TestMethod] + public void Methods4_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers,"); + Debug.WriteLine(" one of the static, virtual, override, or abstract "); + Debug.WriteLine(" modifiers, and an extern modifier."); + Assert.True(MethodsTestClass4.testMethod()); + } + + [TestMethod] + public void Methods6_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers,"); + Debug.WriteLine(" one of the static, virtual, override, or abstract "); + Debug.WriteLine(" modifiers, and an extern modifier."); + Assert.True(MethodsTestClass6.testMethod()); + } + + [TestMethod] + public void Methods7_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers,"); + Debug.WriteLine(" one of the static, virtual, override, or abstract "); + Debug.WriteLine(" modifiers, and an extern modifier."); + Assert.True(MethodsTestClass7.testMethod()); + } + + [TestMethod] + public void Methods9_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers,"); + Debug.WriteLine(" one of the static, virtual, override, or abstract "); + Debug.WriteLine(" modifiers, and an extern modifier."); + Assert.True(MethodsTestClass9.testMethod()); + } + + [TestMethod] + public void Methods10_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers,"); + Debug.WriteLine(" one of the static, virtual, override, or abstract "); + Debug.WriteLine(" modifiers, and an extern modifier."); + Assert.True(MethodsTestClass10.testMethod()); + } + + [TestMethod] + public void Methods11_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers,"); + Debug.WriteLine(" one of the static, virtual, override, or abstract "); + Debug.WriteLine(" modifiers, and an extern modifier."); + Assert.False(MethodsTestClass11.testMethod()); + Debug.WriteLine("This failure indicates a test is now passing that previously failed by design."); + Debug.WriteLine("It previously marked as known failure because of bug # 21563"); + Debug.WriteLine("The Test owner needs to verify that the change was intentional and remove the known failure."); + + } + + [TestMethod] + public void Methods13_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers,"); + Debug.WriteLine(" one of the static, virtual, override, or abstract "); + Debug.WriteLine(" modifiers, and an extern modifier."); + Assert.True(MethodsTestClass13.testMethod()); + } + + [TestMethod] + public void Methods17_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers,"); + Debug.WriteLine(" one of the static, virtual, override, or abstract "); + Debug.WriteLine(" modifiers, and an extern modifier."); + Assert.True(MethodsTestClass17.testMethod()); + } + + [TestMethod] + public void Methods19_Test() + { + Debug.WriteLine(" The return-type of a method declaration specifies"); + Debug.WriteLine(" the type of the value computed and returned by the"); + Debug.WriteLine(" method. The return type is void if the method does"); + Debug.WriteLine(" not return a value."); + Assert.True(MethodsTestClass19.testMethod()); + } + + [TestMethod] + public void Methods20_Test() + { + Debug.WriteLine(" The return-type of a method declaration specifies"); + Debug.WriteLine(" the type of the value computed and returned by the"); + Debug.WriteLine(" method. The return type is void if the method does"); + Debug.WriteLine(" not return a value."); + Assert.True(MethodsTestClass20.testMethod()); + } + + [TestMethod] + public void Methods22_Test() + { + Debug.WriteLine(" The return-type of a method declaration specifies"); + Debug.WriteLine(" the type of the value computed and returned by the"); + Debug.WriteLine(" method. The return type is void if the method does"); + Debug.WriteLine(" not return a value."); + Assert.True(MethodsTestClass22.testMethod()); + } + + [TestMethod] + public void Methods23_Test() + { + Debug.WriteLine(" The return-type of a method declaration specifies"); + Debug.WriteLine(" the type of the value computed and returned by the"); + Debug.WriteLine(" method. The return type is void if the method does"); + Debug.WriteLine(" not return a value."); + Assert.True(MethodsTestClass23.testMethod()); + } + + [TestMethod] + public void Methods24_Test() + { + Debug.WriteLine(" The return-type of a method declaration specifies"); + Debug.WriteLine(" the type of the value computed and returned by the"); + Debug.WriteLine(" method. The return type is void if the method does"); + Debug.WriteLine(" not return a value."); + Assert.True(MethodsTestClass24.testMethod()); + } + + [TestMethod] + public void Methods25_Test() + { + Debug.WriteLine(" The return-type of a method declaration specifies"); + Debug.WriteLine(" the type of the value computed and returned by the"); + Debug.WriteLine(" method. The return type is void if the method does"); + Debug.WriteLine(" not return a value."); + Assert.True(MethodsTestClass25.testMethod()); + } + + [TestMethod] + public void Methods26_Test() + { + Debug.WriteLine(" The return-type of a method declaration specifies"); + Debug.WriteLine(" the type of the value computed and returned by the"); + Debug.WriteLine(" method. The return type is void if the method does"); + Debug.WriteLine(" not return a value."); + Assert.True(MethodsTestClass26.testMethod()); + } + + [TestMethod] + public void Methods29_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" The member-name specifies the name of the method."); + Debug.WriteLine(" Unless the method is an explicit interface member"); + Debug.WriteLine(" implementation, the member-name is simply an "); + Debug.WriteLine(" identifier. For an explicit interface member "); + Debug.WriteLine(" implementation, the member-name consists of an"); + Debug.WriteLine(" interface-type followed by a . and an identifier."); + Assert.True(MethodsTestClass29.testMethod()); + } + + [TestMethod] + public void Methods30_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" The member-name specifies the name of the method."); + Debug.WriteLine(" Unless the method is an explicit interface member"); + Debug.WriteLine(" implementation, the member-name is simply an "); + Debug.WriteLine(" identifier. For an explicit interface member "); + Debug.WriteLine(" implementation, the member-name consists of an"); + Debug.WriteLine(" interface-type followed by a . and an identifier."); + Assert.True(MethodsTestClass30.testMethod()); + } + + [TestMethod] + public void Methods33_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" The optional formal-parameter-list specifies"); + Debug.WriteLine(" the parameters of the method."); + Assert.True(MethodsTestClass33.testMethod()); + } + + [TestMethod] + public void Methods34_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" The optional formal-parameter-list specifies"); + Debug.WriteLine(" the parameters of the method."); + Assert.True(MethodsTestClass34.testMethod()); + } + + [TestMethod] + public void Methods35_Test() + { + Debug.WriteLine("Testing method call with 10 parameters"); + Assert.True(MethodsTestClass35.testMethod()); + } + + [TestMethod] + public void Methods56_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method declaration creates a separate space"); + Debug.WriteLine(" for parameters and local variables. Names are introduced"); + Debug.WriteLine(" into this declaration space by the formal parameter"); + Debug.WriteLine(" list of the method and by the local variable declarations"); + Debug.WriteLine(" in the block of the method. All names in the declaration"); + Debug.WriteLine(" space of a method must be unique. Thus it is an error"); + Debug.WriteLine(" for a parameter or local variable to have the same name"); + Debug.WriteLine(" as another parameter or local variable."); + Assert.True(MethodsTestClass56.testMethod()); + } + + [TestMethod] + public void Methods57_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method declaration creates a separate space"); + Debug.WriteLine(" for parameters and local variables. Names are introduced"); + Debug.WriteLine(" into this declaration space by the formal parameter"); + Debug.WriteLine(" list of the method and by the local variable declarations"); + Debug.WriteLine(" in the block of the method. All names in the declaration"); + Debug.WriteLine(" space of a method must be unique. Thus it is an error"); + Debug.WriteLine(" for a parameter or local variable to have the same name"); + Debug.WriteLine(" as another parameter or local variable."); + Assert.True(MethodsTestClass57.testMethod()); + } + + [TestMethod] + public void Methods58_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" When a formal parameter is a value parameter,"); + Debug.WriteLine(" the corresponding argument in the method invocation"); + Debug.WriteLine(" must be an expression of a type that is implicitly"); + Debug.WriteLine(" convertible to the formal parameter type."); + Assert.True(MethodsTestClass58.testMethod()); + } + + [TestMethod] + public void Methods59_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" When a formal parameter is a value parameter,"); + Debug.WriteLine(" the corresponding argument in the method invocation"); + Debug.WriteLine(" must be an expression of a type that is implicitly"); + Debug.WriteLine(" convertible to the formal parameter type."); + Assert.True(MethodsTestClass59.testMethod()); + } + + [TestMethod] + public void Methods60_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" When a formal parameter is a value parameter,"); + Debug.WriteLine(" the corresponding argument in the method invocation"); + Debug.WriteLine(" must be an expression of a type that is implicitly"); + Debug.WriteLine(" convertible to the formal parameter type."); + Assert.True(MethodsTestClass60.testMethod()); + } + + [TestMethod] + public void Methods61_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" When a formal parameter is a value parameter,"); + Debug.WriteLine(" the corresponding argument in the method invocation"); + Debug.WriteLine(" must be an expression of a type that is implicitly"); + Debug.WriteLine(" convertible to the formal parameter type."); + Assert.True(MethodsTestClass61.testMethod()); + } + + [TestMethod] + public void Methods66_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method is permitted to assign new values to "); + Debug.WriteLine(" a value parameter. Such assignments only affect"); + Debug.WriteLine(" the local storage location represented by the "); + Debug.WriteLine(" value parameter--they have no effect on the actual "); + Debug.WriteLine(" argument given in the method invocation."); + Assert.True(MethodsTestClass66.testMethod()); + } + + [TestMethod] + public void Methods67_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method is permitted to assign new values to "); + Debug.WriteLine(" a value parameter. Such assignments only affect"); + Debug.WriteLine(" the local storage location represented by the "); + Debug.WriteLine(" value parameter--they have no effect on the actual "); + Debug.WriteLine(" argument given in the method invocation."); + Assert.True(MethodsTestClass67.testMethod()); + } + + [TestMethod] + public void Methods68_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method is permitted to assign new values to "); + Debug.WriteLine(" a value parameter. Such assignments only affect"); + Debug.WriteLine(" the local storage location represented by the "); + Debug.WriteLine(" value parameter--they have no effect on the actual "); + Debug.WriteLine(" argument given in the method invocation."); + Assert.True(MethodsTestClass68.testMethod()); + } + + [TestMethod] + public void Methods69_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A parameter declared with a ref modifier is a "); + Debug.WriteLine(" reference parameter. Unlike a value parameter,"); + Debug.WriteLine(" a reference parameter does not create a new "); + Debug.WriteLine(" storage location. Instead, a reference parameter"); + Debug.WriteLine(" represents the same storage location as the"); + Debug.WriteLine(" variable given as the argument in the method"); + Debug.WriteLine(" invocation."); + Assert.True(MethodsTestClass69.testMethod()); + } + + [TestMethod] + public void Methods70_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A parameter declared with a ref modifier is a "); + Debug.WriteLine(" reference parameter. Unlike a value parameter,"); + Debug.WriteLine(" a reference parameter does not create a new "); + Debug.WriteLine(" storage location. Instead, a reference parameter"); + Debug.WriteLine(" represents the same storage location as the"); + Debug.WriteLine(" variable given as the argument in the method"); + Debug.WriteLine(" invocation."); + Assert.True(MethodsTestClass70.testMethod()); + } + + [TestMethod] + public void Methods71_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A parameter declared with a ref modifier is a "); + Debug.WriteLine(" reference parameter. Unlike a value parameter,"); + Debug.WriteLine(" a reference parameter does not create a new "); + Debug.WriteLine(" storage location. Instead, a reference parameter"); + Debug.WriteLine(" represents the same storage location as the"); + Debug.WriteLine(" variable given as the argument in the method"); + Debug.WriteLine(" invocation."); + Assert.True(MethodsTestClass71.testMethod()); + } + + [TestMethod] + public void Methods75_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" When a formal parameter is a reference parameter,"); + Debug.WriteLine(" the corresponding argument in a method invocation"); + Debug.WriteLine(" must consist of the keyword ref followed by a "); + Debug.WriteLine(" variable-reference of the same type as the formal"); + Debug.WriteLine(" parameter. A variable must be definitely assigned"); + Debug.WriteLine(" before it can be passed as a reference parameter."); + Assert.True(MethodsTestClass75.testMethod()); + } + + [TestMethod] + public void Methods78_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A parameter declared with an out modifier is an output"); + Debug.WriteLine(" parameter. Similar to a reference parameter, an output"); + Debug.WriteLine(" parameter does not create a new storage location. Instead,"); + Debug.WriteLine(" an output parameter represents the same storage location"); + Debug.WriteLine(" as the variable given as the argument in the method invocation."); + Assert.True(MethodsTestClass78.testMethod()); + } + + [TestMethod] + public void Methods79_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A parameter declared with an out modifier is an output"); + Debug.WriteLine(" parameter. Similar to a reference parameter, an output"); + Debug.WriteLine(" parameter does not create a new storage location. Instead,"); + Debug.WriteLine(" an output parameter represents the same storage location"); + Debug.WriteLine(" as the variable given as the argument in the method invocation."); + Assert.True(MethodsTestClass79.testMethod()); + } + + [TestMethod] + public void Methods80_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A parameter declared with an out modifier is an output"); + Debug.WriteLine(" parameter. Similar to a reference parameter, an output"); + Debug.WriteLine(" parameter does not create a new storage location. Instead,"); + Debug.WriteLine(" an output parameter represents the same storage location"); + Debug.WriteLine(" as the variable given as the argument in the method invocation."); + Assert.True(MethodsTestClass80.testMethod()); + } + + [TestMethod] + public void Methods84_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" When a formal parameter is an output parameter,"); + Debug.WriteLine(" the corresponding argument in a method invocation"); + Debug.WriteLine(" must consist of the keyword out followed by a "); + Debug.WriteLine(" variable-reference of the same type as the formal "); + Debug.WriteLine(" parameter. A variable need not be definitely"); + Debug.WriteLine(" assigned before it can be passed as an output"); + Debug.WriteLine(" parameter, but following an invocation where a "); + Debug.WriteLine(" variable was passed as an output parameter, the"); + Debug.WriteLine(" variable is considered definitely assigned."); + Assert.True(MethodsTestClass84.testMethod()); + } + + [TestMethod] + public void Methods85_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" When a formal parameter is an output parameter,"); + Debug.WriteLine(" the corresponding argument in a method invocation"); + Debug.WriteLine(" must consist of the keyword out followed by a "); + Debug.WriteLine(" variable-reference of the same type as the formal "); + Debug.WriteLine(" parameter. A variable need not be definitely"); + Debug.WriteLine(" assigned before it can be passed as an output"); + Debug.WriteLine(" parameter, but following an invocation where a "); + Debug.WriteLine(" variable was passed as an output parameter, the"); + Debug.WriteLine(" variable is considered definitely assigned."); + Assert.True(MethodsTestClass85.testMethod()); + } + + [TestMethod] + public void Methods92_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" Every output parameter of a method must be"); + Debug.WriteLine(" definitely assigned before the method returns."); + Assert.True(MethodsTestClass92.testMethod()); + } + + [TestMethod] + public void Methods93_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" Every output parameter of a method must be"); + Debug.WriteLine(" definitely assigned before the method returns."); + Assert.True(MethodsTestClass93.testMethod()); + } + + [TestMethod] + public void Methods94_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" Every output parameter of a method must be"); + Debug.WriteLine(" definitely assigned before the method returns."); + Assert.True(MethodsTestClass94.testMethod()); + } + + [TestMethod] + public void Methods95_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" Every output parameter of a method must be"); + Debug.WriteLine(" definitely assigned before the method returns."); + Assert.True(MethodsTestClass95.testMethod()); + } + + [TestMethod] + public void Methods103_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" The implementation of a non-virtual method"); + Debug.WriteLine(" is invariant: The implementation is the same "); + Debug.WriteLine(" whether the method is invoked on an instance"); + Debug.WriteLine(" of the class in which it is declared or an "); + Debug.WriteLine(" instance of the derived class."); + Assert.True(MethodsTestClass103.testMethod()); + + } + + [TestMethod] + public void Methods104_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" The implementation of a non-virtual method"); + Debug.WriteLine(" is invariant: The implementation is the same "); + Debug.WriteLine(" whether the method is invoked on an instance"); + Debug.WriteLine(" of the class in which it is declared or an "); + Debug.WriteLine(" instance of the derived class."); + Assert.False(MethodsTestClass104.testMethod()); + + Debug.WriteLine("This failure indicates a test is now passing that previously failed by design."); + Debug.WriteLine("It previously marked as known failure because of bug # 21563"); + Debug.WriteLine("The Test owner needs to verify that the change was intentional and remove the known failure."); + + + } + + [TestMethod] + public void Methods105_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" The implementation of a non-virtual method"); + Debug.WriteLine(" is invariant: The implementation is the same "); + Debug.WriteLine(" whether the method is invoked on an instance"); + Debug.WriteLine(" of the class in which it is declared or an "); + Debug.WriteLine(" instance of the derived class."); + Assert.True(MethodsTestClass105.testMethod()); + } + + [TestMethod] + public void Methods106_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" For every virtual method declaration of M,"); + Debug.WriteLine(" there exists a most derived implementation"); + Debug.WriteLine(" of the method with respect to the class."); + Debug.WriteLine(" The most derived implementation of a "); + Debug.WriteLine(" virtual method M with respectto a class"); + Debug.WriteLine(" R is determined as follows:"); + Debug.WriteLine(""); + Debug.WriteLine(" If R contains the introducing virtual"); + Debug.WriteLine(" declaration of M, then this is the most"); + Debug.WriteLine(" derived implementation of M."); + Assert.True(MethodsTestClass106.testMethod()); + } + + [TestMethod] + public void Methods107_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" For every virtual method declaration of M,"); + Debug.WriteLine(" there exists a most derived implementation"); + Debug.WriteLine(" of the method with respect to the class."); + Debug.WriteLine(" The most derived implementation of a "); + Debug.WriteLine(" virtual method M with respectto a class"); + Debug.WriteLine(" R is determined as follows:"); + Debug.WriteLine(""); + Debug.WriteLine(" If R contains the introducing virtual"); + Debug.WriteLine(" declaration of M, then this is the most"); + Debug.WriteLine(" derived implementation of M."); + Assert.False(MethodsTestClass107.testMethod()); + Debug.WriteLine("This failure indicates a test is now passing that previously failed by design."); + Debug.WriteLine("It previously marked as known failure because of bug # 21563"); + Debug.WriteLine("The Test owner needs to verify that the change was intentional and remove the known failure."); + } + + [TestMethod] + public void Methods108_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" For every virtual method declaration of M,"); + Debug.WriteLine(" there exists a most derived implementation"); + Debug.WriteLine(" of the method with respect to the class."); + Debug.WriteLine(" The most derived implementation of a "); + Debug.WriteLine(" virtual method M with respectto a class"); + Debug.WriteLine(" R is determined as follows:"); + Debug.WriteLine(""); + Debug.WriteLine(" If R contains the introducing virtual"); + Debug.WriteLine(" declaration of M, then this is the most"); + Debug.WriteLine(" derived implementation of M."); + Debug.WriteLine(""); + Debug.WriteLine(" Otherwise, if R contains an override of M,"); + Debug.WriteLine(" then this is the most derived implementation"); + Debug.WriteLine(" of M."); + Assert.True(MethodsTestClass108.testMethod()); + } + + [TestMethod] + public void Methods109_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" For every virtual method declaration of M,"); + Debug.WriteLine(" there exists a most derived implementation"); + Debug.WriteLine(" of the method with respect to the class."); + Debug.WriteLine(" The most derived implementation of a "); + Debug.WriteLine(" virtual method M with respectto a class"); + Debug.WriteLine(" R is determined as follows:"); + Debug.WriteLine(""); + Debug.WriteLine(" If R contains the introducing virtual"); + Debug.WriteLine(" declaration of M, then this is the most"); + Debug.WriteLine(" derived implementation of M."); + Debug.WriteLine(""); + Debug.WriteLine(" Otherwise, if R contains an override of M,"); + Debug.WriteLine(" then this is the most derived implementation"); + Debug.WriteLine(" of M."); + Assert.True(MethodsTestClass109.testMethod()); + } + + [TestMethod] + public void Methods110_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" For every virtual method declaration of M,"); + Debug.WriteLine(" there exists a most derived implementation"); + Debug.WriteLine(" of the method with respect to the class."); + Debug.WriteLine(" The most derived implementation of a "); + Debug.WriteLine(" virtual method M with respectto a class"); + Debug.WriteLine(" R is determined as follows:"); + Debug.WriteLine(""); + Debug.WriteLine(" If R contains the introducing virtual"); + Debug.WriteLine(" declaration of M, then this is the most"); + Debug.WriteLine(" derived implementation of M."); + Debug.WriteLine(""); + Debug.WriteLine(" Otherwise, if R contains an override of M,"); + Debug.WriteLine(" then this is the most derived implementation"); + Debug.WriteLine(" of M."); + Assert.False(MethodsTestClass110.testMethod()); + Debug.WriteLine("This failure indicates a test is now passing that previously failed by design."); + Debug.WriteLine("It previously marked as known failure because of bug # 21563"); + Debug.WriteLine("The Test owner needs to verify that the change was intentional and remove the known failure."); + } + + [TestMethod] + public void Methods111_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" For every virtual method declaration of M,"); + Debug.WriteLine(" there exists a most derived implementation"); + Debug.WriteLine(" of the method with respect to the class."); + Debug.WriteLine(" The most derived implementation of a "); + Debug.WriteLine(" virtual method M with respectto a class"); + Debug.WriteLine(" R is determined as follows:"); + Debug.WriteLine(""); + Debug.WriteLine(" If R contains the introducing virtual"); + Debug.WriteLine(" declaration of M, then this is the most"); + Debug.WriteLine(" derived implementation of M."); + Debug.WriteLine(""); + Debug.WriteLine(" Otherwise, if R contains an override of M,"); + Debug.WriteLine(" then this is the most derived implementation"); + Debug.WriteLine(" of M."); + Assert.True(MethodsTestClass111.testMethod()); + } + + [TestMethod] + public void Methods112_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" Because methods are allowed to hide inherited"); + Debug.WriteLine(" methods, it is possible for a class to contain"); + Debug.WriteLine(" several virtual methods with the same signature."); + Debug.WriteLine(" This does not provide an ambiguity problem, since"); + Debug.WriteLine(" all but the most derived method are hidden."); + Assert.False(MethodsTestClass112.testMethod()); + Debug.WriteLine("This failure indicates a test is now passing that previously failed by design."); + Debug.WriteLine("It previously marked as known failure because of bug # 21563"); + Debug.WriteLine("The Test owner needs to verify that the change was intentional and remove the known failure."); + } + + [TestMethod] + public void Methods116_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" It is an error for an override method declaration"); + Debug.WriteLine(" to include any one of the new, static, virtual, or "); + Debug.WriteLine(" abstract modifiers."); + Assert.True(MethodsTestClass116.testMethod()); + } + + [TestMethod] + public void Methods117_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" For purposes of locating the overridden base"); + Debug.WriteLine(" method, a method is considered accessible if "); + Debug.WriteLine(" it is public, if it is protected, if it is "); + Debug.WriteLine(" internal and declared in the same project as "); + Debug.WriteLine(" C, or if it is private and declared in a class"); + Debug.WriteLine(" containing the declaration of C."); + Assert.True(MethodsTestClass117.testMethod()); + } + + [TestMethod] + public void Methods119_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" For purposes of locating the overridden base"); + Debug.WriteLine(" method, a method is considered accessible if "); + Debug.WriteLine(" it is public, if it is protected, if it is "); + Debug.WriteLine(" internal and declared in the same project as "); + Debug.WriteLine(" C, or if it is private and declared in a class"); + Debug.WriteLine(" containing the declaration of C."); + Assert.True(MethodsTestClass119.testMethod()); + } + + [TestMethod] + public void Methods120_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" For purposes of locating the overridden base"); + Debug.WriteLine(" method, a method is considered accessible if "); + Debug.WriteLine(" it is public, if it is protected, if it is "); + Debug.WriteLine(" internal and declared in the same project as "); + Debug.WriteLine(" C, or if it is private and declared in a class"); + Debug.WriteLine(" containing the declaration of C."); + Assert.True(MethodsTestClass120.testMethod()); + } + + [TestMethod] + public void Methods121_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" For purposes of locating the overridden base"); + Debug.WriteLine(" method, a method is considered accessible if "); + Debug.WriteLine(" it is public, if it is protected, if it is "); + Debug.WriteLine(" internal and declared in the same project as "); + Debug.WriteLine(" C, or if it is private and declared in a class"); + Debug.WriteLine(" containing the declaration of C."); + Assert.True(MethodsTestClass121.testMethod()); + } + + [TestMethod] + public void Methods124_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A compile time-error occurs unless all"); + Debug.WriteLine(" of the following are true for an override"); + Debug.WriteLine(" declaration:"); + Debug.WriteLine(""); + Debug.WriteLine(" An overriddden base method can be located"); + Debug.WriteLine(" as described above."); + Debug.WriteLine(""); + Debug.WriteLine(" The overridden base method is virtual,"); + Debug.WriteLine(" abstract, or override method. In other"); + Debug.WriteLine(" words, the overridden base method cannot"); + Debug.WriteLine(" be static or non-virtual."); + Assert.True(MethodsTestClass124.testMethod()); + } + + [TestMethod] + public void Methods125_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A compile time-error occurs unless all"); + Debug.WriteLine(" of the following are true for an override"); + Debug.WriteLine(" declaration:"); + Debug.WriteLine(""); + Debug.WriteLine(" An overriddden base method can be located"); + Debug.WriteLine(" as described above."); + Debug.WriteLine(""); + Debug.WriteLine(" The overridden base method is virtual,"); + Debug.WriteLine(" abstract, or override method. In other"); + Debug.WriteLine(" words, the overridden base method cannot"); + Debug.WriteLine(" be static or non-virtual."); + Assert.True(MethodsTestClass125.testMethod()); + } + + [TestMethod] + public void Methods132_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" An override declaration can access the overridden "); + Debug.WriteLine(" base method using a base-access."); + Assert.True(MethodsTestClass132.testMethod()); + } + + [TestMethod] + public void Methods133_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" An override declaration can access the overridden "); + Debug.WriteLine(" base method using a base-access."); + Assert.True(MethodsTestClass133.testMethod()); + } + + [TestMethod] + public void Methods134_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" Only by including an override modifier can"); + Debug.WriteLine(" a method override another method. In all other"); + Debug.WriteLine(" cases, a method with the same signature as an"); + Debug.WriteLine(" inherited method simply hides the inherited "); + Debug.WriteLine(" member."); + Assert.False(MethodsTestClass134.testMethod()); + Debug.WriteLine("This failure indicates a test is now passing that previously failed by design."); + Debug.WriteLine("It previously marked as known failure because of bug # 21563"); + Debug.WriteLine("The Test owner needs to verify that the change was intentional and remove the known failure."); + } + + [TestMethod] + public void Methods142_Test() + { + Assert.True(MethodsTestClass142.testMethod()); + } + + [TestMethod] + public void Methods148_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" If execution of the method body of a void"); + Debug.WriteLine(" method completes normally (that is, if control"); + Debug.WriteLine(" flows off the end of the method body), the "); + Debug.WriteLine(" method simply returns to the caller."); + Assert.True(MethodsTestClass148.testMethod()); + } + + [TestMethod] + public void Methods149_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" When the return type of a method is not void,"); + Debug.WriteLine(" each return statement in the method body must"); + Debug.WriteLine(" specify an expression of a type that is implicitly"); + Debug.WriteLine(" covertable to the return type."); + Assert.True(MethodsTestClass149.testMethod()); + } + + [TestMethod] + public void Methods150_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" When the return type of a method is not void,"); + Debug.WriteLine(" each return statement in the method body must"); + Debug.WriteLine(" specify an expression of a type that is implicitly"); + Debug.WriteLine(" covertable to the return type."); + Assert.True(MethodsTestClass150.testMethod()); + } + + [TestMethod] + public void Methods154_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" When the return type of a method is not void,"); + Debug.WriteLine(" each return statement in the method body must"); + Debug.WriteLine(" specify an expression of a type that is implicitly"); + Debug.WriteLine(" covertable to the return type."); + Assert.True(MethodsTestClass154.testMethod()); + } + + [TestMethod] + public void Methods159_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" When the return type of a method is not void,"); + Debug.WriteLine(" each return statement in the method body must"); + Debug.WriteLine(" specify an expression of a type that is implicitly"); + Debug.WriteLine(" covertable to the return type. Execution of the "); + Debug.WriteLine(" method body of a value returning method is required"); + Debug.WriteLine(" to terminate in a return statement that specifies"); + Debug.WriteLine(" an expression or in a throw statement that throws"); + Debug.WriteLine(" an System.Exception."); + Assert.True(MethodsTestClass159.testMethod()); + } + + [TestMethod] + public void Methods160_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" When the return type of a method is not void,"); + Debug.WriteLine(" each return statement in the method body must"); + Debug.WriteLine(" specify an expression of a type that is implicitly"); + Debug.WriteLine(" covertable to the return type. Execution of the "); + Debug.WriteLine(" method body of a value returning method is required"); + Debug.WriteLine(" to terminate in a return statement that specifies"); + Debug.WriteLine(" an expression or in a throw statement that throws"); + Debug.WriteLine(" an System.Exception."); + Assert.True(MethodsTestClass160.testMethod()); + } + + [TestMethod] + public void Methods161_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" When the return type of a method is not void,"); + Debug.WriteLine(" each return statement in the method body must"); + Debug.WriteLine(" specify an expression of a type that is implicitly"); + Debug.WriteLine(" covertable to the return type. Execution of the "); + Debug.WriteLine(" method body of a value returning method is required"); + Debug.WriteLine(" to terminate in a return statement that specifies"); + Debug.WriteLine(" an expression or in a throw statement that throws"); + Debug.WriteLine(" an System.Exception."); + Assert.True(MethodsTestClass161.testMethod()); + } + + [TestMethod] + public void Methods163_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A parameter declared with a params modifier is"); + Debug.WriteLine(" a params parameter. A params parameter must be"); + Debug.WriteLine(" the last parameter in the formal parameter list,"); + Debug.WriteLine(" and the type of a params parameter must be a "); + Debug.WriteLine(" single-dimension array type. For example, the"); + Debug.WriteLine(" types int[] and int[][] can be used as the type of"); + Debug.WriteLine(" a params parameter, but the type int[,] cannot be"); + Debug.WriteLine(" used in this way."); + Assert.True(MethodsTestClass163.testMethod()); + } + + [TestMethod] + public void Methods164_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A parameter declared with a params modifier is"); + Debug.WriteLine(" a params parameter. A params parameter must be"); + Debug.WriteLine(" the last parameter in the formal parameter list,"); + Debug.WriteLine(" and the type of a params parameter must be a "); + Debug.WriteLine(" single-dimension array type. For example, the"); + Debug.WriteLine(" types int[] and int[][] can be used as the type of"); + Debug.WriteLine(" a params parameter, but the type int[,] cannot be"); + Debug.WriteLine(" used in this way."); + Assert.True(MethodsTestClass164.testMethod()); + } + + [TestMethod] + public void Methods169_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A params parameter enables a caller to supply values"); + Debug.WriteLine(" in one of two ways."); + Debug.WriteLine(" The caller may specify an expression of a type that"); + Debug.WriteLine(" is implicitly convertible to the formal parameter type."); + Debug.WriteLine(" In this case, the params parameter acts precisely like"); + Debug.WriteLine(" a value parameter."); + Assert.True(MethodsTestClass169.testMethod()); + } + + [TestMethod] + public void Methods172_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A params parameter enables a caller to supply values"); + Debug.WriteLine(" in one of two ways."); + Debug.WriteLine(" Alternately, the caller may specify zero or more expressions,"); + Debug.WriteLine(" where the type of each expression is implicitly convertible"); + Debug.WriteLine(" to the element type of the formal parameter type. In this case,"); + Debug.WriteLine(" params parameter is initialized with an array fo the formal"); + Debug.WriteLine(" parameter type that contains the value or values provided by"); + Debug.WriteLine(" the caller."); + Assert.True(MethodsTestClass172.testMethod()); + } + + [TestMethod] + public void Methods173_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A params parameter enables a caller to supply values"); + Debug.WriteLine(" in one of two ways."); + Debug.WriteLine(" Alternately, the caller may specify zero or more expressions,"); + Debug.WriteLine(" where the type of each expression is implicitly convertible"); + Debug.WriteLine(" to the element type of the formal parameter type. In this case,"); + Debug.WriteLine(" params parameter is initialized with an array fo the formal"); + Debug.WriteLine(" parameter type that contains the value or values provided by"); + Debug.WriteLine(" the caller."); + Assert.True(MethodsTestClass173.testMethod()); + } + + [TestMethod] + public void Methods174_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A params parameter enables a caller to supply values"); + Debug.WriteLine(" in one of two ways."); + Debug.WriteLine(" Alternately, the caller may specify zero or more expressions,"); + Debug.WriteLine(" where the type of each expression is implicitly convertible"); + Debug.WriteLine(" to the element type of the formal parameter type. In this case,"); + Debug.WriteLine(" params parameter is initialized with an array fo the formal"); + Debug.WriteLine(" parameter type that contains the value or values provided by"); + Debug.WriteLine(" the caller."); + Assert.True(MethodsTestClass174.testMethod()); + } + + [TestMethod] + public void Methods175_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A params parameter enables a caller to supply values"); + Debug.WriteLine(" in one of two ways."); + Debug.WriteLine(" Alternately, the caller may specify zero or more expressions,"); + Debug.WriteLine(" where the type of each expression is implicitly convertible"); + Debug.WriteLine(" to the element type of the formal parameter type. In this case,"); + Debug.WriteLine(" params parameter is initialized with an array fo the formal"); + Debug.WriteLine(" parameter type that contains the value or values provided by"); + Debug.WriteLine(" the caller."); + Assert.True(MethodsTestClass175.testMethod()); + } + + [TestMethod] + public void Methods179_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A params parameter enables a caller to supply values"); + Debug.WriteLine(" in one of two ways."); + Debug.WriteLine(" Alternately, the caller may specify zero or more expressions,"); + Debug.WriteLine(" where the type of each expression is implicitly convertible"); + Debug.WriteLine(" to the element type of the formal parameter type. In this case,"); + Debug.WriteLine(" params parameter is initialized with an array fo the formal"); + Debug.WriteLine(" parameter type that contains the value or values provided by"); + Debug.WriteLine(" the caller."); + Assert.True(MethodsTestClass179.testMethod()); + } + + [TestMethod] + public void Methods180_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A params parameter enables a caller to supply values"); + Debug.WriteLine(" in one of two ways."); + Debug.WriteLine(" Alternately, the caller may specify zero or more expressions,"); + Debug.WriteLine(" where the type of each expression is implicitly convertible"); + Debug.WriteLine(" to the element type of the formal parameter type. In this case,"); + Debug.WriteLine(" params parameter is initialized with an array fo the formal"); + Debug.WriteLine(" parameter type that contains the value or values provided by"); + Debug.WriteLine(" the caller."); + Assert.True(MethodsTestClass180.testMethod()); + } + + [TestMethod] + public void Methods181_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A params parameter enables a caller to supply values"); + Debug.WriteLine(" in one of two ways."); + Debug.WriteLine(" Alternately, the caller may specify zero or more expressions,"); + Debug.WriteLine(" where the type of each expression is implicitly convertible"); + Debug.WriteLine(" to the element type of the formal parameter type. In this case,"); + Debug.WriteLine(" params parameter is initialized with an array fo the formal"); + Debug.WriteLine(" parameter type that contains the value or values provided by"); + Debug.WriteLine(" the caller."); + Assert.True(MethodsTestClass181.testMethod()); + } + + [TestMethod] + public void Methods182_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A params parameter enables a caller to supply values"); + Debug.WriteLine(" in one of two ways."); + Debug.WriteLine(" Alternately, the caller may specify zero or more expressions,"); + Debug.WriteLine(" where the type of each expression is implicitly convertible"); + Debug.WriteLine(" to the element type of the formal parameter type. In this case,"); + Debug.WriteLine(" params parameter is initialized with an array fo the formal"); + Debug.WriteLine(" parameter type that contains the value or values provided by"); + Debug.WriteLine(" the caller."); + Assert.True(MethodsTestClass182.testMethod()); + } + + [TestMethod] + public void Methods183_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A params parameter enables a caller to supply values"); + Debug.WriteLine(" in one of two ways."); + Debug.WriteLine(" Alternately, the caller may specify zero or more expressions,"); + Debug.WriteLine(" where the type of each expression is implicitly convertible"); + Debug.WriteLine(" to the element type of the formal parameter type. In this case,"); + Debug.WriteLine(" params parameter is initialized with an array fo the formal"); + Debug.WriteLine(" parameter type that contains the value or values provided by"); + Debug.WriteLine(" the caller."); + Assert.True(MethodsTestClass183.testMethod()); + } + + [TestMethod] + public void Methods184_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A params parameter enables a caller to supply values"); + Debug.WriteLine(" in one of two ways."); + Debug.WriteLine(" Alternately, the caller may specify zero or more expressions,"); + Debug.WriteLine(" where the type of each expression is implicitly convertible"); + Debug.WriteLine(" to the element type of the formal parameter type. In this case,"); + Debug.WriteLine(" params parameter is initialized with an array fo the formal"); + Debug.WriteLine(" parameter type that contains the value or values provided by"); + Debug.WriteLine(" the caller."); + Assert.True(MethodsTestClass184.testMethod()); + } + + [TestMethod] + public void Methods185_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method is permitted to assign new values"); + Debug.WriteLine(" to a params parameter. Such assignments only"); + Debug.WriteLine(" affect the local storage location represented"); + Debug.WriteLine(" by the params parameter."); + Assert.True(MethodsTestClass185.testMethod()); + } + + [TestMethod] + public void Methods186_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A params parameter can be passed along to another"); + Debug.WriteLine(" params parameter."); + Assert.True(MethodsTestClass186.testMethod()); + } + + [TestMethod] + public void Methods187_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A params parameter can be passed along to another"); + Debug.WriteLine(" params parameter."); + Assert.True(MethodsTestClass187.testMethod()); + } + + [TestMethod] + public void Methods188_Test() + { + Debug.WriteLine("Testing explicit base method call to a child class whose parent implements"); + Assert.True(MethodsTestClass188.testMethod()); + } + + [TestMethod] + public void Methods190_Test() + { + Debug.WriteLine("Testing implicit base method calls to protected methods in parent class"); + Assert.True(MethodsTestClass190.testMethod()); + } + + [TestMethod] + public void Methods191_Test() + { + Debug.WriteLine("Testing implicit base method calls to internal methods in parent class"); + Assert.True(MethodsTestClass191.testMethod()); + } + + [TestMethod] + public void Methods192_Test() + { + Debug.WriteLine("Testing implicit base method calls to protected internal methods in parent class"); + Assert.True(MethodsTestClass192.testMethod()); + } + + [TestMethod] + public void Methods193_Test() + { + Debug.WriteLine("Testing implicit base method calls to private methods in parent class"); + Assert.True(MethodsTestClass193.testMethod()); + } + + [TestMethod] + public void Methods194_Test() + { + Debug.WriteLine("Testing implicit base method calls to public virtual methods in parent class"); + Assert.True(MethodsTestClass194.testMethod()); + } + + [TestMethod] + public void Methods195_Test() + { + Debug.WriteLine("Tests if a new method does not overwrite a virtual method in a base class"); + Assert.False(MethodsTestClass195.testMethod()); + Debug.WriteLine("This failure indicates a test is now passing that previously failed by design."); + Debug.WriteLine("It previously marked as known failure because of bug # 21563"); + Debug.WriteLine("The Test owner needs to verify that the change was intentional and remove the known failure."); + } + + [TestMethod] + public void Methods196_Test() + { + Debug.WriteLine("Tests if a new method does overwrite an abstract method in a base class"); + Assert.True(MethodsTestClass196.testMethod()); + } + + [TestMethod] + public void Methods197_Test() + { + Debug.WriteLine("Tests the calling of an empty delegate"); + Assert.True(MethodsTestClass197.testMethod()); + } + + [TestMethod] + public void Methods199_Test() + { + Debug.WriteLine("Tests if a sealed method overwrites a virtual method in a base class"); + Assert.True(MethodsTestClass199.testMethod()); + } + + [TestMethod] + public void Methods200_Test() + { + Debug.WriteLine("Tests large number of assignments inside a public method"); + Assert.True(MethodsTestClass200.testMethod()); + } + + [TestMethod] + public void Methods201_Test() + { + Debug.WriteLine("Tests large number of assignments inside a public static method"); + Assert.True(MethodsTestClass201.testMethod()); + } + + [TestMethod] + public void Methods204_Test() + { + Debug.WriteLine("Tests a method with explicit, params signature"); + Assert.True(MethodsTestClass204.testMethod()); + } + + [TestMethod] + public void Methods205_Test() + { + Debug.WriteLine("Tests a method with a mixed explicit and params signature"); + Assert.True(MethodsTestClass205.testMethod()); + } + + [TestMethod] + public void Methods206_Test() + { + Debug.WriteLine("Tests method overloading between params and explicit signatures (static)"); + Assert.True(MethodsTestClass206.testMethod()); + } + + [TestMethod] + public void Methods207_Test() + { + Debug.WriteLine("Tests method overloading between params and explicit signatures"); + Assert.True(MethodsTestClass207.testMethod()); + } + + [TestMethod] + public void Methods210_Test() + { + Debug.WriteLine(" Section 10.5 If the declaration includes the sealed modifier, then the "); + Debug.WriteLine(" declaration must also include the override modifier."); + Assert.True(MethodsTestClass210.testMethod()); + } + + [TestMethod] + public void Methods223_Test() + { + Debug.WriteLine(" Section 10.5 The ref and out parameters are part of a method's signature, but the params modifier is not."); + Assert.True(MethodsTestClass223.testMethod()); + } + [TestMethod] + public void Methods224_Test() + { + Debug.WriteLine(" Section 10.5 The ref and out parameters are part of a method's signature, but the params modifier is not."); + Assert.True(MethodsTestClass224.testMethod()); + } + [TestMethod] + public void Methods229_Test() + { + Debug.WriteLine(" error CS0114: 'function1' hides inherited member 'function2'."); + Debug.WriteLine(" To make the current method override that implementation, add "); + Debug.WriteLine(" the override keyword. Otherwise add the new keyword."); + Assert.True(MethodsTestClass229.testMethod()); + } + [TestMethod] + public void Methods230_Test() + { + Debug.WriteLine(" error CS0114: 'function1' hides inherited member 'function2'."); + Debug.WriteLine(" To make the current method override that implementation, add "); + Debug.WriteLine(" the override keyword. Otherwise add the new keyword."); + Assert.True(MethodsTestClass230.testMethod()); + } + [TestMethod] + public void Methods231_Test() + { + Debug.WriteLine(" error CS0114: 'function1' hides inherited member 'function2'."); + Debug.WriteLine(" To make the current method override that implementation, add "); + Debug.WriteLine(" the override keyword. Otherwise add the new keyword."); + Assert.True(MethodsTestClass231.testMethod()); + } + [TestMethod] + public void Methods232_Test() + { + Debug.WriteLine(" error CS0114: 'function1' hides inherited member 'function2'."); + Debug.WriteLine(" To make the current method override that implementation, add "); + Debug.WriteLine(" the override keyword. Otherwise add the new keyword."); + Assert.True(MethodsTestClass232.testMethod()); + } + [TestMethod] + public void Methods233_Test() + { + Debug.WriteLine(" Section 10.5"); + Debug.WriteLine(" A method-declaration may include set of attributes,"); + Debug.WriteLine(" a new modifier, one of four access modifiers,"); + Debug.WriteLine(" one of the static, virtual, override, or abstract "); + Debug.WriteLine(" modifiers, and an extern modifier."); + Assert.True(MethodsTestClass233.testMethod()); + } + + public class MethodsTestClass_Base1 + { + public static bool testMethod() + { + return false; + } + } + + public class MethodsTestClass1 : MethodsTestClass_Base1 + { + //new modifier + new public int MyMeth() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass1 test = new MethodsTestClass1(); + if (test.MyMeth() == 2) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass2 + { + //new modifier + new public int MyMeth() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass2 test = new MethodsTestClass2(); + if (test.MyMeth() == 2) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass3 + { + //public modifier + public int MyMeth() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass3 test = new MethodsTestClass3(); + if (test.MyMeth() == 2) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass_Base4 + { + //protected modifier + protected int MyMeth() + { + return 2; + } + } + public class MethodsTestClass4 : MethodsTestClass_Base4 + { + public static bool testMethod() + { + MethodsTestClass4 test = new MethodsTestClass4(); + if (test.MyMeth() == 2) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass6 + { + //internal modifier + internal int MyMeth() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass6 test = new MethodsTestClass6(); + if (test.MyMeth() == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass7 + { + //private modifier + private int MyMeth() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass7 test = new MethodsTestClass7(); + if (test.MyMeth() == 2) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass9 + { + //static modifier + static int MyMeth() + { + return 2; + } + public static bool testMethod() + { + if (MyMeth() == 2) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass_Base10 + { + //virtual modifier + public virtual int MyMeth() + { + return 1; + } + } + + public class MethodsTestClass10 : MethodsTestClass_Base10 + { + //override modifier + public override int MyMeth() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass_Base10 test = new MethodsTestClass10(); + if (test.MyMeth() == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Base11 + { + //virtual modifier + public virtual int MyMeth() + { + return 1; + } + } + public class MethodsTestClass11 : MethodsTestClass_Base11 + { + //new modifier + new int MyMeth() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass_Base11 test = new MethodsTestClass11(); + if (test.MyMeth() == 1) + { + return true; + } + else + { + return false; + } + } + } + + abstract class MethodsTestClass_Base13 + { + //abstract modifier + public abstract int MyMeth(); + } + class MethodsTestClass13 : MethodsTestClass_Base13 + { + public override int MyMeth() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass_Base13 test = new MethodsTestClass13(); + if (test.MyMeth() == 2) + { + return true; + } + else + { + return false; + } + } + } + + public class Test + { + //extern modifier + extern public int MyMeth(); + } + public class MethodsTestClass17 + { + public static bool testMethod() + { + return true; + } + } + + public class MethodsTestClass19 + { + int intI = 1; + //void return type + void MyMeth() + { + intI = 2; + } + public static bool testMethod() + { + MethodsTestClass19 test = new MethodsTestClass19(); + test.MyMeth(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass20 + { + int intI = 1; + //void return type + void MyMeth() + { + intI = 2; + return; + } + public static bool testMethod() + { + MethodsTestClass20 test = new MethodsTestClass20(); + test.MyMeth(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass22 + { + //simple return type + int MyMeth() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass22 test = new MethodsTestClass22(); + if (test.MyMeth() == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass23 + { + //string return type + string MyMeth() + { + return "MyMessage"; + } + public static bool testMethod() + { + MethodsTestClass23 test = new MethodsTestClass23(); + if (test.MyMeth().Equals("MyMessage")) + { + return true; + } + else + { + return false; + } + } + } + struct MyStruct + { + public MyStruct(int intI) + { + intTest = intI; + } + public int intTest; + } + public class MethodsTestClass24 + { + //struct return type + MyStruct MyMeth() + { + return new MyStruct(3); + } + public static bool testMethod() + { + MethodsTestClass24 test = new MethodsTestClass24(); + if (test.MyMeth().intTest == 3) + { + return true; + } + else + { + Debug.WriteLine(test.MyMeth().intTest.ToString()); + return false; + } + } + } + enum MethodsTestClass26_Enum { a = 1, b = 2 } + public class MethodsTestClass25 + { + //enum return type + MethodsTestClass26_Enum MyMeth() + { + return MethodsTestClass26_Enum.a; + } + public static bool testMethod() + { + MethodsTestClass25 test = new MethodsTestClass25(); + if (test.MyMeth() == MethodsTestClass26_Enum.a) + { + return true; + } + else + { + return false; + } + } + } + class MethodsTestClass26_C + { + public MethodsTestClass26_C(int intI) + { + intTest = intI; + } + public int intTest; + } + public class MethodsTestClass26 + { + //class return type + MethodsTestClass26_C MyMeth() + { + return new MethodsTestClass26_C(3); + } + public static bool testMethod() + { + MethodsTestClass26 test = new MethodsTestClass26(); + if (test.MyMeth().intTest == 3) + { + return true; + } + else + { + return false; + } + } + } + + public interface MethodsTestClass29_Interface + { + int RetInt(); + } + + public class MethodsTestClass29 : MethodsTestClass29_Interface + { + + int MethodsTestClass29_Interface.RetInt() + { + return 2; + } + + public static bool testMethod() + { + try + { + MethodsTestClass29_Interface test = new MethodsTestClass29(); + if (test.RetInt() == 2) + { + return true; + } + else + { + return false; + } + } + catch + { + return false; + } + } + } + public interface MethodsTestClass30_Interface + { + int RetInt(); + } + public interface MethodsTestClass30_Interface2 + { + int RetInt(); + } + public class MethodsTestClass30 : MethodsTestClass30_Interface, MethodsTestClass30_Interface2 + { + int MethodsTestClass30_Interface.RetInt() + { + return 2; + } + int MethodsTestClass30_Interface2.RetInt() + { + return 3; + } + public static bool testMethod() + { + try + { + MethodsTestClass30_Interface test1 = new MethodsTestClass30(); + MethodsTestClass30_Interface2 test2 = new MethodsTestClass30(); + if ((test1.RetInt() == 2) && (test2.RetInt() == 3)) + { + return true; + } + else + { + return false; + } + } + catch + { + return false; + } + } + } + + public class MethodsTestClass33 + { + //1 parameter + int RetInt(int MyInt) + { + return MyInt; + } + public static bool testMethod() + { + MethodsTestClass33 test = new MethodsTestClass33(); + if (test.RetInt(3) == 3) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass34 + { + //2 parameters + int RetInt(int MyInt1, int MyInt2) + { + return (MyInt1 + MyInt2); + } + public static bool testMethod() + { + MethodsTestClass34 test = new MethodsTestClass34(); + if (test.RetInt(3, 4) == 7) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass35 + { + //multiple parameters + int RetInt(int MyInt1, int MyInt2, int MyInt3, int MyInt4, int MyInt5, int MyInt6, int MyInt7, int MyInt8, int MyInt9, int MyInt10) + { + return (MyInt1 + MyInt2 + MyInt3 + MyInt4 + MyInt5 + MyInt6 + MyInt7 + MyInt8 + MyInt9 + MyInt10); + } + public static bool testMethod() + { + MethodsTestClass35 test = new MethodsTestClass35(); + if (test.RetInt(2, 2, 2, 2, 2, 2, 2, 2, 2, 2) == 20) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass56 + { + public int intI = 1; + public int TestMeth(int intI) + { + return intI; + } + public static bool testMethod() + { + MethodsTestClass56 test = new MethodsTestClass56(); + if (test.TestMeth(2) == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass57 + { + public int intI = 1; + public int TestMeth() + { + int intI = 2; + return intI; + } + public static bool testMethod() + { + MethodsTestClass57 test = new MethodsTestClass57(); + if (test.TestMeth() == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass58 + { + public int TestMeth(int intI) + { + return intI; + } + public static bool testMethod() + { + short s = 2; + MethodsTestClass58 test = new MethodsTestClass58(); + if (test.TestMeth(s) == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Base59 + { + public int intI = 2; + } + public class MyDerived : MethodsTestClass_Base59 { } + public class MethodsTestClass59 + { + public int TestMeth(MethodsTestClass_Base59 tc) + { + return tc.intI; + } + public static bool testMethod() + { + MethodsTestClass59 test = new MethodsTestClass59(); + MyDerived md = new MyDerived(); + if (test.TestMeth(md) == 2) + { + return true; + } + else + { + return false; + } + } + } + public interface MethodsTestClass_Interface60 + { + int intRet(); + } + public class MethodsTestClass_Derived60 : MethodsTestClass_Interface60 + { + public int intRet() + { + return 2; + } + } + public class MethodsTestClass60 + { + public int TestMeth(MethodsTestClass_Interface60 ti) + { + return ti.intRet(); + } + public static bool testMethod() + { + MethodsTestClass60 test = new MethodsTestClass60(); + MethodsTestClass_Derived60 md = new MethodsTestClass_Derived60(); + if (test.TestMeth(md) == 2) + { + return true; + } + else + { + return false; + } + } + } + public class C1 + { + public int intI = 2; + } + public class C2 + { + public static implicit operator C1(C2 MyC) + { + return new C1(); + } + } + public class MethodsTestClass61 + { + public int TestMeth(C1 c) + { + return c.intI; + } + public static bool testMethod() + { + MethodsTestClass61 test = new MethodsTestClass61(); + C2 MyC2 = new C2(); + if (test.TestMeth(MyC2) == 2) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass66 + { + int int1; + public void TestMeth(int intI) + { + intI = 3; + int1 = intI; + } + public static bool testMethod() + { + int intJ = 2; + MethodsTestClass66 test = new MethodsTestClass66(); + test.TestMeth(intJ); + if ((test.int1 == 3) && (intJ == 2)) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass67 + { + string strS; + public void TestMeth(string s) + { + s = "string1"; + strS = s; + } + public static bool testMethod() + { + string strtest = "string0"; + MethodsTestClass67 test = new MethodsTestClass67(); + test.TestMeth(strtest); + if ((test.strS.Equals("string1")) && (strtest.Equals("string0"))) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Sub68 + { + public int testint; + public MethodsTestClass_Sub68(int intI) + { + testint = intI; + } + } + public class MethodsTestClass68 + { + MethodsTestClass_Sub68 tc; + public void TestMeth(MethodsTestClass_Sub68 t) + { + t = new MethodsTestClass_Sub68(3); + tc = t; + } + public static bool testMethod() + { + MethodsTestClass_Sub68 tc2 = new MethodsTestClass_Sub68(2); + MethodsTestClass68 test = new MethodsTestClass68(); + test.TestMeth(tc2); + if ((tc2.testint == 2) && (test.tc.testint == 3)) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass69 + { + int int1; + public void TestMeth(ref int intI) + { + intI = 3; + int1 = intI; + } + public static bool testMethod() + { + int intJ = 2; + MethodsTestClass69 test = new MethodsTestClass69(); + test.TestMeth(ref intJ); + if ((test.int1 == 3) && (intJ == 3)) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass70 + { + string strS; + public void TestMeth(ref string s) + { + s = "string1"; + strS = s; + } + public static bool testMethod() + { + string strtest = "string0"; + MethodsTestClass70 test = new MethodsTestClass70(); + test.TestMeth(ref strtest); + if ((test.strS.Equals("string1")) && (strtest.Equals("string1"))) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Sub71 + { + public int testint; + public MethodsTestClass_Sub71(int intI) + { + testint = intI; + } + } + public class MethodsTestClass71 + { + MethodsTestClass_Sub71 tc; + public void TestMeth(ref MethodsTestClass_Sub71 t) + { + t = new MethodsTestClass_Sub71(3); + tc = t; + } + public static bool testMethod() + { + MethodsTestClass_Sub71 tc2 = new MethodsTestClass_Sub71(2); + MethodsTestClass71 test = new MethodsTestClass71(); + test.TestMeth(ref tc2); + if ((tc2.testint == 3) && (test.tc.testint == 3)) + { + return true; + } + else + { + return false; + } + } + } + + class MethodsTestClass_Base75 { } + + class MethodsTestClass_Derived75 : MethodsTestClass_Base75 { } + public class MethodsTestClass75 + { + int intI; + public int TestMeth(ref int I1) + { + return I1; + } + public static bool testMethod() + { + MethodsTestClass75 test = new MethodsTestClass75(); + if (test.TestMeth(ref test.intI) == 0) + { + return true; + } + else + { + return false; + } + } + } + + + public class MethodsTestClass78 + { + int int1; + public void TestMeth(out int intI) + { + intI = 3; + int1 = intI; + } + public static bool testMethod() + { + int intJ = 2; + MethodsTestClass78 test = new MethodsTestClass78(); + test.TestMeth(out intJ); + if ((test.int1 == 3) && (intJ == 3)) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass79 + { + string strS; + public void TestMeth(out string s) + { + s = "string1"; + strS = s; + } + public static bool testMethod() + { + string strtest = "string0"; + MethodsTestClass79 test = new MethodsTestClass79(); + test.TestMeth(out strtest); + if ((test.strS.Equals("string1")) && (strtest.Equals("string1"))) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Sub80 + { + public int testint; + public MethodsTestClass_Sub80(int intI) + { + testint = intI; + } + } + public class MethodsTestClass80 + { + MethodsTestClass_Sub80 tc; + public void TestMeth(out MethodsTestClass_Sub80 t) + { + t = new MethodsTestClass_Sub80(3); + tc = t; + } + public static bool testMethod() + { + MethodsTestClass_Sub80 tc2 = new MethodsTestClass_Sub80(2); + MethodsTestClass80 test = new MethodsTestClass80(); + test.TestMeth(out tc2); + if ((tc2.testint == 3) && (test.tc.testint == 3)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass84 + { + public void TestMeth(out int intI) + { + intI = 2; + } + public static bool testMethod() + { + int intJ; + MethodsTestClass84 test = new MethodsTestClass84(); + test.TestMeth(out intJ); + if (intJ == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Sub85 + { + public int intI; + public MethodsTestClass_Sub85(int intJ) + { + intI = intJ; + } + } + public class MethodsTestClass85 + { + public void TestMeth(out MethodsTestClass_Sub85 tc) + { + tc = new MethodsTestClass_Sub85(2); + } + public static bool testMethod() + { + MethodsTestClass_Sub85 tctest; + MethodsTestClass85 test = new MethodsTestClass85(); + test.TestMeth(out tctest); + if (tctest.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + + public class MethodsTestClass92 + { + public void TestMeth(out int intI, out int intJ) + { + intI = 2; + intJ = 3; + } + public static bool testMethod() + { + MethodsTestClass92 test = new MethodsTestClass92(); + int i1, i2; + test.TestMeth(out i1, out i2); + if ((i1 == 2) && (i2 == 3)) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass93 + { + public void TestMeth(ref int intI, out int intJ) + { + intJ = 3; + } + public static bool testMethod() + { + MethodsTestClass93 test = new MethodsTestClass93(); + int i1 = 2; + int i2; + test.TestMeth(ref i1, out i2); + if ((i1 == 2) && (i2 == 3)) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass94 + { + public void TestMeth(int intI, out int intJ) + { + intI = 4; + intJ = 3; + } + public static bool testMethod() + { + MethodsTestClass94 test = new MethodsTestClass94(); + int i1 = 2; + int i2; + test.TestMeth(i1, out i2); + if ((i1 == 2) && (i2 == 3)) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass95 + { + public void TestMeth(int intI, ref int intJ) + { + intI = 4; + intJ = 3; + } + public static bool testMethod() + { + MethodsTestClass95 test = new MethodsTestClass95(); + int i1 = 2; + int i2 = 5; + test.TestMeth(i1, ref i2); + if ((i1 == 2) && (i2 == 3)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass103_Sub + { + public int Test() + { + return 2; + } + } + public class MethodsTestClass103 : MethodsTestClass103_Sub + { + public int Test() + { + return 3; + } + public static bool testMethod() + { + MethodsTestClass103_Sub TC = new MethodsTestClass103(); + if (TC.Test() == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Sub104 + { + public virtual int Test() + { + return 102; + } + } + public class MethodsTestClass104 : MethodsTestClass_Sub104 + { + public new int Test() + { + return 103; + } + public static bool testMethod() + { + MethodsTestClass_Sub104 TC = new MethodsTestClass104(); + if (TC.Test() == 102) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Sub105 + { + public int Test() + { + return 102; + } + } + public class MethodsTestClass105 : MethodsTestClass_Sub105 + { + public new virtual int Test() + { + return 103; + } + public static bool testMethod() + { + MethodsTestClass_Sub105 TC = new MethodsTestClass105(); + if (TC.Test() == 102) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass106 + { + public virtual int Test() + { + return 103; + } + public static bool testMethod() + { + MethodsTestClass106 TC = new MethodsTestClass106(); + if (TC.Test() == 103) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Sub107 + { + public virtual int Test() + { + return 102; + } + } + public class MethodsTestClass107 : MethodsTestClass_Sub107 + { + public new virtual int Test() + { + return 103; + } + public static bool testMethod() + { + MethodsTestClass_Sub107 TC = new MethodsTestClass107(); + if (TC.Test() == 102) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Sub108 + { + public virtual int Test() + { + return 102; + } + } + public class MethodsTestClass108 : MethodsTestClass_Sub108 + { + public override int Test() + { + return 103; + } + public static bool testMethod() + { + MethodsTestClass_Sub108 TC = new MethodsTestClass108(); + if (TC.Test() == 103) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Sub109 + { + public virtual int Test() + { + return 102; + } + } + public class MethodsTestClass_Sub109_2 : MethodsTestClass_Sub109 + { + public override int Test() + { + return 103; + } + } + public class MethodsTestClass109 : MethodsTestClass_Sub109_2 + { + public override int Test() + { + return 104; + } + public static bool testMethod() + { + MethodsTestClass_Sub109 TC = new MethodsTestClass109(); + MethodsTestClass_Sub109_2 TC102 = new MethodsTestClass109(); + if ((TC.Test() == 104) && (TC.Test() == 104)) + { + return true; + } + else + { + return false; + } + } + } + + //Compiled Test Cases + public class MethodsTestClass_Sub110 + { + public virtual int Test() + { + return 2; + } + } + public class MethodsTestClass_Sub1102 : MethodsTestClass_Sub110 + { + new public virtual int Test() + { + return 3; + } + } + public class MethodsTestClass110 : MethodsTestClass_Sub1102 + { + public static bool testMethod() + { + MethodsTestClass_Sub110 TC = new MethodsTestClass110(); + MethodsTestClass_Sub1102 TC2 = new MethodsTestClass110(); + if ((TC.Test() == 2) && (TC2.Test() == 3)) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Sub111 + { + public virtual int Test() + { + return 2; + } + } + public class MethodsTestClass_Sub1112 : MethodsTestClass_Sub111 + { + public override int Test() + { + return 3; + } + } + public class MethodsTestClass111 : MethodsTestClass_Sub1112 + { + public static bool testMethod() + { + MethodsTestClass_Sub111 TC = new MethodsTestClass111(); + MethodsTestClass_Sub1112 TC2 = new MethodsTestClass111(); + if ((TC.Test() == 3) && (TC.Test() == 3)) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Sub112A + { + public virtual int Test() { return 1; } + } + public class MethodsTestClass_Sub112B : MethodsTestClass_Sub112A + { + public override int Test() { return 2; } + } + public class MethodsTestClass_Sub112C : MethodsTestClass_Sub112B + { + public new virtual int Test() { return 3; } + } + public class MethodsTestClass_Sub112D : MethodsTestClass_Sub112C + { + public override int Test() { return 4; } + } + public class MethodsTestClass112 : MethodsTestClass_Sub112D + { + public static bool testMethod() + { + MethodsTestClass_Sub112D d = new MethodsTestClass_Sub112D(); + MethodsTestClass_Sub112A a = d; + MethodsTestClass_Sub112B b = d; + MethodsTestClass_Sub112C c = d; + if ((d.Test() == 4) && (c.Test() == 4) && (b.Test() == 2) && (a.Test() == 2)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass_Base116 + { + public virtual void Test() { } + } + public abstract class MethodsTestClass_Base116_2 : MethodsTestClass_Base116 + { + public override abstract void Test(); + } + public class MethodsTestClass116 : MethodsTestClass_Base116_2 + { + public override void Test() { } + public static bool testMethod() + { + MethodsTestClass116 tc = new MethodsTestClass116(); + tc.Test(); + return true; + } + } + public class MethodsTestClass_Base117 + { + public virtual int Test() + { + return 1; + } + } + public class MethodsTestClass117 : MethodsTestClass_Base117 + { + public override int Test() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass_Base117 BC = new MethodsTestClass117(); + if (BC.Test() == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Base118 + { + public int GetVal() + { + return Test(); + } + protected virtual int Test() + { + return 1; + } + } + public class MethodsTestClass118 : MethodsTestClass_Base118 + { + protected override int Test() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass_Base118 BC = new MethodsTestClass118(); + if (BC.GetVal() == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Base119 + { + public int GetVal() + { + return Test(); + } + internal virtual int Test() + { + return 1; + } + } + public class MethodsTestClass119 : MethodsTestClass_Base119 + { + internal override int Test() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass_Base119 BC = new MethodsTestClass119(); + if (BC.GetVal() == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Base120 + { + public int GetVal() + { + return Test(); + } + protected internal virtual int Test() + { + return 1; + } + } + public class MethodsTestClass120 : MethodsTestClass_Base120 + { + protected internal override int Test() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass_Base120 BC = new MethodsTestClass120(); + if (BC.GetVal() == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Base121 + { + public virtual int Test() + { + return 1; + } + } + public class MethodsTestClass_Base121_2 : MethodsTestClass_Base121 + { + new private int Test() + { + return 2; + } + } + public class MethodsTestClass121 : MethodsTestClass_Base121_2 + { + public override int Test() + { + return 3; + } + public static bool testMethod() + { + MethodsTestClass_Base121 BC = new MethodsTestClass121(); + if (BC.Test() == 3) + { + return true; + } + else + { + return false; + } + } + } + + public abstract class MethodsTestClass_Base124 + { + public abstract int Test(); + } + public class MethodsTestClass124 : MethodsTestClass_Base124 + { + public override int Test() + { + return 1; + } + public static bool testMethod() + { + MethodsTestClass_Base124 BC = new MethodsTestClass124(); + if (BC.Test() == 1) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Base125 + { + public virtual int Test() + { + return 1; + } + } + public class MethodsTestClass_Base125_2 : MethodsTestClass_Base125 + { + public override int Test() + { + return 2; + } + } + public class MethodsTestClass125 : MethodsTestClass_Base125_2 + { + public override int Test() + { + return 3; + } + public static bool testMethod() + { + MethodsTestClass_Base125 BC = new MethodsTestClass125(); + MethodsTestClass_Base125_2 BC2 = new MethodsTestClass125(); + if ((BC.Test() == 3) && (BC2.Test() == 3)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass_Base132 + { + public virtual int Test() + { + return 1; + } + } + + public class MethodsTestClass132 : MethodsTestClass_Base132 + { + public override int Test() + { + return 2; + } + public int RetVal() + { + return base.Test(); + } + public static bool testMethod() + { + MethodsTestClass132 MC = new MethodsTestClass132(); + if ((MC.Test() == 2) && (MC.RetVal() == 1)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass_Base133 + { + public virtual int Test() + { + return 1; + } + } + public class MethodsTestClass133 : MethodsTestClass_Base133 + { + public override int Test() + { + return 2; + } + public int RetVal() + { + return ((MethodsTestClass_Base133)this).Test(); + } + public static bool testMethod() + { + MethodsTestClass133 MC = new MethodsTestClass133(); + if ((MC.Test() == 2) && (MC.RetVal() == 2)) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Base134 + { + public virtual int Test() + { + return 1; + } + } + public class MethodsTestClass134 : MethodsTestClass_Base134 + { + public int Test() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass_Base134 BC = new MethodsTestClass134(); + if (BC.Test() == 1) + { + return true; + } + else + { + return false; + } + } + } + + public abstract class MethodsTestClass_Base142 + { + public abstract int Test(); + } + public class MethodsTestClass142 : MethodsTestClass_Base142 + { + public override int Test() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass_Base142 BC = new MethodsTestClass142(); + if (BC.Test() == 2) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass148 + { + int intI = 2; + public void Test() + { + return; + intI = 3; + } + public static bool testMethod() + { + MethodsTestClass148 test = new MethodsTestClass148(); + test.Test(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass149 + { + public long RetVal() + { + int ret = 2; + return ret; + } + public static bool testMethod() + { + MethodsTestClass149 test = new MethodsTestClass149(); + if (test.RetVal() == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass_Sub150 + { + public int IntI = 2; + public static implicit operator int(MethodsTestClass_Sub150 t) + { + return t.IntI; + } + } + public class MethodsTestClass150 + { + public long RetVal() + { + MethodsTestClass_Sub150 tc = new MethodsTestClass_Sub150(); + return tc; + } + public static bool testMethod() + { + MethodsTestClass150 test = new MethodsTestClass150(); + if (test.RetVal() == 2) + { + return true; + } + else + { + return false; + } + } + } + public class MethodsTestClass154 + { + public long RetVal(bool b) + { + + long ret = 2; + + if (b == true) + { + return ret; + } + else + { + return (ret + 1); + } + } + public static bool testMethod() + { + MethodsTestClass154 test = new MethodsTestClass154(); + if ((test.RetVal(true) == 2) && (test.RetVal(false) == 3)) + { + return true; + } + else + { + return false; + } + } + } + + + public class MethodsTestClass159 + { + public long RetVal() + { + throw new System.Exception(); + } + public static bool testMethod() + { + bool val = false; + MethodsTestClass159 test = new MethodsTestClass159(); + try + { + test.RetVal(); + } + catch + { + val = true; + } + return val; + } + } + + public class MethodsTestClass160 + { + public long RetVal(bool b) + { + + long ret = 2; + + if (b == true) + { + return ret; + } + else + { + throw new System.Exception(); + } + } + public static bool testMethod() + { + bool val = false; + MethodsTestClass160 test = new MethodsTestClass160(); + if (test.RetVal(true) != 2) + { + return false; + } + try + { + test.RetVal(false); + } + catch (System.Exception e) + { + val = true; + } + return val; + } + } + + public class MethodsTestClass161 + { + public long RetVal(bool b) + { + + long ret = 2; + + if (b == true) + { + throw new System.Exception(); + } + else + { + return ret; + } + } + public static bool testMethod() + { + bool val = false; + MethodsTestClass161 test = new MethodsTestClass161(); + if (test.RetVal(false) != 2) + { + return false; + } + try + { + test.RetVal(true); + } + catch (System.Exception e) + { + val = true; + } + return val; + } + } + + public class MethodsTestClass163 + { + public int MyMeth1(params int[] values) + { + return values[0] + values[1] + values[2]; + } + public static int MyMeth2(params int[] values) + { + return values[0] + values[1] + values[2]; + } + public static bool testMethod() + { + int intI = 1; + int intJ = 2; + int intK = 3; + MethodsTestClass163 mc = new MethodsTestClass163(); + if ((mc.MyMeth1(intI, intJ, intK) == 6) && (MyMeth2(intI, intJ, intK) == 6)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass164 + { + public int MyMeth1(params int[][] values) + { + return values[0][0] + values[1][0] + values[2][0]; + } + public static int MyMeth2(params int[][] values) + { + return values[0][0] + values[1][0] + values[2][0]; + } + public static bool testMethod() + { + int[] intI = { 1 }; + int[] intJ = { 2 }; + int[] intK = { 3 }; + MethodsTestClass164 mc = new MethodsTestClass164(); + if ((mc.MyMeth1(intI, intJ, intK) == 6) && (MyMeth2(intI, intJ, intK) == 6)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass169 + { + public int MyMeth1(params int[] values) + { + return values[0] + values[1] + values[2]; + } + public static int MyMeth2(params int[] values) + { + return values[0] + values[1] + values[2]; + } + public static bool testMethod() + { + MethodsTestClass169 mc = new MethodsTestClass169(); + if ((mc.MyMeth1(new int[] { 1, 2, 3 }) == 6) && (MyMeth2(new int[] { 1, 2, 3 }) == 6)) + { + return true; + } + else + { + return false; + } + } + } + + public class MyType + { + public int intI = 2; + } + + public class MethodsTestClass172 + { + public int MyMeth1(params int[] values) + { + return 2; + } + public static int MyMeth2(params int[] values) + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass172 mc = new MethodsTestClass172(); + if ((mc.MyMeth1() == 2) && (MyMeth2() == 2)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass173 + { + public int MyMeth1(params int[] values) + { + return values[0]; + } + public static int MyMeth2(params int[] values) + { + return values[0]; + } + public static bool testMethod() + { + int intI = 2; + MethodsTestClass173 mc = new MethodsTestClass173(); + if ((mc.MyMeth1(intI) == 2) && (MyMeth2(intI) == 2)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass174 + { + public int MyMeth1(params int[] values) + { + return values[0]; + } + public static int MyMeth2(params int[] values) + { + return values[0]; + } + public static bool testMethod() + { + int i = 1; + short s = 2; + byte b = 3; + MethodsTestClass174 mc = new MethodsTestClass174(); + if ((mc.MyMeth1(i, s, b) == 1) && (MyMeth2(i, s, b) == 1)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass175 + { + public int MyMeth1(params int[] values) + { + return values[0]; + } + public static int MyMeth2(params int[] values) + { + return values[0]; + } + public static bool testMethod() + { + short s = 2; + MethodsTestClass175 mc = new MethodsTestClass175(); + if ((mc.MyMeth1(s) == 2) && (MyMeth2(s) == 2)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass179 + { + public int MyMeth1(int intI, params int[] values) + { + return values[0] + values[1] + intI; + } + public static int MyMeth2(int intI, params int[] values) + { + return values[0] + values[1] + intI; + } + public static bool testMethod() + { + int intI = 1; + int intJ = 2; + int intK = 3; + MethodsTestClass179 mc = new MethodsTestClass179(); + if ((mc.MyMeth1(intI, intJ, intK) == 6) && (MyMeth2(intI, intJ, intK) == 6)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass180 + { + public int MyMeth1(int intI, int intJ, int intK) + { + return 1; + } + public int MyMeth1(params int[] values) + { + return 2; + } + public static int MyMeth2(int intI, int intJ, int intK) + { + return 1; + } + public static int MyMeth2(params int[] values) + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass180 mc = new MethodsTestClass180(); + if ((mc.MyMeth1(1, 2) == 2) && (mc.MyMeth1(1, 2, 3) == 1) && (MyMeth2(1, 2) == 2) && (MyMeth2(1, 2, 3) == 1)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass181 + { + public int MyMeth1(int intI, int intJ, int intK) + { + return 1; + } + public int MyMeth1(params int[] values) + { + return 2; + } + public static int MyMeth2(int intI, int intJ, int intK) + { + return 1; + } + public static int MyMeth2(params int[] values) + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass181 mc = new MethodsTestClass181(); + if ((mc.MyMeth1(1, 2, 3, 4) == 2) && (mc.MyMeth1(1, 2, 3) == 1) && (MyMeth2(1, 2, 3, 4) == 2) && (MyMeth2(1, 2, 3) == 1)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass182 + { + public int MyMeth1(params short[] values) + { + return 1; + } + public int MyMeth1(params int[] values) + { + return 2; + } + public static int MyMeth2(params short[] values) + { + return 1; + } + public static int MyMeth2(params int[] values) + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass182 mc = new MethodsTestClass182(); + short s1 = 1, s2 = 1, s3 = 1; + int i1 = 2, i2 = 2, i3 = 2; + if ((mc.MyMeth1(s1, s2, s3) == 1) && (mc.MyMeth1(i1, i2, i3) == 2) && (MyMeth2(s1, s2, s3) == 1) && (MyMeth2(i1, i2, i3) == 2)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass183 + { + public int MyMeth1(params short[] values) + { + return 1; + } + public int MyMeth1(params int[] values) + { + return 2; + } + public static int MyMeth2(params short[] values) + { + return 1; + } + public static int MyMeth2(params int[] values) + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass183 mc = new MethodsTestClass183(); + short s1 = 1; + int i1 = 2; + if ((mc.MyMeth1(s1, i1) == 2) && (MyMeth2(s1, i1) == 2)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass184 + { + public int MyMeth1(params long[] values) + { + return 1; + } + public int MyMeth1(params int[] values) + { + return 2; + } + public static int MyMeth2(params long[] values) + { + return 1; + } + public static int MyMeth2(params int[] values) + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass184 mc = new MethodsTestClass184(); + short s1 = 1; + byte b1 = 2; + if ((mc.MyMeth1(s1, b1) == 2) && (MyMeth2(s1, b1) == 2)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass185 + { + public int MyMeth1(params int[] values) + { + values[0] = 3; + return values[0]; + } + public static int MyMeth2(params int[] values) + { + values[0] = 4; + return values[0]; + } + public static bool testMethod() + { + MethodsTestClass185 mc = new MethodsTestClass185(); + int intI = 2; + if ((mc.MyMeth1(intI) == 3) && (MyMeth2(intI) == 4) && (intI == 2)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass186 + { + public int MyMeth1(params int[] values) + { + return MyMeth2(values); + } + public int MyMeth2(params int[] values) + { + return 3; + } + public static bool testMethod() + { + MethodsTestClass186 mc = new MethodsTestClass186(); + int intI = 2; + if (mc.MyMeth1(intI) == 3) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass187 + { + public int MyMeth1(params object[] values) + { + return MyMeth2((object)values); + } + public int MyMeth2(params object[] values) + { + return values.Length; + } + public static bool testMethod() + { + MethodsTestClass187 mc = new MethodsTestClass187(); + if (mc.MyMeth1(2, 3) == 1) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass_Base188 + { + public int MyMeth() + { + return 2; + } + } + public class MethodsTestClass_Derived188 : MethodsTestClass_Base188 + { + } + public class MethodsTestClass188 : MethodsTestClass_Derived188 + { + public int MyTest() + { + return base.MyMeth(); + } + public static bool testMethod() + { + MethodsTestClass188 mc = new MethodsTestClass188(); + if (mc.MyTest() == 2) + { + return true; + } + else + { + return false; + } + } + } + + + public class MethodsTestClass_Base190 + { + protected int MyMeth1(params int[] values) + { + return values[0] + values[1] + values[2]; + } + protected static int MyMeth2(params int[] values) + { + return values[0] + values[1] + values[2]; + } + } + public class MethodsTestClass190 : MethodsTestClass_Base190 + { + public static bool testMethod() + { + int intI = 1; + int intJ = 2; + int intK = 3; + MethodsTestClass190 mc = new MethodsTestClass190(); + if ((mc.MyMeth1(intI, intJ, intK) == 6) && (MyMeth2(intI, intJ, intK) == 6)) + { + return true; + } + else + { + return false; + } + } + } + + public class MyTest + { + internal int MyMeth1(params int[] values) + { + return values[0] + values[1] + values[2]; + } + internal static int MyMeth2(params int[] values) + { + return values[0] + values[1] + values[2]; + } + } + public class MethodsTestClass191 + { + public static bool testMethod() + { + int intI = 1; + int intJ = 2; + int intK = 3; + MyTest mc = new MyTest(); + if ((mc.MyMeth1(intI, intJ, intK) == 6) && (MyTest.MyMeth2(intI, intJ, intK) == 6)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass192_Test + { + protected internal int MyMeth1(params int[] values) + { + return values[0] + values[1] + values[2]; + } + protected internal static int MyMeth2(params int[] values) + { + return values[0] + values[1] + values[2]; + } + } + public class MethodsTestClass192 + { + public static bool testMethod() + { + int intI = 1; + int intJ = 2; + int intK = 3; + MyTest mc = new MyTest(); + if ((mc.MyMeth1(intI, intJ, intK) == 6) && (MyTest.MyMeth2(intI, intJ, intK) == 6)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass193 + { + private int MyMeth1(params int[] values) + { + return values[0] + values[1] + values[2]; + } + private static int MyMeth2(params int[] values) + { + return values[0] + values[1] + values[2]; + } + public static bool testMethod() + { + int intI = 1; + int intJ = 2; + int intK = 3; + MethodsTestClass193 mc = new MethodsTestClass193(); + if ((mc.MyMeth1(intI, intJ, intK) == 6) && (MyMeth2(intI, intJ, intK) == 6)) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass_Base194 + { + public virtual int MyMeth1(params int[] values) + { + return values[0] + values[1] + values[2]; + } + } + public class MethodsTestClass194 : MethodsTestClass_Base194 + { + public override int MyMeth1(params int[] values) + { + return -1; + } + public static bool testMethod() + { + int intI = 1; + int intJ = 2; + int intK = 3; + MethodsTestClass_Base194 mc = new MethodsTestClass194(); + if (mc.MyMeth1(intI, intJ, intK) == -1) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass_Base195 + { + public virtual int MyMeth1(params int[] values) + { + return values[0] + values[1] + values[2]; + } + } + public class MethodsTestClass195 : MethodsTestClass_Base195 + { + public new int MyMeth1(params int[] values) + { + return -1; + } + public static bool testMethod() + { + int intI = 1; + int intJ = 2; + int intK = 3; + MethodsTestClass_Base195 mc = new MethodsTestClass195(); + if (mc.MyMeth1(intI, intJ, intK) == 6) + { + return true; + } + else + { + return false; + } + } + } + + public abstract class MethodsTestClass_Base196 + { + public abstract int MyMeth1(params int[] values); + } + public class MethodsTestClass196 : MethodsTestClass_Base196 + { + public override int MyMeth1(params int[] values) + { + return values[0] + values[1] + values[2]; + } + public static bool testMethod() + { + int intI = 1; + int intJ = 2; + int intK = 3; + MethodsTestClass_Base196 mc = new MethodsTestClass196(); + if (mc.MyMeth1(intI, intJ, intK) == 6) + { + return true; + } + else + { + return false; + } + } + } + + public delegate int MyDelegate(params int[] values); + public class MethodsTestClass197 + { + public int MyMeth1(params int[] values) + { + return values[0] + values[1] + values[2]; + } + public MyDelegate md; + public static bool testMethod() + { + int intI = 1; + int intJ = 2; + int intK = 3; + MethodsTestClass197 mc = new MethodsTestClass197(); + mc.md = new MyDelegate(mc.MyMeth1); + if (mc.md(intI, intJ, intK) == 6) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass_Base199 + { + public virtual int RetInt() + { + return 1; + } + } + public class MethodsTestClass199 : MethodsTestClass_Base199 + { + public sealed override int RetInt() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass199 MC = new MethodsTestClass199(); + if (MC.RetInt() == 2) + { + return true; + } + else + { + return false; + } + } + } + //Compiled Test Cases + + public class MethodsTestClass200 + { + public int MyMeth() + { + + int int1 = 1; + int int2 = 2; + int int3 = 3; + int int4 = 4; + int int5 = 5; + int int6 = 6; + int int7 = 7; + int int8 = 8; + int int9 = 9; + int int10 = 10; + int int11 = 11; + int int12 = 12; + int int13 = 13; + int int14 = 14; + int int15 = 15; + int int16 = 16; + int int17 = 17; + int int18 = 18; + int int19 = 19; + int int20 = 20; + int int21 = 21; + int int22 = 22; + int int23 = 23; + int int24 = 24; + int int25 = 25; + int int26 = 26; + int int27 = 27; + int int28 = 28; + int int29 = 29; + int int30 = 30; + int int31 = 31; + int int32 = 32; + int int33 = 33; + + int intRet = int1 + int2 + int3 + int4 + int5 + int6 + int7 + int8 + int9 + int10 + + int11 + int12 + int13 + int14 + int15 + int16 + int17 + int18 + int19 + int20 + + int21 + int22 + int23 + int24 + int25 + int26 + int27 + int28 + int29 + int30 + + int31 + int32 + int33; + + return intRet; + + } + + public static bool testMethod() + { + + MethodsTestClass200 MC = new MethodsTestClass200(); + + if (MC.MyMeth() == 561) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass201 + { + public static int MyMeth() + { + int int1 = 1; + int int2 = 2; + int int3 = 3; + int int4 = 4; + int int5 = 5; + int int6 = 6; + int int7 = 7; + int int8 = 8; + int int9 = 9; + int int10 = 10; + int int11 = 11; + int int12 = 12; + int int13 = 13; + int int14 = 14; + int int15 = 15; + int int16 = 16; + int int17 = 17; + int int18 = 18; + int int19 = 19; + int int20 = 20; + int int21 = 21; + int int22 = 22; + int int23 = 23; + int int24 = 24; + int int25 = 25; + int int26 = 26; + int int27 = 27; + int int28 = 28; + int int29 = 29; + int int30 = 30; + int int31 = 31; + int int32 = 32; + int int33 = 33; + int intRet = int1 + int2 + int3 + int4 + int5 + int6 + int7 + int8 + int9 + int10 + + int11 + int12 + int13 + int14 + int15 + int16 + int17 + int18 + int19 + int20 + + int21 + int22 + int23 + int24 + int25 + int26 + int27 + int28 + int29 + int30 + + int31 + int32 + int33; + + return intRet; + } + public static bool testMethod() + { + + if (MyMeth() == 561) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass204 + { + public int MyMeth(int i, int j, params int[] k) + { + return i + j; + } + public static bool testMethod() + { + MethodsTestClass204 MC = new MethodsTestClass204(); + if (MC.MyMeth(1, 2) == 3) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass205 + { + public static int MyMeth(int i, int j, params int[] k) + { + return i + j; + } + public static bool testMethod() + { + if (MyMeth(1, 2) == 3) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass_Sub206 + { + private static int MyMeth(int intI) + { + return 1; + } + public static int MyMeth(params int[] intI) + { + return 202; + } + } + public class MethodsTestClass206 + { + public static bool testMethod() + { + if(MethodsTestClass_Sub206.MyMeth(201) == 202) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass_Sub207 + { + private int MyMeth(int intI) + { + return 1; + } + public int MyMeth(params int[] intI) + { + return 202; + } + } + public class MethodsTestClass207 + { + public static bool testMethod() + { + MethodsTestClass_Sub207 MC = new MethodsTestClass_Sub207(); + if (MC.MyMeth(201) == 202) + { + return true; + } + else + { + return false; + } + } + } + + //Compiled Test Cases + + public class MyMethodsTestClass_Base210 + { + public virtual int MyMeth(int intI) + { + return 1; + } + } + public class MethodsTestClass210_sub : MyMethodsTestClass_Base210 + { + public sealed override int MyMeth(int intI) + { + return 3; + } + } + public class MethodsTestClass210 + { + public static bool testMethod() + { + MethodsTestClass210_sub MC = new MethodsTestClass210_sub(); + if (MC.MyMeth(1) == 3) + { + return true; + } + else + { + return false; + } + } + } + + public class MethodsTestClass223_Sub + { + public int MyMeth(ref int mbc) + { + return 1; + } + public int MyMeth(int mbc) + { + return 2; + } + } + public class MethodsTestClass223 + { + public static bool testMethod() + { + int retval = 3; + MethodsTestClass223_Sub mc = new MethodsTestClass223_Sub(); + retval -= mc.MyMeth(1); + int i = 1; + retval -= mc.MyMeth(ref i); + return (retval == 0); + } + } + + + public class MethodsTestClass224_Sub + { + public int MyMeth(out int mbc) + { + mbc = 666; + return 1; + } + public int MyMeth(int mbc) + { + return 2; + } + } + public class MethodsTestClass224 + { + public static bool testMethod() + { + int retval = 3; + MethodsTestClass224_Sub mc = new MethodsTestClass224_Sub(); + retval -= mc.MyMeth(1); + int i; + retval -= mc.MyMeth(out i); + return (retval == 0); + } + } + + public class MethodsTestClass229_SubB + { + public virtual void f() { } + } + + public class MethodsTestClass229 : MethodsTestClass229_SubB + { + public void f() // CS0114 + { + } + public static bool testMethod() + { + return true; + } + + } + + public class MethodsTestClass230_Base + { + virtual public object f(int x, string y) { return null; } + } + + public class MethodsTestClass230 : MethodsTestClass230_Base + { + object f(int x, string y) // CS0114 + { + return null; + } + + public static bool testMethod() + { + return true; + } + } + + public class MethodsTestClass231_Base + { + virtual public object f + { + get { return null; } + set { } + } + } + + public class MethodsTestClass231 : MethodsTestClass231_Base + { + object f // CS0114 + { + get { return null; } + set { } + } + + public static bool testMethod() + { + return true; + } + } + + + public delegate void MethodsTestClass232_Del(); + + public class MethodsTestClass232_B + { + public MethodsTestClass232_Del fooDel; + + public virtual event MethodsTestClass232_Del fooEv + { + add { } + remove { } + } + } + + public class MethodsTestClass232 : MethodsTestClass232_B + { + event MethodsTestClass232_Del fooEv // CS0114 + { + add { } + remove { } + } + + public static bool testMethod() + { + return true; + } + } + + + public class MethodsTestClass233_Base + { + public int MyMeth() + { + return 1; + } + } + public class MethodsTestClass233 : MethodsTestClass233_Base + { + //new modifier + new public int MyMeth() + { + return 2; + } + public static bool testMethod() + { + MethodsTestClass233 test = new MethodsTestClass233(); + if (test.MyMeth() == 2) + { + return true; + } + else + { + return false; + } + } + } + } +} diff --git a/Tests/NFUnitTestClasses/UnitTestOperatorTests.cs b/Tests/NFUnitTestClasses/UnitTestOperatorTests.cs new file mode 100644 index 00000000..201eb097 --- /dev/null +++ b/Tests/NFUnitTestClasses/UnitTestOperatorTests.cs @@ -0,0 +1,1537 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestClasses +{ + [TestClass] + class UnitTestOperatorTests + { + [TestMethod] + public void Operators1_Test() + { + Debug.WriteLine("Tests overriding unary plus"); + Assert.True(OperatorsTestClass1.testMethod()); + } + + [TestMethod] + public void Operators2_Test() + { + Debug.WriteLine("Tests overriding unary minus"); + Assert.True(OperatorsTestClass2.testMethod()); + } + + [TestMethod] + public void Operators3_Test() + { + Debug.WriteLine("Tests overriding tilde"); + Assert.True(OperatorsTestClass3.testMethod()); + } + + [TestMethod] + public void Operators4_Test() + { + Debug.WriteLine("Tests overriding increment prefix"); + Assert.True(OperatorsTestClass4.testMethod()); + } + + [TestMethod] + public void Operators5_Test() + { + Debug.WriteLine("Tests overriding increment suffix"); + Assert.True(OperatorsTestClass5.testMethod()); + } + + [TestMethod] + public void Operators6_Test() + { + Debug.WriteLine("Tests overriding decrement prefix"); + Assert.True(OperatorsTestClass6.testMethod()); + } + + [TestMethod] + public void Operators7_Test() + { + Debug.WriteLine("Tests overriding decrement suffix"); + Assert.True(OperatorsTestClass7.testMethod()); + } + + [TestMethod] + public void Operators13_Test() + { + Debug.WriteLine("Tests overriding binary plus"); + Assert.True(OperatorsTestClass13.testMethod()); + } + + [TestMethod] + public void Operators14_Test() + { + Debug.WriteLine("Tests overriding binary minus"); + Assert.True(OperatorsTestClass14.testMethod()); + } + + [TestMethod] + public void Operators15_Test() + { + Debug.WriteLine("Tests overriding asterisk (multiply)"); + Assert.True(OperatorsTestClass15.testMethod()); + } + + [TestMethod] + public void Operators16_Test() + { + Debug.WriteLine("Tests overriding slash (division)"); + Assert.True(OperatorsTestClass16.testMethod()); + } + + [TestMethod] + public void Operators17_Test() + { + Debug.WriteLine("Tests overriding percent (modulus)"); + Assert.True(OperatorsTestClass17.testMethod()); + } + + [TestMethod] + public void Operators18_Test() + { + Debug.WriteLine("Tests overriding caret (xor)"); + Assert.True(OperatorsTestClass18.testMethod()); + } + [TestMethod] + public void Operators19_Test() + { + Debug.WriteLine("Tests overriding ampersand"); + Assert.True(OperatorsTestClass19.testMethod()); + } + + [TestMethod] + public void Operators20_Test() + { + Debug.WriteLine("Tests overriding pipe (or)"); + Assert.True(OperatorsTestClass20.testMethod()); + } + + [TestMethod] + public void Operators21_Test() + { + Debug.WriteLine("Tests overriding double less-than (left shift)"); + Assert.True(OperatorsTestClass21.testMethod()); + } + + [TestMethod] + public void Operators22_Test() + { + Debug.WriteLine("Tests overriding double greater-than (right shift)"); + Assert.True(OperatorsTestClass22.testMethod()); + } + + [TestMethod] + public void Operators23_Test() + { + Debug.WriteLine("Tests overriding binary plus with 1 int parameter"); + Assert.True(OperatorsTestClass23.testMethod()); + } + + [TestMethod] + public void Operators24_Test() + { + Debug.WriteLine("Tests overriding double equals (equality comparison) and exclamation-equals (non-equality comparison)"); + Assert.True(OperatorsTestClass24.testMethod()); + } + + [TestMethod] + public void Operators38_Test() + { + Debug.WriteLine("Tests overriding binary plus with 1 int parameter"); + Assert.True(OperatorsTestClass38.testMethod()); + } + + [TestMethod] + public void Operators39_Test() + { + Debug.WriteLine("Tests overriding binary minus with 1 int parameter"); + Assert.True(OperatorsTestClass39.testMethod()); + } + + [TestMethod] + public void Operators40_Test() + { + Debug.WriteLine("Tests overriding asterisk (multiply) with 1 int parameter"); + Assert.True(OperatorsTestClass40.testMethod()); + } + + [TestMethod] + public void Operators41_Test() + { + Debug.WriteLine("Tests overriding slash (divide) with 1 int parameter"); + Assert.True(OperatorsTestClass41.testMethod()); + } + + [TestMethod] + public void Operators42_Test() + { + Debug.WriteLine("Tests overriding percent (modulus) with 1 int parameter"); + Assert.True(OperatorsTestClass42.testMethod()); + } + + [TestMethod] + public void Operators43_Test() + { + Debug.WriteLine("Tests overriding caret (xor) with 1 int parameter"); + Assert.True(OperatorsTestClass43.testMethod()); + } + + [TestMethod] + public void Operators44_Test() + { + Debug.WriteLine("Tests overriding ampersand with 1 int parameter"); + Assert.True(OperatorsTestClass44.testMethod()); + } + + [TestMethod] + public void Operators45_Test() + { + Debug.WriteLine("Tests overriding pipe (or) with 1 int parameter"); + Assert.True(OperatorsTestClass45.testMethod()); + } + + [TestMethod] + public void Operators46_Test() + { + Debug.WriteLine("Tests overriding double equals (equality comparison) and exclamation-equals "); + Debug.WriteLine("(non-equality comparison) with 1 int"); + Assert.True(OperatorsTestClass46.testMethod()); + } + + [TestMethod] + public void Operators67_Test() + { + Debug.WriteLine("Tests overriding unary exclamation (not)"); + Assert.True(OperatorsTestClass67.testMethod()); + } + + [TestMethod] + public void Operators68_Test() + { + Debug.WriteLine("Tests overriding true and false"); + Assert.True(OperatorsTestClass68.testMethod()); + } + + [TestMethod] + public void Operators69_Test() + { + Debug.WriteLine("Tests overriding true and false and ampersand"); + Assert.True(OperatorsTestClass69.testMethod()); + } + + [TestMethod] + public void Operators88_Test() + { + Debug.WriteLine("Tests true and false with ampersand"); + Assert.True(OperatorsTestClass88.testMethod()); + } + + [TestMethod] + public void Operators89_Test() + { + Debug.WriteLine("Tests true and false with double ampersand"); + Assert.True(OperatorsTestClass89.testMethod()); + } + + [TestMethod] + public void Operators90_Test() + { + Debug.WriteLine("Tests true and false with pipe (or)"); + Assert.True(OperatorsTestClass90.testMethod()); + } + + [TestMethod] + public void Operators91_Test() + { + Debug.WriteLine("Tests true and false with double pipe (or)"); + Assert.True(OperatorsTestClass91.testMethod()); + } + + [TestMethod] + public void Operators92_Test() + { + Debug.WriteLine("Tests true and false with caret (xor)"); + Assert.True(OperatorsTestClass92.testMethod()); + } + + [TestMethod] + public void Operators93_Test() + { + Debug.WriteLine("Tests numerical types with plus"); + Assert.True(OperatorsTestClass93.testMethod()); + } + + [TestMethod] + public void Operators94_Test() + { + Debug.WriteLine("Tests numerical types with minus"); + Assert.True(OperatorsTestClass94.testMethod()); + } + + [TestMethod] + public void Operators95_Test() + { + Debug.WriteLine("Tests numerical types with asterisk (multiply)"); + Assert.True(OperatorsTestClass95.testMethod()); + } + + [TestMethod] + public void Operators96_Test() + { + Debug.WriteLine("Tests numerical types with slash (divide)"); + Assert.True(OperatorsTestClass96.testMethod()); + } + + class OperatorsTestClass1 + { + public int intI = 2; + public static OperatorsTestClass1 operator +(OperatorsTestClass1 MyInt) + { + MyInt.intI = 3; + return MyInt; + } + public static bool testMethod() + { + OperatorsTestClass1 Test = new OperatorsTestClass1(); + OperatorsTestClass1 temp = +Test; + if (Test.intI == 3) + { + return true; + } + else + { + return false; + + } + } + } + + class OperatorsTestClass2 + { + public int intI = 2; + public static OperatorsTestClass2 operator -(OperatorsTestClass2 MyInt) + { + MyInt.intI = 3; + return MyInt; + } + public static bool testMethod() + { + OperatorsTestClass2 Test = new OperatorsTestClass2(); + OperatorsTestClass2 temp = -Test; + if (Test.intI == 3) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass3 + { + public int intI = 2; + public static OperatorsTestClass3 operator ~(OperatorsTestClass3 MyInt) + { + MyInt.intI = 3; + return MyInt; + } + public static bool testMethod() + { + OperatorsTestClass3 Test = new OperatorsTestClass3(); + OperatorsTestClass3 temp = ~Test; + if (Test.intI == 3) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass4 + { + public int intI = 2; + public static OperatorsTestClass4 operator ++(OperatorsTestClass4 MyInt) + { + OperatorsTestClass4 MC = new OperatorsTestClass4(); + MC.intI = 3; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass4 Test = new OperatorsTestClass4(); + OperatorsTestClass4 Test2 = ++Test; + + if ((Test.intI == 3) && (Test2.intI == 3)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass5 + { + public int intI = 2; + public static OperatorsTestClass5 operator ++(OperatorsTestClass5 MyInt) + { + OperatorsTestClass5 MC = new OperatorsTestClass5(); + MC.intI = 3; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass5 Test = new OperatorsTestClass5(); + OperatorsTestClass5 Test2 = Test++; + + if ((Test.intI == 3) && (Test2.intI == 2)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass6 + { + public int intI = 2; + public static OperatorsTestClass6 operator --(OperatorsTestClass6 MyInt) + { + OperatorsTestClass6 MC = new OperatorsTestClass6(); + MC.intI = 3; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass6 Test = new OperatorsTestClass6(); + OperatorsTestClass6 Test2 = --Test; + + if ((Test.intI == 3) && (Test2.intI == 3)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass7 + { + public int intI = 2; + public static OperatorsTestClass7 operator --(OperatorsTestClass7 MyInt) + { + OperatorsTestClass7 MC = new OperatorsTestClass7(); + MC.intI = 3; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass7 Test = new OperatorsTestClass7(); + OperatorsTestClass7 Test2 = Test--; + + if ((Test.intI == 3) && (Test2.intI == 2)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass13 + { + public int intI = 2; + public static OperatorsTestClass13 operator +(OperatorsTestClass13 MyInt, OperatorsTestClass13 MyInt2) + { + OperatorsTestClass13 MC = new OperatorsTestClass13(); + MC.intI = MyInt.intI + MyInt2.intI; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass13 Test1 = new OperatorsTestClass13(); + OperatorsTestClass13 Test2 = new OperatorsTestClass13(); + Test2.intI = 3; + OperatorsTestClass13 Test = Test1 + Test2; + if (Test.intI == 5) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass14 + { + public int intI = 2; + public static OperatorsTestClass14 operator -(OperatorsTestClass14 MyInt, OperatorsTestClass14 MyInt2) + { + OperatorsTestClass14 MC = new OperatorsTestClass14(); + MC.intI = MyInt.intI + MyInt2.intI; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass14 Test1 = new OperatorsTestClass14(); + OperatorsTestClass14 Test2 = new OperatorsTestClass14(); + Test2.intI = 3; + OperatorsTestClass14 Test = Test1 - Test2; + if (Test.intI == 5) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass15 + { + public int intI = 2; + public static OperatorsTestClass15 operator *(OperatorsTestClass15 MyInt, OperatorsTestClass15 MyInt2) + { + OperatorsTestClass15 MC = new OperatorsTestClass15(); + MC.intI = MyInt.intI + MyInt2.intI; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass15 Test1 = new OperatorsTestClass15(); + OperatorsTestClass15 Test2 = new OperatorsTestClass15(); + Test2.intI = 3; + OperatorsTestClass15 Test = Test1 * Test2; + if (Test.intI == 5) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass16 + { + public int intI = 2; + public static OperatorsTestClass16 operator /(OperatorsTestClass16 MyInt, OperatorsTestClass16 MyInt2) + { + OperatorsTestClass16 MC = new OperatorsTestClass16(); + MC.intI = MyInt.intI + MyInt2.intI; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass16 Test1 = new OperatorsTestClass16(); + OperatorsTestClass16 Test2 = new OperatorsTestClass16(); + Test2.intI = 3; + OperatorsTestClass16 Test = Test1 / Test2; + if (Test.intI == 5) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass17 + { + public int intI = 2; + public static OperatorsTestClass17 operator %(OperatorsTestClass17 MyInt, OperatorsTestClass17 MyInt2) + { + OperatorsTestClass17 MC = new OperatorsTestClass17(); + MC.intI = MyInt.intI + MyInt2.intI; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass17 Test1 = new OperatorsTestClass17(); + OperatorsTestClass17 Test2 = new OperatorsTestClass17(); + Test2.intI = 3; + OperatorsTestClass17 Test = Test1 % Test2; + if (Test.intI == 5) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass18 + { + public int intI = 2; + public static OperatorsTestClass18 operator ^(OperatorsTestClass18 MyInt, OperatorsTestClass18 MyInt2) + { + OperatorsTestClass18 MC = new OperatorsTestClass18(); + MC.intI = MyInt.intI + MyInt2.intI; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass18 Test1 = new OperatorsTestClass18(); + OperatorsTestClass18 Test2 = new OperatorsTestClass18(); + Test2.intI = 3; + OperatorsTestClass18 Test = Test1 ^ Test2; + if (Test.intI == 5) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass19 + { + public int intI = 2; + public static OperatorsTestClass19 operator &(OperatorsTestClass19 MyInt, OperatorsTestClass19 MyInt2) + { + OperatorsTestClass19 MC = new OperatorsTestClass19(); + MC.intI = MyInt.intI + MyInt2.intI; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass19 Test1 = new OperatorsTestClass19(); + OperatorsTestClass19 Test2 = new OperatorsTestClass19(); + Test2.intI = 3; + OperatorsTestClass19 Test = Test1 & Test2; + if (Test.intI == 5) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass20 + { + public int intI = 2; + public static OperatorsTestClass20 operator |(OperatorsTestClass20 MyInt, OperatorsTestClass20 MyInt2) + { + OperatorsTestClass20 MC = new OperatorsTestClass20(); + MC.intI = MyInt.intI + MyInt2.intI; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass20 Test1 = new OperatorsTestClass20(); + OperatorsTestClass20 Test2 = new OperatorsTestClass20(); + Test2.intI = 3; + OperatorsTestClass20 Test = Test1 | Test2; + if (Test.intI == 5) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass21 + { + public int intI = 2; + public static OperatorsTestClass21 operator <<(OperatorsTestClass21 MyInt, int MyInt2) + { + OperatorsTestClass21 MC = new OperatorsTestClass21(); + MC.intI = MyInt.intI + MyInt2; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass21 Test1 = new OperatorsTestClass21(); + OperatorsTestClass21 Test = Test1 << 3; + if (Test.intI == 5) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass22 + { + public int intI = 2; + public static OperatorsTestClass22 operator >>(OperatorsTestClass22 MyInt, int MyInt2) + { + OperatorsTestClass22 MC = new OperatorsTestClass22(); + MC.intI = MyInt.intI + MyInt2; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass22 Test1 = new OperatorsTestClass22(); + OperatorsTestClass22 Test = Test1 >> 3; + if (Test.intI == 5) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass23 + { + public int intI = 2; + public static OperatorsTestClass23 operator +(OperatorsTestClass23 MyInt, int MyInt2) + { + OperatorsTestClass23 MC = new OperatorsTestClass23(); + MC.intI = MyInt.intI + MyInt2; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass23 Test1 = new OperatorsTestClass23(); + OperatorsTestClass23 Test = Test1 + 3; + if (Test.intI == 5) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass24 + { + public int intI = 2; + public static bool operator ==(OperatorsTestClass24 MyInt, OperatorsTestClass24 MyInt2) + { + if (MyInt.intI == MyInt2.intI) + { + return true; + } + else + { + return false; + } + } + public static bool operator !=(OperatorsTestClass24 MyInt, OperatorsTestClass24 MyInt2) + { + return false; + } + public static bool testMethod() + { + OperatorsTestClass24 Test1 = new OperatorsTestClass24(); + OperatorsTestClass24 Test2 = new OperatorsTestClass24(); + OperatorsTestClass24 Test3 = new OperatorsTestClass24(); + + Test2.intI = 3; + if ((Test1 == Test3) && (!(Test1 == Test2))) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass38 + { + public int intI = 2; + public static OperatorsTestClass38 operator +(OperatorsTestClass38 MyInt, int MyInt2) + { + OperatorsTestClass38 MC = new OperatorsTestClass38(); + MC.intI = MyInt.intI + MyInt2; + return MC; + } + public static OperatorsTestClass38 operator +(int MyInt, OperatorsTestClass38 MyInt2) + { + OperatorsTestClass38 MC = new OperatorsTestClass38(); + MC.intI = MyInt + MyInt2.intI + 1; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass38 Test1 = new OperatorsTestClass38(); + OperatorsTestClass38 TestClass1 = Test1 + 1; + OperatorsTestClass38 TestClass2 = 1 + Test1; + if ((TestClass1.intI == 3) && (TestClass2.intI == 4)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass39 + { + public int intI = 2; + public static OperatorsTestClass39 operator -(OperatorsTestClass39 MyInt, int MyInt2) + { + OperatorsTestClass39 MC = new OperatorsTestClass39(); + MC.intI = MyInt.intI + MyInt2; + return MC; + } + public static OperatorsTestClass39 operator -(int MyInt, OperatorsTestClass39 MyInt2) + { + OperatorsTestClass39 MC = new OperatorsTestClass39(); + MC.intI = MyInt + MyInt2.intI + 1; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass39 Test1 = new OperatorsTestClass39(); + OperatorsTestClass39 TestClass1 = Test1 - 1; + OperatorsTestClass39 TestClass2 = 1 - Test1; + if ((TestClass1.intI == 3) && (TestClass2.intI == 4)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass40 + { + public int intI = 2; + public static OperatorsTestClass40 operator *(OperatorsTestClass40 MyInt, int MyInt2) + { + OperatorsTestClass40 MC = new OperatorsTestClass40(); + MC.intI = MyInt.intI + MyInt2; + return MC; + } + public static OperatorsTestClass40 operator *(int MyInt, OperatorsTestClass40 MyInt2) + { + OperatorsTestClass40 MC = new OperatorsTestClass40(); + MC.intI = MyInt + MyInt2.intI + 1; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass40 Test1 = new OperatorsTestClass40(); + OperatorsTestClass40 TestClass1 = Test1 * 1; + OperatorsTestClass40 TestClass2 = 1 * Test1; + if ((TestClass1.intI == 3) && (TestClass2.intI == 4)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass41 + { + public int intI = 2; + public static OperatorsTestClass41 operator /(OperatorsTestClass41 MyInt, int MyInt2) + { + OperatorsTestClass41 MC = new OperatorsTestClass41(); + MC.intI = MyInt.intI + MyInt2; + return MC; + } + public static OperatorsTestClass41 operator /(int MyInt, OperatorsTestClass41 MyInt2) + { + OperatorsTestClass41 MC = new OperatorsTestClass41(); + MC.intI = MyInt + MyInt2.intI + 1; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass41 Test1 = new OperatorsTestClass41(); + OperatorsTestClass41 TestClass1 = Test1 / 1; + OperatorsTestClass41 TestClass2 = 1 / Test1; + if ((TestClass1.intI == 3) && (TestClass2.intI == 4)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass42 + { + public int intI = 2; + public static OperatorsTestClass42 operator %(OperatorsTestClass42 MyInt, int MyInt2) + { + OperatorsTestClass42 MC = new OperatorsTestClass42(); + MC.intI = MyInt.intI + MyInt2; + return MC; + } + public static OperatorsTestClass42 operator %(int MyInt, OperatorsTestClass42 MyInt2) + { + OperatorsTestClass42 MC = new OperatorsTestClass42(); + MC.intI = MyInt + MyInt2.intI + 1; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass42 Test1 = new OperatorsTestClass42(); + OperatorsTestClass42 TestClass1 = Test1 % 1; + OperatorsTestClass42 TestClass2 = 1 % Test1; + if ((TestClass1.intI == 3) && (TestClass2.intI == 4)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass43 + { + public int intI = 2; + public static OperatorsTestClass43 operator ^(OperatorsTestClass43 MyInt, int MyInt2) + { + OperatorsTestClass43 MC = new OperatorsTestClass43(); + MC.intI = MyInt.intI + MyInt2; + return MC; + } + public static OperatorsTestClass43 operator ^(int MyInt, OperatorsTestClass43 MyInt2) + { + OperatorsTestClass43 MC = new OperatorsTestClass43(); + MC.intI = MyInt + MyInt2.intI + 1; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass43 Test1 = new OperatorsTestClass43(); + OperatorsTestClass43 TestClass1 = Test1 ^ 1; + OperatorsTestClass43 TestClass2 = 1 ^ Test1; + if ((TestClass1.intI == 3) && (TestClass2.intI == 4)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass44 + { + public int intI = 2; + public static OperatorsTestClass44 operator &(OperatorsTestClass44 MyInt, int MyInt2) + { + OperatorsTestClass44 MC = new OperatorsTestClass44(); + MC.intI = MyInt.intI + MyInt2; + return MC; + } + public static OperatorsTestClass44 operator &(int MyInt, OperatorsTestClass44 MyInt2) + { + OperatorsTestClass44 MC = new OperatorsTestClass44(); + MC.intI = MyInt + MyInt2.intI + 1; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass44 Test1 = new OperatorsTestClass44(); + OperatorsTestClass44 TestClass1 = Test1 & 1; + OperatorsTestClass44 TestClass2 = 1 & Test1; + if ((TestClass1.intI == 3) && (TestClass2.intI == 4)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass45 + { + public int intI = 2; + public static OperatorsTestClass45 operator |(OperatorsTestClass45 MyInt, int MyInt2) + { + OperatorsTestClass45 MC = new OperatorsTestClass45(); + MC.intI = MyInt.intI + MyInt2; + return MC; + } + public static OperatorsTestClass45 operator |(int MyInt, OperatorsTestClass45 MyInt2) + { + OperatorsTestClass45 MC = new OperatorsTestClass45(); + MC.intI = MyInt + MyInt2.intI + 1; + return MC; + } + public static bool testMethod() + { + OperatorsTestClass45 Test1 = new OperatorsTestClass45(); + OperatorsTestClass45 TestClass1 = Test1 | 1; + OperatorsTestClass45 TestClass2 = 1 | Test1; + if ((TestClass1.intI == 3) || (TestClass2.intI == 4)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass46 + { + public int intI = 2; + public static bool operator ==(OperatorsTestClass46 MyInt, int MyInt2) + { + return (MyInt.intI != MyInt2); + } + public static bool operator !=(OperatorsTestClass46 MyInt, int MyInt2) + { + return false; + } + public static bool testMethod() + { + OperatorsTestClass46 Test1 = new OperatorsTestClass46(); + if (((Test1 == 2) == false) && ((Test1 == 4) == true)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass67 + { + public int intI = 2; + public static bool operator !(OperatorsTestClass67 MyInt) + { + MyInt.intI = 3; + return true; + } + public static bool testMethod() + { + OperatorsTestClass67 Test = new OperatorsTestClass67(); + + if ((!Test) && (Test.intI == 3)) + { + return true; + } + else + { + return false; + } + } + } + + class OperatorsTestClass68 + { + public int intI = 2; + public static bool operator true(OperatorsTestClass68 MyInt) + { + MyInt.intI = 3; + return true; + } + public static bool operator false(OperatorsTestClass68 MyInt) + { + MyInt.intI = 4; + return false; + } + public static bool testMethod() + { + OperatorsTestClass68 Test = new OperatorsTestClass68(); + if (Test) + { + if (Test.intI == 3) + { + return true; + } + return false; + } + else + { + return false; + } + } + } + + class OperatorsTestClass69 + { + public int intI = 2; + public static bool operator true(OperatorsTestClass69 MyInt) + { + MyInt.intI = 3; + return true; + } + public static bool operator false(OperatorsTestClass69 MyInt) + { + MyInt.intI = 4; + return false; + } + public static OperatorsTestClass69 operator &(OperatorsTestClass69 mc1, OperatorsTestClass69 mc2) + { + return new OperatorsTestClass69(); + } + public static bool testMethod() + { + OperatorsTestClass69 Test1 = new OperatorsTestClass69(); + OperatorsTestClass69 Test2 = new OperatorsTestClass69(); + + if (Test1 && Test2) + { + if ((Test1.intI == 4) && (Test2.intI == 2)) + { + return true; + } + else + { + return false; + } + } + + return false; + } + } + + class OperatorsTestClass88 + { + public static bool retTrue() + { + return true; + } + + public static bool retFalse() + { + return false; + } + public static bool testMethod() + { + bool retVal = true; + + if ((true & true) != true) + retVal = false; + if ((true & retTrue()) != true) + retVal = false; + if ((retTrue() & true) != true) + retVal = false; + if ((true & false) != false) + retVal = false; + if ((retTrue() & false) != false) + retVal = false; + if ((true & retFalse()) != false) + retVal = false; + if ((false & true) != false) + retVal = false; + if ((retFalse() & true) != false) + retVal = false; + if ((false & retTrue()) != false) + retVal = false; + if ((false & false) != false) + retVal = false; + if ((retFalse() & false) != false) + retVal = false; + if ((false & retFalse()) != false) + retVal = false; + return retVal; + } + } + + class OperatorsTestClass89 + { + public static bool retTrue() + { + return true; + } + + public static bool retFalse() + { + return false; + } + public static bool testMethod() + { + bool retVal = true; + + if ((true && true) != true) + retVal = false; + if ((true && retTrue()) != true) + retVal = false; + if ((retTrue() && true) != true) + retVal = false; + if ((true && false) != false) + retVal = false; + if ((retTrue() && false) != false) + retVal = false; + if ((true && retFalse()) != false) + retVal = false; + if ((false && true) != false) + retVal = false; + if ((retFalse() && true) != false) + retVal = false; + if ((false && retTrue()) != false) + retVal = false; + if ((false && false) != false) + retVal = false; + if ((retFalse() && false) != false) + retVal = false; + if ((false && retFalse()) != false) + retVal = false; + return retVal; + } + } + + class OperatorsTestClass90 + { + public static bool retTrue() + { + return true; + } + + public static bool retFalse() + { + return false; + } + public static bool testMethod() + { + bool retVal = true; + + if ((true | true) != true) + retVal = false; + if ((true | retTrue()) != true) + retVal = false; + if ((retTrue() | true) != true) + retVal = false; + if ((true | false) != true) + retVal = false; + if ((retTrue() | false) != true) + retVal = false; + if ((true | retFalse()) != true) + retVal = false; + if ((false | true) != true) + retVal = false; + if ((retFalse() | true) != true) + retVal = false; + if ((false | retTrue()) != true) + retVal = false; + if ((false | false) != false) + retVal = false; + if ((retFalse() | false) != false) + retVal = false; + if ((false | retFalse()) != false) + retVal = false; + return retVal; + } + } + + class OperatorsTestClass91 + { + public static bool retTrue() + { + return true; + } + + public static bool retFalse() + { + return false; + } + public static bool testMethod() + { + bool retVal = true; + + if ((true || true) != true) + retVal = false; + if ((true || retTrue()) != true) + retVal = false; + if ((retTrue() || true) != true) + retVal = false; + if ((true || false) != true) + retVal = false; + if ((retTrue() || false) != true) + retVal = false; + if ((true || retFalse()) != true) + retVal = false; + if ((false || true) != true) + retVal = false; + if ((retFalse() || true) != true) + retVal = false; + if ((false || retTrue()) != true) + retVal = false; + if ((false || false) != false) + retVal = false; + if ((retFalse() || false) != false) + retVal = false; + if ((false || retFalse()) != false) + retVal = false; + return retVal; + } + } + + class OperatorsTestClass92 + { + public static bool retTrue() + { + return true; + } + + public static bool retFalse() + { + return false; + } + public static bool testMethod() + { + bool retVal = true; + + if ((true ^ true) != false) + retVal = false; + if ((true ^ retTrue()) != false) + retVal = false; + if ((retTrue() ^ true) != false) + retVal = false; + if ((true ^ false) != true) + retVal = false; + if ((retTrue() ^ false) != true) + retVal = false; + if ((true ^ retFalse()) != true) + retVal = false; + if ((false ^ true) != true) + retVal = false; + if ((retFalse() ^ true) != true) + retVal = false; + if ((false ^ retTrue()) != true) + retVal = false; + if ((false ^ false) != false) + retVal = false; + if ((retFalse() ^ false) != false) + retVal = false; + if ((false ^ retFalse()) != false) + retVal = false; + return retVal; + } + } + + class OperatorsTestClass93 + { + public static bool testMethod() + { + bool retVal = true; + sbyte sb = 2; + byte b = 2; + short s = 2; + ushort us = 2; + int i = 2; + uint ui = 2; + long l = 2; + ulong ul = 2; + if ((sb + 0) != sb) + retVal = false; + if ((0 + sb) != sb) + retVal = false; + if ((b + 0) != b) + retVal = false; + if ((0 + b) != b) + retVal = false; + if ((s + 0) != s) + retVal = false; + if ((0 + s) != s) + retVal = false; + if ((us + 0) != us) + retVal = false; + if ((0 + us) != us) + retVal = false; + if ((i + 0) != i) + retVal = false; + if ((0 + i) != i) + retVal = false; + if ((ui + 0) != ui) + retVal = false; + if ((0 + ui) != ui) + retVal = false; + if ((l + 0) != l) + retVal = false; + if ((0 + l) != l) + retVal = false; + if ((ul + 0) != ul) + retVal = false; + if ((0 + ul) != ul) + retVal = false; + + return retVal; + } + } + + class OperatorsTestClass94 + { + public static bool testMethod() + { + bool retVal = true; + sbyte sb = 2; + byte b = 2; + short s = 2; + ushort us = 2; + int i = 2; + uint ui = 2; + long l = 2; + ulong ul = 2; + if ((sb - 0) != sb) + retVal = false; + if ((b - 0) != b) + retVal = false; + if ((0 - b) != -b) + retVal = false; + if ((s - 0) != s) + retVal = false; + if ((0 - s) != -s) + retVal = false; + if ((us - 0) != us) + retVal = false; + if ((i - 0) != i) + retVal = false; + if ((0 - i) != -i) + retVal = false; + if ((ui - 0) != ui) + retVal = false; + if ((l - 0) != l) + retVal = false; + if ((0 - l) != -l) + retVal = false; + if ((ul - 0) != ul) + retVal = false; + return retVal; + } + } + + class OperatorsTestClass95 + { + public static bool testMethod() + { + bool retVal = true; + sbyte sb = 2; + byte b = 2; + short s = 2; + ushort us = 2; + int i = 2; + uint ui = 2; + long l = 2; + ulong ul = 2; + if ((sb * 0) != 0) + retVal = false; + if ((0 * sb) != 0) + retVal = false; + if ((b * 0) != 0) + retVal = false; + if ((0 * b) != 0) + retVal = false; + if ((s * 0) != 0) + retVal = false; + if ((0 * s) != 0) + retVal = false; + if ((us * 0) != 0) + retVal = false; + if ((0 * us) != 0) + retVal = false; + if ((i * 0) != 0) + retVal = false; + if ((0 * i) != 0) + retVal = false; + if ((ui * 0) != 0) + retVal = false; + if ((0 * ui) != 0) + retVal = false; + if ((l * 0) != 0) + retVal = false; + if ((0 * l) != 0) + retVal = false; + if ((ul * 0) != 0) + retVal = false; + if ((0 * ul) != 0) + retVal = false; + + return retVal; + } + } + + class OperatorsTestClass96 + { + public static bool testMethod() + { + bool retVal = true; + sbyte sb = 2; + byte b = 2; + short s = 2; + ushort us = 2; + int i = 2; + uint ui = 2; + long l = 2; + ulong ul = 2; + if ((0 / sb) != 0) + retVal = false; + if ((0 / b) != 0) + retVal = false; + if ((0 / s) != 0) + retVal = false; + if ((0 / us) != 0) + retVal = false; + if ((0 / i) != 0) + retVal = false; + if ((0 / ui) != 0) + retVal = false; + if ((0 / l) != 0) + retVal = false; + if ((0 / ul) != 0) + retVal = false; + + return retVal; + } + } + } +} diff --git a/Tests/NFUnitTestClasses/UnitTestPropertiesTests.cs b/Tests/NFUnitTestClasses/UnitTestPropertiesTests.cs new file mode 100644 index 00000000..6e22dc9d --- /dev/null +++ b/Tests/NFUnitTestClasses/UnitTestPropertiesTests.cs @@ -0,0 +1,1965 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestClasses +{ + [TestClass] + class UnitTestPropertiesTests + { + [TestMethod] + public void Properties003_Test() + { + Debug.WriteLine("Section 10.6"); + Debug.WriteLine("A property declaration may include set of"); + Debug.WriteLine("attributes, a new modifier, a valid combination"); + Debug.WriteLine("nof the four access modifiers, and a static modifier."); + Assert.True(PropertiesTestClass003.testMethod()); + } + [TestMethod] + public void Properties004_Test() + { + Debug.WriteLine("Section 10.6"); + Debug.WriteLine("A property declaration may include set of"); + Debug.WriteLine("attributes, a new modifier, a valid combination"); + Debug.WriteLine("nof the four access modifiers, and a static modifier."); + Assert.True(PropertiesTestClass004.testMethod()); + } + [TestMethod] + public void Properties005_Test() + { + Debug.WriteLine("Section 10.6"); + Debug.WriteLine("A property declaration may include set of"); + Debug.WriteLine("attributes, a new modifier, a valid combination"); + Debug.WriteLine("nof the four access modifiers, and a static modifier."); + Assert.True(PropertiesTestClass005.testMethod()); + } + [TestMethod] + public void Properties006_Test() + { + Debug.WriteLine("Section 10.6"); + Debug.WriteLine("A property declaration may include set of"); + Debug.WriteLine("attributes, a new modifier, a valid combination"); + Debug.WriteLine("nof the four access modifiers, and a static modifier."); + Assert.True(PropertiesTestClass006.testMethod()); + } + [TestMethod] + public void Properties007_Test() + { + Debug.WriteLine("Section 10.6"); + Debug.WriteLine("A property declaration may include set of"); + Debug.WriteLine("attributes, a new modifier, a valid combination"); + Debug.WriteLine("nof the four access modifiers, and a static modifier."); + Assert.True(PropertiesTestClass007.testMethod()); + } + [TestMethod] + public void Properties008_Test() + { + Debug.WriteLine("Section 10.6"); + Debug.WriteLine("A property declaration may include set of"); + Debug.WriteLine("attributes, a new modifier, a valid combination"); + Debug.WriteLine("nof the four access modifiers, and a static modifier."); + Assert.True(PropertiesTestClass008.testMethod()); + } + [TestMethod] + public void Properties009_Test() + { + Debug.WriteLine("Section 10.6"); + Debug.WriteLine("A property declaration may include set of"); + Debug.WriteLine("attributes, a new modifier, a valid combination"); + Debug.WriteLine("nof the four access modifiers, and a static modifier."); + Assert.True(PropertiesTestClass009.testMethod()); + } + [TestMethod] + public void Properties010_Test() + { + Debug.WriteLine("Section 10.6"); + Debug.WriteLine("A property declaration may include set of"); + Debug.WriteLine("attributes, a new modifier, a valid combination"); + Debug.WriteLine("nof the four access modifiers, and a static modifier."); + Assert.True(PropertiesTestClass010.testMethod()); + } + [TestMethod] + public void Properties011_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("The type of a property declaration specifies"); + Debug.WriteLine("the type of the property introduced by the"); + Debug.WriteLine("declaration, and the member-name specifies"); + Debug.WriteLine("the name of the property. Unless the property"); + Debug.WriteLine("is an explicit interface member implementation,"); + Debug.WriteLine("the member name is simply an identifier. For an"); + Debug.WriteLine("explicit interface member implementation, the"); + Debug.WriteLine("member name consists of an interface-type followed"); + Debug.WriteLine("by a . and an identifier."); + Debug.WriteLine("This is currently an expected fail, but is resolved in 3.0 see Bug 16341 for details"); + Assert.True(PropertiesTestClass011.testMethod()); + } + [TestMethod] + public void Properties024_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("An instance property is associated with"); + Debug.WriteLine("a given instance of a class, and this instance"); + Debug.WriteLine("can be accessed as this in the accessors of"); + Debug.WriteLine("the property."); + Assert.True(PropertiesTestClass024.testMethod()); + } + [TestMethod] + public void Properties025_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("An instance property is associated with"); + Debug.WriteLine("a given instance of a class, and this instance"); + Debug.WriteLine("can be accessed as this in the accessors of"); + Debug.WriteLine("the property."); + Assert.True(PropertiesTestClass025.testMethod()); + } + [TestMethod] + public void Properties026_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("When a property is referenced in a member-access"); + Debug.WriteLine("of the form E.M, if M is a static property, E must"); + Debug.WriteLine("denote a type, and if M is an instance property,"); + Debug.WriteLine("E must denote an instance."); + Assert.True(PropertiesTestClass026.testMethod()); + } + [TestMethod] + public void Properties027_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("When a property is referenced in a member-access"); + Debug.WriteLine("of the form E.M, if M is a static property, E must"); + Debug.WriteLine("denote a type, and if M is an instance property,"); + Debug.WriteLine("E must denote an instance."); + Assert.True(PropertiesTestClass027.testMethod()); + } + [TestMethod] + public void Properties033_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("The accessor declarations consist of a "); + Debug.WriteLine("get-accessor-declaration, a set-accessor"); + Debug.WriteLine("declaration, or both."); + Assert.True(PropertiesTestClass033.testMethod()); + } + [TestMethod] + public void Properties034_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("The accessor declarations consist of a "); + Debug.WriteLine("get-accessor-declaration, a set-accessor"); + Debug.WriteLine("declaration, or both."); + Assert.True(PropertiesTestClass034.testMethod()); + } + [TestMethod] + public void Properties035_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("The accessor declarations consist of a "); + Debug.WriteLine("get-accessor-declaration, a set-accessor"); + Debug.WriteLine("declaration, or both."); + Assert.True(PropertiesTestClass035.testMethod()); + } + [TestMethod] + public void Properties036_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass036.testMethod()); + } + [TestMethod] + public void Properties037_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass037.testMethod()); + } + [TestMethod] + public void Properties038_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass038.testMethod()); + } + [TestMethod] + public void Properties043_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass043.testMethod()); + } + [TestMethod] + public void Properties046_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass046.testMethod()); + } + [TestMethod] + public void Properties048_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass048.testMethod()); + } + [TestMethod] + public void Properties050_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass050.testMethod()); + } + [TestMethod] + public void Properties053_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass053.testMethod()); + } + [TestMethod] + public void Properties054_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass054.testMethod()); + } + [TestMethod] + public void Properties056_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass056.testMethod()); + } + [TestMethod] + public void Properties058_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass058.testMethod()); + } + [TestMethod] + public void Properties059_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass059.testMethod()); + } + [TestMethod] + public void Properties060_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass060.testMethod()); + } + [TestMethod] + public void Properties062_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass062.testMethod()); + } + [TestMethod] + public void Properties068_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass068.testMethod()); + } + [TestMethod] + public void Properties071_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass071.testMethod()); + } + [TestMethod] + public void Properties072_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass072.testMethod()); + } + [TestMethod] + public void Properties073_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass073.testMethod()); + } + [TestMethod] + public void Properties074_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass074.testMethod()); + } + [TestMethod] + public void Properties075_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass075.testMethod()); + } + [TestMethod] + public void Properties078_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass078.testMethod()); + } + [TestMethod] + public void Properties089_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass089.testMethod()); + } + [TestMethod] + public void Properties090_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass090.testMethod()); + } + [TestMethod] + public void Properties097_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass097.testMethod()); + } + [TestMethod] + public void Properties109_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass109.testMethod()); + } + [TestMethod] + public void Properties110_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass110.testMethod()); + } + [TestMethod] + public void Properties121_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass121.testMethod()); + } + [TestMethod] + public void Properties122_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass122.testMethod()); + } + [TestMethod] + public void Properties123_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Debug.WriteLine("This test is an expected fail"); + Assert.False(PropertiesTestClass123.testMethod()); + } + [TestMethod] + public void Properties124_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Debug.WriteLine("This test is an expected fail"); + Assert.False(PropertiesTestClass124.testMethod()); + } + [TestMethod] + public void Properties125_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass125.testMethod()); + } + [TestMethod] + public void Properties126_Test() + { + Debug.WriteLine("Section 10.6 "); + Debug.WriteLine("Each accessor declaration consists of an"); + Debug.WriteLine("optional accessor-modifier, followed by the"); + Debug.WriteLine("keyword get or set, followed by an accessor"); + Assert.True(PropertiesTestClass126.testMethod()); + } + + //Compiled Test Cases + class PropertiesTestClass003 + { + int intI = 0; + int MyProp + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static bool testMethod() + { + PropertiesTestClass003 test = new PropertiesTestClass003(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass004_Base + { + public int MyProp + { + get + { + return 1; + } + } + } + class PropertiesTestClass004 : PropertiesTestClass004_Base + { + int intI = 0; + new int MyProp + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static bool testMethod() + { + PropertiesTestClass004 test = new PropertiesTestClass004(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass005 + { + int intI = 0; + public int MyProp + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static bool testMethod() + { + PropertiesTestClass005 test = new PropertiesTestClass005(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass006 + { + int intI = 0; + protected int MyProp + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static bool testMethod() + { + PropertiesTestClass006 test = new PropertiesTestClass006(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass007 + { + int intI = 0; + internal int MyProp + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static bool testMethod() + { + PropertiesTestClass007 test = new PropertiesTestClass007(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass008 + { + int intI = 0; + private int MyProp + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static bool testMethod() + { + PropertiesTestClass008 test = new PropertiesTestClass008(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass009 + { + int intI = 0; + protected internal int MyProp + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static bool testMethod() + { + PropertiesTestClass009 test = new PropertiesTestClass009(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass010 + { + static int intI = 0; + static int MyProp + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static bool testMethod() + { + PropertiesTestClass010.MyProp = 2; + if (PropertiesTestClass010.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + interface PropertiesTestClass011_Interface + { + int MyProp + { + get; + set; + } + } + class PropertiesTestClass011 : PropertiesTestClass011_Interface + { + static int intI = 0; + int PropertiesTestClass011_Interface.MyProp + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static bool testMethod() + { + try + { + PropertiesTestClass011 MC = new PropertiesTestClass011(); + ((PropertiesTestClass011_Interface)MC).MyProp = 2; + if (((PropertiesTestClass011_Interface)MC).MyProp == 2) + { + return true; + } + else + { + return false; + } + } + catch + { + return false; + } + } + } + public class PropertiesTestClass024 + { + public int intI = 2; + public int MyProp + { + get + { + return this.intI; + } + } + public static bool testMethod() + { + PropertiesTestClass024 test = new PropertiesTestClass024(); + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass025 + { + public int intI = 1; + public int MyProp + { + set + { + this.intI = value; + } + } + public static bool testMethod() + { + PropertiesTestClass025 test = new PropertiesTestClass025(); + test.MyProp = 2; + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass026 + { + public int intI = 1; + public int MyProp + { + set + { + this.intI = value; + } + get + { + return intI; + } + } + public int GetProp() + { + return MyProp; + } + public void SetProp(int intJ) + { + MyProp = intJ; + } + public static bool testMethod() + { + PropertiesTestClass026 test = new PropertiesTestClass026(); + test.SetProp(3); + if (test.GetProp() == 3) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass027 + { + public static int intI = 1; + public static int MyProp + { + set + { + intI = value; + } + get + { + return intI; + } + } + public static int GetProp() + { + return MyProp; + } + public static void SetProp(int intJ) + { + MyProp = intJ; + } + public static bool testMethod() + { + PropertiesTestClass027.SetProp(3); + if (PropertiesTestClass027.GetProp() == 3) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass033 + { + public int MyProp + { + get + { + return 2; + } + } + public static bool testMethod() + { + PropertiesTestClass033 test = new PropertiesTestClass033(); + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass034 + { + public int intI = 0; + public int MyProp + { + set + { + intI = value; + } + } + public static bool testMethod() + { + PropertiesTestClass034 test = new PropertiesTestClass034(); + test.MyProp = 2; + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass035 + { + public int intI = 0; + public int MyProp + { + set + { + intI = value; + } + get + { + return intI; + } + } + public static bool testMethod() + { + PropertiesTestClass035 test = new PropertiesTestClass035(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass036 + { + int intI = 0; + public virtual int MyProp + { + set + { + intI = value; + } + get + { + return intI; + } + } + public static bool testMethod() + { + PropertiesTestClass036 test = new PropertiesTestClass036(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass037_Base + { + public virtual int MyProp + { + set + { + } + get + { + return -1; + } + } + } + public class PropertiesTestClass037 : PropertiesTestClass037_Base + { + int intI = 0; + public override int MyProp + { + set + { + intI = value; + } + get + { + return intI; + } + } + public static bool testMethod() + { + PropertiesTestClass037_Base test = new PropertiesTestClass037(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + public abstract class PropertiesTestClass038_Base + { + public abstract int MyProp + { + set; + get; + } + } + public class PropertiesTestClass038 : PropertiesTestClass038_Base + { + int intI = 0; + public override int MyProp + { + set + { + intI = value; + } + get + { + return intI; + } + } + public static bool testMethod() + { + PropertiesTestClass038_Base test = new PropertiesTestClass038(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass043 + { + public int TestInt = 1; + public int MyProp + { + get + { + TestInt = 2; + return -1; + } + set + { + } + } + public static bool testMethod() + { + PropertiesTestClass043 test = new PropertiesTestClass043(); + test.MyProp = 2; + if (test.TestInt == 1) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass046 + { + public int MyProp + { + get + { + short s = 3; + return s; + } + } + public static bool testMethod() + { + PropertiesTestClass046 test = new PropertiesTestClass046(); + if (test.MyProp == 3) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass048_Sub + { + public int intI = 2; + public static implicit operator int(PropertiesTestClass048_Sub t) + { + return t.intI; + } + + } + public class PropertiesTestClass048 + { + public int MyProp + { + get + { + PropertiesTestClass048_Sub test = new PropertiesTestClass048_Sub(); + return test; + } + } + public static bool testMethod() + { + PropertiesTestClass048 MC = new PropertiesTestClass048(); + if (MC.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass050_Sub + { + public int intI = 2; + public static implicit operator int(PropertiesTestClass050_Sub t) + { + return t.intI; + } + + } + public class PropertiesTestClass050 + { + public bool b = true; + public int MyProp + { + get + { + if (b == true) + { + PropertiesTestClass050_Sub test = new PropertiesTestClass050_Sub(); + return test; + } + else + { + return 3; + } + } + } + public static bool testMethod() + { + PropertiesTestClass050 MC = new PropertiesTestClass050(); + PropertiesTestClass050 MC2 = new PropertiesTestClass050(); + MC.b = true; + MC2.b = false; + if ((MC.MyProp == 2) && (MC2.MyProp == 3)) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass053 + { + public int MyProp + { + get + { + throw new System.Exception(); + } + } + public static bool testMethod() + { + PropertiesTestClass053 test = new PropertiesTestClass053(); + try + { + int intJ = test.MyProp; + } + catch (System.Exception e) + { + return true; + } + return false; + } + } + public class PropertiesTestClass054 + { + public bool b = true; + public int MyProp + { + get + { + if (b == true) + { + return 1; + } + else + { + throw new System.Exception(); + } + } + } + public static bool testMethod() + { + PropertiesTestClass054 MC = new PropertiesTestClass054(); + PropertiesTestClass054 MC2 = new PropertiesTestClass054(); + MC.b = true; + MC2.b = false; + + if (MC.MyProp != 1) + { + return false; + } + + try + { + int intJ = MC2.MyProp; + } + catch (System.Exception e) + { + return true; + } + return false; + } + } + public class PropertiesTestClass056 + { + public int intI = 2; + public int MyProp + { + set { } + get + { + intI = 3; + return 1; + } + + } + public static bool testMethod() + { + PropertiesTestClass056 test = new PropertiesTestClass056(); + test.MyProp = 4; + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass058 + { + public int intI = 2; + public int MyProp + { + set + { + return; + intI = 3; + } + } + public static bool testMethod() + { + PropertiesTestClass058 test = new PropertiesTestClass058(); + test.MyProp = 4; + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass059 + { + public int intI = 2; + public int MyProp + { + set + { + intI = value; + return; + } + } + public static bool testMethod() + { + PropertiesTestClass059 test = new PropertiesTestClass059(); + test.MyProp = 4; + if (test.intI == 4) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass060 + { + bool b = true; + public int intI = 2; + public int MyProp + { + set + { + if (b == true) + { + intI = value; + return; + } + else + { + intI = value + 1; + return; + } + } + } + public static bool testMethod() + { + PropertiesTestClass060 test = new PropertiesTestClass060(); + PropertiesTestClass060 test2 = new PropertiesTestClass060(); + test.b = true; + test2.b = false; + test.MyProp = 4; + test2.MyProp = 4; + if ((test.intI == 4) && (test2.intI == 5)) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass062 + { + int value; + public int MyProp + { + set + { + this.value = 2; + value = 3; + } + } + public static bool testMethod() + { + PropertiesTestClass062 test = new PropertiesTestClass062(); + test.MyProp = 1; + if (test.value == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass068_Base + { + public int intTest; + public int MyProp + { + get + { + return intTest; + } + set + { + intTest = value; + } + } + } + public class PropertiesTestClass068 : PropertiesTestClass068_Base + { + new public int MyProp + { + get + { + return intTest + 1; + } + set + { + intTest = value + 1; + } + } + public static bool testMethod() + { + PropertiesTestClass068 test = new PropertiesTestClass068(); + test.MyProp = 2; + if (test.MyProp == 4) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass071_Base + { + + public int MyProp + { + get + { + return 1; + } + } + } + public class PropertiesTestClass071 : PropertiesTestClass071_Base + { + new public int MyProp + { + set { } + } + public static bool testMethod() + { + PropertiesTestClass071 test = new PropertiesTestClass071(); + int intJ = ((PropertiesTestClass071_Base)test).MyProp; + if (intJ == 1) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass072_Base + { + + public int intI; + public int MyProp + { + set { intI = value; } + } + } + public class PropertiesTestClass072 : PropertiesTestClass072_Base + { + new public int MyProp + { + get { return 1; } + } + public static bool testMethod() + { + PropertiesTestClass072 test = new PropertiesTestClass072(); + ((PropertiesTestClass072_Base)test).MyProp = 2; + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass073_Base + { + + public int MyProp + { + get + { + return 1; + } + } + } + public class PropertiesTestClass073 : PropertiesTestClass073_Base + { + new public int MyProp + { + get { return 2; } + } + public static bool testMethod() + { + PropertiesTestClass073 test = new PropertiesTestClass073(); + int intJ = ((PropertiesTestClass073_Base)test).MyProp; + if (intJ == 1) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass074_Base + { + + public int intI; + public int MyProp + { + set { intI = value; } + } + } + public class PropertiesTestClass074 : PropertiesTestClass074_Base + { + new public int MyProp + { + set { intI = value + 1; } + } + public static bool testMethod() + { + PropertiesTestClass074 test = new PropertiesTestClass074(); + ((PropertiesTestClass074_Base)test).MyProp = 2; + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass075 + { + int intI = 0; + public virtual int MyProp + { + get { return intI; } + set { intI = value; } + } + public static bool testMethod() + { + PropertiesTestClass075 test = new PropertiesTestClass075(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + public abstract class PropertiesTestClass078_Sub + { + public int intI = 0; + public abstract int MyProp + { + get; + set; + } + } + public class PropertiesTestClass078 : PropertiesTestClass078_Sub + { + public override int MyProp + { + get { return intI; } + set { intI = value; } + } + public static bool testMethod() + { + PropertiesTestClass078_Sub test = new PropertiesTestClass078(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass089_Base + { + public int intI; + public virtual int MyProp + { + set { intI = value; } + get { return intI; } + } + } + public class PropertiesTestClass089 : PropertiesTestClass089_Base + { + public override int MyProp + { + get { return intI + 1; } + } + public static bool testMethod() + { + PropertiesTestClass089_Base test = new PropertiesTestClass089(); + test.MyProp = 2; + if (test.MyProp == 3) + { + return true; + } + else + { + return false; + } + } + } + public class PropertiesTestClass090_Base + { + public int intI; + public virtual int MyProp + { + set { intI = value; } + get { return intI; } + } + } + public class PropertiesTestClass090 : PropertiesTestClass090_Base + { + public override int MyProp + { + set { intI = value - 1; } + } + public static bool testMethod() + { + PropertiesTestClass090_Base test = new PropertiesTestClass090(); + test.MyProp = 2; + if (test.MyProp == 1) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass097 + { + int intI = 0; + int MyProp + { + set + { + intI = value; + } + get + { + return intI; + } + } + public static bool testMethod() + { + PropertiesTestClass097 test = new PropertiesTestClass097(); + test.MyProp = 2; + if (test.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass109_Base + { + public virtual int foo + { + get + { + return 1; + } + } + } + class PropertiesTestClass109_Derived : PropertiesTestClass109_Base + { + private int get_foo() + { + return 1; + } + } + class PropertiesTestClass109 : PropertiesTestClass109_Derived + { + public override int foo + { + get + { + return 2; + } + } + public static bool testMethod() + { + PropertiesTestClass109_Base MB = new PropertiesTestClass109(); + if (MB.foo == 2) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass110_Base + { + public int intI; + public virtual int foo + { + set + { + intI = 1; + } + } + } + class PropertiesTestClass110_Derived : PropertiesTestClass110_Base + { + private void set_foo(int value) + { + intI = 2; + } + } + class PropertiesTestClass110 : PropertiesTestClass110_Derived + { + public override int foo + { + set + { + intI = 3; + } + } + public static bool testMethod() + { + PropertiesTestClass110_Base MB = new PropertiesTestClass110(); + MB.foo = 3; + if (MB.intI == 3) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass121_Base + { + public virtual int MyProp + { + get + { + return 1; + } + } + } + class PropertiesTestClass121 : PropertiesTestClass121_Base + { + public override int MyProp + { + get + { + return 2; + } + } + public static bool testMethod() + { + PropertiesTestClass121_Base MC = new PropertiesTestClass121(); + if (MC.MyProp == 2) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass122_Base + { + public int myInt; + public virtual int MyProp + { + set + { + myInt = 1; + } + } + } + class PropertiesTestClass122 : PropertiesTestClass122_Base + { + public override int MyProp + { + set + { + myInt = 2; + } + } + public static bool testMethod() + { + PropertiesTestClass122_Base MC = new PropertiesTestClass122(); + MC.MyProp = 0; + if (MC.myInt == 2) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass123_Base + { + public virtual int MyProp + { + get + { + return 1; + } + } + } + class PropertiesTestClass123 : PropertiesTestClass123_Base + { + public new int MyProp + { + get + { + return 2; + } + } + public static bool testMethod() + { + PropertiesTestClass123_Base MC = new PropertiesTestClass123(); + if (MC.MyProp == 1) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass124_Base + { + public int myInt; + public virtual int MyProp + { + set + { + myInt = 1; + } + } + } + class PropertiesTestClass124 : PropertiesTestClass124_Base + { + public new int MyProp + { + set + { + myInt = 2; + } + } + public static bool testMethod() + { + PropertiesTestClass124_Base MC = new PropertiesTestClass124(); + MC.MyProp = 0; + if (MC.myInt == 1) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass125_Base + { + public int intI = 0; + public virtual int MyProp + { + get + { + return -1; + } + set + { + intI = -1; + } + + } + } + class PropertiesTestClass125 : PropertiesTestClass125_Base + { + public override int MyProp + { + get + { + return intI; + } + set + { + intI = value; + } + } + public static bool testMethod() + { + PropertiesTestClass125_Base MC = new PropertiesTestClass125(); + MC.MyProp = 4; + if (MC.MyProp == 4) + { + return true; + } + else + { + return false; + } + } + } + class PropertiesTestClass126_Base + { + public int intI = 0; + public virtual int MyProp + { + get + { + return intI; + } + set + { + intI = value; + } + + } + } + class PropertiesTestClass126 : PropertiesTestClass126_Base + { + public new int MyProp + { + get + { + return -1; + } + set + { + intI = -1; + } + } + public static bool testMethod() + { + PropertiesTestClass126_Base MC = new PropertiesTestClass126(); + MC.MyProp = 4; + if (MC.MyProp == -1) + { + return true; + } + else + { + return false; + } + } + } + + } +} diff --git a/Tests/NFUnitTestClasses/UnitTestStaticTests.cs b/Tests/NFUnitTestClasses/UnitTestStaticTests.cs new file mode 100644 index 00000000..6245b9d8 --- /dev/null +++ b/Tests/NFUnitTestClasses/UnitTestStaticTests.cs @@ -0,0 +1,328 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestClasses +{ + [TestClass] + class UnitTestStaticTests + { + [TestMethod] + public void Static_Inst01_Test() + { + Debug.WriteLine(" Section 10.2 "); + Debug.WriteLine(" When a static member is referenced in a member-access"); + Debug.WriteLine(" of the form E.M, E must denote a type. It is an error for"); + Debug.WriteLine(" E to denote an instance."); + Assert.True(Static_InstTestClass01.testMethod()); + } + + [TestMethod] + public void Static_Inst07_Test() + { + Debug.WriteLine(" Section 10.2 "); + Debug.WriteLine(" A static field identifies exactly one storage location."); + Debug.WriteLine(" No matter how many instances of a class are created,"); + Debug.WriteLine(" there is only ever one copy of a static field."); + Assert.True(Static_InstTestClass07.testMethod()); + } + + [TestMethod] + public void Static_Inst14_Test() + { + Debug.WriteLine(" Section 10.2 "); + Debug.WriteLine(" When an instance member is referenced in a member-access"); + Debug.WriteLine(" of the form E.M, E must denote an instance. It is an error "); + Debug.WriteLine(" for E to denote a type."); + Assert.True(Static_InstTestClass14.testMethod()); + } + + [TestMethod] + public void Static_Inst18_Test() + { + Debug.WriteLine(" Section 10.2 "); + Debug.WriteLine(" Every instance of a class contains a separate copy "); + Debug.WriteLine(" of all instance fields of the class."); + Assert.True(Static_InstTestClass18.testMethod()); + } + + [TestMethod] + public void Static_Inst19_Test() + { + Debug.WriteLine(" Section 10.2 "); + Debug.WriteLine(" An instance function member (method, property "); + Debug.WriteLine(" accessor, indexer accessor, constructor, or "); + Debug.WriteLine(" destructor) operates on a given instance of "); + Debug.WriteLine(" the class, and this instance can be accessed as"); + Debug.WriteLine(" this."); + Assert.True(Static_InstTestClass19.testMethod()); + } + + [TestMethod] + public void Static_Inst20_Test() + { + Debug.WriteLine(" Section 10.2 "); + Debug.WriteLine(" An instance function member (method, property "); + Debug.WriteLine(" accessor, indexer accessor, constructor, or "); + Debug.WriteLine(" destructor) operates on a given instance of "); + Debug.WriteLine(" the class, and this instance can be accessed as"); + Debug.WriteLine(" this."); + Assert.True(Static_InstTestClass20.testMethod()); + } + + [TestMethod] + public void Static_Inst21_Test() + { + Debug.WriteLine(" Section 10.2 "); + Debug.WriteLine(" An instance function member (method, property "); + Debug.WriteLine(" accessor, indexer accessor, constructor, or "); + Debug.WriteLine(" destructor) operates on a given instance of "); + Debug.WriteLine(" the class, and this instance can be accessed as"); + Debug.WriteLine(" this."); + Assert.True(Static_InstTestClass21.testMethod()); + } + + [TestMethod] + public void Static_Inst22_Test() + { + Debug.WriteLine(" Section 10.2 "); + Debug.WriteLine(" An instance function member (method, property "); + Debug.WriteLine(" accessor, indexer accessor, constructor, or "); + Debug.WriteLine(" destructor) operates on a given instance of "); + Debug.WriteLine(" the class, and this instance can be accessed as"); + Debug.WriteLine(" this."); + Assert.True(Static_InstTestClass22.testMethod()); + } + + [TestMethod] + public void Static_Inst23_Test() + { + Debug.WriteLine(" Section 10.2 "); + Debug.WriteLine(" An instance function member (method, property "); + Debug.WriteLine(" accessor, indexer accessor, constructor, or "); + Debug.WriteLine(" destructor) operates on a given instance of "); + Debug.WriteLine(" the class, and this instance can be accessed as"); + Debug.WriteLine(" this."); + Assert.True(Static_InstTestClass23.testMethod()); + } + + //Compiled Test Cases + class Static_InstTestClass01 + { + public static int intI = 1; + public static int intJ() + { + return 2; + } + public static int intK + { + get + { + return 3; + } + } + public const int intL = 4; + public class MyInner + { + public int intM = 5; + } + public static bool testMethod() + { + if (Static_InstTestClass01.intI != 1) return false; + if (Static_InstTestClass01.intJ() != 2) return false; + if (Static_InstTestClass01.intK != 3) return false; + if (Static_InstTestClass01.intL != 4) return false; + if (new Static_InstTestClass01.MyInner().intM != 5) return false; + return true; + } + } + class Static_InstTestClass07 + { + public static int intI = 1; + public void increment() + { + Static_InstTestClass07.intI++; + } + public static bool testMethod() + { + + if (Static_InstTestClass07.intI != 1) return false; + Static_InstTestClass07 test1 = new Static_InstTestClass07(); + test1.increment(); + if (Static_InstTestClass07.intI != 2) return false; + Static_InstTestClass07 test2 = new Static_InstTestClass07(); + test2.increment(); + if (Static_InstTestClass07.intI != 3) return false; + Static_InstTestClass07 test3 = new Static_InstTestClass07(); + test3.increment(); + if (Static_InstTestClass07.intI != 4) return false; + return true; + } + } + class Static_InstTestClass14 + { + public int intI = 1; + public int intJ() + { + return 2; + } + public int intK + { + get + { + return 3; + } + } + public static bool testMethod() + { + Static_InstTestClass14 test = new Static_InstTestClass14(); + if (test.intI != 1) return false; + if (test.intJ() != 2) return false; + if (test.intK != 3) return false; + return true; + + } + } + class Static_InstTestClass18 + { + public int intI = 1; + public void setInt(int intJ) + { + intI = intJ; + } + public static bool testMethod() + { + + Static_InstTestClass18 test1 = new Static_InstTestClass18(); + Static_InstTestClass18 test2 = new Static_InstTestClass18(); + Static_InstTestClass18 test3 = new Static_InstTestClass18(); + test1.setInt(2); + test2.setInt(3); + test3.setInt(4); + if (test1.intI != 2) return false; + if (test2.intI != 3) return false; + if (test3.intI != 4) return false; + return true; + } + } + class Static_InstTestClass19 + { + int intI; + public void foo() + { + intI = 2; + } + public static bool testMethod() + { + Static_InstTestClass19 test = new Static_InstTestClass19(); + test.foo(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + class Static_InstTestClass20 + { + int intI; + public int intJ + { + get + { + intI = 2; + return 3; + } + } + public static bool testMethod() + { + Static_InstTestClass20 test = new Static_InstTestClass20(); + int intK = test.intJ; + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + class Static_InstTestClass21 + { + int intI; + public int this[int intJ] + { + get + { + intI = 2; + return 3; + } + } + public static bool testMethod() + { + Static_InstTestClass21 test = new Static_InstTestClass21(); + int intK = test[1]; + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + class Static_InstTestClass22 + { + int intI; + public Static_InstTestClass22() + { + intI = 2; + } + public static bool testMethod() + { + Static_InstTestClass22 test = new Static_InstTestClass22(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + class Static_InstTestClass23 + { + int intI; + public void foo() + { + this.intI = 2; + } + public static bool testMethod() + { + Static_InstTestClass23 test = new Static_InstTestClass23(); + test.foo(); + if (test.intI == 2) + { + return true; + } + else + { + return false; + } + } + } + + } +} diff --git a/Tests/NFUnitTestClasses/nano.runsettings b/Tests/NFUnitTestClasses/nano.runsettings new file mode 100644 index 00000000..38fae61f --- /dev/null +++ b/Tests/NFUnitTestClasses/nano.runsettings @@ -0,0 +1,14 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + True + + \ No newline at end of file diff --git a/Tests/NFUnitTestClasses/packages.config b/Tests/NFUnitTestClasses/packages.config new file mode 100644 index 00000000..6fda075c --- /dev/null +++ b/Tests/NFUnitTestClasses/packages.config @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj b/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj index baae64f3..7859cff3 100644 --- a/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj +++ b/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj @@ -38,13 +38,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestConversions/packages.config b/Tests/NFUnitTestConversions/packages.config index 1adb9284..33fb2695 100644 --- a/Tests/NFUnitTestConversions/packages.config +++ b/Tests/NFUnitTestConversions/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj index ed3e14bc..ec05146a 100644 --- a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj +++ b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj @@ -37,13 +37,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestCoreLibrary/packages.config b/Tests/NFUnitTestCoreLibrary/packages.config index 1adb9284..33fb2695 100644 --- a/Tests/NFUnitTestCoreLibrary/packages.config +++ b/Tests/NFUnitTestCoreLibrary/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj b/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj index d7e2cddb..89755562 100644 --- a/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj +++ b/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj @@ -36,13 +36,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestDelegates/packages.config b/Tests/NFUnitTestDelegates/packages.config index 1adb9284..33fb2695 100644 --- a/Tests/NFUnitTestDelegates/packages.config +++ b/Tests/NFUnitTestDelegates/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj b/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj index 3f9ca252..e86dce69 100644 --- a/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj +++ b/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj @@ -36,13 +36,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestEnum/packages.config b/Tests/NFUnitTestEnum/packages.config index 1adb9284..33fb2695 100644 --- a/Tests/NFUnitTestEnum/packages.config +++ b/Tests/NFUnitTestEnum/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestException/NFUnitTestException.nfproj b/Tests/NFUnitTestException/NFUnitTestException.nfproj index a9ecb290..30f4c979 100644 --- a/Tests/NFUnitTestException/NFUnitTestException.nfproj +++ b/Tests/NFUnitTestException/NFUnitTestException.nfproj @@ -36,13 +36,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestException/packages.config b/Tests/NFUnitTestException/packages.config index 1adb9284..33fb2695 100644 --- a/Tests/NFUnitTestException/packages.config +++ b/Tests/NFUnitTestException/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj b/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj index 6307d67a..55768963 100644 --- a/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj +++ b/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj @@ -36,13 +36,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestInterface/nano.runsettings b/Tests/NFUnitTestInterface/nano.runsettings index 62f0a008..fa881e3a 100644 --- a/Tests/NFUnitTestInterface/nano.runsettings +++ b/Tests/NFUnitTestInterface/nano.runsettings @@ -8,6 +8,7 @@ Framework40 - None + None + False \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/packages.config b/Tests/NFUnitTestInterface/packages.config index dcab08b1..33fb2695 100644 --- a/Tests/NFUnitTestInterface/packages.config +++ b/Tests/NFUnitTestInterface/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj index b022fdec..8bce0880 100644 --- a/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj +++ b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj @@ -37,13 +37,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestLexical/nano.runsettings b/Tests/NFUnitTestLexical/nano.runsettings index 62f0a008..fa881e3a 100644 --- a/Tests/NFUnitTestLexical/nano.runsettings +++ b/Tests/NFUnitTestLexical/nano.runsettings @@ -8,6 +8,7 @@ Framework40 - None + None + False \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/packages.config b/Tests/NFUnitTestLexical/packages.config index dcab08b1..33fb2695 100644 --- a/Tests/NFUnitTestLexical/packages.config +++ b/Tests/NFUnitTestLexical/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj b/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj index 052c269d..ee239009 100644 --- a/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj +++ b/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj @@ -46,13 +46,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestNamespace/packages.config b/Tests/NFUnitTestNamespace/packages.config index 1adb9284..33fb2695 100644 --- a/Tests/NFUnitTestNamespace/packages.config +++ b/Tests/NFUnitTestNamespace/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj b/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj index d27feeda..6c3bf711 100644 --- a/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj +++ b/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj @@ -36,13 +36,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestStatementsTests/nano.runsettings b/Tests/NFUnitTestStatementsTests/nano.runsettings index 62f0a008..fa881e3a 100644 --- a/Tests/NFUnitTestStatementsTests/nano.runsettings +++ b/Tests/NFUnitTestStatementsTests/nano.runsettings @@ -8,6 +8,7 @@ Framework40 - None + None + False \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/packages.config b/Tests/NFUnitTestStatementsTests/packages.config index dcab08b1..33fb2695 100644 --- a/Tests/NFUnitTestStatementsTests/packages.config +++ b/Tests/NFUnitTestStatementsTests/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj b/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj index 386ab873..9a94373f 100644 --- a/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj +++ b/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj @@ -36,13 +36,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestStruct/packages.config b/Tests/NFUnitTestStruct/packages.config index 1adb9284..33fb2695 100644 --- a/Tests/NFUnitTestStruct/packages.config +++ b/Tests/NFUnitTestStruct/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj index c839d9a9..0e9dd87d 100644 --- a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj +++ b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj @@ -47,13 +47,18 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.Runtime.Native.1.5.1-preview.25\lib\nanoFramework.Runtime.Native.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs b/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs index 5c0e6459..c21ad7c5 100644 --- a/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs +++ b/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs @@ -53,7 +53,7 @@ public void WeakRef1_Test() wr.Target = WRC1; Debug.WriteLine("Allow for GC"); - GC.WaitForPendingFinalizers(); + nanoFramework.Runtime.Native.GC.Run(true); int sleepTime = 1000; int slept = 0; while (!hasFinalized1 && slept < sleepTime) @@ -72,7 +72,7 @@ public void WeakRef1_Test() Debug.WriteLine("Allow for GC"); // We should force the finalizer somehow - GC.WaitForPendingFinalizers(); + nanoFramework.Runtime.Native.GC.Run(true); sleepTime = 1000; slept = 0; while (!hasFinalized1 && slept < sleepTime) diff --git a/Tests/NFUnitTestSystemLib/packages.config b/Tests/NFUnitTestSystemLib/packages.config index 1adb9284..22ffa77b 100644 --- a/Tests/NFUnitTestSystemLib/packages.config +++ b/Tests/NFUnitTestSystemLib/packages.config @@ -1,5 +1,6 @@  - + + \ No newline at end of file diff --git a/Tests/NFUnitTestThread/NFUnitTestThread.nfproj b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj index 69557609..f4a5a6cd 100644 --- a/Tests/NFUnitTestThread/NFUnitTestThread.nfproj +++ b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj @@ -42,13 +42,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestThread/packages.config b/Tests/NFUnitTestThread/packages.config index 1adb9284..33fb2695 100644 --- a/Tests/NFUnitTestThread/packages.config +++ b/Tests/NFUnitTestThread/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj b/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj index 15b2b7ac..31410c74 100644 --- a/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj +++ b/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj @@ -41,13 +41,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestTypes/packages.config b/Tests/NFUnitTestTypes/packages.config index 1adb9284..33fb2695 100644 --- a/Tests/NFUnitTestTypes/packages.config +++ b/Tests/NFUnitTestTypes/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj b/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj index f30e8a2e..328b575b 100644 --- a/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj +++ b/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj @@ -37,13 +37,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.53\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestVariables/packages.config b/Tests/NFUnitTestVariables/packages.config index 1adb9284..33fb2695 100644 --- a/Tests/NFUnitTestVariables/packages.config +++ b/Tests/NFUnitTestVariables/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index c952af4b..135f86d4 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -47,6 +47,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestDelegates", "Test EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestConversions", "Tests\NFUnitTestConversions\NFUnitTestConversions.nfproj", "{4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestClasses", "Tests\NFUnitTestClasses\NFUnitTestClasses.nfproj", "{A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -151,6 +153,12 @@ Global {4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB}.Release|Any CPU.ActiveCfg = Release|Any CPU {4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB}.Release|Any CPU.Build.0 = Release|Any CPU {4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB}.Release|Any CPU.Deploy.0 = Release|Any CPU + {A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB}.Release|Any CPU.Build.0 = Release|Any CPU + {A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -171,6 +179,7 @@ Global {75F5ABAE-8DEE-4F8B-8941-D8E0DFCB1B2E} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {A8D00E31-5905-4DB4-A7F2-F0C00E3560DD} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From fb44c5a148162eb38606cd827a057add693f1c1c Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 23:04:51 +0300 Subject: [PATCH 39/55] Adding basic concapt, adjusting nuget --- .../NFUnitTestBasicConcepts.nfproj | 60 + .../Properties/AssemblyInfo.cs | 33 + .../UnitTestBasicConceptsTests.cs | 6062 +++++++++++++++++ .../NFUnitTestBasicConcepts/nano.runsettings | 13 + Tests/NFUnitTestBasicConcepts/packages.config | 5 + Tests/NFUnitTestConversions/nano.runsettings | 2 +- Tests/NFUnitTestCoreLibrary/nano.runsettings | 2 +- Tests/NFUnitTestDelegates/nano.runsettings | 2 +- Tests/NFUnitTestException/nano.runsettings | 2 +- Tests/NFUnitTestInterface/nano.runsettings | 2 +- Tests/NFUnitTestLexical/nano.runsettings | 2 +- Tests/NFUnitTestNamespace/nano.runsettings | 2 +- .../nano.runsettings | 2 +- Tests/NFUnitTestStruct/nano.runsettings | 2 +- Tests/NFUnitTestTypes/nano.runsettings | 2 +- Tests/NFUnitTestVariables/nano.runsettings | 2 +- nanoFramework.CoreLibrary.sln | 9 + 17 files changed, 6193 insertions(+), 11 deletions(-) create mode 100644 Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj create mode 100644 Tests/NFUnitTestBasicConcepts/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestBasicConcepts/UnitTestBasicConceptsTests.cs create mode 100644 Tests/NFUnitTestBasicConcepts/nano.runsettings create mode 100644 Tests/NFUnitTestBasicConcepts/packages.config diff --git a/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj b/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj new file mode 100644 index 00000000..21be8dce --- /dev/null +++ b/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj @@ -0,0 +1,60 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 8fdd0b3f-8a8b-4c98-95ee-fcf0b6982e15 + Library + Properties + 512 + NFUnitTestBasicConcepts + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestBasicConcepts/Properties/AssemblyInfo.cs b/Tests/NFUnitTestBasicConcepts/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestBasicConcepts/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestBasicConcepts/UnitTestBasicConceptsTests.cs b/Tests/NFUnitTestBasicConcepts/UnitTestBasicConceptsTests.cs new file mode 100644 index 00000000..5dc876b6 --- /dev/null +++ b/Tests/NFUnitTestBasicConcepts/UnitTestBasicConceptsTests.cs @@ -0,0 +1,6062 @@ +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestBasicConcepts +{ + [TestClass] + public class UnitTestBasicConceptsTests + { + [TestMethod] + public void Basic_scope001_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a namespace member declared by"); + Debug.WriteLine("a namespace-member-declaration with no enclosing"); + Debug.WriteLine("namespace-declaration is the entire program text"); + Debug.WriteLine("of each compilation unit."); + Assert.True(Basic_TestClass_scope001.testMethod()); + } + [TestMethod] + public void Basic_scope002_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a namespace member declared by a "); + Debug.WriteLine("namespace-member-declaration within a "); + Debug.WriteLine("namespace-declaration whose fully qualified name"); + Debug.WriteLine("is N is the namespace-body of every namespace-declaration"); + Debug.WriteLine("whose fully qualified name is N or starts with the same "); + Debug.WriteLine("sequence of indentifiers as N."); + Assert.True(NS_Basic_TestClass_scope002.Basic_TestClass_scope002.testMethod()); + } + [TestMethod] + public void Basic_scope003_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a namespace member declared by a "); + Debug.WriteLine("namespace-member-declaration within a "); + Debug.WriteLine("namespace-declaration whose fully qualified name"); + Debug.WriteLine("is N is the namespace-body of every namespace-declaration"); + Debug.WriteLine("whose fully qualified name is N or starts with the same "); + Debug.WriteLine("sequence of indentifiers as N."); + Assert.True(NS_Basic_TestClass_scope003.Basic_TestClass_scope003.testMethod()); + } + [TestMethod] + public void Basic_scope004_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a namespace member declared by a "); + Debug.WriteLine("namespace-member-declaration within a "); + Debug.WriteLine("namespace-declaration whose fully qualified name"); + Debug.WriteLine("is N is the namespace-body of every namespace-declaration"); + Debug.WriteLine("whose fully qualified name is N or starts with the same "); + Debug.WriteLine("sequence of indentifiers as N."); + Assert.True(NS_Basic_TestClass_scope004.NS_Basic_TestClass_scope004_2.Basic_TestClass_scope004.testMethod()); + } + [TestMethod] + public void Basic_scope005_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a namespace member declared by a "); + Debug.WriteLine("namespace-member-declaration within a "); + Debug.WriteLine("namespace-declaration whose fully qualified name"); + Debug.WriteLine("is N is the namespace-body of every namespace-declaration"); + Debug.WriteLine("whose fully qualified name is N or starts with the same "); + Debug.WriteLine("sequence of indentifiers as N."); + Assert.True(NS_Basic_TestClass_scope005.NS_Basic_TestClass_scope005_2.Basic_TestClass_scope005.testMethod()); + } + [TestMethod] + public void Basic_scope006_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a namespace member declared by a "); + Debug.WriteLine("namespace-member-declaration within a "); + Debug.WriteLine("namespace-declaration whose fully qualified name"); + Debug.WriteLine("is N is the namespace-body of every namespace-declaration"); + Debug.WriteLine("whose fully qualified name is N or starts with the same "); + Debug.WriteLine("sequence of indentifiers as N."); + Assert.True(NS_Basic_TestClass_scope006.NS_Basic_TestClass_scope006_2.Basic_TestClass_scope006.testMethod()); + } + [TestMethod] + public void Basic_scope012_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a name defined or imported by a using-directive"); + Debug.WriteLine("extends over the namespace-member-declarations of the"); + Debug.WriteLine("compilation-unit or namespace-body in which the using-directive"); + Debug.WriteLine("occurs."); + Assert.True(NS_Basic_TestClass_scope012.Basic_TestClass_scope012.testMethod()); + } + [TestMethod] + public void Basic_scope019_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a member declared by a class-member-declaration"); + Debug.WriteLine("is the class body in which the declaration occurs."); + Assert.True(Basic_TestClass_scope019.testMethod()); + } + [TestMethod] + public void Basic_scope022_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a member declared by a class-member-declaration"); + Debug.WriteLine("is the class body in which the declaration occurs. In addition,"); + Debug.WriteLine("the scope of a class member extends to the class-body of those"); + Debug.WriteLine("derived classes that are included in the accessibility domain"); + Debug.WriteLine("of the member."); + Assert.True(Basic_TestClass_scope022.testMethod()); + } + [TestMethod] + public void Basic_scope023_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a member declared by a class-member-declaration"); + Debug.WriteLine("is the class body in which the declaration occurs. In addition,"); + Debug.WriteLine("the scope of a class member extends to the class-body of those"); + Debug.WriteLine("derived classes that are included in the accessibility domain"); + Debug.WriteLine("of the member."); + Assert.True(Basic_TestClass_scope023.testMethod()); + } + [TestMethod] + public void Basic_scope024_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a member declared by a class-member-declaration"); + Debug.WriteLine("is the class body in which the declaration occurs. In addition,"); + Debug.WriteLine("the scope of a class member extends to the class-body of those"); + Debug.WriteLine("derived classes that are included in the accessibility domain"); + Debug.WriteLine("of the member."); + Assert.True(Basic_TestClass_scope024.testMethod()); + } + [TestMethod] + public void Basic_scope025_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a member declared by a struct-member-declaration"); + Debug.WriteLine("is the struct-body in which the declaration occurs."); + Assert.True(Basic_TestClass_scope025.testMethod()); + } + [TestMethod] + public void Basic_scope027_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a member declared by an enum-member-declaration"); + Debug.WriteLine("is the enum-body in which the declaration occurs."); + Assert.True(Basic_TestClass_scope027.testMethod()); + } + [TestMethod] + public void Basic_scope029_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a parameter declared in a constructor-declaration"); + Debug.WriteLine("is the constructor-initializer and the block of that "); + Debug.WriteLine("constructor-declaration."); + Assert.True(Basic_TestClass_scope029.testMethod()); + } + [TestMethod] + public void Basic_scope033_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a parameter declared in a method-declaration"); + Debug.WriteLine("is the method-body of that method-declaration."); + Assert.True(Basic_TestClass_scope033.testMethod()); + } + [TestMethod] + public void Basic_scope037_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a parameter declared in an indexer-declaration"); + Debug.WriteLine("is the accessor-declarations of that indexer-declaration."); + Assert.True(Basic_TestClass_scope037.testMethod()); + } + [TestMethod] + public void Basic_scope041_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a parameter declared in an operator-declaration"); + Debug.WriteLine("is the block of that operator-declaration."); + Assert.True(Basic_TestClass_scope041.testMethod()); + } + [TestMethod] + public void Basic_scope044_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a local variable declared in a local-variable-declaration"); + Debug.WriteLine("is the block in which the declaration occurs. It is an error to refer to"); + Debug.WriteLine("a lcaol variable in a textual position that precedes the variable-declaratior"); + Debug.WriteLine("of the local variable."); + Assert.True(Basic_TestClass_scope044.testMethod()); + } + [TestMethod] + public void Basic_scope051_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a local variable in a for-initializer of a "); + Debug.WriteLine("for statement is the for-initializer, the for-condition,"); + Debug.WriteLine("the for-iterator, and the contained statement of the for"); + Debug.WriteLine("statement."); + Assert.True(Basic_TestClass_scope051.testMethod()); + } + [TestMethod] + public void Basic_scope053_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a label declared in a label-statement"); + Debug.WriteLine("is the block in which the declaration occurs."); + Assert.True(Basic_TestClass_scope053.testMethod()); + } + [TestMethod] + public void Basic_scope055_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a label declared in a label-statement"); + Debug.WriteLine("is the block in which the declaration occurs."); + Assert.True(Basic_TestClass_scope055.testMethod()); + } + [TestMethod] + public void Basic_scope056_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("Within the scope of a namespace, class,"); + Debug.WriteLine("struct, interface, or enumeration member "); + Debug.WriteLine("it is possible to refer to the member in "); + Debug.WriteLine("a textual position that precedes the "); + Debug.WriteLine("declaration of the member."); + Assert.True(NS_Basic_TestClass_scope056.Basic_TestClass_scope056.testMethod()); + } + [TestMethod] + public void Basic_scope057_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("Within the scope of a namespace, class,"); + Debug.WriteLine("struct, interface, or enumeration member "); + Debug.WriteLine("it is possible to refer to the member in "); + Debug.WriteLine("a textual position that precedes the "); + Debug.WriteLine("declaration of the member."); + Assert.True(Basic_TestClass_scope057.testMethod()); + } + [TestMethod] + public void Basic_scope058_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("Within the scope of a namespace, class,"); + Debug.WriteLine("struct, interface, or enumeration member "); + Debug.WriteLine("it is possible to refer to the member in "); + Debug.WriteLine("a textual position that precedes the "); + Debug.WriteLine("declaration of the member."); + Assert.True(Basic_TestClass_scope058.testMethod()); + } + [TestMethod] + public void Basic_scope059_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("Within the scope of a namespace, class,"); + Debug.WriteLine("struct, interface, or enumeration member "); + Debug.WriteLine("it is possible to refer to the member in "); + Debug.WriteLine("a textual position that precedes the "); + Debug.WriteLine("declaration of the member."); + Assert.True(Basic_TestClass_scope059.testMethod()); + } + [TestMethod] + public void Basic_scope061_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("Witin the scope of a local variable, it is an"); + Debug.WriteLine("error to refer to the local variable in a "); + Debug.WriteLine("textual position that precedes the"); + Debug.WriteLine("variable-declarator of the local variable."); + Assert.True(Basic_TestClass_scope061.testMethod()); + } + [TestMethod] + public void Basic_scope062_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The meaning of a name within a block may differ"); + Debug.WriteLine("based on the context in which the name is used."); + Assert.True(Basic_TestClass_scope062.testMethod()); + } + [TestMethod] + public void Basic_scope063_Test() + { + Debug.WriteLine("Section 3.5"); + Assert.True(Basic_TestClass_scope063.testMethod()); + } + [TestMethod] + public void Basic_scope064_Test() + { + Debug.WriteLine("Section 3.5"); + Assert.True(Basic_TestClass_scope064.testMethod()); + } + [TestMethod] + public void Basic_scope067_Test() + { + Debug.WriteLine("Section 3.5"); + Assert.True(Basic_TestClass_scope067.testMethod()); + } + [TestMethod] + public void Basic_scope068_Test() + { + Debug.WriteLine("Section 3.5"); + Assert.True(Basic_TestClass_scope068.testMethod()); + } + [TestMethod] + public void Basic_scope069_Test() + { + Debug.WriteLine("Section 3"); + Assert.True(Basic_TestClass_scope069.testMethod()); + } + [TestMethod] + public void Basic_scope070_Test() + { + Debug.WriteLine("Section 3"); + Assert.True(Basic_TestClass_scope070.testMethod()); + } + [TestMethod] + public void Basic_scope071_Test() + { + Debug.WriteLine("Section 3"); + Assert.True(Basic_TestClass_scope071.testMethod()); + } + [TestMethod] + public void Basic_scope074_Test() + { + Debug.WriteLine("Section 3.5"); + Debug.WriteLine("The scope of a label declared in a label-statement"); + Debug.WriteLine("is the block in which the declaration occurs."); + Assert.True(Basic_TestClass_scope074.testMethod()); + } + [TestMethod] + public void Basic_nhide001_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(NS_Basic_TestClass_nhide001.Basic_TestClass_nhide001.testMethod()); + } + [TestMethod] + public void Basic_nhide002_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(NS_Basic_TestClass_nhide002.Basic_TestClass_nhide002.testMethod()); + } + [TestMethod] + public void Basic_nhide003_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(NS_Basic_TestClass_nhide003.Basic_TestClass_nhide003.testMethod()); + } + [TestMethod] + public void Basic_nhide004_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(NS_Basic_TestClass_nhide004.Basic_TestClass_nhide004.testMethod()); + } + [TestMethod] + public void Basic_nhide005_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(NS_Basic_TestClass_nhide005.Basic_TestClass_nhide005.testMethod()); + } + [TestMethod] + public void Basic_nhide006_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(NS_Basic_TestClass_nhide006.Basic_TestClass_nhide006.testMethod()); + } + [TestMethod] + public void Basic_nhide007_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide007.testMethod()); + } + [TestMethod] + public void Basic_nhide008_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(NS_Basic_TestClass_nhide008.Basic_TestClass_nhide008.testMethod()); + } + [TestMethod] + public void Basic_nhide009_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(NS_Basic_TestClass_nhide009.Basic_TestClass_nhide009.testMethod()); + } + [TestMethod] + public void Basic_nhide010_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(NS_Basic_TestClass_nhide010.Basic_TestClass_nhide010.testMethod()); + } + [TestMethod] + public void Basic_nhide011_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(NS_Basic_TestClass_nhide011.Basic_TestClass_nhide011.testMethod()); + } + [TestMethod] + public void Basic_nhide012_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(NS_Basic_TestClass_nhide012.Basic_TestClass_nhide012.testMethod()); + } + [TestMethod] + public void Basic_nhide013_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(NS_Basic_TestClass_nhide013.Basic_TestClass_nhide013.testMethod()); + } + [TestMethod] + public void Basic_nhide014_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide014.testMethod()); + } + [TestMethod] + public void Basic_nhide015_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide015.testMethod()); + } + [TestMethod] + public void Basic_nhide016_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide016.testMethod()); + } + [TestMethod] + public void Basic_nhide017_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide017.testMethod()); + } + [TestMethod] + public void Basic_nhide018_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide018.testMethod()); + } + [TestMethod] + public void Basic_nhide019_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide019.testMethod()); + } + [TestMethod] + public void Basic_nhide020_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide020.testMethod()); + } + [TestMethod] + public void Basic_nhide021_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide021.testMethod()); + } + [TestMethod] + public void Basic_nhide022_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide022.testMethod()); + } + [TestMethod] + public void Basic_nhide023_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide023.testMethod()); + } + [TestMethod] + public void Basic_nhide024_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide024.testMethod()); + } + [TestMethod] + public void Basic_nhide025_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide025.testMethod()); + } + [TestMethod] + public void Basic_nhide026_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide026.testMethod()); + } + [TestMethod] + public void Basic_nhide027_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide027.testMethod()); + } + [TestMethod] + public void Basic_nhide028_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide028.testMethod()); + } + [TestMethod] + public void Basic_nhide029_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide029.testMethod()); + } + [TestMethod] + public void Basic_nhide030_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide030.testMethod()); + } + [TestMethod] + public void Basic_nhide031_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide031.testMethod()); + } + [TestMethod] + public void Basic_nhide032_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide032.testMethod()); + } + [TestMethod] + public void Basic_nhide033_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide033.testMethod()); + } + [TestMethod] + public void Basic_nhide034_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide034.testMethod()); + } + [TestMethod] + public void Basic_nhide035_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide035.testMethod()); + } + [TestMethod] + public void Basic_nhide036_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide036.testMethod()); + } + [TestMethod] + public void Basic_nhide037_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide037.testMethod()); + } + [TestMethod] + public void Basic_nhide038_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide038.testMethod()); + } + [TestMethod] + public void Basic_nhide039_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide039.testMethod()); + } + [TestMethod] + public void Basic_nhide040_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide040.testMethod()); + } + [TestMethod] + public void Basic_nhide041_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide041.testMethod()); + } + [TestMethod] + public void Basic_nhide042_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide042.testMethod()); + } + [TestMethod] + public void Basic_nhide043_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide043.testMethod()); + } + [TestMethod] + public void Basic_nhide044_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Name hiding through nesting can occur as a result of"); + Debug.WriteLine("nesting namespaces or types within namespaces, as a "); + Debug.WriteLine("result of nesting types within classes or structs,"); + Debug.WriteLine("and as a result of parameter and local variable"); + Debug.WriteLine("declarations. Name hiding through nesting of scopes"); + Debug.WriteLine("always occurs silently, i.e. no errors or warnings"); + Debug.WriteLine("are reported when outer names are hidden by inner names."); + Assert.True(Basic_TestClass_nhide044.testMethod()); + } + [TestMethod] + public void Basic_nhide045_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("When a name in an inner scope hides a name"); + Debug.WriteLine("in an outer scope, it hides all overloaded "); + Debug.WriteLine("occurrences of that name."); + Assert.True(Basic_TestClass_nhide045.testMethod()); + } + [TestMethod] + public void Basic_nhide047_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("When a name in an inner scope hides a name"); + Debug.WriteLine("in an outer scope, it hides all overloaded "); + Debug.WriteLine("occurrences of that name."); + Assert.True(Basic_TestClass_nhide047.testMethod()); + } + [TestMethod] + public void Basic_nhide049_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("When a name in an inner scope hides a name"); + Debug.WriteLine("in an outer scope, it hides all overloaded "); + Debug.WriteLine("occurrences of that name."); + Assert.True(Basic_TestClass_nhide049.testMethod()); + } + [TestMethod] + public void Basic_nhide050_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("When a name in an inner scope hides a name"); + Debug.WriteLine("in an outer scope, it hides all overloaded "); + Debug.WriteLine("occurrences of that name."); + Assert.True(Basic_TestClass_nhide050.testMethod()); + } + [TestMethod] + public void Basic_nhide051_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("When a name in an inner scope hides a name"); + Debug.WriteLine("in an outer scope, it hides all overloaded "); + Debug.WriteLine("occurrences of that name."); + Assert.True(Basic_TestClass_nhide051.testMethod()); + } + [TestMethod] + public void Basic_nhide053_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("When a name in an inner scope hides a name"); + Debug.WriteLine("in an outer scope, it hides all overloaded "); + Debug.WriteLine("occurrences of that name."); + Assert.True(Basic_TestClass_nhide053.testMethod()); + } + [TestMethod] + public void Basic_nhide055_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("When a name in an inner scope hides a name"); + Debug.WriteLine("in an outer scope, it hides all overloaded "); + Debug.WriteLine("occurrences of that name."); + Assert.True(Basic_TestClass_nhide055.testMethod()); + } + [TestMethod] + public void Basic_nhide056_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("When a name in an inner scope hides a name"); + Debug.WriteLine("in an outer scope, it hides all overloaded "); + Debug.WriteLine("occurrences of that name."); + Assert.True(Basic_TestClass_nhide056.testMethod()); + } + [TestMethod] + public void Basic_nhide057_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("When a name in an inner scope hides a name"); + Debug.WriteLine("in an outer scope, it hides all overloaded "); + Debug.WriteLine("occurrences of that name."); + Assert.True(Basic_TestClass_nhide057.testMethod()); + } + [TestMethod] + public void Basic_nhide059_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("When a name in an inner scope hides a name"); + Debug.WriteLine("in an outer scope, it hides all overloaded "); + Debug.WriteLine("occurrences of that name."); + Assert.True(Basic_TestClass_nhide059.testMethod()); + } + [TestMethod] + public void Basic_nhide061_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A constant, field, property, event or type introduced"); + Debug.WriteLine("in a class or struct hides all base class members with the "); + Debug.WriteLine("same name."); + Assert.True(Basic_TestClass_nhide061.testMethod()); + } + [TestMethod] + public void Basic_nhide062_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A constant, field, property, event or type introduced"); + Debug.WriteLine("in a class or struct hides all base class members with the "); + Debug.WriteLine("same name."); + Assert.True(Basic_TestClass_nhide062.testMethod()); + } + [TestMethod] + public void Basic_nhide063_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A constant, field, property, event or type introduced"); + Debug.WriteLine("in a class or struct hides all base class members with the "); + Debug.WriteLine("same name."); + Assert.True(Basic_TestClass_nhide063.testMethod()); + } + [TestMethod] + public void Basic_nhide064_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A constant, field, property, event or type introduced"); + Debug.WriteLine("in a class or struct hides all base class members with the "); + Debug.WriteLine("same name."); + Assert.True(Basic_TestClass_nhide064.testMethod()); + } + [TestMethod] + public void Basic_nhide067_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A constant, field, property, event or type introduced"); + Debug.WriteLine("in a class or struct hides all base class members with the "); + Debug.WriteLine("same name."); + Assert.True(Basic_TestClass_nhide067.testMethod()); + } + [TestMethod] + public void Basic_nhide068_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A constant, field, property, event or type introduced"); + Debug.WriteLine("in a class or struct hides all base class members with the "); + Debug.WriteLine("same name."); + Assert.True(Basic_TestClass_nhide068.testMethod()); + } + [TestMethod] + public void Basic_nhide071_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A method introduced in a class or a struct"); + Debug.WriteLine("hides all non-method base class members with"); + Debug.WriteLine("the same name, and all base class methods"); + Debug.WriteLine("with the same signature (method name and"); + Debug.WriteLine("parameter count, modifiers, and types)."); + Assert.True(Basic_TestClass_nhide071.testMethod()); + } + [TestMethod] + public void Basic_nhide072_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A method introduced in a class or a struct"); + Debug.WriteLine("hides all non-method base class members with"); + Debug.WriteLine("the same name, and all base class methods"); + Debug.WriteLine("with the same signature (method name and"); + Debug.WriteLine("parameter count, modifiers, and types)."); + Assert.True(Basic_TestClass_nhide072.testMethod()); + } + [TestMethod] + public void Basic_nhide075_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A method introduced in a class or a struct"); + Debug.WriteLine("hides all non-method base class members with"); + Debug.WriteLine("the same name, and all base class methods"); + Debug.WriteLine("with the same signature (method name and"); + Debug.WriteLine("parameter count, modifiers, and types)."); + Assert.True(Basic_TestClass_nhide075.testMethod()); + } + [TestMethod] + public void Basic_nhide076_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A method introduced in a class or a struct"); + Debug.WriteLine("hides all non-method base class members with"); + Debug.WriteLine("the same name, and all base class methods"); + Debug.WriteLine("with the same signature (method name and"); + Debug.WriteLine("parameter count, modifiers, and types)."); + Assert.True(Basic_TestClass_nhide076.testMethod()); + } + [TestMethod] + public void Basic_nhide077_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A method introduced in a class or a struct"); + Debug.WriteLine("hides all non-method base class members with"); + Debug.WriteLine("the same name, and all base class methods"); + Debug.WriteLine("with the same signature (method name and"); + Debug.WriteLine("parameter count, modifiers, and types)."); + Assert.True(Basic_TestClass_nhide077.testMethod()); + } + [TestMethod] + public void Basic_nhide079_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A method introduced in a class or a struct"); + Debug.WriteLine("hides all non-method base class members with"); + Debug.WriteLine("the same name, and all base class methods"); + Debug.WriteLine("with the same signature (method name and"); + Debug.WriteLine("parameter count, modifiers, and types)."); + Assert.True(Basic_TestClass_nhide079.testMethod()); + } + [TestMethod] + public void Basic_nhide081_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A method introduced in a class or a struct"); + Debug.WriteLine("hides all non-method base class members with"); + Debug.WriteLine("the same name, and all base class methods"); + Debug.WriteLine("with the same signature (method name and"); + Debug.WriteLine("parameter count, modifiers, and types)."); + Assert.True(Basic_TestClass_nhide081.testMethod()); + } + [TestMethod] + public void Basic_nhide082_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A method introduced in a class or a struct"); + Debug.WriteLine("hides all non-method base class members with"); + Debug.WriteLine("the same name, and all base class methods"); + Debug.WriteLine("with the same signature (method name and"); + Debug.WriteLine("parameter count, modifiers, and types)."); + Assert.True(Basic_TestClass_nhide082.testMethod()); + } + [TestMethod] + public void Basic_nhide085_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A method introduced in a class or a struct"); + Debug.WriteLine("hides all non-method base class members with"); + Debug.WriteLine("the same name, and all base class methods"); + Debug.WriteLine("with the same signature (method name and"); + Debug.WriteLine("parameter count, modifiers, and types)."); + Assert.True(Basic_TestClass_nhide085.testMethod()); + } + [TestMethod] + public void Basic_nhide086_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A method introduced in a class or a struct"); + Debug.WriteLine("hides all non-method base class members with"); + Debug.WriteLine("the same name, and all base class methods"); + Debug.WriteLine("with the same signature (method name and"); + Debug.WriteLine("parameter count, modifiers, and types)."); + Assert.True(Basic_TestClass_nhide086.testMethod()); + } + [TestMethod] + public void Basic_nhide087_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A method introduced in a class or a struct"); + Debug.WriteLine("hides all non-method base class members with"); + Debug.WriteLine("the same name, and all base class methods"); + Debug.WriteLine("with the same signature (method name and"); + Debug.WriteLine("parameter count, modifiers, and types)."); + Assert.True(Basic_TestClass_nhide087.testMethod()); + } + [TestMethod] + public void Basic_nhide088_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A method introduced in a class or a struct"); + Debug.WriteLine("hides all non-method base class members with"); + Debug.WriteLine("the same name, and all base class methods"); + Debug.WriteLine("with the same signature (method name and"); + Debug.WriteLine("parameter count, modifiers, and types)."); + Debug.WriteLine("This test passes in the baseline, but is an expected Fail"); + Debug.WriteLine("See bug 16852 for more details"); + + Assert.True(Basic_TestClass_nhide088.testMethod()); + } + [TestMethod] + public void Basic_nhide089_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("An indexer introduced in a class or a struct"); + Debug.WriteLine("hides all base class indexers with the same"); + Debug.WriteLine("signature (parameter count and types)."); + Assert.True(Basic_TestClass_nhide089.testMethod()); + } + [TestMethod] + public void Basic_nhide090_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("An indexer introduced in a class or a struct"); + Debug.WriteLine("hides all base class indexers with the same"); + Debug.WriteLine("signature (parameter count and types)."); + Assert.True(Basic_TestClass_nhide090.testMethod()); + } + [TestMethod] + public void Basic_nhide091_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("Contrary to hiding a name from an outer scope,"); + Debug.WriteLine("hding an accessible name from an inherited scope"); + Debug.WriteLine("causes a warning to be reported."); + Assert.True(Basic_TestClass_nhide091.testMethod()); + } + [TestMethod] + public void Basic_nhide092_Test() + { + Debug.WriteLine("Section 3.5.1"); + Debug.WriteLine("A declaration of a new member hides an inherited"); + Debug.WriteLine("member only within the scope of the new member."); + Assert.True(Basic_TestClass_nhide092.testMethod()); + } + [TestMethod] + public void Basic_memac009_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Then, if M is public, the access is permitted."); + Assert.True(Basic_TestClass_memac009.testMethod()); + } + [TestMethod] + public void Basic_memac010_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Then, if M is public, the access is permitted."); + Assert.True(Basic_TestClass_memac010.testMethod()); + } + [TestMethod] + public void Basic_memac011_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is protected internal, the access"); + Debug.WriteLine("is permitted if it occurs within the project in which"); + Debug.WriteLine("M is declared, or if it occurs within a class derived "); + Debug.WriteLine("from the class in which M is declared and takes place "); + Debug.WriteLine("through the derived class type."); + Assert.True(Basic_TestClass_memac011.testMethod()); + } + [TestMethod] + public void Basic_memac012_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is protected internal, the access"); + Debug.WriteLine("is permitted if it occurs within the project in which"); + Debug.WriteLine("M is declared, or if it occurs within a class derived "); + Debug.WriteLine("from the class in which M is declared and takes place "); + Debug.WriteLine("through the derived class type."); + Assert.True(Basic_TestClass_memac012.testMethod()); + } + /* + * These tests were removed because they required additional files, they fail in the baseline + * + [TestMethod] + public void Basic_memac013_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is protected internal, the access"); + Debug.WriteLine("is permitted if it occurs within the project in which"); + Debug.WriteLine("M is declared, or if it occurs within a class derived "); + Debug.WriteLine("from the class in which M is declared and takes place "); + Debug.WriteLine("through the derived class type."); + Assert.True(Basic_TestClass_memac013.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Basic_memac014_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is protected internal, the access"); + Debug.WriteLine("is permitted if it occurs within the project in which"); + Debug.WriteLine("M is declared, or if it occurs within a class derived "); + Debug.WriteLine("from the class in which M is declared and takes place "); + Debug.WriteLine("through the derived class type."); + Assert.True(Basic_TestClass_memac014.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + * */ + [TestMethod] + public void Basic_memac019_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is protected, the access is permitted"); + Debug.WriteLine("if it occurs within the class in which M is declared, or"); + Debug.WriteLine("if it occurs within a class derived from the class in"); + Debug.WriteLine("which M is delared and takes place through the derived class "); + Debug.WriteLine("type."); + Assert.True(Basic_TestClass_memac019.testMethod()); + } + [TestMethod] + public void Basic_memac020_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is protected, the access is permitted"); + Debug.WriteLine("if it occurs within the class in which M is declared, or"); + Debug.WriteLine("if it occurs within a class derived from the class in"); + Debug.WriteLine("which M is delared and takes place through the derived class "); + Debug.WriteLine("type."); + Assert.True(Basic_TestClass_memac020.testMethod()); + } + [TestMethod] + public void Basic_memac021_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is protected, the access is permitted"); + Debug.WriteLine("if it occurs within the class in which M is declared, or"); + Debug.WriteLine("if it occurs within a class derived from the class in"); + Debug.WriteLine("which M is delared and takes place through the derived class "); + Debug.WriteLine("type."); + Assert.True(Basic_TestClass_memac021.testMethod()); + } + [TestMethod] + public void Basic_memac022_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is protected, the access is permitted"); + Debug.WriteLine("if it occurs within the class in which M is declared, or"); + Debug.WriteLine("if it occurs within a class derived from the class in"); + Debug.WriteLine("which M is delared and takes place through the derived class "); + Debug.WriteLine("type."); + Assert.True(Basic_TestClass_memac022.testMethod()); + } + [TestMethod] + public void Basic_memac025_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is protected, the access is permitted"); + Debug.WriteLine("if it occurs within the class in which M is declared, or"); + Debug.WriteLine("if it occurs within a class derived from the class in"); + Debug.WriteLine("which M is delared and takes place through the derived class "); + Debug.WriteLine("type."); + Assert.True(Basic_TestClass_memac025.testMethod()); + } + [TestMethod] + public void Basic_memac027_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is internal, the access is permitted"); + Debug.WriteLine("if it occurs within the project in which M is declared."); + Assert.True(Basic_TestClass_memac027.testMethod()); + } + [TestMethod] + public void Basic_memac029_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is internal, the access is permitted"); + Debug.WriteLine("if it occurs within the project in which M is declared."); + Assert.True(Basic_TestClass_memac029.testMethod()); + } + [TestMethod] + public void Basic_memac030_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is internal, the access is permitted"); + Debug.WriteLine("if it occurs within the project in which M is declared."); + Assert.True(Basic_TestClass_memac030.testMethod()); + } + [TestMethod] + public void Basic_memac033_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is private, the access is permitted"); + Debug.WriteLine("if it occurs within the type in which M is declared."); + Assert.True(Basic_TestClass_memac033.testMethod()); + } + [TestMethod] + public void Basic_memac034_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("Otherwise, if M is private, the access is permitted"); + Debug.WriteLine("if it occurs within the type in which M is declared."); + Assert.True(Basic_TestClass_memac034.testMethod()); + } + + /* + * These tests were skipped because they require extra files, they fail in the baseline. + * + [TestMethod] + public void Basic_memac039_Test() + { + Debug.WriteLine("VS Bug 75548"); + Assert.True(Basic_TestClass_memac039.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Basic_memac041_Test() + { + Assert.True(Basic_TestClass_memac041.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + * */ + [TestMethod] + public void Basic_memac042_Test() + { + Debug.WriteLine("Section 3.5"); + Assert.True(Basic_TestClass_memac042.testMethod()); + } + [TestMethod] + public void Basic_memac043_Test() + { + Debug.WriteLine("Section 3.5"); + Assert.True(Basic_TestClass_memac043.testMethod()); + } + [TestMethod] + public void Basic_memac044_Test() + { + Debug.WriteLine("Section 3.5"); + Assert.True(Basic_TestClass_memac044.testMethod()); + } + [TestMethod] + public void Basic_memac045_Test() + { + Debug.WriteLine("Section 3.5"); + Assert.True(Basic_TestClass_memac045.testMethod()); + } + [TestMethod] + public void Basic_memac046_Test() + { + Debug.WriteLine("Section 3.5"); + Assert.True(Basic_TestClass_memac046.testMethod()); + } + [TestMethod] + public void Basic_memac047_Test() + { + Debug.WriteLine("Section 3.5"); + Assert.True(Basic_TestClass_memac047.testMethod()); + } + [TestMethod] + public void Basic_accon001_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The direct base class of a class type must be"); + Debug.WriteLine("at least as accessible as the class type itself."); + Assert.True(Basic_TestClass_accon001.testMethod()); + } + [TestMethod] + public void Basic_accon003_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The direct base class of a class type must be"); + Debug.WriteLine("at least as accessible as the class type itself."); + Assert.True(Basic_TestClass_accon003.testMethod()); + } + [TestMethod] + public void Basic_accon005_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The direct base class of a class type must be"); + Debug.WriteLine("at least as accessible as the class type itself."); + Assert.True(Basic_TestClass_accon005.testMethod()); + } + [TestMethod] + public void Basic_accon007_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The direct base class of a class type must be"); + Debug.WriteLine("at least as accessible as the class type itself."); + Assert.True(Basic_TestClass_accon007.testMethod()); + } + [TestMethod] + public void Basic_accon009_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The direct base class of a class type must be"); + Debug.WriteLine("at least as accessible as the class type itself."); + Assert.True(Basic_TestClass_accon009.testMethod()); + } + [TestMethod] + public void Basic_accon011_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The direct base class of a class type must be"); + Debug.WriteLine("at least as accessible as the class type itself."); + Assert.True(Basic_TestClass_accon011.testMethod()); + } + [TestMethod] + public void Basic_accon013_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The direct base class of a class type must be"); + Debug.WriteLine("at least as accessible as the class type itself."); + Assert.True(Basic_TestClass_accon013.testMethod()); + } + [TestMethod] + public void Basic_accon015_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The direct base class of a class type must be"); + Debug.WriteLine("at least as accessible as the class type itself."); + Assert.True(Basic_TestClass_accon015.testMethod()); + } + [TestMethod] + public void Basic_accon019_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The direct base class of a class type must be"); + Debug.WriteLine("at least as accessible as the class type itself."); + Assert.True(Basic_TestClass_accon019.testMethod()); + } + [TestMethod] + public void Basic_accon021_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The direct base class of a class type must be"); + Debug.WriteLine("at least as accessible as the class type itself."); + Assert.True(Basic_TestClass_accon021.testMethod()); + } + [TestMethod] + public void Basic_accon023_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The explicit base interfaces of an interface "); + Debug.WriteLine("type must be at least as accessible as the interface"); + Debug.WriteLine("type itself."); + Assert.True(Basic_TestClass_accon023.testMethod()); + } + [TestMethod] + public void Basic_accon025_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The explicit base interfaces of an interface "); + Debug.WriteLine("type must be at least as accessible as the interface"); + Debug.WriteLine("type itself."); + Assert.True(Basic_TestClass_accon025.testMethod()); + } + [TestMethod] + public void Basic_accon027_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The explicit base interfaces of an interface "); + Debug.WriteLine("type must be at least as accessible as the interface"); + Debug.WriteLine("type itself."); + Assert.True(Basic_TestClass_accon027.testMethod()); + } + [TestMethod] + public void Basic_accon029_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The explicit base interfaces of an interface "); + Debug.WriteLine("type must be at least as accessible as the interface"); + Debug.WriteLine("type itself."); + Assert.True(Basic_TestClass_accon029.testMethod()); + } + [TestMethod] + public void Basic_accon031_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The explicit base interfaces of an interface "); + Debug.WriteLine("type must be at least as accessible as the interface"); + Debug.WriteLine("type itself."); + Assert.True(Basic_TestClass_accon031.testMethod()); + } + [TestMethod] + public void Basic_accon033_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The return type and parameter types of a delegate"); + Debug.WriteLine("type must be at least as accessible as the delegate"); + Debug.WriteLine("ytpe itself."); + Assert.True(Basic_TestClass_accon033.testMethod()); + } + [TestMethod] + public void Basic_accon035_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The return type and parameter types of a delegate"); + Debug.WriteLine("type must be at least as accessible as the delegate"); + Debug.WriteLine("ytpe itself."); + Assert.True(Basic_TestClass_accon035.testMethod()); + } + [TestMethod] + public void Basic_accon037_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The type of a constant must be at least as"); + Debug.WriteLine("accessible as the constant itself."); + Assert.True(Basic_TestClass_accon037.testMethod()); + } + [TestMethod] + public void Basic_accon039_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The type of a field must be at least as accessible"); + Debug.WriteLine("as the field itself."); + Assert.True(Basic_TestClass_accon039.testMethod()); + } + [TestMethod] + public void Basic_accon041_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The return type and parameter types of a method"); + Debug.WriteLine("must be at least asaccessible as the method itself."); + Assert.True(Basic_TestClass_accon041.testMethod()); + } + [TestMethod] + public void Basic_accon043_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The return type and parameter types of a method"); + Debug.WriteLine("must be at least asaccessible as the method itself."); + Assert.True(Basic_TestClass_accon043.testMethod()); + } + [TestMethod] + public void Basic_accon045_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The type of a property must be at least as"); + Debug.WriteLine("accessible as the property itself."); + Assert.True(Basic_TestClass_accon045.testMethod()); + } + [TestMethod] + public void Basic_accon047_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The return type and parameter types of an"); + Debug.WriteLine("indexer must be at least as accessible as the"); + Debug.WriteLine("indexer itself."); + Assert.True(Basic_TestClass_accon047.testMethod()); + } + [TestMethod] + public void Basic_accon049_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The return type and parameter types of an"); + Debug.WriteLine("indexer must be at least as accessible as the"); + Debug.WriteLine("indexer itself."); + Assert.True(Basic_TestClass_accon049.testMethod()); + } + [TestMethod] + public void Basic_accon051_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The return type and parameter types of an"); + Debug.WriteLine("operator must be at least as accessible as"); + Debug.WriteLine("the operator itself."); + Assert.True(Basic_TestClass_accon051.testMethod()); + } + [TestMethod] + public void Basic_accon053_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The return type and parameter types of an"); + Debug.WriteLine("operator must be at least as accessible as"); + Debug.WriteLine("the operator itself."); + Assert.True(Basic_TestClass_accon053.testMethod()); + } + [TestMethod] + public void Basic_accon055_Test() + { + Debug.WriteLine("Section 3.3"); + Debug.WriteLine("The parameter types of a constructor must be at least"); + Debug.WriteLine("as accessible as the constructor itself."); + Assert.True(Basic_TestClass_accon055.testMethod()); + } + + class Basic_TestClass_scope001 + { + public static int Main_old() + { + if ((Basic_TestClass_scope001_C1.intI == 1) && (NS_Basic_TestClass_scope001.MyClass2.intI == 2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope001_C1 + { + public static int intI = 1; + } + + + + class Basic_TestClass_scope019 + { + int intTest = 1; + static int intTest2 = 2; + string strTest = "test"; + static string strTest2 = "test2"; + class Basic_TestClass_scope019_C1 { } + public Basic_TestClass_scope019() + { + int intI = intTest; + string strS = strTest; + Basic_TestClass_scope019_C1 tc = new Basic_TestClass_scope019_C1(); + } + ~Basic_TestClass_scope019() + { + int intI = intTest; + string strS = strTest; + Basic_TestClass_scope019_C1 tc = new Basic_TestClass_scope019_C1(); + } + public void TestMeth() + { + int intI = intTest; + string strS = strTest; + Basic_TestClass_scope019_C1 tc = new Basic_TestClass_scope019_C1(); + } + public static int Main_old() + { + int intI = intTest2; + string strS = strTest2; + Basic_TestClass_scope019_C1 tc = new Basic_TestClass_scope019_C1(); + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope022_C2 + { + protected int intTest = 1; + public static int intTest2 = 2; + internal string strTest = "test"; + public static string strTest2 = "test2"; + public class Basic_TestClass_scope022 { } + } + class Basic_TestClass_scope022 : Basic_TestClass_scope022_C2 + { + public Basic_TestClass_scope022() + { + int intI = intTest; + string strS = strTest; + Basic_TestClass_scope022 tc = new Basic_TestClass_scope022(); + } + ~Basic_TestClass_scope022() + { + int intI = intTest; + string strS = strTest; + Basic_TestClass_scope022 tc = new Basic_TestClass_scope022(); + } + public void TestMeth() + { + int intI = intTest; + string strS = strTest; + Basic_TestClass_scope022 tc = new Basic_TestClass_scope022(); + } + public static int Main_old() + { + int intI = intTest2; + string strS = strTest2; + Basic_TestClass_scope022 tc = new Basic_TestClass_scope022(); + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope023 + { + public int intTest = 1; + class Basic_TestClass_scope023_C1 : Basic_TestClass_scope023 + { + + public int RetInt() + { + return intTest; + } + public static int Main_old() + { + Basic_TestClass_scope023_C1 tc = new Basic_TestClass_scope023_C1(); + if (tc.RetInt() == 1) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_scope023_C1.Main_old() == 0); + } + + } + class Basic_TestClass_scope024 + { + static int intTest = 1; + class Basic_TestClass_scope024_C1 + { + + public int RetInt() + { + return intTest; + } + public static int Main_old() + { + Basic_TestClass_scope024_C1 tc = new Basic_TestClass_scope024_C1(); + if (tc.RetInt() == 1) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_scope024_C1.Main_old() == 0); + } + + } + struct Basic_TestClass_scope025 + { + int intTest; + static int intTest2; + string strTest; + static string strTest2; + struct Basic_TestClass_scope025_C1 { } + public void TestMeth() + { + int intI = intTest; + string strS = strTest; + Basic_TestClass_scope025_C1 tc = new Basic_TestClass_scope025_C1(); + } + public static int Main_old() + { + int intI = intTest2; + string strS = strTest2; + Basic_TestClass_scope025_C1 tc = new Basic_TestClass_scope025_C1(); + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + enum Basic_TestClass_scope027_Enum { aa = 2, bb = aa } + public class Basic_TestClass_scope027 + { + public static int Main_old() + { + if ((int)Basic_TestClass_scope027_Enum.bb == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_scope029_C2 + { + protected int intI; + protected string strS; + protected Basic_TestClass_scope029_C2(int i, string s) + { + intI = i; + strS = s; + } + } + public class Basic_TestClass_scope029 : Basic_TestClass_scope029_C2 + { + + int intI2; + string strS2; + public Basic_TestClass_scope029(int i, string s) + : base(i, s) + { + intI2 = i + 1; + strS2 = s + "!"; + } + public static int Main_old() + { + Basic_TestClass_scope029 test = new Basic_TestClass_scope029(2, "test"); + if ((test.intI == 2) && (test.strS == "test") && (test.intI2 == 3) && (test.strS2 == "test!")) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_scope033 + { + + int intI; + string strS; + public void Basic_TestClass_scope033_C1(int i, string s) + { + intI = i; + strS = s; + } + public static int Main_old() + { + Basic_TestClass_scope033 TC = new Basic_TestClass_scope033(); + TC.Basic_TestClass_scope033_C1(2, "test"); + if ((TC.intI == 2) && (TC.strS == "test")) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_scope037 + { + + int intI; + string strS; + public string this[int i, string s] + { + get + { + return s + i; + } + set + { + intI = i; + strS = s; + } + } + public static int Main_old() + { + Basic_TestClass_scope037 test = new Basic_TestClass_scope037(); + test[2, "test"] = "QQQ"; + if ((test[2, "test"] == "test2") && (test.intI == 2) && (test.strS == "test")) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope041 + { + public int intI = 2; + public static Basic_TestClass_scope041 operator +(Basic_TestClass_scope041 MyInt) + { + MyInt.intI = 3; + return new Basic_TestClass_scope041(); + } + public static int Main_old() + { + Basic_TestClass_scope041 Basic_TestClass_scope041_C1 = new Basic_TestClass_scope041(); + Basic_TestClass_scope041 temp = +Basic_TestClass_scope041_C1; + if (Basic_TestClass_scope041_C1.intI == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope044 + { + public bool Basic_TestClass_scope044_C1() + { + int intI = 1; + string strS = "test"; + if ((intI == 1) && (strS == "test")) + { + return true; + } + else + { + return false; + } + } + public static int Main_old() + { + int intI = 2; + string strS = "test2"; + if ((intI != 2) || (strS != "test2")) + { + return 1; + } + for (intI = 1; intI < 3; intI++) + { + int intI2 = 3; + string strS2 = "test3"; + if ((intI2 != 3) || (strS2 != "test3")) + { + return 1; + } + } + { + int intI3 = 4; + string strS3 = "test4"; + if ((intI3 != 4) || (strS3 != "test4")) + { + return 1; + } + } + Basic_TestClass_scope044 TC = new Basic_TestClass_scope044(); + if (TC.Basic_TestClass_scope044_C1() == true) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope051 + { + public static int Main_old() + { + + int i = 0; + for (int intI = 0; intI < 3; intI++) + { + int intJ = intI; + i++; + } + if (i == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope053 + { + public static int Main_old() + { + + int Basic_TestClass_scope053_A = 2; + goto Basic_TestClass_scope053_A; + Basic_TestClass_scope053_A++; + Basic_TestClass_scope053_A: Basic_TestClass_scope053_A++; + if (Basic_TestClass_scope053_A == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope055 + { + public static int Main_old() + { + + int Basic_TestClass_scope055_A = 2; + { + goto Basic_TestClass_scope055_A; + Basic_TestClass_scope055_A++; + } + Basic_TestClass_scope055_A: Basic_TestClass_scope055_A++; + if (Basic_TestClass_scope055_A == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + + + class Basic_TestClass_scope057 + { + public static int Main_old() + { + Basic_TestClass_scope057 TC = new Basic_TestClass_scope057(); + if (TC.test()) + { + return 0; + } + else + { + return 1; + } + } + public bool test() + { + if (intI == 1) + { + return true; + } + return false; + } + int intI = 1; + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + struct Basic_TestClass_scope058 + { + public static int Main_old() + { + Basic_TestClass_scope058 TS = new Basic_TestClass_scope058(1); + if (TS.test()) + { + return 0; + } + else + { + return 1; + } + } + public bool test() + { + if (intI == 1) + { + return true; + } + return false; + } + public Basic_TestClass_scope058(int i) + { + intI = i; + } + + int intI; + public static bool testMethod() + { + return (Main_old() == 0); + } + } + enum Basic_TestClass_scope059_Enum { AA = BB, BB = 1 } + public class Basic_TestClass_scope059 + { + public static int Main_old() + { + if ((int)Basic_TestClass_scope059_Enum.AA == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_scope061 + { + + void G() + { + int j = (j = 1); + } + void H() + { + int a = 1, b = ++a; + } + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope062_A { } + public class Basic_TestClass_scope062 + { + public static int Main_old() + { + string Basic_TestClass_scope062_A = "test"; + string S = Basic_TestClass_scope062_A; + + Type t = typeof(Basic_TestClass_scope062_A); + if (t != typeof(string)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_scope063_C1 { } + public class Basic_TestClass_scope063 + { + static int Basic_TestClass_scope063_C1 = 2; + + public static int Main_old() + { + if (Basic_TestClass_scope063_C1 == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_scope064_C1 + { + public int intI = 3; + } + public class Basic_TestClass_scope064 + { + static int Basic_TestClass_scope064_C1 = 2; + + public static int Main_old() + { + Basic_TestClass_scope064_C1 tc = new Basic_TestClass_scope064_C1(); + if (tc.intI == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_scope067_C1 { } + public class Basic_TestClass_scope067 + { + int Basic_TestClass_scope067_C1 = 2; + public int TestMeth() + { + if (Basic_TestClass_scope067_C1 == 2) + { + return 0; + } + else + { + return 1; + } + } + + public static int Main_old() + { + Basic_TestClass_scope067 MC = new Basic_TestClass_scope067(); + return MC.TestMeth(); + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_scope068_C1 + { + public int intI = 3; + } + public class Basic_TestClass_scope068 + { + int Basic_TestClass_scope068_C1 = 2; + public int TestMeth() + { + Basic_TestClass_scope068_C1 tc = new Basic_TestClass_scope068_C1(); + if (tc.intI == 3) + { + return 0; + } + else + { + return 1; + } + } + + public static int Main_old() + { + Basic_TestClass_scope068 MC = new Basic_TestClass_scope068(); + return MC.TestMeth(); + + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope069 + { + private class MyInner + { + public int MyMeth(MyInner2 arg) + { + return arg.intI; + } + } + protected class MyInner2 + { + public int intI = 2; + } + public static int Main_old() + { + MyInner MI = new MyInner(); + if (MI.MyMeth(new MyInner2()) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope070 + { + protected class MyInner + { + public int MyMeth(MyInner2 arg) + { + return arg.intI; + } + } + protected class MyInner2 + { + public int intI = 2; + } + public static int Main_old() + { + MyInner MI = new MyInner(); + if (MI.MyMeth(new MyInner2()) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope071 + { + internal protected class MyInner + { + public int MyMeth(MyInner2 arg) + { + return arg.intI; + } + } + internal protected class MyInner2 + { + public int intI = 2; + } + public static int Main_old() + { + MyInner MI = new MyInner(); + if (MI.MyMeth(new MyInner2()) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope074 + { + public static int Main_old() + { + { + L1: + int i = 0; + } + { + L1: + int i = 0; + } + { + L1: + int i = 0; + } + { + L1: + int i = 0; + } + + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + class Basic_TestClass_nhide007 + { + public static int Main_old() + { + if (Basic_TestClass_nhide007_C1.Basic_TestClass_nhide007_C1.intI == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + class Basic_TestClass_nhide015 + { + class Basic_TestClass_nhide015_C1 + { + public class Basic_TestClass_nhide015_I + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide015_C2 + { + public static int Main_old() + { + if (Basic_TestClass_nhide015_C1.Basic_TestClass_nhide015_I.intI == 2) + { + Debug.WriteLine("foo"); + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide015_C2.Main_old() == 0); + } + } + + class Basic_TestClass_nhide016_C1 + { + public class Basic_TestClass_nhide016_I + { + public static int intI = 1; + } + } + class Basic_TestClass_nhide016 + { + class Basic_TestClass_nhide016_C1 + { + public class Basic_TestClass_nhide016_I + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide016_C2 + { + public static int Main_old() + { + if (Basic_TestClass_nhide016_C1.Basic_TestClass_nhide016_I.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide016_C2.Main_old() == 0); + } + } + + struct Basic_TestClass_nhide017_St1 + { + public class Basic_TestClass_nhide017_I + { + public static int intI = 1; + } + } + class Basic_TestClass_nhide017 + { + struct Basic_TestClass_nhide017_St1 + { + public class Basic_TestClass_nhide017_I + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide017_C2 + { + public static int Main_old() + { + if (Basic_TestClass_nhide017_St1.Basic_TestClass_nhide017_I.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide017_C2.Main_old() == 0); + } + } + + interface Basic_TestClass_nhide018_Inter + { + void bogus(); + } + class Basic_TestClass_nhide018 + { + interface Basic_TestClass_nhide018_Inter + { + void test(); + } + class Basic_TestClass_nhide018_C2 : Basic_TestClass_nhide018_Inter + { + public void test() { } + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide018_C2.Main_old() == 0); + } + } + + enum Basic_TestClass_nhide019_Enum { test = 1 } + class Basic_TestClass_nhide019 + { + enum Basic_TestClass_nhide019_Enum { test = 2 } + class Basic_TestClass_nhide019_C2 + { + public static int Main_old() + { + if ((int)Basic_TestClass_nhide019_Enum.test == 2) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide019_C2.Main_old() == 0); + } + } + + + delegate void Basic_TestClass_nhide020_Del(); + class Basic_TestClass_nhide020 + { + delegate int Basic_TestClass_nhide020_Del(int intI); + class Basic_TestClass_nhide020_C2 + { + int TestMeth(int intI) + { + return 1; + } + public static int Main_old() + { + Basic_TestClass_nhide020_C2 test = new Basic_TestClass_nhide020_C2(); + Basic_TestClass_nhide020_Del td = new Basic_TestClass_nhide020_Del(test.TestMeth); + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide020_C2.Main_old() == 0); + } + } + class Basic_TestClass_nhide021_C1 + { + public class Basic_TestClass_nhide021_I + { + public static int intI = 1; + } + } + + class T_Basic_TestClass_nhide021 + { + class Basic_TestClass_nhide021_C1 + { + public class Basic_TestClass_nhide021_I + { + public static int intI = 2; + } + } + } + class Basic_TestClass_nhide021 + { + public static int Main_old() + { + if (Basic_TestClass_nhide021_C1.Basic_TestClass_nhide021_I.intI == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + struct Basic_TestClass_nhide022 + { + class Basic_TestClass_nhide022_C1 + { + public class Basic_TestClass_nhide022_I + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide022_C2 + { + public static int Main_old() + { + if (Basic_TestClass_nhide022_C1.Basic_TestClass_nhide022_I.intI == 2) + { + Debug.WriteLine("foo"); + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide022_C2.Main_old() == 0); + } + } + + //Compiled Test Cases + + + + + + + + + + + + + + class Basic_TestClass_nhide023_C1 + { + public class Basic_TestClass_nhide023_I + { + public static int intI = 1; + } + } + struct Basic_TestClass_nhide023 + { + class Basic_TestClass_nhide023_C1 + { + public class Basic_TestClass_nhide023_I + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide023_C2 + { + public static int Main_old() + { + if (Basic_TestClass_nhide023_C1.Basic_TestClass_nhide023_I.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide023_C2.Main_old() == 0); + } + } + struct Basic_TestClass_nhide024_St1 + { + public class Basic_TestClass_nhide024_I + { + public static int intI = 1; + } + } + struct Basic_TestClass_nhide024 + { + struct Basic_TestClass_nhide024_St1 + { + public class Basic_TestClass_nhide024_I + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide024_C1 + { + public static int Main_old() + { + if (Basic_TestClass_nhide024_St1.Basic_TestClass_nhide024_I.intI == 2) + { + Debug.WriteLine("foo"); + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide024_C1.Main_old() == 0); + } + } + interface Basic_TestClass_nhide025_Inter + { + void bogus(); + } + struct Basic_TestClass_nhide025 + { + interface Basic_TestClass_nhide025_Inter + { + void test(); + } + class Basic_TestClass_nhide025_C1 : Basic_TestClass_nhide025_Inter + { + public void test() { } + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide025_C1.Main_old() == 0); + } + } + enum Basic_TestClass_nhide026_Enum { test = 1 } + struct Basic_TestClass_nhide026 + { + enum Basic_TestClass_nhide026_Enum { test = 2 } + class Basic_TestClass_nhide026_C1 + { + public static int Main_old() + { + if ((int)Basic_TestClass_nhide026_Enum.test == 2) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide026_C1.Main_old() == 0); + + } + } + delegate void Basic_TestClass_nhide027_Del(); + struct Basic_TestClass_nhide027 + { + delegate int Basic_TestClass_nhide027_Del(int intI); + class Basic_TestClass_nhide027_C1 + { + int TestMeth(int intI) + { + return 1; + } + public static int Main_old() + { + Basic_TestClass_nhide027_C1 test = new Basic_TestClass_nhide027_C1(); + Basic_TestClass_nhide027_Del td = new Basic_TestClass_nhide027_Del(test.TestMeth); + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide027_C1.Main_old() == 0); + + } + } + class Basic_TestClass_nhide028_C1 + { + public class Basic_TestClass_nhide028_I + { + public static int intI = 1; + } + } + struct Basic_TestClass_nhide028_St2 + { + class Basic_TestClass_nhide028_C1 + { + public class Basic_TestClass_nhide028_I + { + public static int intI = 2; + } + } + } + class Basic_TestClass_nhide028 + { + public static int Main_old() + { + if (Basic_TestClass_nhide028_C1.Basic_TestClass_nhide028_I.intI == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide029 + { + public int intI = 1; + public bool Basic_TestClass_nhide029_C1(int intI) + { + if (intI == 2) + { + return true; + } + return false; + } + public static int Main_old() + { + Basic_TestClass_nhide029 test = new Basic_TestClass_nhide029(); + if (test.Basic_TestClass_nhide029_C1(2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide030 + { + public string strS = "test1"; + public bool Basic_TestClass_nhide030_C1(string strS) + { + if (strS == "test2") + { + return true; + } + return false; + } + public static int Main_old() + { + Basic_TestClass_nhide030 test = new Basic_TestClass_nhide030(); + if (test.Basic_TestClass_nhide030_C1("test2")) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide031 + { + public static int intI = 1; + public static bool Basic_TestClass_nhide031_C1(int intI) + { + if (intI == 2) + { + return true; + } + return false; + } + public static int Main_old() + { + if (Basic_TestClass_nhide031.Basic_TestClass_nhide031_C1(2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide032 + { + public static string strS = "test1"; + public static bool Basic_TestClass_nhide032_C1(string strS) + { + if (strS == "test2") + { + return true; + } + return false; + } + public static int Main_old() + { + if (Basic_TestClass_nhide032.Basic_TestClass_nhide032_C1("test2")) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide033 + { + public int intI = 1; + public int intJ = 2; + public bool Basic_TestClass_nhide033_C1(int intI, int intJ) + { + if ((intI == 2) && (intJ == 3)) + { + return true; + } + return false; + } + public static int Main_old() + { + Basic_TestClass_nhide033 test = new Basic_TestClass_nhide033(); + if (test.Basic_TestClass_nhide033_C1(2, 3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide034 + { + public string strS = "test1"; + public string strS2 = "test2"; + public bool Basic_TestClass_nhide034_C1(string strS, string strS2) + { + if ((strS == "test2") && (strS2 == "test3")) + { + return true; + } + return false; + } + public static int Main_old() + { + Basic_TestClass_nhide034 test = new Basic_TestClass_nhide034(); + if (test.Basic_TestClass_nhide034_C1("test2", "test3")) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide035 + { + public int intI = 1; + public bool Basic_TestClass_nhide035_C1(ref int intI) + { + if (intI == 2) + { + return true; + } + return false; + } + public static int Main_old() + { + int intJ = 2; + Basic_TestClass_nhide035 test = new Basic_TestClass_nhide035(); + if (test.Basic_TestClass_nhide035_C1(ref intJ)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide036 + { + public string strS = "test1"; + public bool Basic_TestClass_nhide036_C1(ref string strS) + { + if (strS == "test2") + { + return true; + } + return false; + } + public static int Main_old() + { + string strTest = "test2"; + Basic_TestClass_nhide036 test = new Basic_TestClass_nhide036(); + if (test.Basic_TestClass_nhide036_C1(ref strTest)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide037 + { + public int intI = 1; + public void Basic_TestClass_nhide037_C1(out int intI) + { + intI = 2; + } + public static int Main_old() + { + int intJ; + Basic_TestClass_nhide037 test = new Basic_TestClass_nhide037(); + test.Basic_TestClass_nhide037_C1(out intJ); + if ((test.intI == 1) && (intJ == 2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide038 + { + public string strS = "test1"; + public void Basic_TestClass_nhide038_C1(out string strS) + { + strS = "test2"; + } + public static int Main_old() + { + string strTest; + Basic_TestClass_nhide038 test = new Basic_TestClass_nhide038(); + test.Basic_TestClass_nhide038_C1(out strTest); + if ((test.strS == "test1") && (strTest == "test2")) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide039 + { + public static int intI = 1; + public static int Main_old() + { + int intI = 2; + if (intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide040 + { + public static string strS = "test"; + public static int Main_old() + { + string strS = "test2"; + if (strS == "test2") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide041 + { + int intI = 1; + + bool Test1() + { + int intI = 2; + if (intI == 2) + { + return true; + } + return false; + } + bool Test2() + { + if (intI == 1) + { + return true; + } + else + { + return false; + } + } + public static int Main_old() + { + Basic_TestClass_nhide041 test = new Basic_TestClass_nhide041(); + if (test.Test1() && test.Test2()) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide042 + { + string strS = "test2"; + + bool Test1() + { + string strS = "test1"; + if (strS == "test1") + { + return true; + } + return false; + } + bool Test2() + { + if (strS == "test2") + { + return true; + } + else + { + return false; + } + } + public static int Main_old() + { + Basic_TestClass_nhide042 test = new Basic_TestClass_nhide042(); + if (test.Test1() && test.Test2()) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide043 + { + int intI = 1; + + bool Test1() + { + int intI = 2; + if (intI == 2) + { + return true; + } + return false; + } + bool Test2() + { + int intI = 3; + if (intI == 3) + { + return true; + } + return false; + } + public static int Main_old() + { + Basic_TestClass_nhide043 test = new Basic_TestClass_nhide043(); + if (test.Test1() && test.Test2()) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide044 + { + string strS = "test2"; + + bool Test1() + { + string strS = "test1"; + if (strS == "test1") + { + return true; + } + return false; + } + bool Test2() + { + string strS = "test2"; + if (strS == "test2") + { + return true; + } + return false; + } + public static int Main_old() + { + Basic_TestClass_nhide044 test = new Basic_TestClass_nhide044(); + if (test.Test1() && test.Test2()) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide045 + { + static int Basic_TestClass_nhide045_C1(int intI) + { + return -1; + } + static int Basic_TestClass_nhide045_C1(string s) + { + return -1; + } + class Basic_TestClass_nhide045_I + { + static int Basic_TestClass_nhide045_C1(int intI) + { + return intI; + } + public static int Main_old() + { + if (Basic_TestClass_nhide045_C1(2) == 2) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide045_I.Main_old() == 0); + } + } + class Basic_TestClass_nhide047 + { + static int Basic_TestClass_nhide047_C1() + { + return 1; + } + class Basic_TestClass_nhide047_I + { + static int Basic_TestClass_nhide047_C1 = 2; + + public static int Main_old() + { + if (Basic_TestClass_nhide047_C1 == 2) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide047_I.Main_old() == 0); + + } + } + class Basic_TestClass_nhide049 + { + class Basic_TestClass_nhide049_C1 { } + class Basic_TestClass_nhide049_I + { + static int Basic_TestClass_nhide049_C1 = 2; + + public static int Main_old() + { + if (Basic_TestClass_nhide049_C1 == 2) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide049_I.Main_old() == 0); + } + } + class Basic_TestClass_nhide050 + { + class Basic_TestClass_nhide050_C1 + { + public int intI = 3; + } + class Basic_TestClass_nhide050_I + { + public static int Basic_TestClass_nhide050_C1 = 2; + + public static int Main_old() + { + Basic_TestClass_nhide050_C1 t = new Basic_TestClass_nhide050_C1(); + if (t.intI == 3) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide050_I.Main_old() == 0); + } + } + class Basic_TestClass_nhide051 + { + static int Basic_TestClass_nhide051_C1(int intI) + { + return -1; + } + static int Basic_TestClass_nhide051_C1(string s) + { + return -1; + } + class Basic_TestClass_nhide051_I + { + int Basic_TestClass_nhide051_C1(int intI) + { + return intI; + } + public int RetVal() + { + if (Basic_TestClass_nhide051_C1(2) == 2) + { + return 0; + } + else + { + return 1; + } + } + public static int Main_old() + { + Basic_TestClass_nhide051_I MC = new Basic_TestClass_nhide051_I(); + return MC.RetVal(); + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide051_I.Main_old() == 0); + } + } + class Basic_TestClass_nhide053 + { + static int Basic_TestClass_nhide053_C1() + { + return 1; + } + class Basic_TestClass_nhide053_I + { + int Basic_TestClass_nhide053_C1 = 2; + + public int RetVal() + { + if (Basic_TestClass_nhide053_C1 == 2) + { + return 0; + } + else + { + return 1; + } + } + public static int Main_old() + { + Basic_TestClass_nhide053_I MC = new Basic_TestClass_nhide053_I(); + return MC.RetVal(); + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide053_I.Main_old() == 0); + } + } + class Basic_TestClass_nhide055 + { + class Basic_TestClass_nhide055_C1 { } + class Basic_TestClass_nhide055_I + { + int Basic_TestClass_nhide055_C1 = 2; + + public int RetVal() + { + if (Basic_TestClass_nhide055_C1 == 2) + { + return 0; + } + else + { + return 1; + } + } + public static int Main_old() + { + Basic_TestClass_nhide055_I MC = new Basic_TestClass_nhide055_I(); + return MC.RetVal(); + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide055_I.Main_old() == 0); + } + } + class Basic_TestClass_nhide056 + { + class Basic_TestClass_nhide056_C1 { } + class Basic_TestClass_nhide056_I + { + int Basic_TestClass_nhide056_C1 = 2; + + public void RetVal() + { + Basic_TestClass_nhide056_C1 tc = new Basic_TestClass_nhide056_C1(); + } + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide056_I.Main_old() == 0); + } + } + class Basic_TestClass_nhide057_C4 + { + public int intRet() + { + return 2; + } + } + class Basic_TestClass_nhide057 + { + class Basic_TestClass_nhide057_C1 + { + public static int intRet() + { + return 1; + } + } + class Basic_TestClass_nhide057_I + { + static Basic_TestClass_nhide057_C4 Basic_TestClass_nhide057_C1 = new Basic_TestClass_nhide057_C4(); + public static int Main_old() + { + if (Basic_TestClass_nhide057_C1.intRet() == 2) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide057_I.Main_old() == 0); + } + } + class Basic_TestClass_nhide059_C4 + { + public int intRet() + { + return 2; + } + } + class Basic_TestClass_nhide059 + { + class Basic_TestClass_nhide059_C1 + { + public static int intRet() + { + return 1; + } + } + class Basic_TestClass_nhide059_I + { + public int TestMeth() + { + Basic_TestClass_nhide059_C4 Basic_TestClass_nhide059_C1 = new Basic_TestClass_nhide059_C4(); + return Basic_TestClass_nhide059_C1.intRet(); + } + public static int Main_old() + { + Basic_TestClass_nhide059_I TC = new Basic_TestClass_nhide059_I(); + if (TC.TestMeth() == 2) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_nhide059_I.Main_old() == 0); + } + } + class Basic_TestClass_nhide061_C5 + { + public const int intI = 1; + } + class Basic_TestClass_nhide061 : Basic_TestClass_nhide061_C5 + { + public const int intI = 2; + public static int Main_old() + { + if (intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide062_C5 + { + public int intI = 1; + } + class Basic_TestClass_nhide062 : Basic_TestClass_nhide062_C5 + { + public int intI = 2; + public static int Main_old() + { + Basic_TestClass_nhide062 test = new Basic_TestClass_nhide062(); + if (test.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide063_C5 + { + public int intI + { + get + { + return 1; + } + } + } + class Basic_TestClass_nhide063 : Basic_TestClass_nhide063_C5 + { + public int intI + { + get + { + return 2; + } + } + public static int Main_old() + { + Basic_TestClass_nhide063 test = new Basic_TestClass_nhide063(); + if (test.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide064_C5 + { + public class Basic_TestClass_nhide064_C1 + { + public int intI = 1; + } + } + class Basic_TestClass_nhide064 : Basic_TestClass_nhide064_C5 + { + public class Basic_TestClass_nhide064_C1 + { + public int intI = 2; + } + public static int Main_old() + { + Basic_TestClass_nhide064_C1 test = new Basic_TestClass_nhide064_C1(); + if (test.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide067_C5 + { + public int intI + { + get + { + return 1; + } + } + } + class Basic_TestClass_nhide067 : Basic_TestClass_nhide067_C5 + { + public class intI + { + public int i = 2; + } + public static int Main_old() + { + intI test = new intI(); + if (test.i == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide068_C5 + { + public class intI + { + public int i = 2; + } + } + class Basic_TestClass_nhide068 : Basic_TestClass_nhide068_C5 + { + const int intI = 3; + public static int Main_old() + { + intI test = new intI(); + if ((test.i == 2) && (intI == 3)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide071_C5 + { + public int MyMeth = 1; + } + class Basic_TestClass_nhide071 : Basic_TestClass_nhide071_C5 + { + public int MyMeth() + { + return 2; + } + public static int Main_old() + { + Basic_TestClass_nhide071 test = new Basic_TestClass_nhide071(); + if (test.MyMeth() == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide072_C5 + { + public static int MyMeth = 1; + } + class Basic_TestClass_nhide072 : Basic_TestClass_nhide072_C5 + { + public static int MyMeth() + { + return 2; + } + public static int Main_old() + { + if (MyMeth() == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide075_C5 + { + public int MyMeth(int intI) + { + return intI; + } + } + class Basic_TestClass_nhide075 : Basic_TestClass_nhide075_C5 + { + public int MyMeth(int intI) + { + return intI + 1; + } + public static int Main_old() + { + Basic_TestClass_nhide075 test = new Basic_TestClass_nhide075(); + if (test.MyMeth(2) == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide076_C5 + { + public static int MyMeth(int intI) + { + return intI; + } + } + class Basic_TestClass_nhide076 : Basic_TestClass_nhide076_C5 + { + public static int MyMeth(int intI) + { + return intI + 1; + } + public static int Main_old() + { + if (MyMeth(2) == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide077_C5 + { + public static int MyMeth(int intI) + { + return intI; + } + } + class Basic_TestClass_nhide077 : Basic_TestClass_nhide077_C5 + { + public int MyMeth(int intI) + { + return intI + 1; + } + public static int Main_old() + { + Basic_TestClass_nhide077 test = new Basic_TestClass_nhide077(); + if (test.MyMeth(2) == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide079_C5 + { + public int MyMeth(int intI) + { + return intI; + } + } + class Basic_TestClass_nhide079 : Basic_TestClass_nhide079_C5 + { + public static int MyMeth(int intI) + { + return intI + 1; + } + public static int Main_old() + { + if (MyMeth(2) == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide081_C5 + { + public int MyMeth() + { + return 1; + } + public int MyMeth(int intI) + { + return intI; + } + } + class Basic_TestClass_nhide081 : Basic_TestClass_nhide081_C5 + { + public int MyMeth(int intI) + { + return intI + 1; + } + public static int Main_old() + { + Basic_TestClass_nhide081 test = new Basic_TestClass_nhide081(); + if (test.MyMeth() == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide082_C5 + { + public static int MyMeth() + { + return 1; + } + public static int MyMeth(int intI) + { + return intI; + } + } + class Basic_TestClass_nhide082 : Basic_TestClass_nhide082_C5 + { + public static int MyMeth(int intI) + { + return intI + 1; + } + public static int Main_old() + { + if (MyMeth() == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide085_C5 + { + public int MyMeth(int intI) + { + return intI; + } + } + class Basic_TestClass_nhide085 : Basic_TestClass_nhide085_C5 + { + public int MyMeth(string strS) + { + return 1; + } + public static int Main_old() + { + Basic_TestClass_nhide085 test = new Basic_TestClass_nhide085(); + if ((test.MyMeth(2) == 2) && (test.MyMeth("bogus") == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_nhide086_C5 + { + public static int MyMeth(int intI) + { + return intI; + } + } + class Basic_TestClass_nhide086 : Basic_TestClass_nhide086_C5 + { + public static int MyMeth(string strS) + { + return 1; + } + public static int Main_old() + { + if ((MyMeth(2) == 2) && (MyMeth("bogus") == 1)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + struct Basic_TestClass_nhide087 + { + public string ToString() + { + return "MyTestStruct"; + } + public static int Main_old() + { + Basic_TestClass_nhide087 test = new Basic_TestClass_nhide087(); + if (test.ToString() == "MyTestStruct") + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + struct Basic_TestClass_nhide088 + { + public string ToString(string strS) + { + return strS; + } + public static int Main_old() + { + Basic_TestClass_nhide088 test = new Basic_TestClass_nhide088(); + string s1 = test.ToString(); + string s2 = test.ToString("Basic_TestClass_nhide088"); + if ((s1 == "NFUnitTestBasicConcepts.UnitTestBasicConceptsTests+Basic_TestClass_nhide088") && (s2 == "Basic_TestClass_nhide088")) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_nhide089_C2 + { + public int this[int intI] + { + get + { + return intI; + } + } + } + public class Basic_TestClass_nhide089 : Basic_TestClass_nhide089_C2 + { + public int this[int intI] + { + get + { + return intI + 1; + } + } + public static int Main_old() + { + Basic_TestClass_nhide089 test = new Basic_TestClass_nhide089(); + if (test[3] == 4) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_nhide090_C2 + { + public int this[long lngL] + { + get + { + return (int)lngL; + } + } + } + public class Basic_TestClass_nhide090 : Basic_TestClass_nhide090_C2 + { + public int this[int intI] + { + get + { + return intI + 1; + } + } + public static int Main_old() + { + Basic_TestClass_nhide090 test = new Basic_TestClass_nhide090(); + if ((test[(long)3] == 3) && (test[(int)3] == 4)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_nhide091_C2 + { + public void F() { } + } + public class Basic_TestClass_nhide091 : Basic_TestClass_nhide091_C2 + { + public void F() { } + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_nhide092_C2 + { + public static int F() + { + return 2; + } + } + public class Basic_TestClass_nhide092_C6 : Basic_TestClass_nhide092_C2 + { + new private static int F() + { + return 3; + } + } + public class Basic_TestClass_nhide092 : Basic_TestClass_nhide092_C6 + { + public static int Main_old() + { + if (F() == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_memac009_O + { + public class Basic_TestClass_memac009_C1 + { + public int intI = 2; + } + } + public class Basic_TestClass_memac009 + { + public static int Main_old() + { + Basic_TestClass_memac009_O.Basic_TestClass_memac009_C1 tc = new Basic_TestClass_memac009_O.Basic_TestClass_memac009_C1(); + if (tc.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_memac010_C1 + { + public static int intI = 2; + } + public class Basic_TestClass_memac010 + { + public static int Main_old() + { + if (Basic_TestClass_memac010_C1.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_memac011_O + { + protected internal class Basic_TestClass_memac011_C1 + { + public int intI = 2; + } + } + public class Basic_TestClass_memac011 + { + public static int Main_old() + { + Basic_TestClass_memac011_O.Basic_TestClass_memac011_C1 tc = new Basic_TestClass_memac011_O.Basic_TestClass_memac011_C1(); + if (tc.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_memac012_O + { + protected static internal int intI = 2; + } + public class Basic_TestClass_memac012 + { + public static int Main_old() + { + if (Basic_TestClass_memac012_O.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + /* + public class Basic_TestClass_memac013 : Basic_TestClass_memac013_O + { + public static int Main_old() + { + Basic_TestClass_memac013_C1 tc = new Basic_TestClass_memac013_C1(); + if (tc.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_memac014 : Basic_TestClass_memac014_O + { + public static int Main_old() + { + if (intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + * */ + public class Basic_TestClass_memac019 + { + protected class Basic_TestClass_memac019_C1 + { + public int intI = 2; + public static int Main_old() + { + Basic_TestClass_memac019_C1 tc = new Basic_TestClass_memac019_C1(); + if (tc.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_memac019_C1.Main_old() == 0); + } + } + public class Basic_TestClass_memac020 + { + protected static int intI = 2; + public static int Main_old() + { + if (intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_memac021_O + { + protected class Basic_TestClass_memac021_C1 + { + public int intI = 2; + } + } + public class Basic_TestClass_memac021 : Basic_TestClass_memac021_O + { + public static int Main_old() + { + Basic_TestClass_memac021_C1 tc = new Basic_TestClass_memac021_C1(); + if (tc.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_memac022_O + { + protected static int intI = 2; + } + public class Basic_TestClass_memac022 : Basic_TestClass_memac022_O + { + public static int Main_old() + { + if (intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_memac025_O + { + protected class Basic_TestClass_memac025_C1 + { + public int intI = 2; + } + } + public class Basic_TestClass_memac025 : Basic_TestClass_memac025_O + { + public static int Main_old() + { + Basic_TestClass_memac025_O.Basic_TestClass_memac025_C1 tc = new Basic_TestClass_memac025_O.Basic_TestClass_memac025_C1(); + if (tc.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + internal class Basic_TestClass_memac027_C1 + { + public int intI = 2; + } + public class Basic_TestClass_memac027 + { + public static int Main_old() + { + Basic_TestClass_memac027_C1 TC = new Basic_TestClass_memac027_C1(); + if (TC.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_memac029_O + { + internal class Basic_TestClass_memac029_C1 + { + public int intI = 2; + } + } + public class Basic_TestClass_memac029 + { + public static int Main_old() + { + Basic_TestClass_memac029_O.Basic_TestClass_memac029_C1 TC = new Basic_TestClass_memac029_O.Basic_TestClass_memac029_C1(); + if (TC.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_memac030_O + { + static internal int intI = 2; + } + public class Basic_TestClass_memac030 + { + public static int Main_old() + { + if (Basic_TestClass_memac030_O.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_memac033 + { + private class Basic_TestClass_memac033_C1 + { + public int intI = 2; + public static int Main_old() + { + Basic_TestClass_memac033_C1 tc = new Basic_TestClass_memac033_C1(); + if (tc.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + } + public static bool testMethod() + { + return (Basic_TestClass_memac033_C1.Main_old() == 0); + } + } + public class Basic_TestClass_memac034 + { + private static int intI = 2; + public static int Main_old() + { + if (intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + /* + public class Basic_TestClass_memac039 : Basic_TestClass_memac039_C2 + { + protected override void OnSetComponentDefaults() { } + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_memac041_B : Basic_TestClass_memac041_A + { + protected override void f() + { Debug.WriteLine("Basic_TestClass_memac041_B.f()"); } + static void Main_old() + { + Basic_TestClass_memac041_B b = new Basic_TestClass_memac041_B(); + b.f(); + } + public static bool testMethod() + { + Main_old(); + Microsoft.SPOT.Debug.Print(""); + } + } + */ + class Basic_TestClass_memac042_B + { + protected static int F() + { + return 2; + } + } + class Basic_TestClass_memac042_D : Basic_TestClass_memac042_B + { + new public static int F() + { + return Basic_TestClass_memac042_B.F(); + } + } + + class Basic_TestClass_memac042 + { + static int Main_old() + { + if (Basic_TestClass_memac042_D.F() == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + class Basic_TestClass_memac043_B + { + protected internal static int F() + { + return 2; + } + } + class Basic_TestClass_memac043_D : Basic_TestClass_memac043_B + { + new public static int F() + { + return Basic_TestClass_memac043_B.F(); + } + } + + class Basic_TestClass_memac043 + { + static int Main_old() + { + if (Basic_TestClass_memac043_D.F() == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + class Basic_TestClass_memac044_B + { + protected static int intI = 2; + } + class Basic_TestClass_memac044_D : Basic_TestClass_memac044_B + { + public static int F() + { + return Basic_TestClass_memac044_B.intI; + } + } + + class Basic_TestClass_memac044 + { + static int Main_old() + { + if (Basic_TestClass_memac044_D.F() == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + class Basic_TestClass_memac045_B + { + protected internal static int intI = 2; + } + class Basic_TestClass_memac045_D : Basic_TestClass_memac045_B + { + public static int F() + { + return Basic_TestClass_memac045_B.intI; + } + } + + class Basic_TestClass_memac045 + { + static int Main_old() + { + if (Basic_TestClass_memac045_D.F() == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + class Basic_TestClass_memac046_B + { + protected static int intI + { + get + { + return 2; + } + } + } + class Basic_TestClass_memac046_D : Basic_TestClass_memac046_B + { + public static int F() + { + return Basic_TestClass_memac046_B.intI; + } + } + + class Basic_TestClass_memac046 + { + static int Main_old() + { + if (Basic_TestClass_memac046_D.F() == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + class Basic_TestClass_memac047_B + { + protected internal static int intI + { + get + { + return 2; + } + } + } + class Basic_TestClass_memac047_D : Basic_TestClass_memac047_B + { + public static int F() + { + return Basic_TestClass_memac047_B.intI; + } + } + + class Basic_TestClass_memac047 + { + static int Main_old() + { + if (Basic_TestClass_memac047_D.F() == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_accon001_C2 { } + internal class Basic_TestClass_accon001 : Basic_TestClass_accon001_C2 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_accon003 + { + public class Basic_TestClass_accon003_C2 { } + private class Basic_TestClass_accon003_C3 : Basic_TestClass_accon003_C2 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon003_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon005 + { + public class Basic_TestClass_accon005_C2 { } + protected class Basic_TestClass_accon005_C3 : Basic_TestClass_accon005_C2 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon005_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon007 + { + public class Basic_TestClass_accon007_C2 { } + internal class Basic_TestClass_accon007_C3 : Basic_TestClass_accon007_C2 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon007_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon009 + { + public class Basic_TestClass_accon009_C2 { } + protected internal class Basic_TestClass_accon009_C3 : Basic_TestClass_accon009_C2 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon009_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon011 + { + protected internal class Basic_TestClass_accon011_C2 { } + protected class Basic_TestClass_accon011_C3 : Basic_TestClass_accon011_C2 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon011_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon013 + { + protected internal class Basic_TestClass_accon013_C2 { } + internal class Basic_TestClass_accon013_C3 : Basic_TestClass_accon013_C2 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon013_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon015 + { + protected internal class Basic_TestClass_accon015_C2 { } + private class Basic_TestClass_accon015_C3 : Basic_TestClass_accon015_C2 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon015_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon019 + { + protected class Basic_TestClass_accon019_C2 { } + private class Basic_TestClass_accon019_C3 : Basic_TestClass_accon019_C2 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon019_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon021 + { + internal class Basic_TestClass_accon021_C2 { } + private class Basic_TestClass_accon021_C3 : Basic_TestClass_accon021_C2 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon021_C3.Main_old() == 0); + } + } + public interface Basic_TestClass_accon023_C2 { } + internal interface Basic_TestClass_accon023_Inter : Basic_TestClass_accon023_C2 { } + public class Basic_TestClass_accon023 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_accon025 + { + public interface Basic_TestClass_accon025_C2 { } + protected internal interface Basic_TestClass_accon025_Inter : Basic_TestClass_accon025_C2 { } + public class Basic_TestClass_accon025_C3 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon025_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon027 + { + protected internal interface Basic_TestClass_accon027_C2 { } + protected interface Basic_TestClass_accon027_Inter : Basic_TestClass_accon027_C2 { } + public class Basic_TestClass_accon027_C3 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon027_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon029 + { + protected internal interface Basic_TestClass_accon029_C2 { } + internal interface Basic_TestClass_accon029_Inter : Basic_TestClass_accon029_C2 { } + public class Basic_TestClass_accon029_C3 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon029_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon031 + { + protected interface Basic_TestClass_accon031_C2 { } + private interface Basic_TestClass_accon031_Inter : Basic_TestClass_accon031_C2 { } + public class Basic_TestClass_accon031_C3 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon031_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon033 + { + public class Basic_TestClass_accon033_C1 { } + protected delegate Basic_TestClass_accon033_C1 MyDelegate(); + public class Basic_TestClass_accon033_C3 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon033_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon035 + { + public class Basic_TestClass_accon035_C1 { } + internal delegate void MyDelegate(Basic_TestClass_accon035_C1 T); + public class Basic_TestClass_accon035_C3 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon035_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon037 + { + public enum Basic_TestClass_accon037_C1 { aa = 1 } + internal const Basic_TestClass_accon037_C1 e1 = Basic_TestClass_accon037_C1.aa; + public class Basic_TestClass_accon037_C3 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon037_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon039 + { + public enum Basic_TestClass_accon039_C1 { aa = 1 } + protected internal Basic_TestClass_accon039_C1 e1 = Basic_TestClass_accon039_C1.aa; + public class Basic_TestClass_accon039_C3 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon039_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon041 + { + public class Basic_TestClass_accon041_C1 { } + private Basic_TestClass_accon041_C1 MyMeth() + { + return new Basic_TestClass_accon041_C1(); + } + public class Basic_TestClass_accon041_C3 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon041_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon043 + { + public class Basic_TestClass_accon043_C1 { } + private void MyMeth(Basic_TestClass_accon043_C1 T) { } + public class Basic_TestClass_accon043_C3 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon043_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon045 + { + public class Basic_TestClass_accon045_C1 { } + protected Basic_TestClass_accon045_C1 c1 + { + get + { + return new Basic_TestClass_accon045_C1(); + } + } + public class Basic_TestClass_accon045_C3 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon045_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon047 + { + public class Basic_TestClass_accon047_C1 { } + internal Basic_TestClass_accon047_C1 this[int intI] + { + get + { + return new Basic_TestClass_accon047_C1(); + } + } + public class Basic_TestClass_accon047_C3 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon047_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon049 + { + public class Basic_TestClass_accon049_C1 { } + internal int this[Basic_TestClass_accon049_C1 T] + { + get + { + return 1; + } + } + public class Basic_TestClass_accon049_C3 + { + public static int Main_old() + { + return 0; + } + } + public static bool testMethod() + { + return (Basic_TestClass_accon049_C3.Main_old() == 0); + } + } + public class Basic_TestClass_accon051_C1 { } + public class Basic_TestClass_accon051 + { + public static Basic_TestClass_accon051_C1 operator +(Basic_TestClass_accon051 MyInt, Basic_TestClass_accon051 MyInt2) + { + return new Basic_TestClass_accon051_C1(); + } + public static int Main_old() + { + return 0; + } + + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_accon053_C1 { } + public class Basic_TestClass_accon053 + { + public static int operator +(Basic_TestClass_accon053 MyInt, Basic_TestClass_accon053_C1 MyInt2) + { + return 1; + } + public static int Main_old() + { + return 0; + } + + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Basic_TestClass_accon055_C1 { } + public class Basic_TestClass_accon055 + { + internal Basic_TestClass_accon055(Basic_TestClass_accon055_C1 T) + { + + } + public static int Main_old() + { + return 0; + } + + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + + } +} + +//Other Namespaces + +namespace NS_Basic_TestClass_scope001 +{ + class MyClass2 + { + public static int intI = 2; + } +} + + + +namespace NS_Basic_TestClass_scope002 +{ + class Basic_TestClass_scope002 + { + public static int Main_old() + { + if ((Basic_TestClass_scope002_C1.intI == 1) && (TestNS.MyClass2.intI == 2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope002_C1 + { + public static int intI = 1; + } + namespace TestNS + { + class MyClass2 + { + public static int intI = 2; + } + } +} +namespace NS_Basic_TestClass_scope003 +{ + class Basic_TestClass_scope003 + { + public static int Main_old() + { + if ((Basic_TestClass_scope003_C1.intI == 1) && (TestNS.MyClass2.intI == 2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +namespace NS_Basic_TestClass_scope003 +{ + class Basic_TestClass_scope003_C1 + { + public static int intI = 1; + } + namespace TestNS + { + class MyClass2 + { + public static int intI = 2; + } + } +} +namespace NS_Basic_TestClass_scope004 +{ + namespace NS_Basic_TestClass_scope004_2 + { + class Basic_TestClass_scope004 + { + + public static int Main_old() + { + if ((Basic_TestClass_scope004_C1.intI == 1) && (TestNS.MyClass2.intI == 2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } +} +namespace NS_Basic_TestClass_scope004.NS_Basic_TestClass_scope004_2 +{ + class Basic_TestClass_scope004_C1 + { + public static int intI = 1; + } + namespace TestNS + { + class MyClass2 + { + public static int intI = 2; + } + } +} +namespace NS_Basic_TestClass_scope005 +{ + class Basic_TestClass_scope005_C1 + { + public static int intI = 1; + } + namespace TestNS + { + class MyClass2 + { + public static int intI = 2; + } + } + namespace NS_Basic_TestClass_scope005_2 + { + class Basic_TestClass_scope005 + { + + public static int Main_old() + { + if ((Basic_TestClass_scope005_C1.intI == 1) && (TestNS.MyClass2.intI == 2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } +} +namespace NS_Basic_TestClass_scope006 +{ + namespace NS_Basic_TestClass_scope006_2 + { + class Basic_TestClass_scope006 + { + + public static int Main_old() + { + if ((Basic_TestClass_scope006_C1.intI == 1) && (TestNS.MyClass2.intI == 2)) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + } +} +namespace NS_Basic_TestClass_scope006 +{ + class Basic_TestClass_scope006_C1 + { + public static int intI = 1; + } + namespace TestNS + { + class MyClass2 + { + public static int intI = 2; + } + } +} +namespace NS_Basic_TestClass_scope012 +{ + + class Basic_TestClass_scope012 + { + static int Math_Max(int i, int j) => i > j ? i : j; + + public static int Main_old() + { + if (Math_Max(2, 3) == 3) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +namespace NS_Basic_TestClass_scope056 +{ + class Basic_TestClass_scope056 + { + public Basic_TestClass_scope056_C2 MC; + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Basic_TestClass_scope056_C2 { } +} + + +namespace Basic_TestClass_nhide001_C1 +{ + class Basic_TestClass_nhide001_C1 + { + public static int intI = 1; + } +} +namespace NS_Basic_TestClass_nhide001 +{ + namespace Basic_TestClass_nhide001_C1 + { + class Basic_TestClass_nhide001_C1 + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide001 + { + public static int Main_old() + { + if (Basic_TestClass_nhide001_C1.Basic_TestClass_nhide001_C1.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +class Basic_TestClass_nhide002_C1 +{ + public class Basic_TestClass_nhide002_C2 + { + public static int intI = 1; + } +} +namespace NS_Basic_TestClass_nhide002 +{ + namespace Basic_TestClass_nhide002_C1 + { + class Basic_TestClass_nhide002_C2 + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide002 + { + public static int Main_old() + { + if (Basic_TestClass_nhide002_C1.Basic_TestClass_nhide002_C2.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +struct Basic_TestClass_nhide003_C1 +{ + public class Basic_TestClass_nhide003_C2 + { + public static int intI = 1; + } +} +namespace NS_Basic_TestClass_nhide003 +{ + namespace Basic_TestClass_nhide003_C1 + { + class Basic_TestClass_nhide003_C2 + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide003 + { + public static int Main_old() + { + if (Basic_TestClass_nhide003_C1.Basic_TestClass_nhide003_C2.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +interface Basic_TestClass_nhide004_C1 { } +namespace NS_Basic_TestClass_nhide004 +{ + namespace Basic_TestClass_nhide004_C1 + { + class Basic_TestClass_nhide004_C2 + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide004 + { + public static int Main_old() + { + if (Basic_TestClass_nhide004_C1.Basic_TestClass_nhide004_C2.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +enum Basic_TestClass_nhide005_C1 { Basic_TestClass_nhide005_C1 = 1 } +namespace NS_Basic_TestClass_nhide005 +{ + namespace Basic_TestClass_nhide005_C1 + { + class Basic_TestClass_nhide005_C1 + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide005 + { + public static int Main_old() + { + if (Basic_TestClass_nhide005_C1.Basic_TestClass_nhide005_C1.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +delegate void Basic_TestClass_nhide006_C1(); +namespace NS_Basic_TestClass_nhide006 +{ + namespace Basic_TestClass_nhide006_C1 + { + class Basic_TestClass_nhide006_C1 + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide006 + { + public static int Main_old() + { + if (Basic_TestClass_nhide006_C1.Basic_TestClass_nhide006_C1.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +namespace Basic_TestClass_nhide007_C1 +{ + class Basic_TestClass_nhide007_C1 + { + public static int intI = 1; + } +} +namespace NS_Basic_TestClass_nhide007 +{ + namespace Basic_TestClass_nhide007_C1 + { + class Basic_TestClass_nhide007_C1 + { + public static int intI = 2; + } + } +} + +namespace Basic_TestClass_nhide008_C1 +{ + class Basic_TestClass_nhide008_I + { + public static int intI = 1; + } +} +namespace NS_Basic_TestClass_nhide008 +{ + class Basic_TestClass_nhide008_C1 + { + public class Basic_TestClass_nhide008_I + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide008 + { + public static int Main_old() + { + if (Basic_TestClass_nhide008_C1.Basic_TestClass_nhide008_I.intI == 2) + { + Debug.WriteLine("foo"); + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +class Basic_TestClass_nhide009_C1 +{ + public class Basic_TestClass_nhide009_I + { + public static int intI = 1; + } +} +namespace NS_Basic_TestClass_nhide009 +{ + class Basic_TestClass_nhide009_C1 + { + public class Basic_TestClass_nhide009_I + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide009 + { + public static int Main_old() + { + if (Basic_TestClass_nhide009_C1.Basic_TestClass_nhide009_I.intI == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +struct Basic_TestClass_nhide010_St1 +{ + public class Basic_TestClass_nhide010_I + { + public static int intI = 1; + } +} +namespace NS_Basic_TestClass_nhide010 +{ + struct Basic_TestClass_nhide010_St1 + { + public class Basic_TestClass_nhide010_I + { + public static int intI = 2; + } + } + class Basic_TestClass_nhide010 + { + public static int Main_old() + { + if (Basic_TestClass_nhide010_St1.Basic_TestClass_nhide010_I.intI == 2) + { + Debug.WriteLine("foo"); + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +interface Basic_TestClass_nhide011_Inter +{ + void bogus(); +} +namespace NS_Basic_TestClass_nhide011 +{ + interface Basic_TestClass_nhide011_Inter + { + void test(); + } + class Basic_TestClass_nhide011 : Basic_TestClass_nhide011_Inter + { + public void test() { } + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} + + +enum Basic_TestClass_nhide012_Enum { test = 1 } +namespace NS_Basic_TestClass_nhide012 +{ + enum Basic_TestClass_nhide012_Enum { test = 2 } + class Basic_TestClass_nhide012 + { + public static int Main_old() + { + if ((int)Basic_TestClass_nhide012_Enum.test == 2) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +delegate void Basic_TestClass_nhide013_Del(); +namespace NS_Basic_TestClass_nhide013 +{ + delegate int Basic_TestClass_nhide013_Del(int intI); + class Basic_TestClass_nhide013 + { + int TestMeth(int intI) + { + return 1; + } + public static int Main_old() + { + Basic_TestClass_nhide013 test = new Basic_TestClass_nhide013(); + Basic_TestClass_nhide013_Del td = new Basic_TestClass_nhide013_Del(test.TestMeth); + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } +} +class Basic_TestClass_nhide014_C1 +{ + public class Basic_TestClass_nhide014_I + { + public static int intI = 1; + } +} +namespace NS_Basic_TestClass_nhide014 +{ + class Basic_TestClass_nhide014_C1 + { + public class Basic_TestClass_nhide014_I + { + public static int intI = 2; + } + } +} +class Basic_TestClass_nhide014 +{ + public static int Main_old() + { + if (Basic_TestClass_nhide014_C1.Basic_TestClass_nhide014_I.intI == 1) + { + return 0; + } + else + { + return 1; + } + } + public static bool testMethod() + { + return (Main_old() == 0); + } +} +namespace Basic_TestClass_nhide015_C1 +{ + class Basic_TestClass_nhide015_I + { + public static int intI = 1; + } +} + +namespace Basic_TestClass_nhide022_C1 +{ + class Basic_TestClass_nhide022_I + { + public static int intI = 1; + } +} diff --git a/Tests/NFUnitTestBasicConcepts/nano.runsettings b/Tests/NFUnitTestBasicConcepts/nano.runsettings new file mode 100644 index 00000000..bf2920ce --- /dev/null +++ b/Tests/NFUnitTestBasicConcepts/nano.runsettings @@ -0,0 +1,13 @@ + + + + + 1 + .\TestResults + 240000 + Framework40 + + + None + + \ No newline at end of file diff --git a/Tests/NFUnitTestBasicConcepts/packages.config b/Tests/NFUnitTestBasicConcepts/packages.config new file mode 100644 index 00000000..dcab08b1 --- /dev/null +++ b/Tests/NFUnitTestBasicConcepts/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestConversions/nano.runsettings b/Tests/NFUnitTestConversions/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestConversions/nano.runsettings +++ b/Tests/NFUnitTestConversions/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/nano.runsettings b/Tests/NFUnitTestCoreLibrary/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestCoreLibrary/nano.runsettings +++ b/Tests/NFUnitTestCoreLibrary/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestDelegates/nano.runsettings b/Tests/NFUnitTestDelegates/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestDelegates/nano.runsettings +++ b/Tests/NFUnitTestDelegates/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestException/nano.runsettings b/Tests/NFUnitTestException/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestException/nano.runsettings +++ b/Tests/NFUnitTestException/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/nano.runsettings b/Tests/NFUnitTestInterface/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestInterface/nano.runsettings +++ b/Tests/NFUnitTestInterface/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/nano.runsettings b/Tests/NFUnitTestLexical/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestLexical/nano.runsettings +++ b/Tests/NFUnitTestLexical/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/nano.runsettings b/Tests/NFUnitTestNamespace/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestNamespace/nano.runsettings +++ b/Tests/NFUnitTestNamespace/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/nano.runsettings b/Tests/NFUnitTestStatementsTests/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestStatementsTests/nano.runsettings +++ b/Tests/NFUnitTestStatementsTests/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestStruct/nano.runsettings b/Tests/NFUnitTestStruct/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestStruct/nano.runsettings +++ b/Tests/NFUnitTestStruct/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/nano.runsettings b/Tests/NFUnitTestTypes/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestTypes/nano.runsettings +++ b/Tests/NFUnitTestTypes/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/nano.runsettings b/Tests/NFUnitTestVariables/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestVariables/nano.runsettings +++ b/Tests/NFUnitTestVariables/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 135f86d4..f9905d3f 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -49,6 +49,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestConversions", "Te EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestClasses", "Tests\NFUnitTestClasses\NFUnitTestClasses.nfproj", "{A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestBasicConcepts", "Tests\NFUnitTestBasicConcepts\NFUnitTestBasicConcepts.nfproj", "{8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -159,6 +161,12 @@ Global {A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB}.Release|Any CPU.ActiveCfg = Release|Any CPU {A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB}.Release|Any CPU.Build.0 = Release|Any CPU {A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB}.Release|Any CPU.Deploy.0 = Release|Any CPU + {8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15}.Release|Any CPU.Build.0 = Release|Any CPU + {8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -180,6 +188,7 @@ Global {A8D00E31-5905-4DB4-A7F2-F0C00E3560DD} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From 4f28bb680c5b9810466952dc47b73604e0de5543 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 23:18:28 +0300 Subject: [PATCH 40/55] Adding attribute tests --- .../NFUnitTestAttributes.nfproj | 61 ++ .../Properties/AssemblyInfo.cs | 33 + .../UnitTestAttributesTest1.cs | 873 ++++++++++++++++++ .../UnitTestAttributesTest2.cs | 107 +++ Tests/NFUnitTestAttributes/nano.runsettings | 13 + Tests/NFUnitTestAttributes/packages.config | 5 + .../UnitTestBasicConceptsTests.cs | 6 + nanoFramework.CoreLibrary.sln | 9 + 8 files changed, 1107 insertions(+) create mode 100644 Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj create mode 100644 Tests/NFUnitTestAttributes/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestAttributes/UnitTestAttributesTest1.cs create mode 100644 Tests/NFUnitTestAttributes/UnitTestAttributesTest2.cs create mode 100644 Tests/NFUnitTestAttributes/nano.runsettings create mode 100644 Tests/NFUnitTestAttributes/packages.config diff --git a/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj b/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj new file mode 100644 index 00000000..c199a3a2 --- /dev/null +++ b/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj @@ -0,0 +1,61 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 0d4ef4f8-f616-4df6-83e3-ab7e4f0eee4b + Library + Properties + 512 + NFUnitTestAttributes + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestAttributes/Properties/AssemblyInfo.cs b/Tests/NFUnitTestAttributes/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestAttributes/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestAttributes/UnitTestAttributesTest1.cs b/Tests/NFUnitTestAttributes/UnitTestAttributesTest1.cs new file mode 100644 index 00000000..8aa36fe0 --- /dev/null +++ b/Tests/NFUnitTestAttributes/UnitTestAttributesTest1.cs @@ -0,0 +1,873 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; +using System.Runtime.InteropServices; + +namespace NFUnitTestAttributes +{ + [TestClass] + public class UnitTestAttributesTest1 + { + [TestMethod] + public void Attrib_attrib000_Test() + { + Debug.WriteLine("Declare a basic attribute class, example from C# Language reference, 1.1"); + Assert.True(Attrib_TestClass_attrib000.testMethod()); + } + [TestMethod] + public void Attrib_attrib000_2_Test() + { + Debug.WriteLine("17.1 - A non-abstract attribute class must have public accessibility."); + Assert.True(Attrib_TestClass_attrib000_2.testMethod()); + } + [TestMethod] + public void Attrib_attrib001_Test() + { + Debug.WriteLine("Declare a basic attribute class, example from C# Language reference, 1.1"); + Assert.True(Attrib_TestClass_attrib001.testMethod()); + } + [TestMethod] + public void Attrib_attrib002_Test() + { + Debug.WriteLine("Declare a basic attribute class, example from C# Language reference, 1.1"); + Assert.True(Attrib_TestClass_attrib002.testMethod()); + } + + [TestMethod] + public void Attrib_attrib017_7a_Test() + { + Debug.WriteLine("17.4.5 test of conditional when DEBUG is undefined"); + Assert.True(Attrib_TestClass_attrib017_7a.testMethod()); + } + [TestMethod] + public void Attrib_attrib017_8c_Test() + { + Debug.WriteLine("17.4.5 - Example from CLR"); + + Assert.True(Attrib_TestClass_attrib017_8c.testMethod()); + } + + [TestMethod] + public void Attrib_attrib021_2_Test() + { + Debug.WriteLine("CLR 17.4.9 - guid Attribute"); + Assert.True(Attrib_TestClass_attrib021_2.testMethod()); + } + [TestMethod] + public void Attrib_attrib021_4_Test() + { + Debug.WriteLine("CLR 17.4.9 - guid Attribute"); + Assert.True(Attrib_TestClass_attrib021_4.testMethod()); + } + [TestMethod] + public void Attrib_attrib029_8_Test() + { + Debug.WriteLine("CLR 17.4.19 - obsolete"); + Debug.WriteLine("obsolete can be used on any declaration, but should be able to call"); + Debug.WriteLine("obsolete methods"); + Assert.True(Attrib_TestClass_attrib029_8.testMethod()); + } + [TestMethod] + public void Attrib_attrib029_9_Test() + { + Debug.WriteLine("CLR 17.4.19 - obsolete"); + Debug.WriteLine("obsolete can be used on any declaration, but should be able to call"); + Debug.WriteLine("obsolete methods"); + Assert.True(Attrib_TestClass_attrib029_9.testMethod()); + } + [TestMethod] + public void Attrib_attrib029_a_Test() + { + Debug.WriteLine("CLR 17.4.19 - obsolete"); + Debug.WriteLine("obsolete can be used on any declaration, but should be able to call"); + Debug.WriteLine("obsolete methods"); + Assert.True(Attrib_TestClass_attrib029_a.testMethod()); + } + [TestMethod] + public void Attrib_attrib029_b_Test() + { + Debug.WriteLine("CLR 17.4.19 - obsolete"); + Debug.WriteLine("obsolete can be used on any declaration, but overrides should generate warning"); + Assert.True(Attrib_TestClass_attrib029_b.testMethod()); + } + [TestMethod] + public void Attrib_attrib031_4_Test() + { + Debug.WriteLine("CLR 17.4.22 - serializable Attribute"); + Assert.True(Attrib_TestClass_attrib031_4.testMethod()); + } + [TestMethod] + public void Attrib_attrib032_2_Test() + { + Debug.WriteLine("CLR 17.4.23 - structlayout Attribute"); + Assert.True(Attrib_TestClass_attrib032_2.testMethod()); + } + [TestMethod] + public void Attrib_attrib033_2_Test() + { + Debug.WriteLine("Attribute usage is inherited."); + Assert.True(Attrib_TestClass_attrib033_2.testMethod()); + } + /* + * These tests are excluded because they require parts of System.Reflection that are not supported in the MF + * + [TestMethod] + public void Attrib_attrib035_12_Test() + { + Debug.WriteLine("Make sure that assembly level GuidAttribute appears in assembly"); + Assert.True(Attrib_TestClass_attrib035_12.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + [TestMethod] + public void Attrib_attrib035_22_Test() + { + Debug.WriteLine("Make sure that assembly level GuidAttribute appears in assembly"); + Assert.True(Attrib_TestClass_attrib035_22.testMethod()) + { + return MFTestResults.Pass; + } + return MFTestResults.Fail; + } + */ + [TestMethod] + public void Attrib_attrib036_1_Test() + { + Debug.WriteLine("17.1 - A top-level, non-abstract attribute class must have public or"); + Debug.WriteLine("internal accessibility. Nested attribute classes may also be private,"); + Debug.WriteLine("protected, or protected internal."); + Assert.True(Attrib_TestClass_attrib036_1.testMethod()); + } + [TestMethod] + public void Attrib_attrib038_1_Test() + { + Debug.WriteLine("Verify params keyword"); + Assert.True(Attrib_TestClass_attrib038_1.testMethod()); + } + [TestMethod] + public void Attrib_attrib047_4_Test() + { + Debug.WriteLine(" Make sure that ObsoleteAttribute works with following targets"); + Debug.WriteLine("[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |"); + Debug.WriteLine(" AttributeTargets.Enum | AttributeTargets.Constructor |"); + Debug.WriteLine(" AttributeTargets.Method | AttributeTargets.Property |"); + Debug.WriteLine(" AttributeTargets.Field | AttributeTargets.Event |"); + Debug.WriteLine(" AttributeTargets.Interface | AttributeTargets.Delegate)]"); + Assert.True(Attrib_TestClass_attrib047_4.testMethod()); + } + [TestMethod] + public void Attrib_attrib047_5_Test() + { + Debug.WriteLine(" Make sure that ObsoleteAttribute works with following targets"); + Debug.WriteLine("[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct |"); + Debug.WriteLine(" AttributeTargets.Enum | AttributeTargets.Constructor |"); + Debug.WriteLine(" AttributeTargets.Method | AttributeTargets.Property |"); + Debug.WriteLine(" AttributeTargets.Field | AttributeTargets.Event |"); + Debug.WriteLine(" AttributeTargets.Interface | AttributeTargets.Delegate)]"); + Assert.True(Attrib_TestClass_attrib047_5.testMethod()); + } + [TestMethod] + public void Attrib_attrib049_4_Test() + { + Debug.WriteLine("Bad named attribute argumements should be an error"); + Assert.True(Attrib_TestClass_attrib049_4.testMethod()); + } + [TestMethod] + public void Attrib_attrib054_Test() + { + Debug.WriteLine("ECMA complaince: support special attribute name binding rules with @ identifier"); + Debug.WriteLine("explictly specify attribute location with @"); + Assert.True(Attrib_TestClass_attrib054.testMethod()); + } + [TestMethod] + public void Attrib_attrib062_Test() + { + Debug.WriteLine("Declare a derived attribute after declaring its base."); + Debug.WriteLine("Attributes can inherit from other attirubtes that have not yet been declared as long as there are no"); + Debug.WriteLine("circular dependencies."); + Assert.True(Attrib_TestClass_attrib062.testMethod()); + } + + + //Compiled Test Cases + [AttributeUsage(AttributeTargets.Class)] + public class Attrib_TestClass_attrib000_A : Attribute { } + public class Attrib_TestClass_attrib000 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + [AttributeUsage(AttributeTargets.Class)] + abstract class Attrib_TestClass_attrib000_2_C1 : Attribute + { + public abstract void mf(); + } + public class Attrib_TestClass_attrib000_2 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + [AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class | AttributeTargets.Interface)] + public class Attrib_TestClass_attrib001_C : Attribute + { + public int Name; + public Attrib_TestClass_attrib001_C(int sName) { Name = sName; } + + [Attrib_TestClass_attrib001_C(5)] + class Attrib_TestClass_attrib001_C1 { } + [Attrib_TestClass_attrib001_C(6)] + interface Attrib_TestClass_attrib001_I1 { } + [Attrib_TestClass_attrib001_C(7)] + struct Attrib_TestClass_attrib001_S1 { } + } + public class Attrib_TestClass_attrib001 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + [AttributeUsage(AttributeTargets.Class)] + public class Attrib_TestClass_attrib002 : Attribute + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + + + + + public class Attrib_TestClass_attrib017_7a_C1 + { + [Conditional("DEBUG")] + public static void M() + { + Attrib_TestClass_attrib017_7a.retval++; + Debug.WriteLine("Executed Attrib_TestClass_attrib017_7a_C1.M"); + } + } + public class Attrib_TestClass_attrib017_7a_C2 + { + public static void Test() + { + Attrib_TestClass_attrib017_7a_C1.M(); + } + } + public class Attrib_TestClass_attrib017_7a + { + public static int retval = 0; + public static int Main_old() + { + Attrib_TestClass_attrib017_7a_C2.Test(); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL"); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Attrib_TestClass_attrib017_8c_C1 + { + [Conditional("DEBUG")] + public static void C1() + { + Debug.WriteLine("Executed Class1.C1()"); + } + } + + class Attrib_TestClass_attrib017_8c_C2 + { + public static void C2() + { + Debug.WriteLine("Executed Class2.C2()"); + Attrib_TestClass_attrib017_8c_C1.C1(); // C1 is called + } + } + + class Attrib_TestClass_attrib017_8c_C3 + { + public static void C4() + { + Debug.WriteLine("Executed Attrib_TestClass_attrib017_8c_C3.C4()"); + Attrib_TestClass_attrib017_8c_C1.C1(); + } + } + public class Attrib_TestClass_attrib017_8c + { + public static int Main_old() + { + Attrib_TestClass_attrib017_8c_C3.C4(); + Attrib_TestClass_attrib017_8c_C2.C2(); + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + [Guid("00020810-0000-0000-C000-000000000046")] + class Attrib_TestClass_attrib021_2_C1 { } + public class Attrib_TestClass_attrib021_2 + { + public static int Main_old() + { + Attrib_TestClass_attrib021_2_C1 w = new Attrib_TestClass_attrib021_2_C1(); // Creates an Excel worksheet + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + [GuidAttribute("00020810-0000-0000-C000-000000000046")] + struct Attrib_TestClass_attrib021_4_C1 { } + public class Attrib_TestClass_attrib021_4 + { + public static int Main_old() + { + Attrib_TestClass_attrib021_4_C1 w = new Attrib_TestClass_attrib021_4_C1(); // Creates an Excel worksheet + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + public class Attrib_TestClass_attrib029_8_C1 + { + public Attrib_TestClass_attrib029_8_C1() + { + _i = -1; + } + private int _i; + [Obsolete] + public int i + { + get { return _i; } + set + { + _i = value; + Attrib_TestClass_attrib029_8_S1 s1 = new Attrib_TestClass_attrib029_8_S1(-1); + s1.j = 3; + if (s1.j == 3) + Attrib_TestClass_attrib029_8.retval -= 1; + } + } + } + public struct Attrib_TestClass_attrib029_8_S1 + { + public Attrib_TestClass_attrib029_8_S1(int i) + { + _j = i; + } + private int _j; + [Obsolete("Attrib_TestClass_attrib029_8_S1 is an obsolete struct")] + public int j + { + get { return _j; } + set { _j = value; } + } + } + public class Attrib_TestClass_attrib029_8 + { + public static int retval = 7; + public static int Main_old() + { + Attrib_TestClass_attrib029_8_C1 c1 = new Attrib_TestClass_attrib029_8_C1(); + c1.i = 5; + int anInt = c1.i; + if (anInt == 5) + retval -= 2; + Attrib_TestClass_attrib029_8_S1 s1 = new Attrib_TestClass_attrib029_8_S1(); + s1.j = 10; + if (10 == s1.j) + retval -= 4; + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval==" + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Attrib_TestClass_attrib029_9_C1 + { + [Obsolete] + public int C1Method(int value) + { + Attrib_TestClass_attrib029_9_S1 s1 = new Attrib_TestClass_attrib029_9_S1(-1); + if (s1.S1Method(3) == 3) + Attrib_TestClass_attrib029_9.retval -= 1; + return value; + } + } + public struct Attrib_TestClass_attrib029_9_S1 + { + public Attrib_TestClass_attrib029_9_S1(int i) { } + [Obsolete("Attrib_TestClass_attrib029_9_S1 is an obsolete struct")] + public int S1Method(int value) + { + return value; + } + } + public class Attrib_TestClass_attrib029_9 + { + public static int retval = 7; + public static int Main_old() + { + Attrib_TestClass_attrib029_9_C1 c1 = new Attrib_TestClass_attrib029_9_C1(); + int anInt = c1.C1Method(5); + if (anInt == 5) + retval -= 2; + Attrib_TestClass_attrib029_9_S1 s1 = new Attrib_TestClass_attrib029_9_S1(); + if (10 == s1.S1Method(10)) + retval -= 4; + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval==" + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Attrib_TestClass_attrib029_a_C1 + { + public Attrib_TestClass_attrib029_a_C1() + { + i = -1; + } + [Obsolete] + public int i; + } + public struct Attrib_TestClass_attrib029_a_S1 + { + public Attrib_TestClass_attrib029_a_S1(int i) + { + j = i; + } + [Obsolete("Attrib_TestClass_attrib029_a_S1 is an obsolete struct")] + public int j; + } + public class Attrib_TestClass_attrib029_a + { + public static int retval = 3; + public static int Main_old() + { + Attrib_TestClass_attrib029_a_C1 c1 = new Attrib_TestClass_attrib029_a_C1(); + c1.i = 5; + int anInt = c1.i; + if (anInt == 5) + retval -= 1; + Attrib_TestClass_attrib029_a_S1 s1 = new Attrib_TestClass_attrib029_a_S1(); + s1.j = 10; + if (10 == s1.j) + retval -= 2; + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval==" + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Attrib_TestClass_attrib029_b_C1 + { + [Obsolete] + public virtual int C1Method(int value) + { + Attrib_TestClass_attrib029_b.retval -= 1; + return value; + } + } + public class Attrib_TestClass_attrib029_b_C2 : Attrib_TestClass_attrib029_b_C1 + { + public override int C1Method(int value) + { + base.C1Method(value); + return value; + } + } + public class Attrib_TestClass_attrib029_b + { + public static int retval = 3; + public static int Main_old() + { + Attrib_TestClass_attrib029_b_C1 c1 = new Attrib_TestClass_attrib029_b_C1(); + int anInt = c1.C1Method(5); + if (anInt == 5) + retval -= 2; + if (0 == retval) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval==" + retval.ToString()); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + [type: Serializable] + struct Attrib_TestClass_attrib031_4_C1 { public int i; } + [type: Serializable] + public class Attrib_TestClass_attrib031_4 + { + public static int Main_old() + { + if (typeof(Attrib_TestClass_attrib031_4_C1).IsSerializable) + { + Debug.WriteLine("PASS"); + return 0; + } + Debug.WriteLine("FAIL"); + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + [StructLayout(LayoutKind.Sequential)] + class Attrib_TestClass_attrib032_2_C1 + { + int i; + double d; + char c; + byte b1, b2, b3; + } + public class Attrib_TestClass_attrib032_2 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + [AttributeUsage(AttributeTargets.Method)] + public class Attrib_TestClass_attrib033_2_A1 : Attribute + { + public Attrib_TestClass_attrib033_2_A1(int i) { } + } + public class Attrib_TestClass_attrib033_2_A2 : Attrib_TestClass_attrib033_2_A1 + { + public Attrib_TestClass_attrib033_2_A2(int i) : base(i) { } + } + class Attrib_TestClass_attrib033_2 + { + [Attrib_TestClass_attrib033_2_A2(4)] // Should be legal. + public static int Main_old() + { return 0; } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + /* + public class Attrib_TestClass_attrib035_12 + { + public static int Main_old() + { + int retval = 3; + object[] gaa = Assembly.GetExecutingAssembly().GetCustomAttributes(typeof(GuidAttribute), false); + GuidAttribute ga = null; + if (gaa.Length == 1) + retval -= 1; + try + { + ga = (GuidAttribute)gaa[0]; + if (ga.Value == Attrib_TestClass_attrib035_12_C5.GuidString) + retval -= 2; + } + catch { } //Just keep the program from dying + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval == {0}", retval); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Attrib_TestClass_attrib035_22 + { + public static int Main_old() + { + Attrib_TestClass_attrib035_22_C5 x = new Attrib_TestClass_attrib035_22_C5(); + int retval = x.MyMethod(); + if (retval == 0) Debug.WriteLine("PASS"); + else Debug.WriteLine("FAIL, retval == {0}", retval); + return retval; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + */ + [AttributeUsage(AttributeTargets.Class)] + internal class Attrib_TestClass_attrib036_1_A1 : Attribute + { + Attrib_TestClass_attrib036_1_A1() { } //Default ctor necessary because compiler generates public ctor otherwise + internal Attrib_TestClass_attrib036_1_A1(int i) { } + [AttributeUsage(AttributeTargets.Class)] + protected class Attrib2 : Attribute + { + Attrib2() { } //Default ctor necessary because compiler generates public ctor otherwise + protected Attrib2(int i) { } + + [AttributeUsage(AttributeTargets.Class)] + internal protected class Attrib3 : Attribute + { + Attrib3() { } //Default ctor necessary because compiler generates public ctor otherwise + protected internal Attrib3(int i) { } + } + [AttributeUsage(AttributeTargets.Class)] + private class Attrib4 : Attribute + { + Attrib4() { } //Default ctor necessary because compiler generates public ctor otherwise + private Attrib4(int i) { } + } + } + } + public class Attrib_TestClass_attrib036_1 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + public delegate void Attrib_TestClass_attrib038_1_F1(params int[] numbers); + public class Attrib_TestClass_attrib038_1_C1 + { + public void Attrib_TestClass_attrib038_1(params int[] numbers) + { + Debug.WriteLine("Called with " + numbers.Length.ToString() + " args"); + } + } + public class Attrib_TestClass_attrib038_1 + { + public static void Main_old() + { + Attrib_TestClass_attrib038_1_C1 cls = new Attrib_TestClass_attrib038_1_C1(); + Attrib_TestClass_attrib038_1_F1 f1 = new Attrib_TestClass_attrib038_1_F1(cls.Attrib_TestClass_attrib038_1); + f1(); + f1(1); + f1(1, 2); + f1(1, 2, 3); + } + public static bool testMethod() + { + Main_old(); + return true; + } + } + [AttributeUsage(AttributeTargets.All, AllowMultiple = true)] + public class Attrib_TestClass_attrib047_4_A1 : Attribute + { + [Obsolete("Constructor", false)] + public Attrib_TestClass_attrib047_4_A1() { } + + [Obsolete("Property", false)] + public int Prop + { + get { return 1; } + set { } + } + + [Obsolete("Field", false)] + public int Field; + } + [Attrib_TestClass_attrib047_4_A1] + [Attrib_TestClass_attrib047_4_A1()] + [Attrib_TestClass_attrib047_4_A1(Field = 1)] + [Attrib_TestClass_attrib047_4_A1(Prop = 1)] + public class Attrib_TestClass_attrib047_4 + { + [method: Attrib_TestClass_attrib047_4_A1] + [method: Attrib_TestClass_attrib047_4_A1()] + [return: Attrib_TestClass_attrib047_4_A1(Field = 1)] + [return: Attrib_TestClass_attrib047_4_A1(Prop = 1)] + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + [Obsolete("Class", false)] + public class Attrib_TestClass_attrib047_5_A + { + [Obsolete("Constructor", false)] + public Attrib_TestClass_attrib047_5_A() { } + [Obsolete("Struct", false)] + public struct S { } + [Obsolete("Enum", false)] + public enum E { } + [Obsolete("Method", false)] + public void foo() { } + + [Obsolete("Property", false)] + public int Prop + { + get { return 1; } + set { } + } + + [Obsolete("Delegate", false)] + public delegate void Del(); + [Obsolete("Event", false)] + public event Del Eve; + [Obsolete("Field", false)] + public readonly int Field; + [Obsolete("Interface", false)] + public interface I { } + } + public class Attrib_TestClass_attrib047_5 + { + public void foo() { } + public static int Main_old() + { + Attrib_TestClass_attrib047_5 t = new Attrib_TestClass_attrib047_5(); + Attrib_TestClass_attrib047_5_A a = new Attrib_TestClass_attrib047_5_A(); + Attrib_TestClass_attrib047_5_A.S s = new Attrib_TestClass_attrib047_5_A.S(); + a.Eve += new Attrib_TestClass_attrib047_5_A.Del(t.foo); + a.foo(); + int i = a.Prop; + a.Prop = i; + i = a.Field; + Attrib_TestClass_attrib047_5_A.E e; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Attrib_TestClass_attrib049_4_B : Attribute + { + public readonly int Attrib_TestClass_attrib049_4_C5; + } + public class Attrib_TestClass_attrib049_4_C : Attrib_TestClass_attrib049_4_B + { + new public int Attrib_TestClass_attrib049_4_C5; + } + [Attrib_TestClass_attrib049_4_C(Attrib_TestClass_attrib049_4_C5 = 5)] // should not be an error + public class Attrib_TestClass_attrib049_4 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + [AttributeUsage(AttributeTargets.All)] + public class Attrib_TestClass_attrib054_C5 : Attribute + { + } + [AttributeUsage(AttributeTargets.All)] + public class Attrib_TestClass_attrib054_A1 : Attribute + { + } + [Attrib_TestClass_attrib054_A1] // Refers to Attrib_TestClass_attrib054_A1 + class Attrib_TestClass_attrib054_C2 + { + } + [@Attrib_TestClass_attrib054_C5] // Refers to Attrib_TestClass_attrib054_C5 + class Attrib_TestClass_attrib054_C3 + { + [method: @Attrib_TestClass_attrib054_C5] + [method: Attrib_TestClass_attrib054_A1] + void foo() { } + [method: @Attrib_TestClass_attrib054_C5] + [method: @Attrib_TestClass_attrib054_A1] + void foo(int i) { } + [method: @Attrib_TestClass_attrib054_C5] + [method: Attrib_TestClass_attrib054_A1] + void foo(int i, int ii) { } + } + [@Attrib_TestClass_attrib054_A1] // Refers to Attrib_TestClass_attrib054_A1 + class Attrib_TestClass_attrib054_C4 + { + } + public class Attrib_TestClass_attrib054 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + public class Attrib_TestClass_attrib062_A2 : Attrib_TestClass_attrib062_A1 { } + public class Attrib_TestClass_attrib062_A1 : Attribute { } + [Attrib_TestClass_attrib062_A1] + [Attrib_TestClass_attrib062_A2] + public class Attrib_TestClass_attrib062 + { + public static int Main_old() + { + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + } +} diff --git a/Tests/NFUnitTestAttributes/UnitTestAttributesTest2.cs b/Tests/NFUnitTestAttributes/UnitTestAttributesTest2.cs new file mode 100644 index 00000000..cef49412 --- /dev/null +++ b/Tests/NFUnitTestAttributes/UnitTestAttributesTest2.cs @@ -0,0 +1,107 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestAttributes +{ + [TestClass] + class UnitTestAttributesTest2 + { + [TestMethod] + public void Attrib_attrib017_7_Test() + { + Debug.WriteLine("17.4.5 Testing Conditional with DEBUG defined."); + Assert.True(Attrib_TestClass_attrib017_7.testMethod()); + } + [TestMethod] + public void Attrib_attrib017_9b_Test() + { + Debug.WriteLine("17.4.5 - Conditional not valid on delegate creation."); + Assert.True(Attrib_TestClass_attrib017_9b.testMethod()); + } + + public class Attrib_TestClass_attrib017_7_C1 + { + [Conditional("DEBUG")] + public static void M() + { + Attrib_TestClass_attrib017_7.retval++; + Debug.WriteLine("Executed Attrib_TestClass_attrib017_7_C1.M"); + } + } + public class Attrib_TestClass_attrib017_7_C2 + { + public static void Attrib_TestClass_attrib017_7() + { + Attrib_TestClass_attrib017_7_C1.M(); + } + } + public class Attrib_TestClass_attrib017_7 + { + public static int retval = 0; + public static int Main_old() + { + Attrib_TestClass_attrib017_7_C2.Attrib_TestClass_attrib017_7(); + if (retval != 0) + { + Debug.WriteLine("PASS"); + return 0; + } + Debug.WriteLine("FAIL"); + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + class Attrib_TestClass_attrib017_9b_C1 + { + [Conditional("DEBUG")] + public virtual void M() + { + Debug.WriteLine("Class1.M executed"); + } + } + class Attrib_TestClass_attrib017_9b_C2 : Attrib_TestClass_attrib017_9b_C1 + { + public override void M() + { + Debug.WriteLine("Class2.M executed"); + base.M(); // base.M is not called! + } + } + + + class Attrib_TestClass_attrib017_9b_C3 + { + public static void Attrib_TestClass_attrib017_9b() + { + Attrib_TestClass_attrib017_9b_C2 c = new Attrib_TestClass_attrib017_9b_C2(); + c.M(); // Attrib_TestClass_attrib017_9b_C2.M() is called, but Attrib_TestClass_attrib017_9b_C1.M() is not! + Attrib_TestClass_attrib017_9b_C1 c1 = new Attrib_TestClass_attrib017_9b_C1(); + c1.M(); // But this time Attrib_TestClass_attrib017_9b_C1.M() is called. + } + } + public class Attrib_TestClass_attrib017_9b + { + public static int Main_old() + { + Attrib_TestClass_attrib017_9b_C3.Attrib_TestClass_attrib017_9b(); + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + } +} diff --git a/Tests/NFUnitTestAttributes/nano.runsettings b/Tests/NFUnitTestAttributes/nano.runsettings new file mode 100644 index 00000000..62f0a008 --- /dev/null +++ b/Tests/NFUnitTestAttributes/nano.runsettings @@ -0,0 +1,13 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + + \ No newline at end of file diff --git a/Tests/NFUnitTestAttributes/packages.config b/Tests/NFUnitTestAttributes/packages.config new file mode 100644 index 00000000..dcab08b1 --- /dev/null +++ b/Tests/NFUnitTestAttributes/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestBasicConcepts/UnitTestBasicConceptsTests.cs b/Tests/NFUnitTestBasicConcepts/UnitTestBasicConceptsTests.cs index 5dc876b6..585520e3 100644 --- a/Tests/NFUnitTestBasicConcepts/UnitTestBasicConceptsTests.cs +++ b/Tests/NFUnitTestBasicConcepts/UnitTestBasicConceptsTests.cs @@ -1,3 +1,9 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + using nanoFramework.TestFramework; using System; using System.Diagnostics; diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index f9905d3f..bec72a77 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -51,6 +51,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestClasses", "Tests\ EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestBasicConcepts", "Tests\NFUnitTestBasicConcepts\NFUnitTestBasicConcepts.nfproj", "{8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestAttributes", "Tests\NFUnitTestAttributes\NFUnitTestAttributes.nfproj", "{0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -167,6 +169,12 @@ Global {8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15}.Release|Any CPU.ActiveCfg = Release|Any CPU {8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15}.Release|Any CPU.Build.0 = Release|Any CPU {8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15}.Release|Any CPU.Deploy.0 = Release|Any CPU + {0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B}.Release|Any CPU.Build.0 = Release|Any CPU + {0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -189,6 +197,7 @@ Global {4EF6D81D-0DBB-41BB-B55B-A37B0B630ADB} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From 2a338a44ae1ba1e4cc5298e9ca600ba9de14c2da Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Mon, 1 Mar 2021 23:32:24 +0300 Subject: [PATCH 41/55] Adding Array tests --- Tests/NFUnitTestArray/NFUnitTestArray.nfproj | 61 + .../Properties/AssemblyInfo.cs | 33 + Tests/NFUnitTestArray/UnitTestOtherTests.cs | 571 +++ Tests/NFUnitTestArray/UnitTestSimpleTests.cs | 3481 +++++++++++++++++ Tests/NFUnitTestArray/nano.runsettings | 13 + Tests/NFUnitTestArray/packages.config | 5 + nanoFramework.CoreLibrary.sln | 9 + 7 files changed, 4173 insertions(+) create mode 100644 Tests/NFUnitTestArray/NFUnitTestArray.nfproj create mode 100644 Tests/NFUnitTestArray/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestArray/UnitTestOtherTests.cs create mode 100644 Tests/NFUnitTestArray/UnitTestSimpleTests.cs create mode 100644 Tests/NFUnitTestArray/nano.runsettings create mode 100644 Tests/NFUnitTestArray/packages.config diff --git a/Tests/NFUnitTestArray/NFUnitTestArray.nfproj b/Tests/NFUnitTestArray/NFUnitTestArray.nfproj new file mode 100644 index 00000000..96c0857f --- /dev/null +++ b/Tests/NFUnitTestArray/NFUnitTestArray.nfproj @@ -0,0 +1,61 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + f388c3cc-8875-4fa0-b6c7-c5c8d8b92437 + Library + Properties + 512 + NFUnitTestArray + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestArray/Properties/AssemblyInfo.cs b/Tests/NFUnitTestArray/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestArray/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestArray/UnitTestOtherTests.cs b/Tests/NFUnitTestArray/UnitTestOtherTests.cs new file mode 100644 index 00000000..8c29199c --- /dev/null +++ b/Tests/NFUnitTestArray/UnitTestOtherTests.cs @@ -0,0 +1,571 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestArray +{ + [TestClass] + public class UnitTestOtherTests + { + [TestMethod] + public void Othersystemarrays_conversion_01_Test() + { + Debug.WriteLine("System.Array Type - Conversions "); + Debug.WriteLine("Verify that an implicit reference conversion from T[D] to System.Array exists"); + Assert.True(Other_TestClass_systemarrays_conversion_01.testMethod()); + } + + [TestMethod] + public void Othersystemarrays_conversion_02_Test() + { + Debug.WriteLine("System.Array Type - Conversions "); + Debug.WriteLine("Verify that an explicit reference conversion from System.Array to T[D] exists"); + Assert.True(Other_TestClass_systemarrays_conversion_02.testMethod()); + } + + [TestMethod] + public void Othersystemarrays_nullvalue_01_Test() + { + Debug.WriteLine("System.Array Type - Null Values"); + Debug.WriteLine("Verify that a System.Array array can be set to null"); + Assert.True(Other_TestClass_systemarrays_nullvalue_01.testMethod()); + } + + [TestMethod] + public void Othercovariance_exception_01_Test() + { + Assert.True(Other_TestClass_covariance_exception_01.testMethod()); + } + + [TestMethod] + public void Othercovariance_exception_02_Test() + { + Debug.WriteLine("Array Covariance"); + Debug.WriteLine("Verify an System.Exception is thrown when incompatible types are assigned to array elements"); + Assert.True(Other_TestClass_covariance_exception_02.testMethod()); + } + + [TestMethod] + public void Othercovariance_explicit_01_Test() + { + Debug.WriteLine("Array Covariance"); + Debug.WriteLine("Verify covariance from object to any reference-type (class)"); + Assert.True(Other_TestClass_covariance_explicit_01.testMethod()); + } + + [TestMethod] + public void Othercovariance_explicit_02_Test() + { + Debug.WriteLine("Array Covariance"); + Debug.WriteLine("Verify covariance from any reference-type (interface) to object"); + Assert.True(Other_TestClass_covariance_explicit_02.testMethod()); + } + + [TestMethod] + public void Othercovariance_explicit_03_Test() + { + Debug.WriteLine("Array Covariance"); + Debug.WriteLine("Verify covariance from any class-type S to any class-type T, provided S is base class of T"); + Assert.True(Other_TestClass_covariance_explicit_03.testMethod()); + } + + [TestMethod] + public void Othercovariance_explicit_04_Test() + { + Debug.WriteLine("Array Covariance"); + Debug.WriteLine("Verify covariance from any interface-type S to any interface-type T, provided S is not derived from T"); + Assert.True(Other_TestClass_covariance_explicit_04.testMethod()); + } + + [TestMethod] + public void Othercovariance_implicit_01_Test() + { + Debug.WriteLine("Array Covariance"); + Debug.WriteLine("Verify covariance from any reference-type (class) to object"); + Assert.True(Other_TestClass_covariance_implicit_01.testMethod()); + } + + [TestMethod] + public void Othercovariance_implicit_02_Test() + { + Debug.WriteLine("Array Covariance"); + Debug.WriteLine("Verify covariance from any reference-type (interface) to object"); + Assert.True(Other_TestClass_covariance_implicit_02.testMethod()); + } + + [TestMethod] + public void Othercovariance_implicit_03_Test() + { + Debug.WriteLine("Array Covariance"); + Debug.WriteLine("Verify covariance from any class-type S to any class-type T, provided S is derived from T"); + Assert.True(Other_TestClass_covariance_implicit_03.testMethod()); + } + + [TestMethod] + public void Othercovariance_implicit_04_Test() + { + Debug.WriteLine("Array Covariance"); + Debug.WriteLine("Verify covariance from any class-type S to any interface-type T, provided S implements T"); + Assert.True(Other_TestClass_covariance_implicit_04.testMethod()); + } + + [TestMethod] + public void Othercovariance_implicit_05_Test() + { + Debug.WriteLine("Array Covariance"); + Debug.WriteLine("Verify covariance from any interface-type S to any interface-type T, provided S is derived from T"); + Assert.True(Other_TestClass_covariance_implicit_05.testMethod()); + } + + [TestMethod] + public void BinarySearch_Test() + { + Debug.WriteLine("Array.BinarySearch"); + + var objects = new MyClass[6]; + for (int i = 0; i < 6; i++) + { + objects[i] = new MyClass(i + 1); + } + + int y = Array.BinarySearch(objects, new MyClass(5), null); + Assert.Equal(y, 4); + } + + class MyClass : IComparable + { + int m_int; + + public MyClass(int i) + { + m_int = i; + } + + public int Value { get { return m_int; } } + + public int CompareTo(object obj) + { + var target = obj as MyClass; + if (target == null) + { + throw new ArgumentException(); + } + + return m_int - target.m_int; + } + } + + //Compiled Test Cases + class Other_TestClass_systemarrays_conversion_01 + { + public static int Main_old() + { + int result = 32; + + MyClass[] a = new MyClass[] { new MyClass(5), new MyClass(6), new MyClass(7) }; + + + System.Array SystemArray; + int[] StaticArray = new int[] { 10, 20, 30, 40 }; + // There exists an implicit reference conversion for this + SystemArray = StaticArray; + + if (result == a[2].Value) + { + return 1; + } + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_systemarrays_conversion_02 + { + public static int Main_old() + { + System.Array SystemArray; + int[] StaticArray = new int[] { 10, 20, 30, 40 }; + int[] StaticArray2 = new int[] { 1, 2, 3, 4 }; + SystemArray = StaticArray; + StaticArray2 = (int[])SystemArray; + int result = 0; + for (int x = 0; x < 4; x++) + { + if (StaticArray[x] != (x + 1) * 10) + { + result = 1; + } + } + return result; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_systemarrays_nullvalue_01 + { + public static int Main_old() + { + System.Array SystemArray; + SystemArray = null; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_covariance_exception_01 + { + static void Fill(object[] array, int index, int count, object value) + { + for (int i = index; i < index + count; i++) + array[i] = value; + } + public static int Main_old() + { + string[] strings = new string[100]; + Fill(strings, 0, 100, "Undefined"); + Fill(strings, 0, 10, null); + + try + { + Fill(strings, 90, 10, 0); + } + catch (System.Exception) + { + return 0; + } + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Queue + { + int next; + int prev; + } + class Other_TestClass_covariance_exception_02 + { + public static int Main_old() + { + string[] stringArr = new string[10]; + object[] objectArr = stringArr; + objectArr[0] = "hello"; + + try + { + objectArr[1] = new Queue(); + } + catch (System.Exception) + { + return 0; + } + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_covariance_explicit_01_Imp + { + public int x; + } + class Other_TestClass_covariance_explicit_01 + { + public static int Main_old() + { + Other_TestClass_covariance_explicit_01_Imp[] mc = new Other_TestClass_covariance_explicit_01_Imp[10]; + for (int x = 0; x < 10; x++) + { + mc[x] = new Other_TestClass_covariance_explicit_01_Imp(); + mc[x].x = x; + } + object[] o = new Other_TestClass_covariance_explicit_01_Imp[10]; + mc = (Other_TestClass_covariance_explicit_01_Imp[])o; + + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + interface Other_TestClass_covariance_explicit_02_Inter + { + int testmethod(); + } + class Other_TestClass_covariance_explicit_02_Imp : Other_TestClass_covariance_explicit_02_Inter + { + public int testmethod() + { + Debug.WriteLine("Other_TestClass_covariance_explicit_02_Imp::testmethod()"); + return 0; + } + } + class Other_TestClass_covariance_explicit_02 + { + public static int Main_old() + { + Other_TestClass_covariance_explicit_02_Inter[] inst = new Other_TestClass_covariance_explicit_02_Inter[10]; + for (int x = 0; x < 10; x++) + { + inst[x] = new Other_TestClass_covariance_explicit_02_Imp(); + } + object[] o = new Other_TestClass_covariance_explicit_02_Imp[10]; + inst = (Other_TestClass_covariance_explicit_02_Imp[])o; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class ClassS + { + public int x; + } + class ClassT : ClassS + { + public int y; + } + class Other_TestClass_covariance_explicit_03 + { + public static int Main_old() + { + ClassS[] cs = new ClassT[10]; + ClassT[] ct = new ClassT[10]; + for (int x = 0; x < 10; x++) + { + cs[x] = new ClassT(); + ct[x] = new ClassT(); + } + ct = (ClassT[])cs; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + interface InterfaceS + { + int Other_TestClass_covariance_explicit_04MethodS(); + } + interface InterfaceT : InterfaceS + { + int Other_TestClass_covariance_explicit_04MethodT(); + } + class Other_TestClass_covariance_explicit_04_Imp : InterfaceS, InterfaceT + { + public int x; + public int Other_TestClass_covariance_explicit_04MethodS() + { + return 0; + } + public int Other_TestClass_covariance_explicit_04MethodT() + { + return 0; + } + } + class Other_TestClass_covariance_explicit_04 + { + public static int Main_old() + { + InterfaceS[] ifs = new InterfaceT[10]; + InterfaceT[] ift = new InterfaceT[10]; + Other_TestClass_covariance_explicit_04_Imp mc = new Other_TestClass_covariance_explicit_04_Imp(); + for (int x = 0; x < 10; x++) + { + ifs[x] = new Other_TestClass_covariance_explicit_04_Imp(); + ift[x] = new Other_TestClass_covariance_explicit_04_Imp(); + } + ift = (InterfaceT[])ifs; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_covariance_implicit_01_Imp + { + public int x; + } + class Other_TestClass_covariance_implicit_01 + { + public static int Main_old() + { + Other_TestClass_covariance_implicit_01_Imp[] mc = new Other_TestClass_covariance_implicit_01_Imp[10]; + for (int x = 0; x < 10; x++) + { + mc[x] = new Other_TestClass_covariance_implicit_01_Imp(); + Debug.WriteLine(x.ToString()); + mc[x].x = x; + } + object[] o = new object[10]; + o = mc; + for (int x = 0; x < 10; x++) + { + Debug.WriteLine(((Other_TestClass_covariance_implicit_01_Imp)o[x]).x.ToString()); + } + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + interface Other_TestClass_covariance_implicit_02_Inter + { + int testmethod(); + } + class Other_TestClass_covariance_implicit_02_Imp : Other_TestClass_covariance_implicit_02_Inter + { + public int testmethod() + { + Debug.WriteLine("Other_TestClass_covariance_implicit_02_Imp::testmethod()"); + return 0; + } + } + class Other_TestClass_covariance_implicit_02 + { + public static int Main_old() + { + Other_TestClass_covariance_implicit_02_Inter[] inst = new Other_TestClass_covariance_implicit_02_Inter[10]; + for (int x = 0; x < 10; x++) + { + inst[x] = new Other_TestClass_covariance_implicit_02_Imp(); + } + object[] o = new object[10]; + o = inst; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Other_TestClass_covariance_implicit_03_T + { + public int x; + } + class Other_TestClass_covariance_implicit_03_S : Other_TestClass_covariance_implicit_03_T + { + public int y; + } + class Other_TestClass_covariance_implicit_03 + { + public static int Main_old() + { + Other_TestClass_covariance_implicit_03_S[] cs = new Other_TestClass_covariance_implicit_03_S[10]; + Other_TestClass_covariance_implicit_03_T[] ct = new Other_TestClass_covariance_implicit_03_T[10]; + for (int x = 0; x < 10; x++) + { + cs[x] = new Other_TestClass_covariance_implicit_03_S(); + ct[x] = new Other_TestClass_covariance_implicit_03_T(); + } + ct = cs; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + interface Other_TestClass_covariance_implicit_04_IT + { + int Other_TestClass_covariance_implicit_04Method(); + } + class Other_TestClass_covariance_implicit_04_ImpS : Other_TestClass_covariance_implicit_04_IT + { + public int x; + public int Other_TestClass_covariance_implicit_04Method() + { + return 0; + } + } + class Other_TestClass_covariance_implicit_04 + { + public static int Main_old() + { + Other_TestClass_covariance_implicit_04_IT[] it = new Other_TestClass_covariance_implicit_04_IT[10]; + Other_TestClass_covariance_implicit_04_ImpS[] cs = new Other_TestClass_covariance_implicit_04_ImpS[10]; + for (int x = 0; x < 10; x++) + { + it[x] = new Other_TestClass_covariance_implicit_04_ImpS(); + cs[x] = new Other_TestClass_covariance_implicit_04_ImpS(); + } + it = cs; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + interface Other_TestClass_covariance_implicit_05_IT + { + int Other_TestClass_covariance_implicit_05MethodT(); + } + interface Other_TestClass_covariance_implicit_05_IS : Other_TestClass_covariance_implicit_05_IT + { + int Other_TestClass_covariance_implicit_05MethodS(); + } + class Other_TestClass_covariance_implicit_05_ImpT : Other_TestClass_covariance_implicit_05_IT + { + public int x; + public int Other_TestClass_covariance_implicit_05MethodT() + { + return 0; + } + } + class Other_TestClass_covariance_implicit_05_ImpS : Other_TestClass_covariance_implicit_05_IS + { + public int x; + public int Other_TestClass_covariance_implicit_05MethodS() + { + return 0; + } + public int Other_TestClass_covariance_implicit_05MethodT() + { + return 0; + } + } + class Other_TestClass_covariance_implicit_05 + { + public static int Main_old() + { + Other_TestClass_covariance_implicit_05_IS[] ifs = new Other_TestClass_covariance_implicit_05_IS[10]; + Other_TestClass_covariance_implicit_05_IT[] ift = new Other_TestClass_covariance_implicit_05_IT[10]; + Other_TestClass_covariance_implicit_05_ImpS cs = new Other_TestClass_covariance_implicit_05_ImpS(); + Other_TestClass_covariance_implicit_05_ImpT ct = new Other_TestClass_covariance_implicit_05_ImpT(); + for (int x = 0; x < 10; x++) + { + ifs[x] = new Other_TestClass_covariance_implicit_05_ImpS(); + ift[x] = new Other_TestClass_covariance_implicit_05_ImpT(); + } + ift = ifs; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + } +} diff --git a/Tests/NFUnitTestArray/UnitTestSimpleTests.cs b/Tests/NFUnitTestArray/UnitTestSimpleTests.cs new file mode 100644 index 00000000..372e0774 --- /dev/null +++ b/Tests/NFUnitTestArray/UnitTestSimpleTests.cs @@ -0,0 +1,3481 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestArray +{ + [TestClass] + class UnitTestSimpleTests + { + [TestMethod] + public void Simple_decl_decl_01_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of type int"); + + Assert.True(Simple_TestClass_decl_decl_01.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_02_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of type byte"); + Assert.True(Simple_TestClass_decl_decl_02.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_03_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of type short"); + + Assert.True(Simple_TestClass_decl_decl_03.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_04_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of type long"); + + Assert.True(Simple_TestClass_decl_decl_04.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_05_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of type char"); + + Assert.True(Simple_TestClass_decl_decl_05.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_06_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of type double"); + + Assert.True(Simple_TestClass_decl_decl_06.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_07_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of type float"); + + Assert.True(Simple_TestClass_decl_decl_07.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_08_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of type double"); + + Assert.True(Simple_TestClass_decl_decl_08.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_09_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of type bool"); + + Assert.True(Simple_TestClass_decl_decl_09.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_10_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of a user-defined struct"); + + Assert.True(Simple_TestClass_decl_decl_10.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_11_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of a user-defined class"); + + Assert.True(Simple_TestClass_decl_decl_11.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_12_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of a user-defined interface"); + + Assert.True(Simple_TestClass_decl_decl_12.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_13_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of type object"); + + Assert.True(Simple_TestClass_decl_decl_13.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_14_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of delegates"); + + Assert.True(Simple_TestClass_decl_decl_14.testMethod()); + } + [TestMethod] + public void Simple_decl_decl_15_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Declare a simple array of type System.Array"); + + Assert.True(Simple_TestClass_decl_decl_15.testMethod()); + } + [TestMethod] + public void Simple_decl_bounds_01_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" An array created as array[0] compiles successfully"); + + Assert.True(Simple_TestClass_decl_bounds_01.testMethod()); + } + [TestMethod] + public void Simple_decl_bounds_02_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" An array created as array[maxint] compiles successfully"); + Debug.WriteLine("This test is expected to generate"); + Debug.WriteLine("Out Of Memory System.Exception"); + Assert.False(Simple_TestClass_decl_bounds_02.testMethod()); + Debug.WriteLine(" This failure indicates a test is now passing that previously failed by design."); + Debug.WriteLine(" It previously marked as known failure because of bug # 16823"); + Debug.WriteLine(" The Test owner needs to verify that the change was intentional and remove the known failure."); + } + [TestMethod] + public void Simple_decl_bounds_03_Test() + { + Debug.WriteLine(" decl_bounds_03 "); + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" An array created as array[maxint+1] compiles successfully"); + Assert.False(Simple_TestClass_decl_bounds_03.testMethod()); + Debug.WriteLine(" This failure indicates a test is now passing that previously failed by design."); + Debug.WriteLine(" It previously marked as known failure because of bug # 16823"); + Debug.WriteLine(" The Test owner needs to verify that the change was intentional and remove the known failure."); + } + [TestMethod] + public void Simple_decl_index_01_Test() + { + Debug.WriteLine(" decl_index_01 "); + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" A char variable as an array index should work"); + + Assert.True(Simple_TestClass_decl_index_01.testMethod()); + } + [TestMethod] + public void Simple_decl_index_02_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" A byte variable as an array index should work"); + Assert.True(Simple_TestClass_decl_index_02.testMethod()); + } + [TestMethod] + public void Simple_decl_index_03_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" A short variable as an array index should work"); + Assert.True(Simple_TestClass_decl_index_03.testMethod()); + } + [TestMethod] + public void Simple_decl_index_04_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" A short literal as an array index should work"); + + Assert.True(Simple_TestClass_decl_index_04.testMethod()); + } + [TestMethod] + public void Simple_decl_index_05_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" A byte literal as an array index should work"); + Assert.True(Simple_TestClass_decl_index_05.testMethod()); + } + [TestMethod] + public void Simple_decl_index_06_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" A char literal as an array index should work"); + Assert.True(Simple_TestClass_decl_index_06.testMethod()); + } + [TestMethod] + public void Simple_decl_index_07_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" A uint variable as an array index should work"); + Assert.True(Simple_TestClass_decl_index_07.testMethod()); + } + [TestMethod] + public void Simple_decl_index_08_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" A long variable as an array index should work"); + Assert.True(Simple_TestClass_decl_index_08.testMethod()); + } + [TestMethod] + public void Simple_decl_index_09_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" A ulong variable as an array index should work"); + Assert.True(Simple_TestClass_decl_index_09.testMethod()); + } + [TestMethod] + public void Simple_decl_index_10_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" A uint literal as an array index should work"); + Assert.True(Simple_TestClass_decl_index_10.testMethod()); + } + [TestMethod] + public void Simple_decl_index_11_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" A long literal as an array index should work"); + Assert.True(Simple_TestClass_decl_index_11.testMethod()); + } + [TestMethod] + public void Simple_decl_index_12_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" A ulong literal as an array index should work"); + Assert.True(Simple_TestClass_decl_index_12.testMethod()); + } + [TestMethod] + public void Simple_decl_syntax_03_Test() + { + Debug.WriteLine(" Arrays - Declarations"); + Debug.WriteLine(" Spaces after type and between brackets and comments do not affect arrays"); + Assert.True(Simple_TestClass_decl_syntax_03.testMethod()); + } + [TestMethod] + public void Simple_init_init_a_01_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type int using new (longhand)"); + Assert.True(Simple_TestClass_init_init_a_01.testMethod()); + } + [TestMethod] + public void Simple_init_init_a_02_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type short using new (longhand)"); + Assert.True(Simple_TestClass_init_init_a_02.testMethod()); + } + [TestMethod] + public void Simple_init_init_a_03_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type byte using new (longhand)"); + Assert.True(Simple_TestClass_init_init_a_03.testMethod()); + } + [TestMethod] + public void Simple_init_init_a_04_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type long using new (longhand)"); + Assert.True(Simple_TestClass_init_init_a_04.testMethod()); + } + [TestMethod] + public void Simple_init_init_a_05_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type double using new (longhand)"); + Assert.True(Simple_TestClass_init_init_a_05.testMethod()); + } + [TestMethod] + public void Simple_init_init_a_06_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type float using new (longhand)"); + + Assert.True(Simple_TestClass_init_init_a_06.testMethod()); + } + [TestMethod] + public void Simple_init_init_a_08_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type String using new (longhand)"); + Assert.True(Simple_TestClass_init_init_a_08.testMethod()); + } + [TestMethod] + public void Simple_init_init_a_09_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type char using new (longhand)"); + Assert.True(Simple_TestClass_init_init_a_09.testMethod()); + } + [TestMethod] + public void Simple_init_init_a_10_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type bool using new (longhand)"); + Assert.True(Simple_TestClass_init_init_a_10.testMethod()); + } + [TestMethod] + public void Simple_init_init_b_01_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type int using new (shorthand)"); + Assert.True(Simple_TestClass_init_init_b_01.testMethod()); + } + [TestMethod] + public void Simple_init_init_b_02_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type short using new (shorthand)"); + Assert.True(Simple_TestClass_init_init_b_02.testMethod()); + } + [TestMethod] + public void Simple_init_init_b_03_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type byte using new (shorthand)"); + Assert.True(Simple_TestClass_init_init_b_03.testMethod()); + } + [TestMethod] + public void Simple_init_init_b_04_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type long using new (shorthand)"); + Assert.True(Simple_TestClass_init_init_b_04.testMethod()); + } + [TestMethod] + public void Simple_init_init_b_05_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type double using new (shorthand)"); + Assert.True(Simple_TestClass_init_init_b_05.testMethod()); + } + [TestMethod] + public void Simple_init_init_b_06_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type float using new (shorthand)"); + Assert.True(Simple_TestClass_init_init_b_06.testMethod()); + } + [TestMethod] + public void Simple_init_init_b_08_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type String using new (shorthand)"); + Assert.True(Simple_TestClass_init_init_b_08.testMethod()); + } + [TestMethod] + public void Simple_init_init_b_09_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type char using new (shorthand)"); + Assert.True(Simple_TestClass_init_init_b_09.testMethod()); + } + [TestMethod] + public void Simple_init_init_b_10_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type bool using new (shorthand)"); + + Assert.True(Simple_TestClass_init_init_b_10.testMethod()); + } + [TestMethod] + public void Simple_init_init_c_01_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type int using new (# init values sets array size)"); + Assert.True(Simple_TestClass_init_init_c_01.testMethod()); + } + [TestMethod] + public void Simple_init_init_c_02_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type short using new (# init values sets array size)"); + Assert.True(Simple_TestClass_init_init_c_02.testMethod()); + } + [TestMethod] + public void Simple_init_init_c_03_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type byte using new (# init values sets array size)"); + Assert.True(Simple_TestClass_init_init_c_03.testMethod()); + } + [TestMethod] + public void Simple_init_init_c_04_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type long using new (# init values sets array size)"); + Assert.True(Simple_TestClass_init_init_c_04.testMethod()); + } + [TestMethod] + public void Simple_init_init_c_05_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type double using new (# init values sets array size)"); + Assert.True(Simple_TestClass_init_init_c_05.testMethod()); + } + [TestMethod] + public void Simple_init_init_c_06_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type float using new (# init values sets array size)"); + Assert.True(Simple_TestClass_init_init_c_06.testMethod()); + } + [TestMethod] + public void Simple_init_init_c_08_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type String using new (# init values sets array size)"); + Assert.True(Simple_TestClass_init_init_c_08.testMethod()); + } + [TestMethod] + public void Simple_init_init_c_09_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type char using new (# init values sets array size)"); + Assert.True(Simple_TestClass_init_init_c_09.testMethod()); + } + [TestMethod] + public void Simple_init_init_c_10_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type bool using new (# init values sets array size)"); + Assert.True(Simple_TestClass_init_init_c_10.testMethod()); + } + [TestMethod] + public void Simple_init_init_d_01_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type int using new (longhand) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_d_01.testMethod()); + } + [TestMethod] + public void Simple_init_init_d_02_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type short using new (longhand) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_d_02.testMethod()); + } + [TestMethod] + public void Simple_init_init_d_03_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type byte using new (longhand) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_d_03.testMethod()); + } + [TestMethod] + public void Simple_init_init_d_04_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type long using new (longhand) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_d_04.testMethod()); + } + [TestMethod] + public void Simple_init_init_d_05_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type double using new (longhand) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_d_05.testMethod()); + } + [TestMethod] + public void Simple_init_init_d_06_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type float using new (longhand) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_d_06.testMethod()); + } + [TestMethod] + public void Simple_init_init_d_08_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type String using new (longhand) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_d_08.testMethod()); + } + [TestMethod] + public void Simple_init_init_d_09_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type char using new (longhand) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_d_09.testMethod()); + } + [TestMethod] + public void Simple_init_init_d_10_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type bool using new (longhand) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_d_10.testMethod()); + } + [TestMethod] + public void Simple_init_init_e_01_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type int using new (# init values sets array size) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_e_01.testMethod()); + } + [TestMethod] + public void Simple_init_init_e_02_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type short using new (# init values sets array size) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_e_02.testMethod()); + } + [TestMethod] + public void Simple_init_init_e_03_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type byte using new (# init values sets array size) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_e_03.testMethod()); + } + [TestMethod] + public void Simple_init_init_e_04_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type long using new (# init values sets array size) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_e_04.testMethod()); + } + [TestMethod] + public void Simple_init_init_e_05_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type double using new (# init values sets array size) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_e_05.testMethod()); + } + [TestMethod] + public void Simple_init_init_e_06_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type float using new (# init values sets array size) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_e_06.testMethod()); + } + [TestMethod] + public void Simple_init_init_e_08_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type String using new (# init values sets array size) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_e_08.testMethod()); + } + [TestMethod] + public void Simple_init_init_e_09_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type char using new (# init values sets array size) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_e_09.testMethod()); + } + [TestMethod] + public void Simple_init_init_e_10_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type bool using new (# init values sets array size) separate from decl statement"); + Assert.True(Simple_TestClass_init_init_e_10.testMethod()); + } + [TestMethod] + public void Simple_init_syntax_09_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Syntax - Whitespace and comments in braces should not affect anything"); + Assert.True(Simple_TestClass_init_syntax_09.testMethod()); + } + [TestMethod] + public void Simple_init_syntax_11_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Syntax - zero elements in initializer should create zero length array"); + Assert.True(Simple_TestClass_init_syntax_11.testMethod()); + } + [TestMethod] + public void Simple_init_syntax_12_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Syntax - zero elements in initializer should be allowed for 0-length array"); + Assert.True(Simple_TestClass_init_syntax_12.testMethod()); + } + [TestMethod] + public void Simple_init_decl_02_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Declaration - if initializer is used, a provided index can be a const"); + Assert.True(Simple_TestClass_init_decl_02.testMethod()); + } + [TestMethod] + public void Simple_init_decl_03_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Declaration - if initializer is used, a provided index can be a const short"); + Assert.True(Simple_TestClass_init_decl_03.testMethod()); + } + [TestMethod] + public void Simple_init_decl_04_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Declaration - if initializer is used, a provided index can be a const byte"); + Assert.True(Simple_TestClass_init_decl_04.testMethod()); + } + [TestMethod] + public void Simple_init_decl_05_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Declaration - if initializer is used, a provided index can be a const long casted to an int"); + Assert.True(Simple_TestClass_init_decl_05.testMethod()); + } + [TestMethod] + public void Simple_init_shorthand_01_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Initialization of arrays of type int using new (shorthand)"); + Debug.WriteLine(" This is to verify bug #52958 doesn't regress"); + Assert.True(Simple_TestClass_init_shorthand_01.testMethod()); + } + [TestMethod] + public void Simple_init_constinit_01_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Ensure all constant init optimization code paths are covered: all constants (VS7:124565 for more info)"); + Assert.True(Simple_TestClass_init_constinit_01.testMethod()); + } + [TestMethod] + public void Simple_init_constinit_02_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Ensure all constant init optimization code paths are covered: all variables (VS7:124565 for more info)"); + + Assert.True(Simple_TestClass_init_constinit_02.testMethod()); + } + [TestMethod] + public void Simple_init_constinit_03_Test() + { + Debug.WriteLine(" Arrays - Initialization"); + Debug.WriteLine(" Ensure all constant init optimization code paths are covered: half variables and half constants (VS7:124565 for more info)"); + Assert.True(Simple_TestClass_init_constinit_03.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_length_01_Test() + { + Debug.WriteLine(" acc_iter_length_01 "); + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Declare simple arrays of various lengths and verify that array.Length is correct"); + Assert.True(Simple_TestClass_acc_iter_length_01.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_bounds_01_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's 0th element should work fine"); + Assert.True(Simple_TestClass_acc_iter_bounds_01.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_bounds_02_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's maxlength element should work fine"); + Assert.True(Simple_TestClass_acc_iter_bounds_02.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_bounds_03_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's -1 element should throw an System.Exception"); + Assert.True(Simple_TestClass_acc_iter_bounds_03.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_bounds_04_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's maxlength+1 element should throw an System.Exception"); + Assert.True(Simple_TestClass_acc_iter_bounds_04.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_idxtype_a_01_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's index with a variable of type int should work"); + Assert.True(Simple_TestClass_acc_iter_idxtype_a_01.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_idxtype_a_02_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's index with a variable of type short should work"); + Assert.True(Simple_TestClass_acc_iter_idxtype_a_02.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_idxtype_a_03_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's index with a variable of type byte should work"); + + Assert.True(Simple_TestClass_acc_iter_idxtype_a_03.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_idxtype_a_04_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's index with a variable of type char should work"); + Assert.True(Simple_TestClass_acc_iter_idxtype_a_04.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_idxtype_a_06_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's index with a variable of type long should work"); + Assert.True(Simple_TestClass_acc_iter_idxtype_a_06.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_idxtype_b_01_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's index with an int literal should work"); + + Assert.True(Simple_TestClass_acc_iter_idxtype_b_01.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_idxtype_b_02_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's index with a short literal should work"); + Assert.True(Simple_TestClass_acc_iter_idxtype_b_02.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_idxtype_b_03_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's index with a byte literal should work"); + Assert.True(Simple_TestClass_acc_iter_idxtype_b_03.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_idxtype_b_04_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's index with a char literal should work"); + Assert.True(Simple_TestClass_acc_iter_idxtype_b_04.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_idxtype_b_06_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Accessing an array's index with a variable of type long should work"); + Assert.True(Simple_TestClass_acc_iter_idxtype_b_06.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_iter_01_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Declare simple array of int, init it through iteration, verify values are correct"); + Assert.True(Simple_TestClass_acc_iter_iter_01.testMethod()); + } + [TestMethod] + public void Simple_acc_iter_iter_02_Test() + { + Debug.WriteLine(" Arrays - Access and Iteration"); + Debug.WriteLine(" Declare simple array of char, init it through individual element assignments, verify correctness"); + Assert.True(Simple_TestClass_acc_iter_iter_02.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_a_01_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning int type literals into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_a_01.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_a_02_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning byte type literals into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_a_02.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_a_03_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning short type literals into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_a_03.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_a_04_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning long type literals into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_a_04.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_a_05_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning char type literals into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_a_05.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_a_06_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning double type literals into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_a_06.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_a_07_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning float type literals into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_a_07.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_a_08_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning double type literals into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_a_08.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_a_09_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning bool type literals into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_a_09.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_b_01_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning int type variables into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_b_01.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_b_02_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning byte type variables into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_b_02.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_b_03_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning short type variables into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_b_03.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_b_04_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning long type variables into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_b_04.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_b_05_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning char type variables into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_b_05.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_b_06_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning double type variables into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_b_06.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_b_07_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning float type variables into array elements should work"); + + Assert.True(Simple_TestClass_assign_smpass_b_07.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_b_08_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning double type variables into array elements should work"); + + Assert.True(Simple_TestClass_assign_smpass_b_08.testMethod()); + } + [TestMethod] + public void Simple_assign_smpass_b_09_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning bool type variables into array elements should work"); + Assert.True(Simple_TestClass_assign_smpass_b_09.testMethod()); + } + [TestMethod] + public void Simple_assign_badass_01_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning null to an array variable should work"); + Assert.True(Simple_TestClass_assign_badass_01.testMethod()); + } + [TestMethod] + public void Simple_assign_badass_03_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning a smaller array to a bigger array should work"); + Assert.True(Simple_TestClass_assign_badass_03.testMethod()); + } + [TestMethod] + public void Simple_assign_badass_04_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning a bigger array to a smaller array should work"); + Assert.True(Simple_TestClass_assign_badass_04.testMethod()); + } + [TestMethod] + public void Simple_assign_element_01_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning one element to another element of the same array should work"); + Assert.True(Simple_TestClass_assign_element_01.testMethod()); + } + [TestMethod] + public void Simple_assign_element_02_Test() + { + Debug.WriteLine(" Arrays - Assignments"); + Debug.WriteLine(" Assigning one element to another element of a different array should work"); + Assert.True(Simple_TestClass_assign_element_02.testMethod()); + } + [TestMethod] + public void Simple_assign_argpass_01_Test() + { + Debug.WriteLine(" Arrays - Assignments - Passing elements to methods"); + Debug.WriteLine(" Passing an element to a function should work"); + Assert.True(Simple_TestClass_assign_argpass_01.testMethod()); + } + [TestMethod] + public void Simple_assign_argpass_02_Test() + { + Debug.WriteLine(" Arrays - Assignments - Passing elements to methods"); + Debug.WriteLine(" Passing an element to a function as a ref parameter should work"); + Assert.True(Simple_TestClass_assign_argpass_02.testMethod()); + } + [TestMethod] + public void Simple_assign_argpass_03_Test() + { + Debug.WriteLine(" Arrays - Assignments - Passing elements to methods"); + Debug.WriteLine(" Passing an element to a function as an out parameter should work"); + Assert.True(Simple_TestClass_assign_argpass_03.testMethod()); + } + [TestMethod] + public void Simple_object_sysarr_01_Test() + { + Debug.WriteLine(" Arrays - As Object and System.Array"); + Debug.WriteLine(" Testing the System.Array methods and Properties: System.Array.Clear()"); + Assert.True(Simple_TestClass_object_sysarr_01.testMethod()); + } + [TestMethod] + public void Simple_object_sysarr_02_Test() + { + Debug.WriteLine(" Arrays - As Object and System.Array"); + Debug.WriteLine(" Testing the System.Array methods and Properties: Length property"); + Assert.True(Simple_TestClass_object_sysarr_02.testMethod()); + } + + //Compiled Test Cases + class Simple_TestClass_decl_decl_01 + { + public static int Main_old() + { + int[] arr = new int[10]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_decl_02 + { + public static int Main_old() + { + byte[] arr = new byte[10]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_decl_03 + { + public static int Main_old() + { + short[] arr = new short[10]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_decl_04 + { + public static int Main_old() + { + long[] arr = new long[10]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_decl_05 + { + public static int Main_old() + { + char[] arr = new char[10]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_decl_06 + { + public static int Main_old() + { + double[] arr = new double[10]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_decl_07 + { + public static int Main_old() + { + float[] arr = new float[10]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_decl_08 + { + public static int Main_old() + { + double[] arr = new double[10]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_decl_09 + { + public static int Main_old() + { + bool[] arr = new bool[10]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + struct myStruct + { + public int x; + } + class Simple_TestClass_decl_decl_10 + { + public static int Main_old() + { + myStruct[] arr = new myStruct[10]; + + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class myClass + { + public int x = 0; + void meth() { } + } + class Simple_TestClass_decl_decl_11 + { + public static int Main_old() + { + myClass[] arr = new myClass[10]; + + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + interface myInterface { } + class Simple_TestClass_decl_decl_12 + { + public static int Main_old() + { + myInterface[] arr = new myInterface[10]; + + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_decl_13 + { + public static int Main_old() + { + object[] arr = new object[10]; + + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + delegate void myDelegate(String myString); + class Simple_TestClass_decl_decl_14 + { + public static int Main_old() + { + myDelegate[] myDel = new myDelegate[10]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_decl_15 + { + public static int Main_old() + { + Array[] arr = new Array[10]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_bounds_01 + { + public static int Main_old() + { + int[] arr = new int[0]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_bounds_02 + { + public static int Main_old() + { + try + {//bug 16823 + //int[] arr = new int[2147483647]; + } + catch (System.Exception) + { + Debug.WriteLine("Out Of Memory System.Exception"); + } + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_bounds_03 + { + public static int Main_old() + { + try + {//bug 16823 + //int[] arr = new int[2147483648]; + } + catch (System.Exception) + { + return 0; + } + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_index_01 + { + public static int Main_old() + { + char x = 'a'; + int[] arr1 = new int[x]; + + char y = 'b'; + int[] arr2 = new int[y]; + + if (arr1.Length == (arr2.Length - 1)) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_index_02 + { + public static int Main_old() + { + byte x = 5; + int[] arr1 = new int[x]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_index_03 + { + public static int Main_old() + { + short x = 5; + int[] arr1 = new int[x]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_index_04 + { + public static int Main_old() + { + int[] arr1 = new int[(short)5]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_index_05 + { + public static int Main_old() + { + int[] arr1 = new int[(byte)5]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_index_06 + { + public static int Main_old() + { + int[] arr1 = new int['a']; + int[] arr2 = new int['b']; + + Debug.WriteLine(arr1.Length.ToString()); + Debug.WriteLine(arr2.Length.ToString()); + if (arr1.Length == (arr2.Length - 1)) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_index_07 + { + public static int Main_old() + { + uint x = 5; + int[] arr1 = new int[x]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_index_08 + { + public static int Main_old() + { + long x = 5; + int[] arr1 = new int[x]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_index_09 + { + public static int Main_old() + { + ulong x = 5; + int[] arr1 = new int[x]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_index_10 + { + public static int Main_old() + { + int[] arr1 = new int[5U]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_index_11 + { + public static int Main_old() + { + int[] arr1 = new int[5L]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_index_12 + { + public static int Main_old() + { + int[] arr1 = new int[5UL]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_decl_syntax_03 + { + public static int Main_old() + { + int[] arr = new int[10]; + int[ /* test comment */ ] arr2 = new int[5]; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_a_01 + { + public static int Main_old() + { + int[] arr = new int[5] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_a_02 + { + public static int Main_old() + { + short[] arr = new short[5] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_a_03 + { + public static int Main_old() + { + byte[] arr = new byte[5] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_a_04 + { + public static int Main_old() + { + long[] arr = new long[5] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_a_05 + { + public static int Main_old() + { + double[] arr = new double[5] { 1.0, 2.0, 3.0, 4.0, 5.0 }; + int x = 0; + if (arr[0] != 1.0) + x = 1; + if (arr[1] != 2.0) + x = 1; + if (arr[2] != 3.0) + x = 1; + if (arr[3] != 4.0) + x = 1; + if (arr[4] != 5.0) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_a_06 + { + public static int Main_old() + { + float[] arr = new float[5] { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }; + int x = 0; + if (arr[0] != 1.0) + x = 1; + if (arr[1] != 2.0) + x = 1; + if (arr[2] != 3.0) + x = 1; + if (arr[3] != 4.0) + x = 1; + if (arr[4] != 5.0) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_a_08 + { + public static int Main_old() + { + String[] arr = new String[5] { "one", "two", "three", "four", "five" }; + int x = 0; + if (!arr[0].Equals("one")) + x = 1; + if (!arr[1].Equals("two")) + x = 1; + if (!arr[2].Equals("three")) + x = 1; + if (!arr[3].Equals("four")) + x = 1; + if (!arr[4].Equals("five")) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_a_09 + { + public static int Main_old() + { + char[] arr = new char[5] { '1', '2', '3', '4', '5' }; + int x = 0; + if (arr[0] != '1') + x = 1; + if (arr[1] != '2') + x = 1; + if (arr[2] != '3') + x = 1; + if (arr[3] != '4') + x = 1; + if (arr[4] != '5') + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_a_10 + { + public static int Main_old() + { + bool[] arr = new bool[5] { true, false, true, false, true }; + int x = 0; + if (!arr[0]) + x = 1; + if (arr[1]) + x = 1; + if (!arr[2]) + x = 1; + if (arr[3]) + x = 1; + if (!arr[4]) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_b_01 + { + public static int Main_old() + { + int[] arr = { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_b_02 + { + public static int Main_old() + { + short[] arr = { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_b_03 + { + public static int Main_old() + { + byte[] arr = { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_b_04 + { + public static int Main_old() + { + long[] arr = { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_b_05 + { + public static int Main_old() + { + double[] arr = { 1.0, 2.0, 3.0, 4.0, 5.0 }; + int x = 0; + if (arr[0] != 1.0) + x = 1; + if (arr[1] != 2.0) + x = 1; + if (arr[2] != 3.0) + x = 1; + if (arr[3] != 4.0) + x = 1; + if (arr[4] != 5.0) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_b_06 + { + public static int Main_old() + { + float[] arr = { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }; + int x = 0; + if (arr[0] != 1.0) + x = 1; + if (arr[1] != 2.0) + x = 1; + if (arr[2] != 3.0) + x = 1; + if (arr[3] != 4.0) + x = 1; + if (arr[4] != 5.0) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_b_08 + { + public static int Main_old() + { + String[] arr = { "one", "two", "three", "four", "five" }; + int x = 0; + if (!arr[0].Equals("one")) + x = 1; + if (!arr[1].Equals("two")) + x = 1; + if (!arr[2].Equals("three")) + x = 1; + if (!arr[3].Equals("four")) + x = 1; + if (!arr[4].Equals("five")) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_b_09 + { + public static int Main_old() + { + char[] arr = { '1', '2', '3', '4', '5' }; + int x = 0; + if (arr[0] != '1') + x = 1; + if (arr[1] != '2') + x = 1; + if (arr[2] != '3') + x = 1; + if (arr[3] != '4') + x = 1; + if (arr[4] != '5') + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_b_10 + { + public static int Main_old() + { + bool[] arr = { true, false, true, false, true }; + int x = 0; + if (!arr[0]) + x = 1; + if (arr[1]) + x = 1; + if (!arr[2]) + x = 1; + if (arr[3]) + x = 1; + if (!arr[4]) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_c_01 + { + public static int Main_old() + { + int[] arr = new int[] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_c_02 + { + public static int Main_old() + { + short[] arr = new short[] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_c_03 + { + public static int Main_old() + { + byte[] arr = new byte[] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_c_04 + { + public static int Main_old() + { + long[] arr = new long[] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_c_05 + { + public static int Main_old() + { + double[] arr = new double[] { 1.0, 2.0, 3.0, 4.0, 5.0 }; + int x = 0; + if (arr[0] != 1.0) + x = 1; + if (arr[1] != 2.0) + x = 1; + if (arr[2] != 3.0) + x = 1; + if (arr[3] != 4.0) + x = 1; + if (arr[4] != 5.0) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_c_06 + { + public static int Main_old() + { + float[] arr = new float[] { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }; + int x = 0; + if (arr[0] != 1.0) + x = 1; + if (arr[1] != 2.0) + x = 1; + if (arr[2] != 3.0) + x = 1; + if (arr[3] != 4.0) + x = 1; + if (arr[4] != 5.0) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_c_08 + { + public static int Main_old() + { + String[] arr = new String[] { "one", "two", "three", "four", "five" }; + int x = 0; + if (!arr[0].Equals("one")) + x = 1; + if (!arr[1].Equals("two")) + x = 1; + if (!arr[2].Equals("three")) + x = 1; + if (!arr[3].Equals("four")) + x = 1; + if (!arr[4].Equals("five")) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_c_09 + { + public static int Main_old() + { + char[] arr = new char[] { '1', '2', '3', '4', '5' }; + int x = 0; + if (arr[0] != '1') + x = 1; + if (arr[1] != '2') + x = 1; + if (arr[2] != '3') + x = 1; + if (arr[3] != '4') + x = 1; + if (arr[4] != '5') + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_c_10 + { + public static int Main_old() + { + bool[] arr = new bool[] { true, false, true, false, true }; + int x = 0; + if (!arr[0]) + x = 1; + if (arr[1]) + x = 1; + if (!arr[2]) + x = 1; + if (arr[3]) + x = 1; + if (!arr[4]) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_d_01 + { + public static int Main_old() + { + int[] arr; + arr = new int[5] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_d_02 + { + public static int Main_old() + { + short[] arr; + arr = new short[5] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_d_03 + { + public static int Main_old() + { + byte[] arr; + arr = new byte[5] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_d_04 + { + public static int Main_old() + { + long[] arr; + arr = new long[5] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_d_05 + { + public static int Main_old() + { + double[] arr; + arr = new double[5] { 1.0, 2.0, 3.0, 4.0, 5.0 }; + int x = 0; + if (arr[0] != 1.0) + x = 1; + if (arr[1] != 2.0) + x = 1; + if (arr[2] != 3.0) + x = 1; + if (arr[3] != 4.0) + x = 1; + if (arr[4] != 5.0) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_d_06 + { + public static int Main_old() + { + float[] arr; + arr = new float[5] { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }; + int x = 0; + if (arr[0] != 1.0) + x = 1; + if (arr[1] != 2.0) + x = 1; + if (arr[2] != 3.0) + x = 1; + if (arr[3] != 4.0) + x = 1; + if (arr[4] != 5.0) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_d_08 + { + public static int Main_old() + { + String[] arr; + arr = new String[5] { "one", "two", "three", "four", "five" }; + int x = 0; + if (!arr[0].Equals("one")) + x = 1; + if (!arr[1].Equals("two")) + x = 1; + if (!arr[2].Equals("three")) + x = 1; + if (!arr[3].Equals("four")) + x = 1; + if (!arr[4].Equals("five")) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_d_09 + { + public static int Main_old() + { + char[] arr; + arr = new char[5] { '1', '2', '3', '4', '5' }; + int x = 0; + if (arr[0] != '1') + x = 1; + if (arr[1] != '2') + x = 1; + if (arr[2] != '3') + x = 1; + if (arr[3] != '4') + x = 1; + if (arr[4] != '5') + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_d_10 + { + public static int Main_old() + { + bool[] arr; + arr = new bool[5] { true, false, true, false, true }; + int x = 0; + if (!arr[0]) + x = 1; + if (arr[1]) + x = 1; + if (!arr[2]) + x = 1; + if (arr[3]) + x = 1; + if (!arr[4]) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_e_01 + { + public static int Main_old() + { + int[] arr; + arr = new int[] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_e_02 + { + public static int Main_old() + { + short[] arr; + arr = new short[] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_e_03 + { + public static int Main_old() + { + byte[] arr; + arr = new byte[] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_e_04 + { + public static int Main_old() + { + long[] arr; + arr = new long[] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_e_05 + { + public static int Main_old() + { + double[] arr; + arr = new double[] { 1.0, 2.0, 3.0, 4.0, 5.0 }; + int x = 0; + if (arr[0] != 1.0) + x = 1; + if (arr[1] != 2.0) + x = 1; + if (arr[2] != 3.0) + x = 1; + if (arr[3] != 4.0) + x = 1; + if (arr[4] != 5.0) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_e_06 + { + public static int Main_old() + { + float[] arr; + arr = new float[] { 1.0f, 2.0f, 3.0f, 4.0f, 5.0f }; + int x = 0; + if (arr[0] != 1.0) + x = 1; + if (arr[1] != 2.0) + x = 1; + if (arr[2] != 3.0) + x = 1; + if (arr[3] != 4.0) + x = 1; + if (arr[4] != 5.0) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_e_08 + { + public static int Main_old() + { + String[] arr; + arr = new String[] { "one", "two", "three", "four", "five" }; + int x = 0; + if (!arr[0].Equals("one")) + x = 1; + if (!arr[1].Equals("two")) + x = 1; + if (!arr[2].Equals("three")) + x = 1; + if (!arr[3].Equals("four")) + x = 1; + if (!arr[4].Equals("five")) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_e_09 + { + public static int Main_old() + { + char[] arr; + arr = new char[] { '1', '2', '3', '4', '5' }; + int x = 0; + if (arr[0] != '1') + x = 1; + if (arr[1] != '2') + x = 1; + if (arr[2] != '3') + x = 1; + if (arr[3] != '4') + x = 1; + if (arr[4] != '5') + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_init_e_10 + { + public static int Main_old() + { + bool[] arr; + arr = new bool[] { true, false, true, false, true }; + int x = 0; + if (!arr[0]) + x = 1; + if (arr[1]) + x = 1; + if (!arr[2]) + x = 1; + if (arr[3]) + x = 1; + if (!arr[4]) + x = 1; + if (arr.Length != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_syntax_09 + { + public static int Main_old() + { + int[] arr = new int[5] { 1, 2, 3, 4, 5 }; + int[] arr2 = new int[5] { 1, /* test comment */ 2, 3, 4, 5 }; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_syntax_11 + { + public static int Main_old() + { + int[] arr = new int[] { }; + if (arr.Length == 0) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_syntax_12 + { + public static int Main_old() + { + int[] arr = new int[0] { }; + if (arr.Length == 0) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_decl_02 + { + const int myLength = 5; + public static int Main_old() + { + int[] arr = new int[myLength] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_decl_03 + { + const short myLength = 5; + public static int Main_old() + { + int[] arr = new int[myLength] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_decl_04 + { + const byte myLength = 5; + public static int Main_old() + { + int[] arr = new int[myLength] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_decl_05 + { + const long myLength = 5; + public static int Main_old() + { + int[] arr = new int[(int)myLength] { 1, 2, 3, 4, 5 }; + int x = 0; + if (arr[0] != 1) + x = 1; + if (arr[1] != 2) + x = 1; + if (arr[2] != 3) + x = 1; + if (arr[3] != 4) + x = 1; + if (arr[4] != 5) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_shorthand_01 + { + static int[] a = { 1, 2, 3, 4 }; + public static int Main_old() + { + for (int i = 0; i < 4; i++) + { + int[] b = { 1, 2, 3, 4 }; + Debug.WriteLine(a[i].ToString()); + Debug.WriteLine(b[i].ToString()); + } + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_constinit_01 + { + int[] TestArray1 = new int[] { 1, 2, 3, 4 }; + static int Main_old() + { + int[] TestArray2 = new int[] { 1, 2, 3, 4 }; + + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_constinit_02 + { + int a = 1; + int b = 2; + int c = 3; + int d = 4; + void MyMethod() + { + int[] TestArray = new int[] { a, b, c, d }; + + } + static int Main_old() + { + Simple_TestClass_init_constinit_02 a = new Simple_TestClass_init_constinit_02(); + a.MyMethod(); + + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_init_constinit_03 + { + int a = 1; + int b = 2; + void MyMethod() + { + int[] TestArray = new int[] { 1, a, 2, b }; + + } + static int Main_old() + { + Simple_TestClass_init_constinit_03 a = new Simple_TestClass_init_constinit_03(); + a.MyMethod(); + + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_length_01 + { + public static int Main_old() + { + int[] arr1 = new int[10]; + double[] arr2 = new double[15]; + float[] arr3; + arr3 = new float[1]; + char[] arr4; + arr4 = new char[0]; + int x = 0; + if (arr1.Length != 10) + x = 1; + if (arr2.Length != 15) + x = 1; + if (arr3.Length != 1) + x = 1; + if (arr4.Length != 0) + x = 1; + return x; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_bounds_01 + { + public static int Main_old() + { + int[] arr = new int[10]; + arr[0] = 5; + if (arr[0] == 5) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_bounds_02 + { + public static int Main_old() + { + int[] arr = new int[10]; + arr[9] = 5; + if (arr[9] == 5) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_bounds_03 + { + public static int Main_old() + { + int[] arr = new int[10]; + try + { + arr[-1] = 5; + } + catch (System.Exception) + { + return 0; + } + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_bounds_04 + { + public static int Main_old() + { + int[] arr = new int[10]; + try + { + arr[10] = 5; + } + catch (System.Exception) + { + return 0; + } + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_idxtype_a_01 + { + public static int Main_old() + { + int[] arr = new int[10]; + arr[5] = 100; + int idx = 5; + if (arr[idx] == 100) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_idxtype_a_02 + { + public static int Main_old() + { + int[] arr = new int[10]; + arr[5] = 100; + short idx = 5; + if (arr[idx] == 100) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_idxtype_a_03 + { + public static int Main_old() + { + int[] arr = new int[10]; + arr[5] = 100; + byte idx = 5; + if (arr[idx] == 100) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_idxtype_a_04 + { + public static int Main_old() + { + int[] arr = new int[10]; + arr[5] = 100; + char idx = (char)5; + if (arr[idx] == 100) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_idxtype_a_06 + { + public static int Main_old() + { + int[] arr = new int[10]; + arr[5] = 100; + long idx = 5L; + if (arr[idx] == 100) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_idxtype_b_01 + { + public static int Main_old() + { + int[] arr = new int[10]; + arr[5] = 100; + if (arr[5] == 100) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_idxtype_b_02 + { + public static int Main_old() + { + int[] arr = new int[10]; + arr[5] = 100; + if (arr[(short)5] == 100) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_idxtype_b_03 + { + public static int Main_old() + { + int[] arr = new int[10]; + arr[5] = 100; + if (arr[(byte)5] == 100) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_idxtype_b_04 + { + public static int Main_old() + { + int[] arr = new int[35]; + arr[32] = 100; + if (arr[' '] == 100) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_idxtype_b_06 + { + public static int Main_old() + { + int[] arr = new int[10]; + arr[5] = 100; + if (arr[5L] == 100) + return 0; + else + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_iter_01 + { + public static int Main_old() + { + int[] arr = new int[10]; + for (int x = 0; x < arr.Length; x++) + { + arr[x] = x; + } + int result = 0; + for (int y = 0; y < arr.Length; y++) + { + if (arr[y] != y) + result = 1; + } + return result; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_acc_iter_iter_02 + { + public static int Main_old() + { + char[] arr = new char[10]; + arr[0] = 'L'; + arr[1] = 'a'; + arr[2] = 'n'; + arr[3] = 'g'; + arr[4] = 'u'; + arr[5] = 'a'; + arr[6] = 'g'; + arr[7] = 'e'; + + int result = 0; + if (arr[0] != 'L') result = 1; + if (arr[1] != 'a') result = 1; + if (arr[2] != 'n') result = 1; + if (arr[3] != 'g') result = 1; + if (arr[4] != 'u') result = 1; + if (arr[5] != 'a') result = 1; + if (arr[6] != 'g') result = 1; + if (arr[7] != 'e') result = 1; + return result; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_a_01 + { + public static int Main_old() + { + int[] arr = new int[5]; + arr[3] = 5; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_a_02 + { + public static int Main_old() + { + byte[] arr = new byte[5]; + arr[3] = (byte)5; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_a_03 + { + public static int Main_old() + { + short[] arr = new short[5]; + arr[3] = (short)5; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_a_04 + { + public static int Main_old() + { + long[] arr = new long[5]; + arr[3] = (long)5; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_a_05 + { + public static int Main_old() + { + char[] arr = new char[5]; + arr[3] = 'c'; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_a_06 + { + public static int Main_old() + { + double[] arr = new double[5]; + arr[3] = 5.42; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_a_07 + { + public static int Main_old() + { + float[] arr = new float[5]; + arr[3] = (float)1.00; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_a_08 + { + public static int Main_old() + { + double[] arr = new double[5]; + arr[3] = (double)1.00; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_a_09 + { + public static int Main_old() + { + bool[] arr = new bool[5]; + arr[3] = true; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_b_01 + { + public static int Main_old() + { + int[] arr = new int[5]; + int x = 5; + arr[3] = x; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_b_02 + { + public static int Main_old() + { + byte[] arr = new byte[5]; + byte x = 5; + + arr[3] = x; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_b_03 + { + public static int Main_old() + { + short[] arr = new short[5]; + short x = 5; + arr[3] = x; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_b_04 + { + public static int Main_old() + { + long[] arr = new long[5]; + long x = 5; + arr[3] = x; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_b_05 + { + public static int Main_old() + { + char[] arr = new char[5]; + char x = 'c'; + arr[3] = x; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_b_06 + { + public static int Main_old() + { + double[] arr = new double[5]; + double x = 5.42; + arr[3] = x; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_b_07 + { + public static int Main_old() + { + float[] arr = new float[5]; + float x = (float)1.00; + arr[3] = x; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_b_08 + { + public static int Main_old() + { + double[] arr = new double[5]; + double x = (double)1.00; + arr[3] = x; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_smpass_b_09 + { + public static int Main_old() + { + bool[] arr = new bool[5]; + bool x = true; + arr[3] = x; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_badass_01 + { + public static int Main_old() + { + int[] arr = new int[5] { 1, 2, 3, 4, 5 }; + if (arr[2] != 3) + return 1; + arr = null; + try + { + if (arr[2] == 3) + return 1; + } + catch (System.Exception) + { + return 0; + } + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_badass_03 + { + public static int Main_old() + { + int[] arr1 = new int[5] { 1, 2, 3, 4, 5 }; + int[] arr2 = new int[3] { 6, 7, 8 }; + int result = 0; + // Verify lengths are different + if (arr1.Length == arr2.Length) + result = 1; + // assign the small array to the larger array + // This is actually just making arr1 point to arr2, NOT copying + arr1 = arr2; + + // verify the values are correct + if (arr1[0] != 6) result = 1; + if (arr1[1] != 7) result = 1; + if (arr1[2] != 8) result = 1; + + if (arr1.Length != arr2.Length) + result = 1; + return result; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_badass_04 + { + public static int Main_old() + { + int[] arr1 = new int[3] { 6, 7, 8 }; + int[] arr2 = new int[5] { 1, 2, 3, 4, 5 }; + int result = 0; + // Verify lengths are different + if (arr1.Length == arr2.Length) + result = 1; + // assign the larger array to the smaller array + // This is actually just making arr1 point to arr2, NOT copying + arr1 = arr2; + + // verify the values are correct + if (arr1[0] != 1) result = 1; + if (arr1[1] != 2) result = 1; + if (arr1[2] != 3) result = 1; + + if (arr1.Length != arr2.Length) + result = 1; + return result; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_element_01 + { + public static int Main_old() + { + int[] arr = new int[5] { 1, 2, 3, 4, 5 }; + arr[2] = arr[4]; + if (arr[2] == 5) + return 0; + + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_element_02 + { + public static int Main_old() + { + int[] arr1 = new int[5] { 1, 2, 3, 4, 5 }; + int[] arr2 = new int[5] { 6, 7, 8, 9, 10 }; + arr1[2] = arr2[4]; + if (arr1[2] == 10) + return 0; + + return 1; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_argpass_01 + { + public static int ElementTaker(int val) + { + return val; + } + + public static int Main_old() + { + int[] arr = new int[5] { 1, 2, 3, 4, 5 }; + Debug.WriteLine(ElementTaker(arr[2]).ToString()); + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_argpass_02 + { + public static int ElementTaker(ref int val) + { + val += 5; + return val; + } + + public static int Main_old() + { + int[] arr = new int[5] { 1, 2, 3, 4, 5 }; + Debug.WriteLine(ElementTaker(ref arr[2]).ToString()); + if (arr[2] != 8) + return 1; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_assign_argpass_03 + { + public static int ElementTaker(out int val) + { + val = 5; + return val; + } + + public static int Main_old() + { + int[] arr = new int[5] { 1, 2, 3, 4, 5 }; + Debug.WriteLine(ElementTaker(out arr[2]).ToString()); + if (arr[2] != 5) + return 1; + return 0; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_object_sysarr_01 + { + public static int Main_old() + { + int[] arr = new int[5] { 1, 2, 3, 4, 5 }; + int result = 0; + + for (int x = 0; x < arr.Length; x++) + if (arr[x] != x + 1) result = 1; + + Array.Clear(arr, 0, 5); + for (int x = 0; x < arr.Length; x++) + if (arr[x] != 0) result = 1; + + return result; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + class Simple_TestClass_object_sysarr_02 + { + public static int Main_old() + { + int result = 0; + int[] arr1 = new int[5] { 1, 2, 3, 4, 5 }; + if (arr1.Length != 5) result = 1; + + int[] arr2 = new int[] { 1, 2, 3, 4, 5 }; + if (arr2.Length != 5) result = 1; + + int[] arr3 = new int[] { }; + if (arr3.Length != 0) result = 1; + int[] arr4 = new int[0]; + if (arr4.Length != 0) result = 1; + return result; + } + public static bool testMethod() + { + return (Main_old() == 0); + } + } + + } +} diff --git a/Tests/NFUnitTestArray/nano.runsettings b/Tests/NFUnitTestArray/nano.runsettings new file mode 100644 index 00000000..62f0a008 --- /dev/null +++ b/Tests/NFUnitTestArray/nano.runsettings @@ -0,0 +1,13 @@ + + + + + 1 + .\TestResults + 120000 + Framework40 + + + None + + \ No newline at end of file diff --git a/Tests/NFUnitTestArray/packages.config b/Tests/NFUnitTestArray/packages.config new file mode 100644 index 00000000..dcab08b1 --- /dev/null +++ b/Tests/NFUnitTestArray/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index bec72a77..92294011 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -53,6 +53,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestBasicConcepts", " EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestAttributes", "Tests\NFUnitTestAttributes\NFUnitTestAttributes.nfproj", "{0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestArray", "Tests\NFUnitTestArray\NFUnitTestArray.nfproj", "{F388C3CC-8875-4FA0-B6C7-C5C8D8B92437}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -175,6 +177,12 @@ Global {0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B}.Release|Any CPU.ActiveCfg = Release|Any CPU {0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B}.Release|Any CPU.Build.0 = Release|Any CPU {0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B}.Release|Any CPU.Deploy.0 = Release|Any CPU + {F388C3CC-8875-4FA0-B6C7-C5C8D8B92437}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F388C3CC-8875-4FA0-B6C7-C5C8D8B92437}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F388C3CC-8875-4FA0-B6C7-C5C8D8B92437}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {F388C3CC-8875-4FA0-B6C7-C5C8D8B92437}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F388C3CC-8875-4FA0-B6C7-C5C8D8B92437}.Release|Any CPU.Build.0 = Release|Any CPU + {F388C3CC-8875-4FA0-B6C7-C5C8D8B92437}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -198,6 +206,7 @@ Global {A4BAF1FB-27EB-4D4F-9780-1E399FB7C6EB} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {F388C3CC-8875-4FA0-B6C7-C5C8D8B92437} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From 3f44231e3a2692a7d04b8709b5d4e40e2e10e078 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Tue, 2 Mar 2021 13:43:23 +0300 Subject: [PATCH 42/55] Adjusting packages and date/time tests --- Tests/NFUnitTestArithmetic/packages.config | 2 +- Tests/NFUnitTestArray/NFUnitTestArray.nfproj | 6 +++--- Tests/NFUnitTestArray/nano.runsettings | 3 ++- Tests/NFUnitTestArray/packages.config | 2 +- .../NFUnitTestAttributes.nfproj | 6 +++--- Tests/NFUnitTestAttributes/nano.runsettings | 5 +++-- Tests/NFUnitTestAttributes/packages.config | 2 +- Tests/NFUnitTestBasicConcepts/nano.runsettings | 1 + Tests/NFUnitTestClasses/packages.config | 2 +- Tests/NFUnitTestConversions/packages.config | 2 +- Tests/NFUnitTestCoreLibrary/packages.config | 2 +- Tests/NFUnitTestDelegates/packages.config | 2 +- Tests/NFUnitTestEnum/packages.config | 2 +- Tests/NFUnitTestException/packages.config | 2 +- Tests/NFUnitTestInterface/packages.config | 2 +- Tests/NFUnitTestLexical/packages.config | 2 +- Tests/NFUnitTestNamespace/packages.config | 2 +- Tests/NFUnitTestStatementsTests/packages.config | 2 +- Tests/NFUnitTestStruct/packages.config | 2 +- Tests/NFUnitTestSystemLib/UnitTestDateTime.cs | 15 ++++++++------- .../UnitTestWeakReferenceTests.cs | 5 +++-- Tests/NFUnitTestThread/packages.config | 2 +- Tests/NFUnitTestTypes/packages.config | 2 +- Tests/NFUnitTestVariables/packages.config | 2 +- 24 files changed, 40 insertions(+), 35 deletions(-) diff --git a/Tests/NFUnitTestArithmetic/packages.config b/Tests/NFUnitTestArithmetic/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestArithmetic/packages.config +++ b/Tests/NFUnitTestArithmetic/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestArray/NFUnitTestArray.nfproj b/Tests/NFUnitTestArray/NFUnitTestArray.nfproj index 96c0857f..933211fc 100644 --- a/Tests/NFUnitTestArray/NFUnitTestArray.nfproj +++ b/Tests/NFUnitTestArray/NFUnitTestArray.nfproj @@ -37,13 +37,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.56\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.56\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestArray/nano.runsettings b/Tests/NFUnitTestArray/nano.runsettings index 62f0a008..38fae61f 100644 --- a/Tests/NFUnitTestArray/nano.runsettings +++ b/Tests/NFUnitTestArray/nano.runsettings @@ -8,6 +8,7 @@ Framework40 - None + None + True \ No newline at end of file diff --git a/Tests/NFUnitTestArray/packages.config b/Tests/NFUnitTestArray/packages.config index dcab08b1..7d305dfe 100644 --- a/Tests/NFUnitTestArray/packages.config +++ b/Tests/NFUnitTestArray/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj b/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj index c199a3a2..1849062e 100644 --- a/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj +++ b/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj @@ -37,13 +37,13 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + + ..\..\packages\nanoFramework.TestFramework.1.0.56\lib\nanoFramework.TestFramework.dll True True - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.TestFramework.1.0.56\lib\nanoFramework.UnitTestLauncher.exe True True diff --git a/Tests/NFUnitTestAttributes/nano.runsettings b/Tests/NFUnitTestAttributes/nano.runsettings index 62f0a008..4f2cdb50 100644 --- a/Tests/NFUnitTestAttributes/nano.runsettings +++ b/Tests/NFUnitTestAttributes/nano.runsettings @@ -5,9 +5,10 @@ 1 .\TestResults 120000 - Framework40 + Framework40 - None + None + True \ No newline at end of file diff --git a/Tests/NFUnitTestAttributes/packages.config b/Tests/NFUnitTestAttributes/packages.config index dcab08b1..7d305dfe 100644 --- a/Tests/NFUnitTestAttributes/packages.config +++ b/Tests/NFUnitTestAttributes/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestBasicConcepts/nano.runsettings b/Tests/NFUnitTestBasicConcepts/nano.runsettings index bf2920ce..ea6ef9ba 100644 --- a/Tests/NFUnitTestBasicConcepts/nano.runsettings +++ b/Tests/NFUnitTestBasicConcepts/nano.runsettings @@ -9,5 +9,6 @@ None + True \ No newline at end of file diff --git a/Tests/NFUnitTestClasses/packages.config b/Tests/NFUnitTestClasses/packages.config index 6fda075c..d28bc079 100644 --- a/Tests/NFUnitTestClasses/packages.config +++ b/Tests/NFUnitTestClasses/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/Tests/NFUnitTestConversions/packages.config b/Tests/NFUnitTestConversions/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestConversions/packages.config +++ b/Tests/NFUnitTestConversions/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/packages.config b/Tests/NFUnitTestCoreLibrary/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestCoreLibrary/packages.config +++ b/Tests/NFUnitTestCoreLibrary/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestDelegates/packages.config b/Tests/NFUnitTestDelegates/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestDelegates/packages.config +++ b/Tests/NFUnitTestDelegates/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestEnum/packages.config b/Tests/NFUnitTestEnum/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestEnum/packages.config +++ b/Tests/NFUnitTestEnum/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestException/packages.config b/Tests/NFUnitTestException/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestException/packages.config +++ b/Tests/NFUnitTestException/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/packages.config b/Tests/NFUnitTestInterface/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestInterface/packages.config +++ b/Tests/NFUnitTestInterface/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/packages.config b/Tests/NFUnitTestLexical/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestLexical/packages.config +++ b/Tests/NFUnitTestLexical/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/packages.config b/Tests/NFUnitTestNamespace/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestNamespace/packages.config +++ b/Tests/NFUnitTestNamespace/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/packages.config b/Tests/NFUnitTestStatementsTests/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestStatementsTests/packages.config +++ b/Tests/NFUnitTestStatementsTests/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestStruct/packages.config b/Tests/NFUnitTestStruct/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestStruct/packages.config +++ b/Tests/NFUnitTestStruct/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestSystemLib/UnitTestDateTime.cs b/Tests/NFUnitTestSystemLib/UnitTestDateTime.cs index d1f4dd44..80c1f0c7 100644 --- a/Tests/NFUnitTestSystemLib/UnitTestDateTime.cs +++ b/Tests/NFUnitTestSystemLib/UnitTestDateTime.cs @@ -67,7 +67,7 @@ public void DateTime_ConstructorTest3() Debug.WriteLine("Creating Minimum DateTime and verifying"); DateTime minDT1 = DateTime.MinValue; DateTime minDT2 = new DateTime(); - DateTime minDT3 = new DateTime(0); + DateTime minDT3 = new DateTime(504911232000000000); DateTime minDT4 = new DateTime(1601, 1, 1, 0, 0, 0, 0); if ((DateTime.Compare(minDT1, minDT2) != 0) || @@ -82,7 +82,7 @@ public void DateTime_ConstructorTest3() } Debug.WriteLine("Creating Maximum DateTime and verifying"); - DateTime maxDateTime = new DateTime(441796895990000000); + DateTime maxDateTime = new DateTime(946708127999999999); Assert.True(DateTime.MaxValue.Equals(maxDateTime)); } @@ -704,7 +704,7 @@ public void DateTime_op_Subtraction_DateTimeTest31() for (int i = 0; i < dtArr.Length; i++) { DateTime dt1 = dtArr[i]; - DateTime dt2 = new DateTime(random.Next(1000) + 1); + DateTime dt2 = new DateTime(504911232000000000 + random.Next(1000) + 1); TimeSpan ts = dt1 - dt2; Assert.Equal(ts.Ticks, (dt1.Ticks - dt2.Ticks)); } @@ -843,7 +843,8 @@ public void DateTime_MinValueTest39() /// Debug.WriteLine("Getting the Min. DateTime and Verifying"); DateTime field = DateTime.MinValue; - Assert.Equal(field.Ticks, 0); + Debug.WriteLine(field.Ticks.ToString()); + Assert.Equal(field.Ticks, 504911232000000000); } [TestMethod] @@ -855,7 +856,7 @@ public void DateTime_MaxValueTest40() Debug.WriteLine("Getting the Max. DateTime and Verifying"); DateTime field = DateTime.MaxValue; Debug.WriteLine(field.Ticks.ToString()); - Assert.Equal(field.Ticks, 441796895990000000); + Assert.Equal(field.Ticks, 946708127999999999); } [TestMethod] @@ -1000,9 +1001,9 @@ public void DateTime_TicksTest52() /// 1. Verifies the Ticks property /// Debug.WriteLine("Creating a DateTime, getting the Ticks and Verifying"); - DateTime testDateTime = new System.DateTime(0); + DateTime testDateTime = new System.DateTime(504911232000000000); long _ticks = testDateTime.Ticks; - Assert.Equal(_ticks, 0); + Assert.Equal(_ticks, 504911232000000000); } [TestMethod] diff --git a/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs b/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs index c21ad7c5..e6d6c80a 100644 --- a/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs +++ b/Tests/NFUnitTestSystemLib/UnitTestWeakReferenceTests.cs @@ -54,7 +54,7 @@ public void WeakRef1_Test() Debug.WriteLine("Allow for GC"); nanoFramework.Runtime.Native.GC.Run(true); - int sleepTime = 1000; + int sleepTime = 2000; int slept = 0; while (!hasFinalized1 && slept < sleepTime) { @@ -73,7 +73,8 @@ public void WeakRef1_Test() Debug.WriteLine("Allow for GC"); // We should force the finalizer somehow nanoFramework.Runtime.Native.GC.Run(true); - sleepTime = 1000; + GC.WaitForPendingFinalizers(); + sleepTime = 2000; slept = 0; while (!hasFinalized1 && slept < sleepTime) { diff --git a/Tests/NFUnitTestThread/packages.config b/Tests/NFUnitTestThread/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestThread/packages.config +++ b/Tests/NFUnitTestThread/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/packages.config b/Tests/NFUnitTestTypes/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestTypes/packages.config +++ b/Tests/NFUnitTestTypes/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/packages.config b/Tests/NFUnitTestVariables/packages.config index 33fb2695..7d305dfe 100644 --- a/Tests/NFUnitTestVariables/packages.config +++ b/Tests/NFUnitTestVariables/packages.config @@ -1,5 +1,5 @@  - + \ No newline at end of file From 26a0a7cb0f71ebc35ea0cc19b3af35e25856d8b9 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Tue, 2 Mar 2021 19:30:03 +0300 Subject: [PATCH 43/55] Moving to project reference --- .../NFUnitTestArithmetic.nfproj | 22 +++-------- Tests/NFUnitTestArithmetic/nano.runsettings | 2 +- .../TestFramework/Properties/AssemblyInfo.cs | 39 +++++++++++++++++++ Tests/TestFramework/TestFramework.nfproj | 38 ++++++++++++++++++ Tests/TestFramework/packages.config | 4 ++ .../Properties/AssemblyInfo.cs | 33 ++++++++++++++++ .../UnitTestLauncher/UnitTestLauncher.nfproj | 37 ++++++++++++++++++ Tests/UnitTestLauncher/packages.config | 4 ++ nanoFramework.CoreLibrary.sln | 24 ++++++++++++ nanoFramework.TestFramework | 1 + 10 files changed, 186 insertions(+), 18 deletions(-) create mode 100644 Tests/TestFramework/Properties/AssemblyInfo.cs create mode 100644 Tests/TestFramework/TestFramework.nfproj create mode 100644 Tests/TestFramework/packages.config create mode 100644 Tests/UnitTestLauncher/Properties/AssemblyInfo.cs create mode 100644 Tests/UnitTestLauncher/UnitTestLauncher.nfproj create mode 100644 Tests/UnitTestLauncher/packages.config create mode 160000 nanoFramework.TestFramework diff --git a/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj index 0fc6cacc..71f4a9e7 100644 --- a/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj +++ b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj @@ -33,27 +33,15 @@ - - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.UnitTestLauncher.exe - True - True - - + + + + + diff --git a/Tests/NFUnitTestArithmetic/nano.runsettings b/Tests/NFUnitTestArithmetic/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestArithmetic/nano.runsettings +++ b/Tests/NFUnitTestArithmetic/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/TestFramework/Properties/AssemblyInfo.cs b/Tests/TestFramework/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..61f731f9 --- /dev/null +++ b/Tests/TestFramework/Properties/AssemblyInfo.cs @@ -0,0 +1,39 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.BlankApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.BlankApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] + +///////////////////////////////////////////////////////////////// +// This attribute is mandatory when building Interop libraries // +// update this whenever the native assembly signature changes // +[assembly: AssemblyNativeVersion("1.0.0.0")] +///////////////////////////////////////////////////////////////// diff --git a/Tests/TestFramework/TestFramework.nfproj b/Tests/TestFramework/TestFramework.nfproj new file mode 100644 index 00000000..1920c218 --- /dev/null +++ b/Tests/TestFramework/TestFramework.nfproj @@ -0,0 +1,38 @@ + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 44a0c6a8-4f31-405b-95ca-6f0d65bc11b8 + Library + Properties + 512 + TestFramework + TestFramework + v1.0 + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/TestFramework/packages.config b/Tests/TestFramework/packages.config new file mode 100644 index 00000000..a6f02adb --- /dev/null +++ b/Tests/TestFramework/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/Tests/UnitTestLauncher/Properties/AssemblyInfo.cs b/Tests/UnitTestLauncher/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..262254df --- /dev/null +++ b/Tests/UnitTestLauncher/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.BlankApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.BlankApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/UnitTestLauncher/UnitTestLauncher.nfproj b/Tests/UnitTestLauncher/UnitTestLauncher.nfproj new file mode 100644 index 00000000..62a12173 --- /dev/null +++ b/Tests/UnitTestLauncher/UnitTestLauncher.nfproj @@ -0,0 +1,37 @@ + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 48c77e72-02d2-4d6f-b68b-b0972388781f + Exe + Properties + 512 + UnitTestLauncher + UnitTestLauncher + v1.0 + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/UnitTestLauncher/packages.config b/Tests/UnitTestLauncher/packages.config new file mode 100644 index 00000000..a6f02adb --- /dev/null +++ b/Tests/UnitTestLauncher/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 92294011..8218ccce 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -55,7 +55,16 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestAttributes", "Tes EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestArray", "Tests\NFUnitTestArray\NFUnitTestArray.nfproj", "{F388C3CC-8875-4FA0-B6C7-C5C8D8B92437}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "UnitTestLauncher", "Tests\UnitTestLauncher\UnitTestLauncher.nfproj", "{48C77E72-02D2-4D6F-B68B-B0972388781F}" +EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "TestFramework", "Tests\TestFramework\TestFramework.nfproj", "{44A0C6A8-4F31-405B-95CA-6F0D65BC11B8}" +EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "TestFrameworkShared", "nanoFramework.TestFramework\source\TestFrameworkShared\TestFrameworkShared.shproj", "{55F048B5-6739-43C5-A93D-DB61DB8E912F}" +EndProject Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + nanoFramework.TestFramework\source\TestFrameworkShared\TestFrameworkShared.projitems*{55f048b5-6739-43c5-a93d-db61db8e912f}*SharedItemsImports = 13 + EndGlobalSection GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU Release|Any CPU = Release|Any CPU @@ -183,6 +192,18 @@ Global {F388C3CC-8875-4FA0-B6C7-C5C8D8B92437}.Release|Any CPU.ActiveCfg = Release|Any CPU {F388C3CC-8875-4FA0-B6C7-C5C8D8B92437}.Release|Any CPU.Build.0 = Release|Any CPU {F388C3CC-8875-4FA0-B6C7-C5C8D8B92437}.Release|Any CPU.Deploy.0 = Release|Any CPU + {48C77E72-02D2-4D6F-B68B-B0972388781F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {48C77E72-02D2-4D6F-B68B-B0972388781F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {48C77E72-02D2-4D6F-B68B-B0972388781F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {48C77E72-02D2-4D6F-B68B-B0972388781F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {48C77E72-02D2-4D6F-B68B-B0972388781F}.Release|Any CPU.Build.0 = Release|Any CPU + {48C77E72-02D2-4D6F-B68B-B0972388781F}.Release|Any CPU.Deploy.0 = Release|Any CPU + {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8}.Release|Any CPU.Build.0 = Release|Any CPU + {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -207,6 +228,9 @@ Global {8FDD0B3F-8A8B-4C98-95EE-FCF0B6982E15} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {0D4EF4F8-F616-4DF6-83E3-AB7E4F0EEE4B} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {F388C3CC-8875-4FA0-B6C7-C5C8D8B92437} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {48C77E72-02D2-4D6F-B68B-B0972388781F} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {55F048B5-6739-43C5-A93D-DB61DB8E912F} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} diff --git a/nanoFramework.TestFramework b/nanoFramework.TestFramework new file mode 160000 index 00000000..36baadb1 --- /dev/null +++ b/nanoFramework.TestFramework @@ -0,0 +1 @@ +Subproject commit 36baadb10b65677452a4ba682569f8f41dda2f2b From 48f86eef1728f5e3ff68924f8cb8dc6c577ea12e Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Tue, 2 Mar 2021 20:53:41 +0300 Subject: [PATCH 44/55] Moving to project reference --- Tests/NFUnitTestArithmetic/nano.runsettings | 2 +- Tests/NFUnitTestArithmetic/packages.config | 3 +- Tests/NFUnitTestArray/NFUnitTestArray.nfproj | 18 ++--------- Tests/NFUnitTestArray/packages.config | 3 +- .../NFUnitTestAttributes.nfproj | 18 ++--------- Tests/NFUnitTestAttributes/packages.config | 3 +- .../NFUnitTestBasicConcepts.nfproj | 18 ++--------- Tests/NFUnitTestBasicConcepts/packages.config | 3 +- .../NFUnitTestClasses.nfproj | 30 +++++++------------ Tests/NFUnitTestClasses/packages.config | 5 ++-- .../NFUnitTestConversions.nfproj | 18 ++--------- Tests/NFUnitTestConversions/packages.config | 3 +- .../NFUnitTestBitConverter.nfproj | 18 ++--------- Tests/NFUnitTestCoreLibrary/packages.config | 3 +- .../NFUnitTestDelegates.nfproj | 18 ++--------- Tests/NFUnitTestDelegates/packages.config | 3 +- Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj | 18 ++--------- Tests/NFUnitTestEnum/packages.config | 3 +- .../NFUnitTestException.nfproj | 18 ++--------- Tests/NFUnitTestException/packages.config | 3 +- .../NFUnitTestInterface.nfproj | 18 ++--------- Tests/NFUnitTestInterface/packages.config | 3 +- .../NFUnitTestLexical.nfproj | 18 ++--------- Tests/NFUnitTestLexical/packages.config | 3 +- .../NFUnitTestNamespace.nfproj | 18 ++--------- Tests/NFUnitTestNamespace/packages.config | 3 +- .../NFUnitTestStatements.nfproj | 18 ++--------- .../NFUnitTestStatementsTests/packages.config | 3 +- .../NFUnitTestStruct/NFUnitTestStruct.nfproj | 18 ++--------- Tests/NFUnitTestStruct/packages.config | 3 +- .../NFUnitTestSystemLib.nfproj | 27 +++++++---------- Tests/NFUnitTestSystemLib/packages.config | 6 ++-- .../NFUnitTestThread/NFUnitTestThread.nfproj | 18 ++--------- Tests/NFUnitTestThread/packages.config | 3 +- Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj | 18 ++--------- Tests/NFUnitTestTypes/packages.config | 3 +- .../NFUnitTestVariables.nfproj | 18 ++--------- Tests/NFUnitTestVariables/packages.config | 3 +- Tests/TestFramework/TestFramework.nfproj | 5 ++-- Tests/TestFramework/packages.config | 4 --- .../UnitTestLauncher/UnitTestLauncher.nfproj | 3 -- Tests/UnitTestLauncher/packages.config | 4 --- 42 files changed, 94 insertions(+), 331 deletions(-) delete mode 100644 Tests/TestFramework/packages.config delete mode 100644 Tests/UnitTestLauncher/packages.config diff --git a/Tests/NFUnitTestArithmetic/nano.runsettings b/Tests/NFUnitTestArithmetic/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestArithmetic/nano.runsettings +++ b/Tests/NFUnitTestArithmetic/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestArithmetic/packages.config b/Tests/NFUnitTestArithmetic/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestArithmetic/packages.config +++ b/Tests/NFUnitTestArithmetic/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestArray/NFUnitTestArray.nfproj b/Tests/NFUnitTestArray/NFUnitTestArray.nfproj index 933211fc..0adc95f5 100644 --- a/Tests/NFUnitTestArray/NFUnitTestArray.nfproj +++ b/Tests/NFUnitTestArray/NFUnitTestArray.nfproj @@ -32,21 +32,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.56\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.56\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestArray/packages.config b/Tests/NFUnitTestArray/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestArray/packages.config +++ b/Tests/NFUnitTestArray/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj b/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj index 1849062e..4692a574 100644 --- a/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj +++ b/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj @@ -32,21 +32,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.56\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.56\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestAttributes/packages.config b/Tests/NFUnitTestAttributes/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestAttributes/packages.config +++ b/Tests/NFUnitTestAttributes/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj b/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj index 21be8dce..00586302 100644 --- a/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj +++ b/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj @@ -31,21 +31,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestBasicConcepts/packages.config b/Tests/NFUnitTestBasicConcepts/packages.config index dcab08b1..4524644b 100644 --- a/Tests/NFUnitTestBasicConcepts/packages.config +++ b/Tests/NFUnitTestBasicConcepts/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestClasses/NFUnitTestClasses.nfproj b/Tests/NFUnitTestClasses/NFUnitTestClasses.nfproj index 2da27aa7..f0d6533e 100644 --- a/Tests/NFUnitTestClasses/NFUnitTestClasses.nfproj +++ b/Tests/NFUnitTestClasses/NFUnitTestClasses.nfproj @@ -42,31 +42,21 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.Runtime.Native.1.5.1-preview.25\lib\nanoFramework.Runtime.Native.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + + + + ..\..\packages\nanoFramework.Runtime.Native.1.5.1-preview.30\lib\nanoFramework.Runtime.Native.dll + True + True + + diff --git a/Tests/NFUnitTestClasses/packages.config b/Tests/NFUnitTestClasses/packages.config index d28bc079..09794131 100644 --- a/Tests/NFUnitTestClasses/packages.config +++ b/Tests/NFUnitTestClasses/packages.config @@ -1,6 +1,5 @@  - - - + + \ No newline at end of file diff --git a/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj b/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj index 7859cff3..cc5dc915 100644 --- a/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj +++ b/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj @@ -33,21 +33,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestConversions/packages.config b/Tests/NFUnitTestConversions/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestConversions/packages.config +++ b/Tests/NFUnitTestConversions/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj index ec05146a..e7c91803 100644 --- a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj +++ b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj @@ -32,21 +32,9 @@ - - packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestCoreLibrary/packages.config b/Tests/NFUnitTestCoreLibrary/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestCoreLibrary/packages.config +++ b/Tests/NFUnitTestCoreLibrary/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj b/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj index 89755562..4759972c 100644 --- a/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj +++ b/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj @@ -31,21 +31,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.59\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestDelegates/packages.config b/Tests/NFUnitTestDelegates/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestDelegates/packages.config +++ b/Tests/NFUnitTestDelegates/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj b/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj index e86dce69..4a63691f 100644 --- a/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj +++ b/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj @@ -31,21 +31,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestEnum/packages.config b/Tests/NFUnitTestEnum/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestEnum/packages.config +++ b/Tests/NFUnitTestEnum/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestException/NFUnitTestException.nfproj b/Tests/NFUnitTestException/NFUnitTestException.nfproj index 30f4c979..ad78222d 100644 --- a/Tests/NFUnitTestException/NFUnitTestException.nfproj +++ b/Tests/NFUnitTestException/NFUnitTestException.nfproj @@ -31,21 +31,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestException/packages.config b/Tests/NFUnitTestException/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestException/packages.config +++ b/Tests/NFUnitTestException/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj b/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj index 55768963..4e72ae0c 100644 --- a/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj +++ b/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj @@ -31,21 +31,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestInterface/packages.config b/Tests/NFUnitTestInterface/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestInterface/packages.config +++ b/Tests/NFUnitTestInterface/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj index 8bce0880..8f168a2a 100644 --- a/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj +++ b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj @@ -32,21 +32,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestLexical/packages.config b/Tests/NFUnitTestLexical/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestLexical/packages.config +++ b/Tests/NFUnitTestLexical/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj b/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj index ee239009..42e04439 100644 --- a/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj +++ b/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj @@ -41,21 +41,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestNamespace/packages.config b/Tests/NFUnitTestNamespace/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestNamespace/packages.config +++ b/Tests/NFUnitTestNamespace/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj b/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj index 6c3bf711..6a9343bd 100644 --- a/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj +++ b/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj @@ -31,21 +31,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestStatementsTests/packages.config b/Tests/NFUnitTestStatementsTests/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestStatementsTests/packages.config +++ b/Tests/NFUnitTestStatementsTests/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj b/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj index 9a94373f..63b9af9d 100644 --- a/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj +++ b/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj @@ -31,21 +31,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestStruct/packages.config b/Tests/NFUnitTestStruct/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestStruct/packages.config +++ b/Tests/NFUnitTestStruct/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj index 0e9dd87d..a8e6f672 100644 --- a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj +++ b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj @@ -41,32 +41,27 @@ + + + + + + + + + - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.11\lib\mscorlib.dll True True - ..\..\packages\nanoFramework.Runtime.Native.1.5.1-preview.25\lib\nanoFramework.Runtime.Native.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe + ..\..\packages\nanoFramework.Runtime.Native.1.5.1-preview.30\lib\nanoFramework.Runtime.Native.dll True True - - - - diff --git a/Tests/NFUnitTestSystemLib/packages.config b/Tests/NFUnitTestSystemLib/packages.config index 22ffa77b..8fa284a4 100644 --- a/Tests/NFUnitTestSystemLib/packages.config +++ b/Tests/NFUnitTestSystemLib/packages.config @@ -1,6 +1,6 @@  - - - + + + \ No newline at end of file diff --git a/Tests/NFUnitTestThread/NFUnitTestThread.nfproj b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj index f4a5a6cd..337abf1e 100644 --- a/Tests/NFUnitTestThread/NFUnitTestThread.nfproj +++ b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj @@ -37,21 +37,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestThread/packages.config b/Tests/NFUnitTestThread/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestThread/packages.config +++ b/Tests/NFUnitTestThread/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj b/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj index 31410c74..73b6d583 100644 --- a/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj +++ b/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj @@ -36,21 +36,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestTypes/packages.config b/Tests/NFUnitTestTypes/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestTypes/packages.config +++ b/Tests/NFUnitTestTypes/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj b/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj index 328b575b..f5c8e160 100644 --- a/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj +++ b/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj @@ -32,21 +32,9 @@ - - ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.58\lib\nanoFramework.UnitTestLauncher.exe - True - True - + + + diff --git a/Tests/NFUnitTestVariables/packages.config b/Tests/NFUnitTestVariables/packages.config index 7d305dfe..4524644b 100644 --- a/Tests/NFUnitTestVariables/packages.config +++ b/Tests/NFUnitTestVariables/packages.config @@ -1,5 +1,4 @@  - - + \ No newline at end of file diff --git a/Tests/TestFramework/TestFramework.nfproj b/Tests/TestFramework/TestFramework.nfproj index 1920c218..e37e2525 100644 --- a/Tests/TestFramework/TestFramework.nfproj +++ b/Tests/TestFramework/TestFramework.nfproj @@ -23,12 +23,11 @@ - - + - + diff --git a/Tests/TestFramework/packages.config b/Tests/TestFramework/packages.config deleted file mode 100644 index a6f02adb..00000000 --- a/Tests/TestFramework/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/UnitTestLauncher/UnitTestLauncher.nfproj b/Tests/UnitTestLauncher/UnitTestLauncher.nfproj index 62a12173..5a2f49a4 100644 --- a/Tests/UnitTestLauncher/UnitTestLauncher.nfproj +++ b/Tests/UnitTestLauncher/UnitTestLauncher.nfproj @@ -21,9 +21,6 @@ - - - diff --git a/Tests/UnitTestLauncher/packages.config b/Tests/UnitTestLauncher/packages.config deleted file mode 100644 index a6f02adb..00000000 --- a/Tests/UnitTestLauncher/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file From c6949ae70f2e795365a690b5e8e9c6fb49c719ca Mon Sep 17 00:00:00 2001 From: josesimoes Date: Tue, 2 Mar 2021 19:27:42 +0000 Subject: [PATCH 45/55] Add test framework sub-module --- .gitmodules | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 00000000..f7345a99 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "nanoFramework.TestFramework"] + path = nanoFramework.TestFramework + url = https://github.com/nanoframework/nanoFramework.TestFramework From 8bcd570bb4ece30a663ab9570e345c843f6afb97 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Tue, 2 Mar 2021 23:41:15 +0300 Subject: [PATCH 46/55] Adjusting for UnitTestLauncher to be always in release --- nanoFramework.CoreLibrary.sln | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 9b55e59c..1465ca88 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -196,9 +196,9 @@ Global {48C77E72-02D2-4D6F-B68B-B0972388781F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {48C77E72-02D2-4D6F-B68B-B0972388781F}.Debug|Any CPU.Build.0 = Debug|Any CPU {48C77E72-02D2-4D6F-B68B-B0972388781F}.Debug|Any CPU.Deploy.0 = Debug|Any CPU - {48C77E72-02D2-4D6F-B68B-B0972388781F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {48C77E72-02D2-4D6F-B68B-B0972388781F}.Release|Any CPU.Build.0 = Release|Any CPU - {48C77E72-02D2-4D6F-B68B-B0972388781F}.Release|Any CPU.Deploy.0 = Release|Any CPU + {48C77E72-02D2-4D6F-B68B-B0972388781F}.Release|Any CPU.ActiveCfg = Debug|Any CPU + {48C77E72-02D2-4D6F-B68B-B0972388781F}.Release|Any CPU.Build.0 = Debug|Any CPU + {48C77E72-02D2-4D6F-B68B-B0972388781F}.Release|Any CPU.Deploy.0 = Debug|Any CPU {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8}.Debug|Any CPU.Build.0 = Debug|Any CPU {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8}.Debug|Any CPU.Deploy.0 = Debug|Any CPU From b1b7ceb10234597245f3c66cb5e0d51e677a10b4 Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 3 Mar 2021 14:10:40 +0300 Subject: [PATCH 47/55] adjusting doc --- README.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 8900f643..b472c0ca 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ----- -### Welcome to the **nanoFramework** Base Class Library repository! +# Welcome to the **nanoFramework** Base Class Library repository! ## Build status @@ -20,6 +20,23 @@ The **nanoFramework** Base Class Library is provided in two flavours: with or without support for System.Reflection namespace. The reason for this is that the reflection API adds up a significant size to the DLL and image size. For targets with smaller flash this can be prohibitive. +## Unit Test + +nanoFramework has a dedicated [Unit Test framework](https://github.com/nanoframework/nanoFramework.TestFramework). This repository has Unit Test and you will find all of them under the `Tests`folder. The main solution embed all all the tests as well. You can run them directly from Visual Studio and create new tests. For more information on the [Unit Test Framework](https://docs.nanoframework.net/content/unit-test/index.html). + +lib-CoreLibrary has specific needs that differ from what you'll find in the documentation: + +- You need to have th nanoFramework.TestFramework as a nuget package as it will bring the nanoCLR Win32 emulator +- You need to remove the reference to mscorlib, nanoFramework.TestFramework and nanoFramework.UnitTestLauncher +- Use project reference instead for all those 3 elements + +You can then run the test either on a real device, either in the emulator as described in the documentation. You may have to manually flash your device for the mscorlib version to match the one you are building on. + +**Important**: Any new code checked in this repository will have to: + +- have a proper test covering for all the methods, properties, events and the possible exceptions, +- do not break more of the the existing tests meaning, in other words, it should not create more issues than already existing. + ## Feedback and documentation For documentation, providing feedback, issues and finding out how to contribute please refer to the [Home repo](https://github.com/nanoframework/Home). From 566bffede86549e4c74539e5a5c36da7c90512ad Mon Sep 17 00:00:00 2001 From: josesimoes Date: Wed, 3 Mar 2021 11:20:36 +0000 Subject: [PATCH 48/55] Work CI-CD - Enable unit tests. --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 358dcc64..2e64ebfd 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -40,6 +40,7 @@ jobs: - template: azure-pipelines-templates/class-lib-build-only.yml@templates parameters: sonarCloudProject: 'nanoframework_lib-CoreLibrary' + runUnitTests: true # package steps - template: azure-pipelines-templates/class-lib-package.yml@templates From a6a9dd6e91ba5660c4bb89bb9c4fe308110d93d0 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Wed, 3 Mar 2021 12:02:40 +0000 Subject: [PATCH 49/55] Update Test framework NuGet - Adjust run settings to run on win32 CLR. --- .../NFUnitTestArithmetic.nfproj | 20 +++++++++++++++---- Tests/NFUnitTestArithmetic/nano.runsettings | 2 +- Tests/NFUnitTestArithmetic/packages.config | 2 +- Tests/NFUnitTestArray/NFUnitTestArray.nfproj | 12 +++++++++++ Tests/NFUnitTestArray/nano.runsettings | 2 +- Tests/NFUnitTestArray/packages.config | 2 +- .../NFUnitTestAttributes.nfproj | 12 +++++++++++ Tests/NFUnitTestAttributes/nano.runsettings | 4 ++-- Tests/NFUnitTestAttributes/packages.config | 2 +- .../NFUnitTestBasicConcepts.nfproj | 12 +++++++++++ .../NFUnitTestBasicConcepts/nano.runsettings | 6 +++--- Tests/NFUnitTestBasicConcepts/packages.config | 2 +- Tests/NFUnitTestClasses/nano.runsettings | 2 +- .../NFUnitTestConversions.nfproj | 12 +++++++++++ Tests/NFUnitTestConversions/nano.runsettings | 2 +- Tests/NFUnitTestConversions/packages.config | 2 +- .../NFUnitTestBitConverter.nfproj | 12 +++++++++++ Tests/NFUnitTestCoreLibrary/nano.runsettings | 2 +- Tests/NFUnitTestCoreLibrary/packages.config | 2 +- .../NFUnitTestDelegates.nfproj | 12 +++++++++++ Tests/NFUnitTestDelegates/nano.runsettings | 2 +- Tests/NFUnitTestDelegates/packages.config | 2 +- Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj | 12 +++++++++++ Tests/NFUnitTestEnum/nano.runsettings | 2 +- Tests/NFUnitTestEnum/packages.config | 2 +- .../NFUnitTestException.nfproj | 12 +++++++++++ Tests/NFUnitTestException/nano.runsettings | 2 +- Tests/NFUnitTestException/packages.config | 2 +- .../NFUnitTestInterface.nfproj | 12 +++++++++++ Tests/NFUnitTestInterface/nano.runsettings | 2 +- Tests/NFUnitTestInterface/packages.config | 2 +- .../NFUnitTestLexical.nfproj | 12 +++++++++++ Tests/NFUnitTestLexical/nano.runsettings | 2 +- Tests/NFUnitTestLexical/packages.config | 2 +- .../NFUnitTestNamespace.nfproj | 12 +++++++++++ Tests/NFUnitTestNamespace/nano.runsettings | 2 +- Tests/NFUnitTestNamespace/packages.config | 2 +- .../NFUnitTestStatements.nfproj | 12 +++++++++++ .../nano.runsettings | 2 +- .../NFUnitTestStatementsTests/packages.config | 2 +- .../NFUnitTestStruct/NFUnitTestStruct.nfproj | 12 +++++++++++ Tests/NFUnitTestStruct/nano.runsettings | 2 +- Tests/NFUnitTestStruct/packages.config | 2 +- .../NFUnitTestSystemLib.nfproj | 10 ++++++++++ Tests/NFUnitTestSystemLib/nano.runsettings | 2 +- Tests/NFUnitTestSystemLib/packages.config | 2 +- .../NFUnitTestThread/NFUnitTestThread.nfproj | 12 +++++++++++ Tests/NFUnitTestThread/nano.runsettings | 4 ++-- Tests/NFUnitTestThread/packages.config | 2 +- Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj | 12 +++++++++++ Tests/NFUnitTestTypes/nano.runsettings | 2 +- Tests/NFUnitTestTypes/packages.config | 2 +- .../NFUnitTestVariables.nfproj | 12 +++++++++++ Tests/NFUnitTestVariables/nano.runsettings | 2 +- Tests/NFUnitTestVariables/packages.config | 2 +- 55 files changed, 259 insertions(+), 45 deletions(-) diff --git a/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj index 71f4a9e7..0ebc783f 100644 --- a/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj +++ b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj @@ -33,15 +33,27 @@ - - - - + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + diff --git a/Tests/NFUnitTestArithmetic/nano.runsettings b/Tests/NFUnitTestArithmetic/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestArithmetic/nano.runsettings +++ b/Tests/NFUnitTestArithmetic/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestArithmetic/packages.config b/Tests/NFUnitTestArithmetic/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestArithmetic/packages.config +++ b/Tests/NFUnitTestArithmetic/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestArray/NFUnitTestArray.nfproj b/Tests/NFUnitTestArray/NFUnitTestArray.nfproj index 0adc95f5..63a4aa1d 100644 --- a/Tests/NFUnitTestArray/NFUnitTestArray.nfproj +++ b/Tests/NFUnitTestArray/NFUnitTestArray.nfproj @@ -36,6 +36,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestArray/nano.runsettings b/Tests/NFUnitTestArray/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestArray/nano.runsettings +++ b/Tests/NFUnitTestArray/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestArray/packages.config b/Tests/NFUnitTestArray/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestArray/packages.config +++ b/Tests/NFUnitTestArray/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj b/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj index 4692a574..b461fd35 100644 --- a/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj +++ b/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj @@ -40,6 +40,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestAttributes/nano.runsettings b/Tests/NFUnitTestAttributes/nano.runsettings index 4f2cdb50..fa881e3a 100644 --- a/Tests/NFUnitTestAttributes/nano.runsettings +++ b/Tests/NFUnitTestAttributes/nano.runsettings @@ -5,10 +5,10 @@ 1 .\TestResults 120000 - Framework40 + Framework40 None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestAttributes/packages.config b/Tests/NFUnitTestAttributes/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestAttributes/packages.config +++ b/Tests/NFUnitTestAttributes/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj b/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj index 00586302..bdb548c4 100644 --- a/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj +++ b/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj @@ -39,6 +39,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestBasicConcepts/nano.runsettings b/Tests/NFUnitTestBasicConcepts/nano.runsettings index ea6ef9ba..fa881e3a 100644 --- a/Tests/NFUnitTestBasicConcepts/nano.runsettings +++ b/Tests/NFUnitTestBasicConcepts/nano.runsettings @@ -4,11 +4,11 @@ 1 .\TestResults - 240000 + 120000 Framework40 - None - True + None + False \ No newline at end of file diff --git a/Tests/NFUnitTestBasicConcepts/packages.config b/Tests/NFUnitTestBasicConcepts/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestBasicConcepts/packages.config +++ b/Tests/NFUnitTestBasicConcepts/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestClasses/nano.runsettings b/Tests/NFUnitTestClasses/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestClasses/nano.runsettings +++ b/Tests/NFUnitTestClasses/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj b/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj index cc5dc915..6de1cca1 100644 --- a/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj +++ b/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj @@ -37,6 +37,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestConversions/nano.runsettings b/Tests/NFUnitTestConversions/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestConversions/nano.runsettings +++ b/Tests/NFUnitTestConversions/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestConversions/packages.config b/Tests/NFUnitTestConversions/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestConversions/packages.config +++ b/Tests/NFUnitTestConversions/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj index e7c91803..cb79cf36 100644 --- a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj +++ b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj @@ -40,6 +40,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestCoreLibrary/nano.runsettings b/Tests/NFUnitTestCoreLibrary/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestCoreLibrary/nano.runsettings +++ b/Tests/NFUnitTestCoreLibrary/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/packages.config b/Tests/NFUnitTestCoreLibrary/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestCoreLibrary/packages.config +++ b/Tests/NFUnitTestCoreLibrary/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj b/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj index 4759972c..55bf5745 100644 --- a/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj +++ b/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj @@ -35,6 +35,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestDelegates/nano.runsettings b/Tests/NFUnitTestDelegates/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestDelegates/nano.runsettings +++ b/Tests/NFUnitTestDelegates/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestDelegates/packages.config b/Tests/NFUnitTestDelegates/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestDelegates/packages.config +++ b/Tests/NFUnitTestDelegates/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj b/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj index 4a63691f..7e8bdd38 100644 --- a/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj +++ b/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj @@ -39,6 +39,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestEnum/nano.runsettings b/Tests/NFUnitTestEnum/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestEnum/nano.runsettings +++ b/Tests/NFUnitTestEnum/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestEnum/packages.config b/Tests/NFUnitTestEnum/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestEnum/packages.config +++ b/Tests/NFUnitTestEnum/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestException/NFUnitTestException.nfproj b/Tests/NFUnitTestException/NFUnitTestException.nfproj index ad78222d..2ba60fa2 100644 --- a/Tests/NFUnitTestException/NFUnitTestException.nfproj +++ b/Tests/NFUnitTestException/NFUnitTestException.nfproj @@ -35,6 +35,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestException/nano.runsettings b/Tests/NFUnitTestException/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestException/nano.runsettings +++ b/Tests/NFUnitTestException/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestException/packages.config b/Tests/NFUnitTestException/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestException/packages.config +++ b/Tests/NFUnitTestException/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj b/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj index 4e72ae0c..6be1aeae 100644 --- a/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj +++ b/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj @@ -35,6 +35,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestInterface/nano.runsettings b/Tests/NFUnitTestInterface/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestInterface/nano.runsettings +++ b/Tests/NFUnitTestInterface/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/packages.config b/Tests/NFUnitTestInterface/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestInterface/packages.config +++ b/Tests/NFUnitTestInterface/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj index 8f168a2a..b3d84ee2 100644 --- a/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj +++ b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj @@ -36,6 +36,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestLexical/nano.runsettings b/Tests/NFUnitTestLexical/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestLexical/nano.runsettings +++ b/Tests/NFUnitTestLexical/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/packages.config b/Tests/NFUnitTestLexical/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestLexical/packages.config +++ b/Tests/NFUnitTestLexical/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj b/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj index 42e04439..6be68ba8 100644 --- a/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj +++ b/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj @@ -45,6 +45,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestNamespace/nano.runsettings b/Tests/NFUnitTestNamespace/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestNamespace/nano.runsettings +++ b/Tests/NFUnitTestNamespace/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/packages.config b/Tests/NFUnitTestNamespace/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestNamespace/packages.config +++ b/Tests/NFUnitTestNamespace/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj b/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj index 6a9343bd..3763248b 100644 --- a/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj +++ b/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj @@ -39,6 +39,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestStatementsTests/nano.runsettings b/Tests/NFUnitTestStatementsTests/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestStatementsTests/nano.runsettings +++ b/Tests/NFUnitTestStatementsTests/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/packages.config b/Tests/NFUnitTestStatementsTests/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestStatementsTests/packages.config +++ b/Tests/NFUnitTestStatementsTests/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj b/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj index 63b9af9d..b7c3bb24 100644 --- a/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj +++ b/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj @@ -39,6 +39,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestStruct/nano.runsettings b/Tests/NFUnitTestStruct/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestStruct/nano.runsettings +++ b/Tests/NFUnitTestStruct/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestStruct/packages.config b/Tests/NFUnitTestStruct/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestStruct/packages.config +++ b/Tests/NFUnitTestStruct/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj index a8e6f672..8776a02e 100644 --- a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj +++ b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj @@ -61,6 +61,16 @@ True True + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + diff --git a/Tests/NFUnitTestSystemLib/nano.runsettings b/Tests/NFUnitTestSystemLib/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestSystemLib/nano.runsettings +++ b/Tests/NFUnitTestSystemLib/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestSystemLib/packages.config b/Tests/NFUnitTestSystemLib/packages.config index 8fa284a4..fde77996 100644 --- a/Tests/NFUnitTestSystemLib/packages.config +++ b/Tests/NFUnitTestSystemLib/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/Tests/NFUnitTestThread/NFUnitTestThread.nfproj b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj index 337abf1e..dcf119ab 100644 --- a/Tests/NFUnitTestThread/NFUnitTestThread.nfproj +++ b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj @@ -45,6 +45,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestThread/nano.runsettings b/Tests/NFUnitTestThread/nano.runsettings index 637da150..fa881e3a 100644 --- a/Tests/NFUnitTestThread/nano.runsettings +++ b/Tests/NFUnitTestThread/nano.runsettings @@ -4,11 +4,11 @@ 1 .\TestResults - 300000 + 120000 Framework40 None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestThread/packages.config b/Tests/NFUnitTestThread/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestThread/packages.config +++ b/Tests/NFUnitTestThread/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj b/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj index 73b6d583..4ca867ad 100644 --- a/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj +++ b/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj @@ -40,6 +40,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestTypes/nano.runsettings b/Tests/NFUnitTestTypes/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestTypes/nano.runsettings +++ b/Tests/NFUnitTestTypes/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/packages.config b/Tests/NFUnitTestTypes/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestTypes/packages.config +++ b/Tests/NFUnitTestTypes/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj b/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj index f5c8e160..aaaeea6a 100644 --- a/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj +++ b/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj @@ -36,6 +36,18 @@ + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe + True + True + + diff --git a/Tests/NFUnitTestVariables/nano.runsettings b/Tests/NFUnitTestVariables/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestVariables/nano.runsettings +++ b/Tests/NFUnitTestVariables/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/packages.config b/Tests/NFUnitTestVariables/packages.config index 4524644b..f879a4bf 100644 --- a/Tests/NFUnitTestVariables/packages.config +++ b/Tests/NFUnitTestVariables/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file From ae3d11a3787b1b179d01b1973176fa2f2cdec10b Mon Sep 17 00:00:00 2001 From: josesimoes Date: Wed, 3 Mar 2021 12:23:17 +0000 Subject: [PATCH 50/55] Add nanoFramework Azure feed to nuget config --- NuGet.Config | 1 + 1 file changed, 1 insertion(+) diff --git a/NuGet.Config b/NuGet.Config index b02a9811..ef0bacfd 100644 --- a/NuGet.Config +++ b/NuGet.Config @@ -2,5 +2,6 @@ + From 18b4ebb2df0095d79ca642adce3f04e8e247e3b5 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Wed, 3 Mar 2021 12:29:11 +0000 Subject: [PATCH 51/55] Revert "Update Test framework NuGet" This reverts commit a6a9dd6e91ba5660c4bb89bb9c4fe308110d93d0. --- .../NFUnitTestArithmetic.nfproj | 20 ++++--------------- Tests/NFUnitTestArithmetic/nano.runsettings | 2 +- Tests/NFUnitTestArithmetic/packages.config | 2 +- Tests/NFUnitTestArray/NFUnitTestArray.nfproj | 12 ----------- Tests/NFUnitTestArray/nano.runsettings | 2 +- Tests/NFUnitTestArray/packages.config | 2 +- .../NFUnitTestAttributes.nfproj | 12 ----------- Tests/NFUnitTestAttributes/nano.runsettings | 4 ++-- Tests/NFUnitTestAttributes/packages.config | 2 +- .../NFUnitTestBasicConcepts.nfproj | 12 ----------- .../NFUnitTestBasicConcepts/nano.runsettings | 6 +++--- Tests/NFUnitTestBasicConcepts/packages.config | 2 +- Tests/NFUnitTestClasses/nano.runsettings | 2 +- .../NFUnitTestConversions.nfproj | 12 ----------- Tests/NFUnitTestConversions/nano.runsettings | 2 +- Tests/NFUnitTestConversions/packages.config | 2 +- .../NFUnitTestBitConverter.nfproj | 12 ----------- Tests/NFUnitTestCoreLibrary/nano.runsettings | 2 +- Tests/NFUnitTestCoreLibrary/packages.config | 2 +- .../NFUnitTestDelegates.nfproj | 12 ----------- Tests/NFUnitTestDelegates/nano.runsettings | 2 +- Tests/NFUnitTestDelegates/packages.config | 2 +- Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj | 12 ----------- Tests/NFUnitTestEnum/nano.runsettings | 2 +- Tests/NFUnitTestEnum/packages.config | 2 +- .../NFUnitTestException.nfproj | 12 ----------- Tests/NFUnitTestException/nano.runsettings | 2 +- Tests/NFUnitTestException/packages.config | 2 +- .../NFUnitTestInterface.nfproj | 12 ----------- Tests/NFUnitTestInterface/nano.runsettings | 2 +- Tests/NFUnitTestInterface/packages.config | 2 +- .../NFUnitTestLexical.nfproj | 12 ----------- Tests/NFUnitTestLexical/nano.runsettings | 2 +- Tests/NFUnitTestLexical/packages.config | 2 +- .../NFUnitTestNamespace.nfproj | 12 ----------- Tests/NFUnitTestNamespace/nano.runsettings | 2 +- Tests/NFUnitTestNamespace/packages.config | 2 +- .../NFUnitTestStatements.nfproj | 12 ----------- .../nano.runsettings | 2 +- .../NFUnitTestStatementsTests/packages.config | 2 +- .../NFUnitTestStruct/NFUnitTestStruct.nfproj | 12 ----------- Tests/NFUnitTestStruct/nano.runsettings | 2 +- Tests/NFUnitTestStruct/packages.config | 2 +- .../NFUnitTestSystemLib.nfproj | 10 ---------- Tests/NFUnitTestSystemLib/nano.runsettings | 2 +- Tests/NFUnitTestSystemLib/packages.config | 2 +- .../NFUnitTestThread/NFUnitTestThread.nfproj | 12 ----------- Tests/NFUnitTestThread/nano.runsettings | 4 ++-- Tests/NFUnitTestThread/packages.config | 2 +- Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj | 12 ----------- Tests/NFUnitTestTypes/nano.runsettings | 2 +- Tests/NFUnitTestTypes/packages.config | 2 +- .../NFUnitTestVariables.nfproj | 12 ----------- Tests/NFUnitTestVariables/nano.runsettings | 2 +- Tests/NFUnitTestVariables/packages.config | 2 +- 55 files changed, 45 insertions(+), 259 deletions(-) diff --git a/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj index 0ebc783f..71f4a9e7 100644 --- a/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj +++ b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj @@ -33,27 +33,15 @@ + + + + - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - - - - - diff --git a/Tests/NFUnitTestArithmetic/nano.runsettings b/Tests/NFUnitTestArithmetic/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestArithmetic/nano.runsettings +++ b/Tests/NFUnitTestArithmetic/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestArithmetic/packages.config b/Tests/NFUnitTestArithmetic/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestArithmetic/packages.config +++ b/Tests/NFUnitTestArithmetic/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestArray/NFUnitTestArray.nfproj b/Tests/NFUnitTestArray/NFUnitTestArray.nfproj index 63a4aa1d..0adc95f5 100644 --- a/Tests/NFUnitTestArray/NFUnitTestArray.nfproj +++ b/Tests/NFUnitTestArray/NFUnitTestArray.nfproj @@ -36,18 +36,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestArray/nano.runsettings b/Tests/NFUnitTestArray/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestArray/nano.runsettings +++ b/Tests/NFUnitTestArray/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestArray/packages.config b/Tests/NFUnitTestArray/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestArray/packages.config +++ b/Tests/NFUnitTestArray/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj b/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj index b461fd35..4692a574 100644 --- a/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj +++ b/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj @@ -40,18 +40,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestAttributes/nano.runsettings b/Tests/NFUnitTestAttributes/nano.runsettings index fa881e3a..4f2cdb50 100644 --- a/Tests/NFUnitTestAttributes/nano.runsettings +++ b/Tests/NFUnitTestAttributes/nano.runsettings @@ -5,10 +5,10 @@ 1 .\TestResults 120000 - Framework40 + Framework40 None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestAttributes/packages.config b/Tests/NFUnitTestAttributes/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestAttributes/packages.config +++ b/Tests/NFUnitTestAttributes/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj b/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj index bdb548c4..00586302 100644 --- a/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj +++ b/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj @@ -39,18 +39,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestBasicConcepts/nano.runsettings b/Tests/NFUnitTestBasicConcepts/nano.runsettings index fa881e3a..ea6ef9ba 100644 --- a/Tests/NFUnitTestBasicConcepts/nano.runsettings +++ b/Tests/NFUnitTestBasicConcepts/nano.runsettings @@ -4,11 +4,11 @@ 1 .\TestResults - 120000 + 240000 Framework40 - None - False + None + True \ No newline at end of file diff --git a/Tests/NFUnitTestBasicConcepts/packages.config b/Tests/NFUnitTestBasicConcepts/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestBasicConcepts/packages.config +++ b/Tests/NFUnitTestBasicConcepts/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestClasses/nano.runsettings b/Tests/NFUnitTestClasses/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestClasses/nano.runsettings +++ b/Tests/NFUnitTestClasses/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj b/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj index 6de1cca1..cc5dc915 100644 --- a/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj +++ b/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj @@ -37,18 +37,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestConversions/nano.runsettings b/Tests/NFUnitTestConversions/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestConversions/nano.runsettings +++ b/Tests/NFUnitTestConversions/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestConversions/packages.config b/Tests/NFUnitTestConversions/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestConversions/packages.config +++ b/Tests/NFUnitTestConversions/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj index cb79cf36..e7c91803 100644 --- a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj +++ b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj @@ -40,18 +40,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestCoreLibrary/nano.runsettings b/Tests/NFUnitTestCoreLibrary/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestCoreLibrary/nano.runsettings +++ b/Tests/NFUnitTestCoreLibrary/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/packages.config b/Tests/NFUnitTestCoreLibrary/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestCoreLibrary/packages.config +++ b/Tests/NFUnitTestCoreLibrary/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj b/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj index 55bf5745..4759972c 100644 --- a/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj +++ b/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj @@ -35,18 +35,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestDelegates/nano.runsettings b/Tests/NFUnitTestDelegates/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestDelegates/nano.runsettings +++ b/Tests/NFUnitTestDelegates/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestDelegates/packages.config b/Tests/NFUnitTestDelegates/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestDelegates/packages.config +++ b/Tests/NFUnitTestDelegates/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj b/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj index 7e8bdd38..4a63691f 100644 --- a/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj +++ b/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj @@ -39,18 +39,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestEnum/nano.runsettings b/Tests/NFUnitTestEnum/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestEnum/nano.runsettings +++ b/Tests/NFUnitTestEnum/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestEnum/packages.config b/Tests/NFUnitTestEnum/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestEnum/packages.config +++ b/Tests/NFUnitTestEnum/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestException/NFUnitTestException.nfproj b/Tests/NFUnitTestException/NFUnitTestException.nfproj index 2ba60fa2..ad78222d 100644 --- a/Tests/NFUnitTestException/NFUnitTestException.nfproj +++ b/Tests/NFUnitTestException/NFUnitTestException.nfproj @@ -35,18 +35,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestException/nano.runsettings b/Tests/NFUnitTestException/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestException/nano.runsettings +++ b/Tests/NFUnitTestException/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestException/packages.config b/Tests/NFUnitTestException/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestException/packages.config +++ b/Tests/NFUnitTestException/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj b/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj index 6be1aeae..4e72ae0c 100644 --- a/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj +++ b/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj @@ -35,18 +35,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestInterface/nano.runsettings b/Tests/NFUnitTestInterface/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestInterface/nano.runsettings +++ b/Tests/NFUnitTestInterface/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/packages.config b/Tests/NFUnitTestInterface/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestInterface/packages.config +++ b/Tests/NFUnitTestInterface/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj index b3d84ee2..8f168a2a 100644 --- a/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj +++ b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj @@ -36,18 +36,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestLexical/nano.runsettings b/Tests/NFUnitTestLexical/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestLexical/nano.runsettings +++ b/Tests/NFUnitTestLexical/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/packages.config b/Tests/NFUnitTestLexical/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestLexical/packages.config +++ b/Tests/NFUnitTestLexical/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj b/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj index 6be68ba8..42e04439 100644 --- a/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj +++ b/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj @@ -45,18 +45,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestNamespace/nano.runsettings b/Tests/NFUnitTestNamespace/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestNamespace/nano.runsettings +++ b/Tests/NFUnitTestNamespace/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/packages.config b/Tests/NFUnitTestNamespace/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestNamespace/packages.config +++ b/Tests/NFUnitTestNamespace/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj b/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj index 3763248b..6a9343bd 100644 --- a/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj +++ b/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj @@ -39,18 +39,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestStatementsTests/nano.runsettings b/Tests/NFUnitTestStatementsTests/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestStatementsTests/nano.runsettings +++ b/Tests/NFUnitTestStatementsTests/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/packages.config b/Tests/NFUnitTestStatementsTests/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestStatementsTests/packages.config +++ b/Tests/NFUnitTestStatementsTests/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj b/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj index b7c3bb24..63b9af9d 100644 --- a/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj +++ b/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj @@ -39,18 +39,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestStruct/nano.runsettings b/Tests/NFUnitTestStruct/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestStruct/nano.runsettings +++ b/Tests/NFUnitTestStruct/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestStruct/packages.config b/Tests/NFUnitTestStruct/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestStruct/packages.config +++ b/Tests/NFUnitTestStruct/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj index 8776a02e..a8e6f672 100644 --- a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj +++ b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj @@ -61,16 +61,6 @@ True True - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - diff --git a/Tests/NFUnitTestSystemLib/nano.runsettings b/Tests/NFUnitTestSystemLib/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestSystemLib/nano.runsettings +++ b/Tests/NFUnitTestSystemLib/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestSystemLib/packages.config b/Tests/NFUnitTestSystemLib/packages.config index fde77996..8fa284a4 100644 --- a/Tests/NFUnitTestSystemLib/packages.config +++ b/Tests/NFUnitTestSystemLib/packages.config @@ -2,5 +2,5 @@ - + \ No newline at end of file diff --git a/Tests/NFUnitTestThread/NFUnitTestThread.nfproj b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj index dcf119ab..337abf1e 100644 --- a/Tests/NFUnitTestThread/NFUnitTestThread.nfproj +++ b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj @@ -45,18 +45,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestThread/nano.runsettings b/Tests/NFUnitTestThread/nano.runsettings index fa881e3a..637da150 100644 --- a/Tests/NFUnitTestThread/nano.runsettings +++ b/Tests/NFUnitTestThread/nano.runsettings @@ -4,11 +4,11 @@ 1 .\TestResults - 120000 + 300000 Framework40 None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestThread/packages.config b/Tests/NFUnitTestThread/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestThread/packages.config +++ b/Tests/NFUnitTestThread/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj b/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj index 4ca867ad..73b6d583 100644 --- a/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj +++ b/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj @@ -40,18 +40,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestTypes/nano.runsettings b/Tests/NFUnitTestTypes/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestTypes/nano.runsettings +++ b/Tests/NFUnitTestTypes/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/packages.config b/Tests/NFUnitTestTypes/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestTypes/packages.config +++ b/Tests/NFUnitTestTypes/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj b/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj index aaaeea6a..f5c8e160 100644 --- a/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj +++ b/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj @@ -36,18 +36,6 @@ - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.TestFramework.dll - True - True - - - ..\..\packages\nanoFramework.TestFramework.1.0.67\lib\nanoFramework.UnitTestLauncher.exe - True - True - - diff --git a/Tests/NFUnitTestVariables/nano.runsettings b/Tests/NFUnitTestVariables/nano.runsettings index fa881e3a..38fae61f 100644 --- a/Tests/NFUnitTestVariables/nano.runsettings +++ b/Tests/NFUnitTestVariables/nano.runsettings @@ -9,6 +9,6 @@ None - False + True \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/packages.config b/Tests/NFUnitTestVariables/packages.config index f879a4bf..4524644b 100644 --- a/Tests/NFUnitTestVariables/packages.config +++ b/Tests/NFUnitTestVariables/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file From 79a9a5cf5f59b16070812ed98379ef7a39d044f9 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Wed, 3 Mar 2021 12:31:14 +0000 Subject: [PATCH 52/55] Update test framework sub-module @830202c --- nanoFramework.TestFramework | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanoFramework.TestFramework b/nanoFramework.TestFramework index 36baadb1..830202cf 160000 --- a/nanoFramework.TestFramework +++ b/nanoFramework.TestFramework @@ -1 +1 @@ -Subproject commit 36baadb10b65677452a4ba682569f8f41dda2f2b +Subproject commit 830202cfec73ff974bb863e137c21e4324633da9 From 68f3b8d2685e525de475090006b5e28e288f769d Mon Sep 17 00:00:00 2001 From: josesimoes Date: Wed, 3 Mar 2021 12:31:57 +0000 Subject: [PATCH 53/55] Set run settings to run on win32 CLR --- Tests/NFUnitTestArithmetic/nano.runsettings | 2 +- Tests/NFUnitTestArray/nano.runsettings | 2 +- Tests/NFUnitTestAttributes/nano.runsettings | 2 +- Tests/NFUnitTestBasicConcepts/nano.runsettings | 2 +- Tests/NFUnitTestClasses/nano.runsettings | 2 +- Tests/NFUnitTestConversions/nano.runsettings | 2 +- Tests/NFUnitTestCoreLibrary/nano.runsettings | 2 +- Tests/NFUnitTestDelegates/nano.runsettings | 2 +- Tests/NFUnitTestEnum/nano.runsettings | 2 +- Tests/NFUnitTestException/nano.runsettings | 2 +- Tests/NFUnitTestInterface/nano.runsettings | 2 +- Tests/NFUnitTestLexical/nano.runsettings | 2 +- Tests/NFUnitTestNamespace/nano.runsettings | 2 +- Tests/NFUnitTestStatementsTests/nano.runsettings | 2 +- Tests/NFUnitTestStruct/nano.runsettings | 2 +- Tests/NFUnitTestSystemLib/nano.runsettings | 2 +- Tests/NFUnitTestThread/nano.runsettings | 2 +- Tests/NFUnitTestTypes/nano.runsettings | 2 +- Tests/NFUnitTestVariables/nano.runsettings | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Tests/NFUnitTestArithmetic/nano.runsettings b/Tests/NFUnitTestArithmetic/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestArithmetic/nano.runsettings +++ b/Tests/NFUnitTestArithmetic/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestArray/nano.runsettings b/Tests/NFUnitTestArray/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestArray/nano.runsettings +++ b/Tests/NFUnitTestArray/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestAttributes/nano.runsettings b/Tests/NFUnitTestAttributes/nano.runsettings index 4f2cdb50..73577665 100644 --- a/Tests/NFUnitTestAttributes/nano.runsettings +++ b/Tests/NFUnitTestAttributes/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestBasicConcepts/nano.runsettings b/Tests/NFUnitTestBasicConcepts/nano.runsettings index ea6ef9ba..0d3925dc 100644 --- a/Tests/NFUnitTestBasicConcepts/nano.runsettings +++ b/Tests/NFUnitTestBasicConcepts/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestClasses/nano.runsettings b/Tests/NFUnitTestClasses/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestClasses/nano.runsettings +++ b/Tests/NFUnitTestClasses/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestConversions/nano.runsettings b/Tests/NFUnitTestConversions/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestConversions/nano.runsettings +++ b/Tests/NFUnitTestConversions/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/nano.runsettings b/Tests/NFUnitTestCoreLibrary/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestCoreLibrary/nano.runsettings +++ b/Tests/NFUnitTestCoreLibrary/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestDelegates/nano.runsettings b/Tests/NFUnitTestDelegates/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestDelegates/nano.runsettings +++ b/Tests/NFUnitTestDelegates/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestEnum/nano.runsettings b/Tests/NFUnitTestEnum/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestEnum/nano.runsettings +++ b/Tests/NFUnitTestEnum/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestException/nano.runsettings b/Tests/NFUnitTestException/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestException/nano.runsettings +++ b/Tests/NFUnitTestException/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/nano.runsettings b/Tests/NFUnitTestInterface/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestInterface/nano.runsettings +++ b/Tests/NFUnitTestInterface/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/nano.runsettings b/Tests/NFUnitTestLexical/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestLexical/nano.runsettings +++ b/Tests/NFUnitTestLexical/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/nano.runsettings b/Tests/NFUnitTestNamespace/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestNamespace/nano.runsettings +++ b/Tests/NFUnitTestNamespace/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/nano.runsettings b/Tests/NFUnitTestStatementsTests/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestStatementsTests/nano.runsettings +++ b/Tests/NFUnitTestStatementsTests/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestStruct/nano.runsettings b/Tests/NFUnitTestStruct/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestStruct/nano.runsettings +++ b/Tests/NFUnitTestStruct/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestSystemLib/nano.runsettings b/Tests/NFUnitTestSystemLib/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestSystemLib/nano.runsettings +++ b/Tests/NFUnitTestSystemLib/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestThread/nano.runsettings b/Tests/NFUnitTestThread/nano.runsettings index 637da150..fe5475a1 100644 --- a/Tests/NFUnitTestThread/nano.runsettings +++ b/Tests/NFUnitTestThread/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/nano.runsettings b/Tests/NFUnitTestTypes/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestTypes/nano.runsettings +++ b/Tests/NFUnitTestTypes/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/nano.runsettings b/Tests/NFUnitTestVariables/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestVariables/nano.runsettings +++ b/Tests/NFUnitTestVariables/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file From e4f1bece5284259d1d5923120ddbac271e23798c Mon Sep 17 00:00:00 2001 From: Laurent Ellerbach Date: Wed, 3 Mar 2021 15:40:49 +0300 Subject: [PATCH 54/55] Adjusting to remove nuget dependencies --- .../NFUnitTestAdpater.nfproj | 60 +++++++++++++++++++ .../Properties/AssemblyInfo.cs | 33 ++++++++++ Tests/NFUnitTestAdpater/UnitTest1.cs | 22 +++++++ .../nano.runsettings | 3 +- Tests/NFUnitTestAdpater/packages.config | 5 ++ .../NFUnitTestArithmetic.nfproj | 1 - Tests/NFUnitTestArithmetic/nano.runsettings | 2 +- Tests/NFUnitTestArithmetic/packages.config | 4 -- Tests/NFUnitTestArray/NFUnitTestArray.nfproj | 1 - Tests/NFUnitTestArray/nano.runsettings | 2 +- Tests/NFUnitTestArray/packages.config | 4 -- .../NFUnitTestAttributes.nfproj | 1 - Tests/NFUnitTestAttributes/nano.runsettings | 2 +- Tests/NFUnitTestAttributes/packages.config | 4 -- .../NFUnitTestBasicConcepts.nfproj | 1 - .../NFUnitTestBasicConcepts/nano.runsettings | 2 +- Tests/NFUnitTestBasicConcepts/packages.config | 4 -- Tests/NFUnitTestClasses/nano.runsettings | 2 +- .../NFUnitTestConversions.nfproj | 4 -- Tests/NFUnitTestConversions/packages.config | 4 -- .../NFUnitTestBitConverter.nfproj | 1 - Tests/NFUnitTestCoreLibrary/nano.runsettings | 2 +- Tests/NFUnitTestCoreLibrary/packages.config | 4 -- .../NFUnitTestDelegates.nfproj | 4 -- Tests/NFUnitTestDelegates/nano.runsettings | 14 ----- Tests/NFUnitTestDelegates/packages.config | 4 -- Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj | 4 -- Tests/NFUnitTestEnum/nano.runsettings | 14 ----- Tests/NFUnitTestEnum/packages.config | 4 -- .../NFUnitTestException.nfproj | 4 -- Tests/NFUnitTestException/nano.runsettings | 14 ----- Tests/NFUnitTestException/packages.config | 4 -- .../NFUnitTestInterface.nfproj | 4 -- Tests/NFUnitTestInterface/nano.runsettings | 14 ----- Tests/NFUnitTestInterface/packages.config | 4 -- .../NFUnitTestLexical.nfproj | 4 -- Tests/NFUnitTestLexical/nano.runsettings | 14 ----- Tests/NFUnitTestLexical/packages.config | 4 -- .../NFUnitTestNamespace.nfproj | 4 -- Tests/NFUnitTestNamespace/nano.runsettings | 14 ----- Tests/NFUnitTestNamespace/packages.config | 4 -- .../NFUnitTestStatements.nfproj | 4 -- .../nano.runsettings | 14 ----- .../NFUnitTestStatementsTests/packages.config | 4 -- .../NFUnitTestStruct/NFUnitTestStruct.nfproj | 4 -- Tests/NFUnitTestStruct/nano.runsettings | 14 ----- Tests/NFUnitTestStruct/packages.config | 4 -- .../NFUnitTestSystemLib.nfproj | 1 - Tests/NFUnitTestSystemLib/nano.runsettings | 14 ----- Tests/NFUnitTestSystemLib/packages.config | 1 - .../NFUnitTestThread/NFUnitTestThread.nfproj | 1 - Tests/NFUnitTestThread/nano.runsettings | 2 +- Tests/NFUnitTestThread/packages.config | 4 -- Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj | 4 -- Tests/NFUnitTestTypes/nano.runsettings | 14 ----- Tests/NFUnitTestTypes/packages.config | 4 -- .../NFUnitTestVariables.nfproj | 4 -- Tests/NFUnitTestVariables/nano.runsettings | 14 ----- Tests/NFUnitTestVariables/packages.config | 4 -- nanoFramework.CoreLibrary.sln | 9 +++ 60 files changed, 137 insertions(+), 283 deletions(-) create mode 100644 Tests/NFUnitTestAdpater/NFUnitTestAdpater.nfproj create mode 100644 Tests/NFUnitTestAdpater/Properties/AssemblyInfo.cs create mode 100644 Tests/NFUnitTestAdpater/UnitTest1.cs rename Tests/{NFUnitTestConversions => NFUnitTestAdpater}/nano.runsettings (86%) create mode 100644 Tests/NFUnitTestAdpater/packages.config delete mode 100644 Tests/NFUnitTestArithmetic/packages.config delete mode 100644 Tests/NFUnitTestArray/packages.config delete mode 100644 Tests/NFUnitTestAttributes/packages.config delete mode 100644 Tests/NFUnitTestBasicConcepts/packages.config delete mode 100644 Tests/NFUnitTestConversions/packages.config delete mode 100644 Tests/NFUnitTestCoreLibrary/packages.config delete mode 100644 Tests/NFUnitTestDelegates/nano.runsettings delete mode 100644 Tests/NFUnitTestDelegates/packages.config delete mode 100644 Tests/NFUnitTestEnum/nano.runsettings delete mode 100644 Tests/NFUnitTestEnum/packages.config delete mode 100644 Tests/NFUnitTestException/nano.runsettings delete mode 100644 Tests/NFUnitTestException/packages.config delete mode 100644 Tests/NFUnitTestInterface/nano.runsettings delete mode 100644 Tests/NFUnitTestInterface/packages.config delete mode 100644 Tests/NFUnitTestLexical/nano.runsettings delete mode 100644 Tests/NFUnitTestLexical/packages.config delete mode 100644 Tests/NFUnitTestNamespace/nano.runsettings delete mode 100644 Tests/NFUnitTestNamespace/packages.config delete mode 100644 Tests/NFUnitTestStatementsTests/nano.runsettings delete mode 100644 Tests/NFUnitTestStatementsTests/packages.config delete mode 100644 Tests/NFUnitTestStruct/nano.runsettings delete mode 100644 Tests/NFUnitTestStruct/packages.config delete mode 100644 Tests/NFUnitTestSystemLib/nano.runsettings delete mode 100644 Tests/NFUnitTestThread/packages.config delete mode 100644 Tests/NFUnitTestTypes/nano.runsettings delete mode 100644 Tests/NFUnitTestTypes/packages.config delete mode 100644 Tests/NFUnitTestVariables/nano.runsettings delete mode 100644 Tests/NFUnitTestVariables/packages.config diff --git a/Tests/NFUnitTestAdpater/NFUnitTestAdpater.nfproj b/Tests/NFUnitTestAdpater/NFUnitTestAdpater.nfproj new file mode 100644 index 00000000..f2fb61ee --- /dev/null +++ b/Tests/NFUnitTestAdpater/NFUnitTestAdpater.nfproj @@ -0,0 +1,60 @@ + + + + + + + $(MSBuildToolsPath)..\..\..\nanoFramework\v1.0\ + + + + Debug + AnyCPU + {11A8DD76-328B-46DF-9F39-F559912D0360};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 396a2b21-8a5f-4274-9fdd-3b35dc8eae47 + Library + Properties + 512 + NFUnitTestAdpater + NFUnitTest + False + true + UnitTest + v1.0 + + + + $(MSBuildProjectDirectory)\nano.runsettings + + + + + + + + ..\..\packages\nanoFramework.CoreLibrary.1.10.1-preview.9\lib\mscorlib.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.TestFramework.dll + True + True + + + ..\..\packages\nanoFramework.TestFramework.1.0.25\lib\nanoFramework.UnitTestLauncher.exe + True + True + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestAdpater/Properties/AssemblyInfo.cs b/Tests/NFUnitTestAdpater/Properties/AssemblyInfo.cs new file mode 100644 index 00000000..0383fb89 --- /dev/null +++ b/Tests/NFUnitTestAdpater/Properties/AssemblyInfo.cs @@ -0,0 +1,33 @@ +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("CSharp.TestApplication")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("CSharp.TestApplication")] +[assembly: AssemblyCopyright("Copyright © ")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/Tests/NFUnitTestAdpater/UnitTest1.cs b/Tests/NFUnitTestAdpater/UnitTest1.cs new file mode 100644 index 00000000..d442a199 --- /dev/null +++ b/Tests/NFUnitTestAdpater/UnitTest1.cs @@ -0,0 +1,22 @@ +// +// Copyright (c) .NET Foundation and Contributors +// Portions Copyright (c) Microsoft Corporation. All rights reserved. +// See LICENSE file in the project root for full license information. +// + +using nanoFramework.TestFramework; +using System; +using System.Diagnostics; + +namespace NFUnitTestAdpater +{ + [TestClass] + public class Test1 + { + [TestMethod] + public void TestMethod() + { + Debug.WriteLine("This is just to get the TestAdapter. Don not remove this project!"); + } + } +} diff --git a/Tests/NFUnitTestConversions/nano.runsettings b/Tests/NFUnitTestAdpater/nano.runsettings similarity index 86% rename from Tests/NFUnitTestConversions/nano.runsettings rename to Tests/NFUnitTestAdpater/nano.runsettings index 38fae61f..62f0a008 100644 --- a/Tests/NFUnitTestConversions/nano.runsettings +++ b/Tests/NFUnitTestAdpater/nano.runsettings @@ -8,7 +8,6 @@ Framework40 - None - True + None \ No newline at end of file diff --git a/Tests/NFUnitTestAdpater/packages.config b/Tests/NFUnitTestAdpater/packages.config new file mode 100644 index 00000000..dcab08b1 --- /dev/null +++ b/Tests/NFUnitTestAdpater/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj index 71f4a9e7..4e296971 100644 --- a/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj +++ b/Tests/NFUnitTestArithmetic/NFUnitTestArithmetic.nfproj @@ -35,7 +35,6 @@ - diff --git a/Tests/NFUnitTestArithmetic/nano.runsettings b/Tests/NFUnitTestArithmetic/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestArithmetic/nano.runsettings +++ b/Tests/NFUnitTestArithmetic/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestArithmetic/packages.config b/Tests/NFUnitTestArithmetic/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestArithmetic/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestArray/NFUnitTestArray.nfproj b/Tests/NFUnitTestArray/NFUnitTestArray.nfproj index 0adc95f5..5345557c 100644 --- a/Tests/NFUnitTestArray/NFUnitTestArray.nfproj +++ b/Tests/NFUnitTestArray/NFUnitTestArray.nfproj @@ -38,7 +38,6 @@ - diff --git a/Tests/NFUnitTestArray/nano.runsettings b/Tests/NFUnitTestArray/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestArray/nano.runsettings +++ b/Tests/NFUnitTestArray/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestArray/packages.config b/Tests/NFUnitTestArray/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestArray/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj b/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj index 4692a574..e32281e3 100644 --- a/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj +++ b/Tests/NFUnitTestAttributes/NFUnitTestAttributes.nfproj @@ -38,7 +38,6 @@ - diff --git a/Tests/NFUnitTestAttributes/nano.runsettings b/Tests/NFUnitTestAttributes/nano.runsettings index 4f2cdb50..73577665 100644 --- a/Tests/NFUnitTestAttributes/nano.runsettings +++ b/Tests/NFUnitTestAttributes/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestAttributes/packages.config b/Tests/NFUnitTestAttributes/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestAttributes/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj b/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj index 00586302..8b866d71 100644 --- a/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj +++ b/Tests/NFUnitTestBasicConcepts/NFUnitTestBasicConcepts.nfproj @@ -37,7 +37,6 @@ - diff --git a/Tests/NFUnitTestBasicConcepts/nano.runsettings b/Tests/NFUnitTestBasicConcepts/nano.runsettings index ea6ef9ba..0d3925dc 100644 --- a/Tests/NFUnitTestBasicConcepts/nano.runsettings +++ b/Tests/NFUnitTestBasicConcepts/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestBasicConcepts/packages.config b/Tests/NFUnitTestBasicConcepts/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestBasicConcepts/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestClasses/nano.runsettings b/Tests/NFUnitTestClasses/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestClasses/nano.runsettings +++ b/Tests/NFUnitTestClasses/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj b/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj index cc5dc915..f9a85c5e 100644 --- a/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj +++ b/Tests/NFUnitTestConversions/NFUnitTestConversions.nfproj @@ -37,10 +37,6 @@ - - - - diff --git a/Tests/NFUnitTestConversions/packages.config b/Tests/NFUnitTestConversions/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestConversions/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj index e7c91803..6a93e1e7 100644 --- a/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj +++ b/Tests/NFUnitTestCoreLibrary/NFUnitTestBitConverter.nfproj @@ -38,7 +38,6 @@ - diff --git a/Tests/NFUnitTestCoreLibrary/nano.runsettings b/Tests/NFUnitTestCoreLibrary/nano.runsettings index 38fae61f..fa881e3a 100644 --- a/Tests/NFUnitTestCoreLibrary/nano.runsettings +++ b/Tests/NFUnitTestCoreLibrary/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestCoreLibrary/packages.config b/Tests/NFUnitTestCoreLibrary/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestCoreLibrary/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj b/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj index 4759972c..06085aba 100644 --- a/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj +++ b/Tests/NFUnitTestDelegates/NFUnitTestDelegates.nfproj @@ -35,10 +35,6 @@ - - - - diff --git a/Tests/NFUnitTestDelegates/nano.runsettings b/Tests/NFUnitTestDelegates/nano.runsettings deleted file mode 100644 index 38fae61f..00000000 --- a/Tests/NFUnitTestDelegates/nano.runsettings +++ /dev/null @@ -1,14 +0,0 @@ - - - - - 1 - .\TestResults - 120000 - Framework40 - - - None - True - - \ No newline at end of file diff --git a/Tests/NFUnitTestDelegates/packages.config b/Tests/NFUnitTestDelegates/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestDelegates/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj b/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj index 4a63691f..63fcb0e8 100644 --- a/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj +++ b/Tests/NFUnitTestEnum/NFUnitTestEnum.nfproj @@ -35,10 +35,6 @@ - - - - diff --git a/Tests/NFUnitTestEnum/nano.runsettings b/Tests/NFUnitTestEnum/nano.runsettings deleted file mode 100644 index 38fae61f..00000000 --- a/Tests/NFUnitTestEnum/nano.runsettings +++ /dev/null @@ -1,14 +0,0 @@ - - - - - 1 - .\TestResults - 120000 - Framework40 - - - None - True - - \ No newline at end of file diff --git a/Tests/NFUnitTestEnum/packages.config b/Tests/NFUnitTestEnum/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestEnum/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestException/NFUnitTestException.nfproj b/Tests/NFUnitTestException/NFUnitTestException.nfproj index ad78222d..ed5afa3b 100644 --- a/Tests/NFUnitTestException/NFUnitTestException.nfproj +++ b/Tests/NFUnitTestException/NFUnitTestException.nfproj @@ -35,10 +35,6 @@ - - - - diff --git a/Tests/NFUnitTestException/nano.runsettings b/Tests/NFUnitTestException/nano.runsettings deleted file mode 100644 index 38fae61f..00000000 --- a/Tests/NFUnitTestException/nano.runsettings +++ /dev/null @@ -1,14 +0,0 @@ - - - - - 1 - .\TestResults - 120000 - Framework40 - - - None - True - - \ No newline at end of file diff --git a/Tests/NFUnitTestException/packages.config b/Tests/NFUnitTestException/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestException/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj b/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj index 4e72ae0c..518252bf 100644 --- a/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj +++ b/Tests/NFUnitTestInterface/NFUnitTestInterface.nfproj @@ -35,10 +35,6 @@ - - - - diff --git a/Tests/NFUnitTestInterface/nano.runsettings b/Tests/NFUnitTestInterface/nano.runsettings deleted file mode 100644 index 38fae61f..00000000 --- a/Tests/NFUnitTestInterface/nano.runsettings +++ /dev/null @@ -1,14 +0,0 @@ - - - - - 1 - .\TestResults - 120000 - Framework40 - - - None - True - - \ No newline at end of file diff --git a/Tests/NFUnitTestInterface/packages.config b/Tests/NFUnitTestInterface/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestInterface/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj index 8f168a2a..82f17cd1 100644 --- a/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj +++ b/Tests/NFUnitTestLexical/NFUnitTestLexical.nfproj @@ -36,10 +36,6 @@ - - - - diff --git a/Tests/NFUnitTestLexical/nano.runsettings b/Tests/NFUnitTestLexical/nano.runsettings deleted file mode 100644 index 38fae61f..00000000 --- a/Tests/NFUnitTestLexical/nano.runsettings +++ /dev/null @@ -1,14 +0,0 @@ - - - - - 1 - .\TestResults - 120000 - Framework40 - - - None - True - - \ No newline at end of file diff --git a/Tests/NFUnitTestLexical/packages.config b/Tests/NFUnitTestLexical/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestLexical/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj b/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj index 42e04439..be93a638 100644 --- a/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj +++ b/Tests/NFUnitTestNamespace/NFUnitTestNamespace.nfproj @@ -45,10 +45,6 @@ - - - - diff --git a/Tests/NFUnitTestNamespace/nano.runsettings b/Tests/NFUnitTestNamespace/nano.runsettings deleted file mode 100644 index 38fae61f..00000000 --- a/Tests/NFUnitTestNamespace/nano.runsettings +++ /dev/null @@ -1,14 +0,0 @@ - - - - - 1 - .\TestResults - 120000 - Framework40 - - - None - True - - \ No newline at end of file diff --git a/Tests/NFUnitTestNamespace/packages.config b/Tests/NFUnitTestNamespace/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestNamespace/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj b/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj index 6a9343bd..89a641fa 100644 --- a/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj +++ b/Tests/NFUnitTestStatementsTests/NFUnitTestStatements.nfproj @@ -35,10 +35,6 @@ - - - - diff --git a/Tests/NFUnitTestStatementsTests/nano.runsettings b/Tests/NFUnitTestStatementsTests/nano.runsettings deleted file mode 100644 index 38fae61f..00000000 --- a/Tests/NFUnitTestStatementsTests/nano.runsettings +++ /dev/null @@ -1,14 +0,0 @@ - - - - - 1 - .\TestResults - 120000 - Framework40 - - - None - True - - \ No newline at end of file diff --git a/Tests/NFUnitTestStatementsTests/packages.config b/Tests/NFUnitTestStatementsTests/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestStatementsTests/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj b/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj index 63b9af9d..7914448d 100644 --- a/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj +++ b/Tests/NFUnitTestStruct/NFUnitTestStruct.nfproj @@ -35,10 +35,6 @@ - - - - diff --git a/Tests/NFUnitTestStruct/nano.runsettings b/Tests/NFUnitTestStruct/nano.runsettings deleted file mode 100644 index 38fae61f..00000000 --- a/Tests/NFUnitTestStruct/nano.runsettings +++ /dev/null @@ -1,14 +0,0 @@ - - - - - 1 - .\TestResults - 120000 - Framework40 - - - None - True - - \ No newline at end of file diff --git a/Tests/NFUnitTestStruct/packages.config b/Tests/NFUnitTestStruct/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestStruct/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj index a8e6f672..9e5338f0 100644 --- a/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj +++ b/Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj @@ -47,7 +47,6 @@ - diff --git a/Tests/NFUnitTestSystemLib/nano.runsettings b/Tests/NFUnitTestSystemLib/nano.runsettings deleted file mode 100644 index 38fae61f..00000000 --- a/Tests/NFUnitTestSystemLib/nano.runsettings +++ /dev/null @@ -1,14 +0,0 @@ - - - - - 1 - .\TestResults - 120000 - Framework40 - - - None - True - - \ No newline at end of file diff --git a/Tests/NFUnitTestSystemLib/packages.config b/Tests/NFUnitTestSystemLib/packages.config index 8fa284a4..09794131 100644 --- a/Tests/NFUnitTestSystemLib/packages.config +++ b/Tests/NFUnitTestSystemLib/packages.config @@ -2,5 +2,4 @@ - \ No newline at end of file diff --git a/Tests/NFUnitTestThread/NFUnitTestThread.nfproj b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj index 337abf1e..f63d985e 100644 --- a/Tests/NFUnitTestThread/NFUnitTestThread.nfproj +++ b/Tests/NFUnitTestThread/NFUnitTestThread.nfproj @@ -43,7 +43,6 @@ - diff --git a/Tests/NFUnitTestThread/nano.runsettings b/Tests/NFUnitTestThread/nano.runsettings index 637da150..fe5475a1 100644 --- a/Tests/NFUnitTestThread/nano.runsettings +++ b/Tests/NFUnitTestThread/nano.runsettings @@ -9,6 +9,6 @@ None - True + False \ No newline at end of file diff --git a/Tests/NFUnitTestThread/packages.config b/Tests/NFUnitTestThread/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestThread/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj b/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj index 73b6d583..8a50615b 100644 --- a/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj +++ b/Tests/NFUnitTestTypes/NFUnitTestTypes.nfproj @@ -40,10 +40,6 @@ - - - - diff --git a/Tests/NFUnitTestTypes/nano.runsettings b/Tests/NFUnitTestTypes/nano.runsettings deleted file mode 100644 index 38fae61f..00000000 --- a/Tests/NFUnitTestTypes/nano.runsettings +++ /dev/null @@ -1,14 +0,0 @@ - - - - - 1 - .\TestResults - 120000 - Framework40 - - - None - True - - \ No newline at end of file diff --git a/Tests/NFUnitTestTypes/packages.config b/Tests/NFUnitTestTypes/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestTypes/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj b/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj index f5c8e160..8b0cb7a6 100644 --- a/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj +++ b/Tests/NFUnitTestVariables/NFUnitTestVariables.nfproj @@ -36,10 +36,6 @@ - - - - diff --git a/Tests/NFUnitTestVariables/nano.runsettings b/Tests/NFUnitTestVariables/nano.runsettings deleted file mode 100644 index 38fae61f..00000000 --- a/Tests/NFUnitTestVariables/nano.runsettings +++ /dev/null @@ -1,14 +0,0 @@ - - - - - 1 - .\TestResults - 120000 - Framework40 - - - None - True - - \ No newline at end of file diff --git a/Tests/NFUnitTestVariables/packages.config b/Tests/NFUnitTestVariables/packages.config deleted file mode 100644 index 4524644b..00000000 --- a/Tests/NFUnitTestVariables/packages.config +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 1465ca88..8661b984 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -62,6 +62,8 @@ Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "TestFramework", "Tests\Test EndProject Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "TestFrameworkShared", "nanoFramework.TestFramework\source\TestFrameworkShared\TestFrameworkShared.shproj", "{55F048B5-6739-43C5-A93D-DB61DB8E912F}" EndProject +Project("{11A8DD76-328B-46DF-9F39-F559912D0360}") = "NFUnitTestAdpater", "Tests\NFUnitTestAdpater\NFUnitTestAdpater.nfproj", "{396A2B21-8A5F-4274-9FDD-3B35DC8EAE47}" +EndProject Global GlobalSection(SharedMSBuildProjectFiles) = preSolution nanoFramework.TestFramework\source\TestFrameworkShared\TestFrameworkShared.projitems*{55f048b5-6739-43c5-a93d-db61db8e912f}*SharedItemsImports = 13 @@ -205,6 +207,12 @@ Global {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8}.Release|Any CPU.ActiveCfg = Release|Any CPU {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8}.Release|Any CPU.Build.0 = Release|Any CPU {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8}.Release|Any CPU.Deploy.0 = Release|Any CPU + {396A2B21-8A5F-4274-9FDD-3B35DC8EAE47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {396A2B21-8A5F-4274-9FDD-3B35DC8EAE47}.Debug|Any CPU.Build.0 = Debug|Any CPU + {396A2B21-8A5F-4274-9FDD-3B35DC8EAE47}.Debug|Any CPU.Deploy.0 = Debug|Any CPU + {396A2B21-8A5F-4274-9FDD-3B35DC8EAE47}.Release|Any CPU.ActiveCfg = Release|Any CPU + {396A2B21-8A5F-4274-9FDD-3B35DC8EAE47}.Release|Any CPU.Build.0 = Release|Any CPU + {396A2B21-8A5F-4274-9FDD-3B35DC8EAE47}.Release|Any CPU.Deploy.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -232,6 +240,7 @@ Global {48C77E72-02D2-4D6F-B68B-B0972388781F} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {44A0C6A8-4F31-405B-95CA-6F0D65BC11B8} = {0BAE286A-5434-4F56-A9F1-41B72056170E} {55F048B5-6739-43C5-A93D-DB61DB8E912F} = {0BAE286A-5434-4F56-A9F1-41B72056170E} + {396A2B21-8A5F-4274-9FDD-3B35DC8EAE47} = {0BAE286A-5434-4F56-A9F1-41B72056170E} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {8DE44407-9B41-4459-97D2-FCE54B1F4300} From ce425596c05c63c6ebcf87e06ec27eb53d72eb98 Mon Sep 17 00:00:00 2001 From: josesimoes Date: Wed, 3 Mar 2021 13:08:48 +0000 Subject: [PATCH 55/55] Unload namespace project - Issues witg build (waiting for a fix on MDP). --- nanoFramework.CoreLibrary.sln | 4 ---- 1 file changed, 4 deletions(-) diff --git a/nanoFramework.CoreLibrary.sln b/nanoFramework.CoreLibrary.sln index 8661b984..7a79d804 100644 --- a/nanoFramework.CoreLibrary.sln +++ b/nanoFramework.CoreLibrary.sln @@ -124,11 +124,7 @@ Global {222D8571-6646-47E4-95A5-8AED732DCB70}.Release|Any CPU.Build.0 = Release|Any CPU {222D8571-6646-47E4-95A5-8AED732DCB70}.Release|Any CPU.Deploy.0 = Release|Any CPU {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Debug|Any CPU.Deploy.0 = Debug|Any CPU {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Release|Any CPU.ActiveCfg = Release|Any CPU - {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Release|Any CPU.Build.0 = Release|Any CPU - {9B5EFD66-CCDC-4D00-960C-993296C56F3B}.Release|Any CPU.Deploy.0 = Release|Any CPU {E0538338-9941-410C-B8C8-0C928F26F8A7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {E0538338-9941-410C-B8C8-0C928F26F8A7}.Debug|Any CPU.Build.0 = Debug|Any CPU {E0538338-9941-410C-B8C8-0C928F26F8A7}.Debug|Any CPU.Deploy.0 = Debug|Any CPU