diff --git a/test/DotRecast.Core.Test/RcRentedArrayTest.cs b/test/DotRecast.Core.Test/RcRentedArrayTest.cs index 48a1cd2..b099ffa 100644 --- a/test/DotRecast.Core.Test/RcRentedArrayTest.cs +++ b/test/DotRecast.Core.Test/RcRentedArrayTest.cs @@ -29,7 +29,7 @@ public class RcRentedArrayTest { RcRentedArray rentedArray; { - int length = (int)(rand.Next() * 2048); + int length = Math.Max(2, (int)(rand.Next() * 2048)); var values = RandomValues(length); using var array = RcRentedArray.RentDisposableArray(length); @@ -44,12 +44,12 @@ public class RcRentedArrayTest } Assert.That(array[^1], Is.EqualTo(values[^1])); - + Assert.Throws(() => array[-1] = 0); Assert.Throws(() => array[array.Length + 1] = 0); Assert.Throws(() => _ = array[-1]); Assert.Throws(() => _ = array[array.Length + 1]); - + // danger rentedArray = array; }