Add unit test to check edge case in Array.Reverse(Array, ...) (dotnet/corefx#29559)
authorLevi Broderick <GrabYourPitchforks@users.noreply.github.com>
Tue, 15 May 2018 13:15:24 +0000 (06:15 -0700)
committerStephen Toub <stoub@microsoft.com>
Tue, 15 May 2018 13:15:24 +0000 (09:15 -0400)
* Fix Array.Reverse tests to match validation checks in corelib

* Revert "Fix Array.Reverse tests to match validation checks in corelib"

Commit migrated from https://github.com/dotnet/corefx/commit/c75431cd74a92f97d7be15e754b15f76d9bce28c

src/libraries/System.Runtime/tests/System/ArrayTests.netcoreapp.cs

index 6f2bbd7..853e09b 100644 (file)
@@ -141,6 +141,16 @@ namespace System.Tests
         }
 
         [Fact]
+        public static void Reverse_NonSZArrayWithMinValueLowerBound()
+        {
+            Array array = NonZeroLowerBoundArray(new int[] { 1, 2, 3 }, int.MinValue);
+
+            Reverse(array, int.MinValue, 0, new int[] { 1, 2, 3 });
+            Reverse(array, int.MinValue, 1, new int[] { 1, 2, 3 });
+            Reverse(array, int.MinValue, 2, new int[] { 2, 1, 3 });
+        }
+
+        [Fact]
         public void CreateInstance_TypeNotRuntimeType_ThrowsArgumentException()
         {
             // This cannot be a [Theory] due to https://github.com/xunit/xunit/issues/1325.