diff options
author | Morgan Deters <mdeters@gmail.com> | 2010-04-14 06:21:26 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2010-04-14 06:21:26 +0000 |
commit | 7c83d004874a46efe36d58717f7a4d72553b3693 (patch) | |
tree | 40fdb91a99c0ea0a9e4ce884126c0f572959a003 /test/unit/context | |
parent | 12a8a7f9a90e45e8313f26af527a52e6dda943d3 (diff) |
* Better dependency tracking for unit test building and linking, and
auto-generated headers (metakind.h etc.), so they don't have to be
recompiled every time. This drastically improves build time when
only small updates are made.
* Added "memory.h" unit test header for checking out-of-memory
conditions. cdlist_black uses it.
* Added helpful output when you "make lcov" in a non-coverage-enabled
build.
* Removed strict aliasing warning when compiling metakind.h header
with optimization on.
* Removed const version of NodeBuilder::operator Node()---it was
poorly performing, better to not permit it---and fixed the
convenience builders to use the non-const version
(re: code review #63)
* Color-coded test output on capable terminals.
* Fixed some warnings in unit tests.
Diffstat (limited to 'test/unit/context')
-rw-r--r-- | test/unit/context/cdlist_black.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/test/unit/context/cdlist_black.h b/test/unit/context/cdlist_black.h index 418357630..bcc95b470 100644 --- a/test/unit/context/cdlist_black.h +++ b/test/unit/context/cdlist_black.h @@ -17,12 +17,17 @@ #include <vector> #include <iostream> + +#include <limits.h> + +#include "memory.h" + #include "context/context.h" #include "context/cdlist.h" using namespace std; using namespace CVC4::context; - +using namespace CVC4::test; struct DtorSensitiveObject { bool& d_dtorCalled; @@ -30,7 +35,6 @@ struct DtorSensitiveObject { ~DtorSensitiveObject() { d_dtorCalled = true; } }; - class CDListBlack : public CxxTest::TestSuite { private: @@ -125,4 +129,17 @@ public: TS_ASSERT_EQUALS(shouldAlsoRemainFalse, false); TS_ASSERT_EQUALS(aThirdFalse, false); } + + void testOutOfMemory() { + CDList<unsigned> list(d_context); + WithLimitedMemory wlm(0); + + TS_ASSERT_THROWS({ + // We cap it at UINT_MAX, preferring to terminate with a + // failure than run indefinitely. + for(unsigned i = 0; i < UINT_MAX; ++i) { + list.push_back(i); + } + }, bad_alloc); + } }; |