summaryrefslogtreecommitdiff
path: root/test/unit/expr/node_black.h
diff options
context:
space:
mode:
authorDejan Jovanović <dejan.jovanovic@gmail.com>2010-04-14 19:06:53 +0000
committerDejan Jovanović <dejan.jovanovic@gmail.com>2010-04-14 19:06:53 +0000
commitf8ca588548491146fffbf22b2e9082986504211c (patch)
tree980553ffdb2b275a1e203c6e87743a01d1d5e5bc /test/unit/expr/node_black.h
parent7c83d004874a46efe36d58717f7a4d72553b3693 (diff)
Marging from types 404:415, changes: Massive
* Types are now represented as nodes in the attribute table and are managed, i.e. you can say Type booleanType = d_nodeManager->booleanType(); Type t = d_nodeManager->mkFunctionType(booleanType, booleanType); FunctionType ft = (FunctionType)t; Assert(ft.getArgTypes()[0], booleanType); * The attributes now have a table for Nodes and a table for TNodes (both should be used with caution) * Changes the way nodes are extracted from NodeBuilder, added several methods to extract a Node, NodeValue, or Node*, with corresponding methods for extraction * Used the above in the construction of Expr and Type objects * The NodeManager now destroys the attributes in the destructor by pausing the garbage collection * To achive destruction a flag d_inDesctruction has been added to loosen the assertion in NodeValue::dec() (there might be -refcount TNodes leftover) * Beginnings of the Bitvector constants using GMP Not yet in tiptop phase, needs more documentation, and Types should be pulled out to TypeNodes eventually. Also, the types are currently defined in the builting_kinds, and I need to add these to the theory specific definitions with special 'type' constructs. I hate branching and merging.
Diffstat (limited to 'test/unit/expr/node_black.h')
-rw-r--r--test/unit/expr/node_black.h40
1 files changed, 20 insertions, 20 deletions
diff --git a/test/unit/expr/node_black.h b/test/unit/expr/node_black.h
index 23d1daf4e..6469806d6 100644
--- a/test/unit/expr/node_black.h
+++ b/test/unit/expr/node_black.h
@@ -36,7 +36,7 @@ private:
Context* d_ctxt;
NodeManager* d_nodeManager;
NodeManagerScope* d_scope;
- Type* d_booleanType;
+ Type *d_booleanType;
public:
@@ -44,11 +44,11 @@ public:
d_ctxt = new Context;
d_nodeManager = new NodeManager(d_ctxt);
d_scope = new NodeManagerScope(d_nodeManager);
-
- d_booleanType = d_nodeManager->booleanType();
+ d_booleanType = new Type(d_nodeManager->booleanType());
}
void tearDown() {
+ delete d_booleanType;
delete d_scope;
delete d_nodeManager;
delete d_ctxt;
@@ -97,12 +97,12 @@ public:
void testOperatorEquals() {
Node a, b, c;
- b = d_nodeManager->mkVar(d_booleanType);
+ b = d_nodeManager->mkVar(*d_booleanType);
a = b;
c = a;
- Node d = d_nodeManager->mkVar(d_booleanType);
+ Node d = d_nodeManager->mkVar(*d_booleanType);
TS_ASSERT(a==a);
TS_ASSERT(a==b);
@@ -137,12 +137,12 @@ public:
Node a, b, c;
- b = d_nodeManager->mkVar(d_booleanType);
+ b = d_nodeManager->mkVar(*d_booleanType);
a = b;
c = a;
- Node d = d_nodeManager->mkVar(d_booleanType);
+ Node d = d_nodeManager->mkVar(*d_booleanType);
/*structed assuming operator == works */
TS_ASSERT(iff(a!=a, !(a==a)));
@@ -199,7 +199,7 @@ public:
/*tests: Node& operator=(const Node&); */
void testOperatorAssign() {
Node a, b;
- Node c = d_nodeManager->mkNode(NOT, d_nodeManager->mkVar(d_booleanType));
+ Node c = d_nodeManager->mkNode(NOT, d_nodeManager->mkVar(*d_booleanType));
b = c;
TS_ASSERT(b==c);
@@ -320,8 +320,8 @@ public:
void testIteNode() {
/*Node iteNode(const Node& thenpart, const Node& elsepart) const;*/
- Node a = d_nodeManager->mkVar(d_booleanType);
- Node b = d_nodeManager->mkVar(d_booleanType);
+ Node a = d_nodeManager->mkVar(*d_booleanType);
+ Node b = d_nodeManager->mkVar(*d_booleanType);
Node cnd = d_nodeManager->mkNode(PLUS, a, b);
Node thenBranch = d_nodeManager->mkConst(true);
@@ -383,8 +383,8 @@ public:
void testGetKind() {
/*inline Kind getKind() const; */
- Node a = d_nodeManager->mkVar(d_booleanType);
- Node b = d_nodeManager->mkVar(d_booleanType);
+ Node a = d_nodeManager->mkVar(*d_booleanType);
+ Node b = d_nodeManager->mkVar(*d_booleanType);
Node n = d_nodeManager->mkNode(NOT, a);
TS_ASSERT(NOT == n.getKind());
@@ -400,9 +400,9 @@ public:
}
void testGetOperator() {
- Type* sort = d_nodeManager->mkSort("T");
- Type* booleanType = d_nodeManager->booleanType();
- Type* predType = d_nodeManager->mkFunctionType(sort, booleanType);
+ Type sort = d_nodeManager->mkSort("T");
+ Type booleanType = d_nodeManager->booleanType();
+ Type predType = d_nodeManager->mkFunctionType(sort, booleanType);
Node f = d_nodeManager->mkVar(predType);
Node a = d_nodeManager->mkVar(booleanType);
@@ -466,9 +466,9 @@ public:
void testIterator() {
NodeBuilder<> b;
- Node x = d_nodeManager->mkVar(d_booleanType);
- Node y = d_nodeManager->mkVar(d_booleanType);
- Node z = d_nodeManager->mkVar(d_booleanType);
+ Node x = d_nodeManager->mkVar(*d_booleanType);
+ Node y = d_nodeManager->mkVar(*d_booleanType);
+ Node z = d_nodeManager->mkVar(*d_booleanType);
Node n = b << x << y << z << kind::AND;
{ // iterator
@@ -490,7 +490,7 @@ public:
}
void testToString() {
- Type* booleanType = d_nodeManager->booleanType();
+ Type booleanType = d_nodeManager->booleanType();
Node w = d_nodeManager->mkVar("w",booleanType);
Node x = d_nodeManager->mkVar("x",booleanType);
@@ -503,7 +503,7 @@ public:
}
void testToStream() {
- Type* booleanType = d_nodeManager->booleanType();
+ Type booleanType = d_nodeManager->booleanType();
Node w = d_nodeManager->mkVar("w",booleanType);
Node x = d_nodeManager->mkVar("x",booleanType);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback