diff options
| author | Eugen Wissner <belka@caraus.de> | 2017-06-15 10:37:50 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2017-06-15 10:37:50 +0200 |
| commit | 3789853d989476c72357ad3c414aeae8c0c96e1b (patch) | |
| tree | 0dd08779342be0847caa983379ab8b7cfbcee7d9 | |
| parent | f0d016bcde823ab65e29028dd4b82ad2de41baff (diff) | |
| download | tanya-3789853d989476c72357ad3c414aeae8c0c96e1b.tar.gz | |
Fix one Mallocator test
Test that if the reallocation fails, the pointer doesn't change.
| -rw-r--r-- | source/tanya/memory/mallocator.d | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/source/tanya/memory/mallocator.d b/source/tanya/memory/mallocator.d index 9e0f5fb..0c86e9d 100644 --- a/source/tanya/memory/mallocator.d +++ b/source/tanya/memory/mallocator.d @@ -154,8 +154,11 @@ final class Mallocator : Allocator // Fails with false. private @nogc nothrow unittest { - void[] p; + void[] p = Mallocator.instance.allocate(20); + void[] oldP = p; assert(!Mallocator.instance.reallocate(p, size_t.max - Mallocator.psize * 2)); + assert(oldP is p); + Mallocator.instance.deallocate(p); } /** |
