diff options
author | Tim King <taking@google.com> | 2017-07-14 16:56:11 -0700 |
---|---|---|
committer | Tim King <taking@cs.nyu.edu> | 2017-07-19 18:25:13 -0700 |
commit | d70a63324c95210f1d78c2efc46395d2369d2e2b (patch) | |
tree | 5f1ce222cb3940eb427e3c80544b405479ac02ab /test/unit/expr | |
parent | 7fd11d0df4c257a916e93c3f44238f1d3f70f721 (diff) |
Removing the unused CDAttribute. This makes CDHashMap::obliterate unused. Removing it as well.
Diffstat (limited to 'test/unit/expr')
-rw-r--r-- | test/unit/expr/attribute_black.h | 60 | ||||
-rw-r--r-- | test/unit/expr/attribute_white.h | 137 |
2 files changed, 0 insertions, 197 deletions
diff --git a/test/unit/expr/attribute_black.h b/test/unit/expr/attribute_black.h index d919bcbe3..d3f043f36 100644 --- a/test/unit/expr/attribute_black.h +++ b/test/unit/expr/attribute_black.h @@ -88,10 +88,7 @@ public: } struct PrimitiveIntAttributeId {}; - struct CDPrimitiveIntAttributeId {}; - typedef expr::Attribute<PrimitiveIntAttributeId,uint64_t> PrimitiveIntAttribute; - typedef expr::CDAttribute<CDPrimitiveIntAttributeId,uint64_t> CDPrimitiveIntAttribute; void testInts(){ TypeNode booleanType = d_nodeManager->booleanType(); Node* node = new Node(d_nodeManager->mkSkolem("b", booleanType)); @@ -105,21 +102,12 @@ public: TS_ASSERT(node->getAttribute(attr, data1)); TS_ASSERT_EQUALS(data1, val); - uint64_t data2 = 0; - uint64_t data3 = 0; - CDPrimitiveIntAttribute cdattr; - TS_ASSERT(!node->getAttribute(cdattr, data2)); - node->setAttribute(cdattr, val); - TS_ASSERT(node->getAttribute(cdattr, data3)); - TS_ASSERT_EQUALS(data3, val); delete node; } struct TNodeAttributeId {}; - struct CDTNodeAttributeId {}; typedef expr::Attribute<TNodeAttributeId, TNode> TNodeAttribute; - typedef expr::CDAttribute<CDTNodeAttributeId, TNode> CDTNodeAttribute; void testTNodes(){ TypeNode booleanType = d_nodeManager->booleanType(); Node* node = new Node(d_nodeManager->mkSkolem("b", booleanType)); @@ -134,13 +122,6 @@ public: TS_ASSERT(node->getAttribute(attr, data1)); TS_ASSERT_EQUALS(data1, val); - TNode data2; - TNode data3; - CDTNodeAttribute cdattr; - TS_ASSERT(!node->getAttribute(cdattr, data2)); - node->setAttribute(cdattr, val); - TS_ASSERT(node->getAttribute(cdattr, data3)); - TS_ASSERT_EQUALS(data3, val); delete node; } @@ -152,10 +133,8 @@ public: }; struct PtrAttributeId {}; - struct CDPtrAttributeId {}; typedef expr::Attribute<PtrAttributeId, Foo*> PtrAttribute; - typedef expr::CDAttribute<CDPtrAttributeId, Foo*> CDPtrAttribute; void testPtrs(){ TypeNode booleanType = d_nodeManager->booleanType(); Node* node = new Node(d_nodeManager->mkSkolem("b", booleanType)); @@ -170,25 +149,14 @@ public: TS_ASSERT(node->getAttribute(attr, data1)); TS_ASSERT_EQUALS(data1, val); - Foo* data2 = NULL; - Foo* data3 = NULL; - CDPtrAttribute cdattr; - TS_ASSERT(!node->getAttribute(cdattr, data2)); - node->setAttribute(cdattr, val); - TS_ASSERT(node->getAttribute(cdattr, data3)); - TS_ASSERT(data3 != NULL); - TS_ASSERT_EQUALS(63489, data3->getBar()); - TS_ASSERT_EQUALS(data3, val); delete node; delete val; } struct ConstPtrAttributeId {}; - struct CDConstPtrAttributeId {}; typedef expr::Attribute<ConstPtrAttributeId, const Foo*> ConstPtrAttribute; - typedef expr::CDAttribute<CDConstPtrAttributeId, const Foo*> CDConstPtrAttribute; void testConstPtrs(){ TypeNode booleanType = d_nodeManager->booleanType(); Node* node = new Node(d_nodeManager->mkSkolem("b", booleanType)); @@ -203,22 +171,12 @@ public: TS_ASSERT(node->getAttribute(attr, data1)); TS_ASSERT_EQUALS(data1, val); - const Foo* data2 = NULL; - const Foo* data3 = NULL; - CDConstPtrAttribute cdattr; - TS_ASSERT(!node->getAttribute(cdattr, data2)); - node->setAttribute(cdattr, val); - TS_ASSERT(node->getAttribute(cdattr, data3)); - TS_ASSERT_EQUALS(data3, val); delete node; delete val; } struct StringAttributeId {}; - struct CDStringAttributeId {}; - typedef expr::Attribute<StringAttributeId, std::string> StringAttribute; - typedef expr::CDAttribute<CDStringAttributeId, std::string> CDStringAttribute; void testStrings(){ TypeNode booleanType = d_nodeManager->booleanType(); Node* node = new Node(d_nodeManager->mkSkolem("b", booleanType)); @@ -233,21 +191,11 @@ public: TS_ASSERT(node->getAttribute(attr, data1)); TS_ASSERT_EQUALS(data1, val); - std::string data2; - std::string data3; - CDStringAttribute cdattr; - TS_ASSERT(!node->getAttribute(cdattr, data2)); - node->setAttribute(cdattr, val); - TS_ASSERT(node->getAttribute(cdattr, data3)); - TS_ASSERT_EQUALS(data3, val); delete node; } struct BoolAttributeId {}; - struct CDBoolAttributeId {}; - typedef expr::Attribute<BoolAttributeId, bool> BoolAttribute; - typedef expr::CDAttribute<CDBoolAttributeId, bool> CDBoolAttribute; void testBools(){ TypeNode booleanType = d_nodeManager->booleanType(); Node* node = new Node(d_nodeManager->mkSkolem("b", booleanType)); @@ -263,14 +211,6 @@ public: TS_ASSERT(node->getAttribute(attr, data1)); TS_ASSERT_EQUALS(data1, val); - bool data2 = false; - bool data3 = false; - CDBoolAttribute cdattr; - TS_ASSERT(node->getAttribute(cdattr, data2)); - TS_ASSERT_EQUALS(false, data2); - node->setAttribute(cdattr, val); - TS_ASSERT(node->getAttribute(cdattr, data3)); - TS_ASSERT_EQUALS(data3, val); delete node; } diff --git a/test/unit/expr/attribute_white.h b/test/unit/expr/attribute_white.h index e4786b8e3..60a83b5c7 100644 --- a/test/unit/expr/attribute_white.h +++ b/test/unit/expr/attribute_white.h @@ -47,18 +47,12 @@ struct Test5; typedef Attribute<Test1, std::string> TestStringAttr1; typedef Attribute<Test2, std::string> TestStringAttr2; -// it would be nice to have CDAttribute<> for context-dependence -typedef CDAttribute<Test1, bool> TestCDFlag; - typedef Attribute<Test1, bool> TestFlag1; typedef Attribute<Test2, bool> TestFlag2; typedef Attribute<Test3, bool> TestFlag3; typedef Attribute<Test4, bool> TestFlag4; typedef Attribute<Test5, bool> TestFlag5; -typedef CDAttribute<Test1, bool> TestFlag1cd; -typedef CDAttribute<Test2, bool> TestFlag2cd; - class AttributeWhite : public CxxTest::TestSuite { ExprManager* d_em; @@ -127,11 +121,6 @@ public: TS_ASSERT_DIFFERS(TestFlag4::s_id, TestFlag5::s_id); lastId = attr::LastAttributeId<bool, true>::getId(); - TS_ASSERT_LESS_THAN(TestFlag1cd::s_id, lastId); - TS_ASSERT_LESS_THAN(TestFlag2cd::s_id, lastId); - TS_ASSERT_DIFFERS(TestFlag1cd::s_id, TestFlag2cd::s_id); - cout << "1: " << TestFlag1cd::s_id << endl; - cout << "2: " << TestFlag2cd::s_id << endl; lastId = attr::LastAttributeId<Node, false>::getId(); // TS_ASSERT_LESS_THAN(theory::PreRewriteCache::s_id, lastId); @@ -149,132 +138,6 @@ public: TS_ASSERT_LESS_THAN(TypeAttr::s_id, lastId); } - void testCDAttributes() { - //Debug.on("cdboolattr"); - - Node a = d_nm->mkVar(*d_booleanType); - Node b = d_nm->mkVar(*d_booleanType); - Node c = d_nm->mkVar(*d_booleanType); - - Debug("cdboolattr") << "get flag 1 on a (should be F)\n"; - TS_ASSERT(! a.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on b (should be F)\n"; - TS_ASSERT(! b.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on c (should be F)\n"; - TS_ASSERT(! c.getAttribute(TestFlag1cd())); - - d_smtEngine->push(); // level 1 - - // test that all boolean flags are FALSE to start - Debug("cdboolattr") << "get flag 1 on a (should be F)\n"; - TS_ASSERT(! a.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on b (should be F)\n"; - TS_ASSERT(! b.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on c (should be F)\n"; - TS_ASSERT(! c.getAttribute(TestFlag1cd())); - - // test that they all HAVE the boolean attributes - TS_ASSERT(a.hasAttribute(TestFlag1cd())); - TS_ASSERT(b.hasAttribute(TestFlag1cd())); - TS_ASSERT(c.hasAttribute(TestFlag1cd())); - - // test two-arg version of hasAttribute() - bool bb = false; - Debug("cdboolattr") << "get flag 1 on a (should be F)\n"; - TS_ASSERT(a.getAttribute(TestFlag1cd(), bb)); - TS_ASSERT(! bb); - Debug("cdboolattr") << "get flag 1 on b (should be F)\n"; - TS_ASSERT(b.getAttribute(TestFlag1cd(), bb)); - TS_ASSERT(! bb); - Debug("cdboolattr") << "get flag 1 on c (should be F)\n"; - TS_ASSERT(c.getAttribute(TestFlag1cd(), bb)); - TS_ASSERT(! bb); - - // setting boolean flags - Debug("cdboolattr") << "set flag 1 on a to T\n"; - a.setAttribute(TestFlag1cd(), true); - Debug("cdboolattr") << "set flag 1 on b to F\n"; - b.setAttribute(TestFlag1cd(), false); - Debug("cdboolattr") << "set flag 1 on c to F\n"; - c.setAttribute(TestFlag1cd(), false); - - Debug("cdboolattr") << "get flag 1 on a (should be T)\n"; - TS_ASSERT(a.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on b (should be F)\n"; - TS_ASSERT(! b.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on c (should be F)\n"; - TS_ASSERT(! c.getAttribute(TestFlag1cd())); - - d_smtEngine->push(); // level 2 - - Debug("cdboolattr") << "get flag 1 on a (should be T)\n"; - TS_ASSERT(a.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on b (should be F)\n"; - TS_ASSERT(! b.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on c (should be F)\n"; - TS_ASSERT(! c.getAttribute(TestFlag1cd())); - - Debug("cdboolattr") << "set flag 1 on a to F\n"; - a.setAttribute(TestFlag1cd(), false); - Debug("cdboolattr") << "set flag 1 on b to T\n"; - b.setAttribute(TestFlag1cd(), true); - - Debug("cdboolattr") << "get flag 1 on a (should be F)\n"; - TS_ASSERT(! a.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on b (should be T)\n"; - TS_ASSERT(b.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on c (should be F)\n"; - TS_ASSERT(! c.getAttribute(TestFlag1cd())); - - d_smtEngine->push(); // level 3 - - Debug("cdboolattr") << "get flag 1 on a (should be F)\n"; - TS_ASSERT(! a.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on b (should be T)\n"; - TS_ASSERT(b.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on c (should be F)\n"; - TS_ASSERT(! c.getAttribute(TestFlag1cd())); - - Debug("cdboolattr") << "set flag 1 on c to T\n"; - c.setAttribute(TestFlag1cd(), true); - - Debug("cdboolattr") << "get flag 1 on a (should be F)\n"; - TS_ASSERT(! a.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on b (should be T)\n"; - TS_ASSERT(b.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on c (should be T)\n"; - TS_ASSERT(c.getAttribute(TestFlag1cd())); - - d_smtEngine->pop(); // level 2 - - Debug("cdboolattr") << "get flag 1 on a (should be F)\n"; - TS_ASSERT(! a.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on b (should be T)\n"; - TS_ASSERT(b.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on c (should be F)\n"; - TS_ASSERT(! c.getAttribute(TestFlag1cd())); - - d_smtEngine->pop(); // level 1 - - Debug("cdboolattr") << "get flag 1 on a (should be T)\n"; - TS_ASSERT(a.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on b (should be F)\n"; - TS_ASSERT(! b.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on c (should be F)\n"; - TS_ASSERT(! c.getAttribute(TestFlag1cd())); - - d_smtEngine->pop(); // level 0 - - Debug("cdboolattr") << "get flag 1 on a (should be F)\n"; - TS_ASSERT(! a.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on b (should be F)\n"; - TS_ASSERT(! b.getAttribute(TestFlag1cd())); - Debug("cdboolattr") << "get flag 1 on c (should be F)\n"; - TS_ASSERT(! c.getAttribute(TestFlag1cd())); - - TS_ASSERT_THROWS( d_smtEngine->pop(), ModalException ); - } - void testAttributes() { //Debug.on("boolattr"); |