From a36b51f0c3c176d4107e7ea84a4c0dd51197b8dd Mon Sep 17 00:00:00 2001 From: Eugen Wissner Date: Thu, 21 Mar 2019 14:54:16 +0100 Subject: Fix MmapPool private tests; move remaining tests --- middle/tanya/memory/mmappool.d | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'middle') 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); +} -- cgit v1.2.3