From b5d3f907b61d838325e4ee8a2c80d36fea438537 Mon Sep 17 00:00:00 2001 From: Andreas Stöckel Date: Thu, 11 Dec 2014 02:02:39 +0100 Subject: added assertion to Buffer class which makes sure that all cursors are marked as free (just to be sure), adapted Buffer unit tests accordingly --- src/core/utils/CharReader.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/core/utils/CharReader.cpp') diff --git a/src/core/utils/CharReader.cpp b/src/core/utils/CharReader.cpp index c661b6f..61616d7 100644 --- a/src/core/utils/CharReader.cpp +++ b/src/core/utils/CharReader.cpp @@ -17,6 +17,7 @@ */ #include +#include #include #include @@ -80,6 +81,16 @@ Buffer::Buffer(const std::string &str) startBucket = buckets.begin(); } +#ifndef NDEBUG +Buffer::~Buffer() +{ + // Make sure all cursors have been deleted + for (bool cursor_alive: alive) { + assert(!cursor_alive); + } +} +#endif + void Buffer::advance(BucketIterator &it) { it++; -- cgit v1.2.3