summaryrefslogtreecommitdiff
path: root/test/unit/expr
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/expr')
-rw-r--r--test/unit/expr/node_black.h4
-rw-r--r--test/unit/expr/node_self_iterator_black.h81
2 files changed, 83 insertions, 2 deletions
diff --git a/test/unit/expr/node_black.h b/test/unit/expr/node_black.h
index 6c5d8888f..5389e1308 100644
--- a/test/unit/expr/node_black.h
+++ b/test/unit/expr/node_black.h
@@ -39,8 +39,8 @@ private:
Context* d_ctxt;
NodeManager* d_nodeManager;
NodeManagerScope* d_scope;
- TypeNode *d_booleanType;
- TypeNode *d_realType;
+ TypeNode* d_booleanType;
+ TypeNode* d_realType;
public:
diff --git a/test/unit/expr/node_self_iterator_black.h b/test/unit/expr/node_self_iterator_black.h
new file mode 100644
index 000000000..5627a9db5
--- /dev/null
+++ b/test/unit/expr/node_self_iterator_black.h
@@ -0,0 +1,81 @@
+/********************* */
+/*! \file node_self_iterator_black.h
+ ** \verbatim
+ ** Original author: mdeters
+ ** Major contributors: none
+ ** Minor contributors (to current version): none
+ ** 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.\endverbatim
+ **
+ ** \brief Black box testing of CVC4::expr::NodeSelfIterator
+ **
+ ** Black box testing of CVC4::expr::NodeSelfIterator
+ **/
+
+#include <cxxtest/TestSuite.h>
+
+#include "context/context.h"
+#include "expr/node.h"
+#include "expr/node_self_iterator.h"
+#include "expr/node_builder.h"
+#include "expr/convenience_node_builders.h"
+
+using namespace CVC4;
+using namespace CVC4::context;
+using namespace CVC4::kind;
+using namespace CVC4::expr;
+using namespace std;
+
+class NodeSelfIteratorBlack : public CxxTest::TestSuite {
+private:
+
+ Context* d_ctxt;
+ NodeManager* d_nodeManager;
+ NodeManagerScope* d_scope;
+ TypeNode* d_booleanType;
+ TypeNode* d_realType;
+
+public:
+
+ void setUp() {
+ d_ctxt = new Context;
+ d_nodeManager = new NodeManager(d_ctxt);
+ d_scope = new NodeManagerScope(d_nodeManager);
+ d_booleanType = new TypeNode(d_nodeManager->booleanType());
+ d_realType = new TypeNode(d_nodeManager->realType());
+ }
+
+ void tearDown() {
+ delete d_booleanType;
+ delete d_scope;
+ delete d_nodeManager;
+ delete d_ctxt;
+ }
+
+ void testSelfIteration() {
+ Node x = d_nodeManager->mkVar("x", *d_booleanType);
+ Node y = d_nodeManager->mkVar("y", *d_booleanType);
+ Node x_and_y = x && y;
+ NodeSelfIterator i = x_and_y, j = NodeSelfIterator::self(x_and_y);
+ TS_ASSERT(i != x_and_y.end());
+ TS_ASSERT(j != x_and_y.end());
+ TS_ASSERT(*i == x_and_y);
+ TS_ASSERT(*j == x_and_y);
+ TS_ASSERT(*i++ == x_and_y);
+ TS_ASSERT(*j++ == x_and_y);
+ TS_ASSERT(i == NodeSelfIterator::selfEnd(x_and_y));
+ TS_ASSERT(j == NodeSelfIterator::selfEnd(x_and_y));
+ TS_ASSERT(i == x_and_y.end());
+ TS_ASSERT(j == x_and_y.end());
+ i = x_and_y.begin();
+ TS_ASSERT(i != x_and_y.end());
+ TS_ASSERT(*i == x);
+ TS_ASSERT(*++i == y);
+ TS_ASSERT(++i == x_and_y.end());
+ }
+
+};
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback