diff options
author | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2014-12-11 02:02:39 +0100 |
---|---|---|
committer | Andreas Stöckel <astoecke@techfak.uni-bielefeld.de> | 2014-12-11 02:02:39 +0100 |
commit | b5d3f907b61d838325e4ee8a2c80d36fea438537 (patch) | |
tree | af447337ee46e2142beb2e440117bacbd81b2251 /src/core/utils/CharReader.cpp | |
parent | 7b7c34011150c4db92220924d02e7e70eda3a8a7 (diff) |
added assertion to Buffer class which makes sure that all cursors are marked as free (just to be sure), adapted Buffer unit tests accordingly
Diffstat (limited to 'src/core/utils/CharReader.cpp')
-rw-r--r-- | src/core/utils/CharReader.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
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 <algorithm> +#include <cassert> #include <limits> #include <sstream> @@ -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++; |