Add test for Enumeerable.Range high boundaries
authorJb Evain <jbevain@gmail.com>
Tue, 25 Jan 2011 22:46:22 +0000 (23:46 +0100)
committerJb Evain <jbevain@gmail.com>
Tue, 25 Jan 2011 22:46:22 +0000 (23:46 +0100)
mcs/class/System.Core/Test/System.Linq/EnumerableTest.cs

index 26655c56dfd9912aeb5bc477eb4cca1e4628f87a..182f7fd39fa64f5ef2c3777dc63ab8db0b5d7567 100644 (file)
@@ -362,10 +362,32 @@ namespace MonoTests.System.Linq {
                public void TestRange ()
                {
                        AssertAreSame (new [] {1, 2, 3, 4}, Enumerable.Range (1, 4));
-
                        AssertAreSame (new [] {0, 1, 2, 3}, Enumerable.Range (0, 4));
                }
 
+               [Test]
+               public void SingleValueOfMaxInt32 ()
+               {
+                       AssertAreSame (new [] { int.MaxValue }, Enumerable.Range(int.MaxValue, 1));
+               }
+
+               [Test]
+               public void EmptyRangeStartingAtMinInt32 ()
+               {
+                       AssertAreSame (new int [0], Enumerable.Range(int.MinValue, 0));
+               }
+
+               static void AssertThrows<T> (Action action) where T : Exception
+               {
+                       try {
+                               action ();
+                               Assert.Fail ();
+                       } catch (T) {
+                       } catch {
+                               Assert.Fail ();
+                       }
+               }
+
                [Test]
                public void TestTakeTakesProperNumberOfItems ()
                {