From 88b52c971b43248e6ceacf1c8140a06427d0418d Mon Sep 17 00:00:00 2001 From: Morgan Deters Date: Fri, 5 Mar 2010 08:26:37 +0000 Subject: * public/private code untangled (smt/smt_engine.h no longer #includes expr/node.h). This removes the warnings we had during compilation, and heads off a number of potential linking errors due to improper inlining of private (library-only) stuff in client (out-of-library) code. * "configure" now takes some options as part of a "bare-option" build type (e.g., "./configure debug-coverage" or "./configure production-muzzle"). * split cdo.h, cdlist.h, cdmap.h, and cdset.h from context.h * split cdlist_black unit test from context_black * implement CDMap<>. * give ExprManagers ownership of the context (and have SmtEngine share that one) * fix main driver to properly report file-not-found * fix MemoryMappedInputBuffer class to report reasons for "errno"-returned system errors * src/expr/attribute.h: context-dependent attribute kinds now supported * test/unit/expr/node_white.h: context-dependent attribute tests * src/prop/cnf_conversion.h and associated parts of src/util/options.h and src/main/getopt.cpp: obsolete command-line option, removed. * src/util/Assert.h: assertions are now somewhat more useful (in debug builds, anyway) during stack unwinding. * test/unit/theory/theory_black.h: test context-dependent behavior of registerTerm() attribute for theories * src/expr/node_builder.h: formatting, fixes for arithmetic convenience node builders, check memory allocations * test/unit/expr/node_builder_black.h: add tessts for addition, subtraction, unary minus, and multiplication convenience node builders * src/expr/attribute.h: more comments * (various) code formatting, comment cleanup, added throws specifier to some destructors * contrib/code-checker: prototype perl script to test (some) code policy * contrib/indent-settings: command line for GNU indent to indent using CVC4 style (sort of; this is a work in progress) * COPYING: legal stuff * DESIGN_QUESTIONS: obsolete, removed --- test/unit/context/cdlist_black.h | 72 +++++++++++++++++++++++++++++++++++++++ test/unit/context/context_black.h | 45 +++++------------------- 2 files changed, 80 insertions(+), 37 deletions(-) create mode 100644 test/unit/context/cdlist_black.h (limited to 'test/unit/context') diff --git a/test/unit/context/cdlist_black.h b/test/unit/context/cdlist_black.h new file mode 100644 index 000000000..560c70722 --- /dev/null +++ b/test/unit/context/cdlist_black.h @@ -0,0 +1,72 @@ +/********************* */ +/** cdlist_black.h + ** Original author: dejan + ** Major contributors: none + ** Minor contributors (to current version): mdeters + ** This file is part of the CVC4 prototype. + ** Copyright (c) 2009, 2010 The Analysis of Computer Systems Group (ACSys) + ** Courant Institute of Mathematical Sciences + ** New York University + ** See the file COPYING in the top-level source directory for licensing + ** information. + ** + ** Black box testing of CVC4::context::CDList<>. + **/ + +#include + +#include +#include +#include "context/context.h" +#include "context/cdlist.h" + +using namespace std; +using namespace CVC4::context; + +class CDListBlack : public CxxTest::TestSuite { +private: + + Context* d_context; + +public: + + void setUp() { + d_context = new Context(); + } + + // test at different sizes. this triggers grow() behavior differently. + // grow() is completely broken in revision 256; fix forthcoming by Tim + void testCDList10() { listTest(10); } + void testCDList15() { listTest(15); } + void testCDList20() { listTest(20); } + void testCDList35() { listTest(35); } + void testCDList50() { listTest(50); } + void testCDList99() { listTest(99); } + + void listTest(int N) { + CDList list(d_context); + + TS_ASSERT(list.empty()); + for(int i = 0; i < N; ++i) { + TS_ASSERT(list.size() == i); + list.push_back(i); + TS_ASSERT(!list.empty()); + TS_ASSERT(list.back() == i); + int i2 = 0; + for(CDList::const_iterator j = list.begin(); + j != list.end(); + ++j) { + TS_ASSERT(*j == i2++); + } + } + TS_ASSERT(list.size() == N); + + for(int i = 0; i < N; ++i) { + TS_ASSERT(list[i] == i); + } + } + + void tearDown() { + delete d_context; + } +}; diff --git a/test/unit/context/context_black.h b/test/unit/context/context_black.h index 64ad2d7f7..f06ed9f42 100644 --- a/test/unit/context/context_black.h +++ b/test/unit/context/context_black.h @@ -10,17 +10,20 @@ ** See the file COPYING in the top-level source directory for licensing ** information. ** - ** Black box testing of CVC4::Node. + ** Black box testing of CVC4::context::Context. **/ #include -//Used in some of the tests #include #include #include "context/context.h" +#include "context/cdlist.h" +#include "context/cdo.h" +#include "util/Assert.h" using namespace std; +using namespace CVC4; using namespace CVC4::context; class ContextBlack : public CxxTest::TestSuite { @@ -31,7 +34,7 @@ private: public: void setUp() { - d_context = new Context(); + d_context = new Context; } void testIntCDO() { @@ -53,40 +56,8 @@ public: // the interface doesn't declare any exceptions d_context->push(); d_context->pop(); -// d_context->pop(); -// d_context->pop(); - } - - // test at different sizes. this triggers grow() behavior differently. - // grow() is completely broken in revision 256; fix forthcoming by Tim - void testCDList10() { listTest(10); } - void testCDList15() { listTest(15); } - void testCDList20() { listTest(20); } - void testCDList35() { listTest(35); } - void testCDList50() { listTest(50); } - void testCDList99() { listTest(99); } - - void listTest(int N) { - CDList list(d_context); - - TS_ASSERT(list.empty()); - for(int i = 0; i < N; ++i) { - TS_ASSERT(list.size() == i); - list.push_back(i); - TS_ASSERT(!list.empty()); - TS_ASSERT(list.back() == i); - int i2 = 0; - for(CDList::const_iterator j = list.begin(); - j != list.end(); - ++j) { - TS_ASSERT(*j == i2++); - } - } - TS_ASSERT(list.size() == N); - - for(int i = 0; i < N; ++i) { - TS_ASSERT(list[i] == i); - } + TS_ASSERT_THROWS( d_context->pop(), AssertionException ); + TS_ASSERT_THROWS( d_context->pop(), AssertionException ); } void tearDown() { -- cgit v1.2.3