diff options
author | Morgan Deters <mdeters@cs.nyu.edu> | 2013-02-04 18:11:09 -0500 |
---|---|---|
committer | Morgan Deters <mdeters@cs.nyu.edu> | 2013-02-04 18:11:09 -0500 |
commit | ef0e079d85b18fd36b4d90be15b465e2316a38c9 (patch) | |
tree | 21f9e41c1ca44dd3dfd13846032c9316ec6dd47c /test | |
parent | 00514e3804ebde7053ba095c678625a9035dc5e3 (diff) |
Fix NodeBuilder bug which could attempt to allocate beyond hard limit
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/expr/node_manager_white.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/unit/expr/node_manager_white.h b/test/unit/expr/node_manager_white.h index 3be95ad87..57fb8f445 100644 --- a/test/unit/expr/node_manager_white.h +++ b/test/unit/expr/node_manager_white.h @@ -54,4 +54,23 @@ public: Node m = d_nm->mkConst(i); TS_ASSERT_EQUALS(n.getId(), m.getId()); } + + void testOversizedNodeBuilder() { + NodeBuilder<> nb; + + TS_ASSERT_THROWS_NOTHING(nb.realloc(15)); + TS_ASSERT_THROWS_NOTHING(nb.realloc(25)); + TS_ASSERT_THROWS_NOTHING(nb.realloc(256)); +#ifdef CVC4_ASSERTIONS + TS_ASSERT_THROWS(nb.realloc(100), AssertionException); +#endif /* CVC4_ASSERTIONS */ + TS_ASSERT_THROWS_NOTHING(nb.realloc(257)); + TS_ASSERT_THROWS_NOTHING(nb.realloc(4000)); + TS_ASSERT_THROWS_NOTHING(nb.realloc(20000)); + TS_ASSERT_THROWS_NOTHING(nb.realloc(60000)); + TS_ASSERT_THROWS_NOTHING(nb.realloc(65535)); +#ifdef CVC4_ASSERTIONS + TS_ASSERT_THROWS(nb.realloc(65536), AssertionException); +#endif /* CVC4_ASSERTIONS */ + } }; |