diff options
Diffstat (limited to 'middle/tanya/memory/mmappool.d')
| -rw-r--r-- | middle/tanya/memory/mmappool.d | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/middle/tanya/memory/mmappool.d b/middle/tanya/memory/mmappool.d index 05f71c6..b6cd7d0 100644 --- a/middle/tanya/memory/mmappool.d +++ b/middle/tanya/memory/mmappool.d @@ -501,3 +501,20 @@ final class MmapPool : Allocator } private alias Block = shared BlockEntry*; } + +@nogc nothrow pure @system unittest +{ + // allocate() check. + size_t tooMuchMemory = size_t.max + - MmapPool.alignment_ + - BlockEntry.sizeof * 2 + - RegionEntry.sizeof + - pageSize; + assert(MmapPool.instance.allocate(tooMuchMemory) is null); + + assert(MmapPool.instance.allocate(size_t.max) is null); + + // initializeRegion() check. + tooMuchMemory = size_t.max - MmapPool.alignment_; + assert(MmapPool.instance.allocate(tooMuchMemory) is null); +} |
