summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMorgan Deters <mdeters@gmail.com>2011-03-25 05:20:56 +0000
committerMorgan Deters <mdeters@gmail.com>2011-03-25 05:20:56 +0000
commitee36b95b8f722fe6501cc6ac635efd49ca673791 (patch)
treeb6149a6b843b26b65db788d0cf3215dd68d53e79 /test
parent33239a85e160bcbdfa23b44e316065166e361af8 (diff)
Fix for a bug Andrew Reynolds found for iterators that affects empty CDList<> objects that allocate from ContextMemoryAllocator<>. Iterators were broken in that begin() != end() for empty lists (again---only those that allocated space from ContextMemoryAllocator<>). Added a unit test for this, too. Thanks Andy!
Diffstat (limited to 'test')
-rw-r--r--test/unit/context/cdlist_black.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/context/cdlist_black.h b/test/unit/context/cdlist_black.h
index aa25ba9eb..6541973bf 100644
--- a/test/unit/context/cdlist_black.h
+++ b/test/unit/context/cdlist_black.h
@@ -25,12 +25,15 @@
#include "memory.h"
+#include "util/exception.h"
#include "context/context.h"
#include "context/cdlist.h"
+#include "context/cdlist_context_memory.h"
using namespace std;
using namespace CVC4::context;
using namespace CVC4::test;
+using namespace CVC4;
struct DtorSensitiveObject {
bool& d_dtorCalled;
@@ -133,6 +136,17 @@ public:
TS_ASSERT_EQUALS(aThirdFalse, false);
}
+ void testEmptyIterators() {
+ CDList<int>* list1 = new(true) CDList<int>(d_context);
+ CDList< int, ContextMemoryAllocator<int> >* list2 =
+ new(d_context->getCMM())
+ CDList< int, ContextMemoryAllocator<int> >(true, d_context, false,
+ ContextMemoryAllocator<int>(d_context->getCMM()));
+ TS_ASSERT_EQUALS(list1->begin(), list1->end());
+ TS_ASSERT_EQUALS(list2->begin(), list2->end());
+ list1->deleteSelf();
+ }
+
/* setrlimit() totally broken on Mac OS X */
void testOutOfMemory() {
#ifdef __APPLE__
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback