mirror of https://github.com/SixLabors/ImageSharp
5 changed files with 85 additions and 18 deletions
@ -0,0 +1,45 @@ |
|||||
|
// Copyright (c) Six Labors and contributors.
|
||||
|
// Licensed under the Apache License, Version 2.0.
|
||||
|
|
||||
|
using System; |
||||
|
using System.Runtime.InteropServices; |
||||
|
using Xunit; |
||||
|
|
||||
|
namespace SixLabors.Memory.Tests |
||||
|
{ |
||||
|
public class SimpleGcMemoryAllocatorTests |
||||
|
{ |
||||
|
public class BufferTests : BufferTestSuite |
||||
|
{ |
||||
|
public BufferTests() |
||||
|
: base(new SimpleGcMemoryAllocator()) |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
protected SimpleGcMemoryAllocator MemoryAllocator { get; } = new SimpleGcMemoryAllocator(); |
||||
|
|
||||
|
[Theory] |
||||
|
[InlineData(-1)] |
||||
|
[InlineData(int.MaxValue)] |
||||
|
public void Allocate_IncorrectAmount_ThrowsCorrect_ArgumentOutOfRangeException(int length) |
||||
|
{ |
||||
|
var ex = Assert.Throws<ArgumentOutOfRangeException>(() => this.MemoryAllocator.Allocate<BigStruct>( length)); |
||||
|
Assert.Equal("length", ex.ParamName); |
||||
|
} |
||||
|
|
||||
|
[Theory] |
||||
|
[InlineData(-1)] |
||||
|
[InlineData(int.MaxValue)] |
||||
|
public void AllocateManagedByteBuffer_IncorrectAmount_ThrowsCorrect_ArgumentOutOfRangeException(int length) |
||||
|
{ |
||||
|
var ex = Assert.Throws<ArgumentOutOfRangeException>(() => this.MemoryAllocator.AllocateManagedByteBuffer(length)); |
||||
|
Assert.Equal("length", ex.ParamName); |
||||
|
} |
||||
|
|
||||
|
[StructLayout(LayoutKind.Explicit, Size = 512)] |
||||
|
private struct BigStruct |
||||
|
{ |
||||
|
} |
||||
|
} |
||||
|
} |
||||
@ -1,16 +0,0 @@ |
|||||
// Copyright (c) Six Labors and contributors.
|
|
||||
// Licensed under the Apache License, Version 2.0.
|
|
||||
|
|
||||
namespace SixLabors.Memory.Tests |
|
||||
{ |
|
||||
public class SimpleGcMemoryManagerTests |
|
||||
{ |
|
||||
public class BufferTests : BufferTestSuite |
|
||||
{ |
|
||||
public BufferTests() |
|
||||
: base(new SimpleGcMemoryAllocator()) |
|
||||
{ |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
Loading…
Reference in new issue