Fix MmapPool private tests; move remaining tests

This commit is contained in:
2019-03-21 14:54:16 +01:00
parent 0fe7308a22
commit a36b51f0c3
11 changed files with 801 additions and 751 deletions

View File

@ -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);
}