diff options
Diffstat (limited to 'src/System.Memory/tests/Memory/Retain.cs')
-rw-r--r-- | src/System.Memory/tests/Memory/Retain.cs | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/System.Memory/tests/Memory/Retain.cs b/src/System.Memory/tests/Memory/Retain.cs index 3a33817dff..1ef319103c 100644 --- a/src/System.Memory/tests/Memory/Retain.cs +++ b/src/System.Memory/tests/Memory/Retain.cs @@ -46,6 +46,30 @@ namespace System.MemoryTests } [Fact] + public static void MemoryFromEmptyArrayRetainWithPinning() + { + Memory<int> memory = new int[0]; + MemoryHandle handle = memory.Retain(pin: true); + Assert.True(handle.HasPointer); + handle.Dispose(); + } + + [Theory] + [InlineData(true)] + [InlineData(false)] + public static void DefaultMemoryRetain(bool pin) + { + Memory<int> memory = default; + MemoryHandle handle = memory.Retain(pin: pin); + Assert.False(handle.HasPointer); + unsafe + { + Assert.True(handle.Pointer == null); + } + handle.Dispose(); + } + + [Fact] public static void MemoryRetainWithPinningAndSlice() { int[] array = { 1, 2, 3, 4, 5 }; @@ -111,15 +135,6 @@ namespace System.MemoryTests } [Fact] - public static void MemoryFromEmptyArrayRetainWithPinning() - { - Memory<int> memory = new int[0]; - MemoryHandle handle = memory.Retain(pin: true); - Assert.True(handle.HasPointer); - handle.Dispose(); - } - - [Fact] public static void OwnedMemoryRetainWithPinningAndSlice() { int[] array = { 1, 2, 3, 4, 5 }; @@ -146,20 +161,5 @@ namespace System.MemoryTests } handle.Dispose(); } - - [Theory] - [InlineData(true)] - [InlineData(false)] - public static void DefaultMemoryRetain(bool pin) - { - Memory<int> memory = default; - MemoryHandle handle = memory.Retain(pin: pin); - Assert.False(handle.HasPointer); - unsafe - { - Assert.True(handle.Pointer == null); - } - handle.Dispose(); - } } } |