diff options
| author | Eugen Wissner <belka@caraus.de> | 2019-03-21 14:54:16 +0100 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2019-03-21 14:54:16 +0100 |
| commit | a36b51f0c3c176d4107e7ea84a4c0dd51197b8dd (patch) | |
| tree | 3f5ea20e1b3c0b34b9f7b00932b9b73925a6c156 /middle | |
| parent | 0fe7308a229cfa9227ce372b57da3d046cce316e (diff) | |
| download | tanya-a36b51f0c3c176d4107e7ea84a4c0dd51197b8dd.tar.gz | |
Fix MmapPool private tests; move remaining tests
Diffstat (limited to 'middle')
| -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); +} |
