Debug("groundterms") << "ground term of " << colorsType.getDatatype().getName() << endl
<< " is " << colorsType.mkGroundTerm() << endl;
TS_ASSERT(colorsType.mkGroundTerm().getType() == colorsType);
- // all ctors should be well-founded too
- for(Datatype::const_iterator i = colorsType.getDatatype().begin(),
- i_end = colorsType.getDatatype().end();
- i != i_end;
- ++i) {
- TS_ASSERT((*i).isWellFounded());
- Debug("groundterms") << "ground term of " << *i << endl
- << " is " << (*i).mkGroundTerm( colorsType ) << endl;
- TS_ASSERT((*i).mkGroundTerm( colorsType ).getType() == colorsType);
- }
}
void testNat() {
Debug("groundterms") << "ground term of " << natType.getDatatype().getName() << endl
<< " is " << natType.mkGroundTerm() << endl;
TS_ASSERT(natType.mkGroundTerm().getType() == natType);
- // all ctors should be well-founded too
- for(Datatype::const_iterator i = natType.getDatatype().begin(),
- i_end = natType.getDatatype().end();
- i != i_end;
- ++i) {
- Debug("datatypes") << "checking " << (*i).getName() << endl;
- TS_ASSERT((*i).isWellFounded());
- Debug("groundterms") << "ground term of " << *i << endl
- << " is " << (*i).mkGroundTerm( natType ) << endl;
- TS_ASSERT((*i).mkGroundTerm( natType ).getType() == natType);
- }
}
void testTree() {
Debug("groundterms") << "ground term of " << treeType.getDatatype().getName() << endl
<< " is " << treeType.mkGroundTerm() << endl;
TS_ASSERT(treeType.mkGroundTerm().getType() == treeType);
- // all ctors should be well-founded too
- for(Datatype::const_iterator i = treeType.getDatatype().begin(),
- i_end = treeType.getDatatype().end();
- i != i_end;
- ++i) {
- TS_ASSERT((*i).isWellFounded());
- Debug("groundterms") << "ground term of " << *i << endl
- << " is " << (*i).mkGroundTerm( treeType ) << endl;
- TS_ASSERT((*i).mkGroundTerm( treeType ).getType() == treeType);
- }
}
void testListInt() {
Debug("groundterms") << "ground term of " << listType.getDatatype().getName() << endl
<< " is " << listType.mkGroundTerm() << endl;
TS_ASSERT(listType.mkGroundTerm().getType() == listType);
- // all ctors should be well-founded too
- for(Datatype::const_iterator i = listType.getDatatype().begin(),
- i_end = listType.getDatatype().end();
- i != i_end;
- ++i) {
- TS_ASSERT((*i).isWellFounded());
- Debug("groundterms") << "ground term of " << *i << endl
- << " is " << (*i).mkGroundTerm( listType ) << endl;
- TS_ASSERT((*i).mkGroundTerm( listType ).getType() == listType);
- }
}
void testListReal() {
Debug("groundterms") << "ground term of " << listType.getDatatype().getName() << endl
<< " is " << listType.mkGroundTerm() << endl;
TS_ASSERT(listType.mkGroundTerm().getType() == listType);
- // all ctors should be well-founded too
- for(Datatype::const_iterator i = listType.getDatatype().begin(),
- i_end = listType.getDatatype().end();
- i != i_end;
- ++i) {
- TS_ASSERT((*i).isWellFounded());
- Debug("groundterms") << "ground term of " << *i << endl
- << " is " << (*i).mkGroundTerm( listType ) << endl;
- TS_ASSERT((*i).mkGroundTerm( listType ).getType() == listType);
- }
}
void testListBoolean() {
Debug("groundterms") << "ground term of " << listType.getDatatype().getName() << endl
<< " is " << listType.mkGroundTerm() << endl;
TS_ASSERT(listType.mkGroundTerm().getType() == listType);
- // all ctors should be well-founded too
- for(Datatype::const_iterator i = listType.getDatatype().begin(),
- i_end = listType.getDatatype().end();
- i != i_end;
- ++i) {
- TS_ASSERT((*i).isWellFounded());
- Debug("groundterms") << "ground term of " << *i << endl
- << " is " << (*i).mkGroundTerm( listType ) << endl;
- TS_ASSERT((*i).mkGroundTerm( listType ).getType() == listType);
- }
}
void testMutualListTrees() {
Debug("groundterms") << "ground term of " << dtts[0].getDatatype().getName() << endl
<< " is " << dtts[0].mkGroundTerm() << endl;
TS_ASSERT(dtts[0].mkGroundTerm().getType() == dtts[0]);
- // all ctors should be well-founded too
- for(Datatype::const_iterator i = dtts[0].getDatatype().begin(),
- i_end = dtts[0].getDatatype().end();
- i != i_end;
- ++i) {
- TS_ASSERT((*i).isWellFounded());
- Debug("groundterms") << "ground term of " << *i << endl
- << " is " << (*i).mkGroundTerm( dtts[0] ) << endl;
- TS_ASSERT((*i).mkGroundTerm( dtts[0] ).getType() == dtts[0]);
- }
TS_ASSERT(! dtts[1].getDatatype().isFinite());
TS_ASSERT(dtts[1].getDatatype().getCardinality().compare(Cardinality::INTEGERS) == Cardinality::EQUAL);
Debug("groundterms") << "ground term of " << dtts[1].getDatatype().getName() << endl
<< " is " << dtts[1].mkGroundTerm() << endl;
TS_ASSERT(dtts[1].mkGroundTerm().getType() == dtts[1]);
- // all ctors should be well-founded too
- for(Datatype::const_iterator i = dtts[1].getDatatype().begin(),
- i_end = dtts[1].getDatatype().end();
- i != i_end;
- ++i) {
- TS_ASSERT((*i).isWellFounded());
- Debug("groundterms") << "ground term of " << *i << endl
- << " is " << (*i).mkGroundTerm( dtts[1] ) << endl;
- TS_ASSERT((*i).mkGroundTerm( dtts[1] ).getType() == dtts[1]);
- }
// add another constructor to list datatype resulting in an
// "otherNil-list"
Debug("groundterms") << "ground term of " << dtts2[0].getDatatype().getName() << endl
<< " is " << dtts2[0].mkGroundTerm() << endl;
TS_ASSERT(dtts2[0].mkGroundTerm().getType() == dtts2[0]);
- // all ctors should be well-founded too
- for(Datatype::const_iterator i = dtts2[0].getDatatype().begin(),
- i_end = dtts2[0].getDatatype().end();
- i != i_end;
- ++i) {
- TS_ASSERT((*i).isWellFounded());
- Debug("groundterms") << "ground term of " << *i << endl
- << " is " << (*i).mkGroundTerm( dtts2[0] ) << endl;
- TS_ASSERT((*i).mkGroundTerm( dtts2[0] ).getType() == dtts2[0]);
- }
TS_ASSERT(! dtts2[1].getDatatype().isParametric());
TS_ASSERT(! dtts2[1].getDatatype().isFinite());
Debug("groundterms") << "ground term of " << dtts2[1].getDatatype().getName() << endl
<< " is " << dtts2[1].mkGroundTerm() << endl;
TS_ASSERT(dtts2[1].mkGroundTerm().getType() == dtts2[1]);
- // all ctors should be well-founded too
- for(Datatype::const_iterator i = dtts2[1].getDatatype().begin(),
- i_end = dtts2[1].getDatatype().end();
- i != i_end;
- ++i) {
- TS_ASSERT((*i).isWellFounded());
- Debug("groundterms") << "ground term of " << *i << endl
- << " is " << (*i).mkGroundTerm( dtts2[1] ) << endl;
- TS_ASSERT((*i).mkGroundTerm( dtts2[1] ).getType() == dtts2[1]);
- }
}
void testNotSoWellFounded() {
TS_ASSERT(! treeType.getDatatype().isWellFounded());
TS_ASSERT_THROWS_ANYTHING( treeType.mkGroundTerm() );
TS_ASSERT_THROWS_ANYTHING( treeType.getDatatype().mkGroundTerm( treeType ) );
- // all ctors should be not-well-founded either
- for(Datatype::const_iterator i = treeType.getDatatype().begin(),
- i_end = treeType.getDatatype().end();
- i != i_end;
- ++i) {
- TS_ASSERT(! (*i).isWellFounded());
- TS_ASSERT_THROWS_ANYTHING( (*i).mkGroundTerm( treeType ) );
- }
}
void testParametricDatatype() {
+++ /dev/null
-/********************* */
-/*! \file trans_closure_black.h
- ** \verbatim
- ** Original author: Clark Barrett
- ** Major contributors: none
- ** Minor contributors (to current version): Morgan Deters
- ** This file is part of the CVC4 project.
- ** Copyright (c) 2009-2014 New York University and The University of Iowa
- ** See the file COPYING in the top-level source directory for licensing
- ** information.\endverbatim
- **
- ** \brief Black box testing of CVC4::TransitiveClosure.
- **
- ** Black box testing of CVC4::TransitiveClosure.
- **/
-
-
-#include "util/trans_closure.h"
-
-
-using namespace CVC4;
-using namespace CVC4::context;
-using namespace std;
-
-
-class TransitiveClosureBlack : public CxxTest::TestSuite {
- Context* d_context;
- TransitiveClosure* d_tc;
-
-public:
-
- void setUp() {
- d_context = new Context;
- d_tc = new TransitiveClosure(d_context);
- }
-
- void tearDown() {
- try {
- delete d_tc;
- delete d_context;
- } catch(Exception& e) {
- Warning() << std::endl << e << std::endl;
- throw;
- }
- }
-
- void testSimple() {
- bool b;
- b = d_tc->addEdge(1,2);
- TS_ASSERT(!b);
-
- b = d_tc->addEdge(2,3);
- TS_ASSERT(!b);
-
- b = d_tc->addEdge(3,1);
- TS_ASSERT(b);
-
- b = d_tc->addEdge(2,4);
- TS_ASSERT(!b);
-
- b = d_tc->addEdge(2,5);
- TS_ASSERT(!b);
-
- b = d_tc->addEdge(4,6);
- TS_ASSERT(!b);
-
- b = d_tc->addEdge(6,2);
- TS_ASSERT(b);
- }
-
-
- void test1() {
- bool b;
- b = d_tc->addEdge(1,2);
- TS_ASSERT(!b);
-
- d_context->push();
-
- b = d_tc->addEdge(2,3);
- TS_ASSERT(!b);
-
- b = d_tc->addEdge(3,1);
- TS_ASSERT(b);
-
- d_context->pop();
-
- b = d_tc->addEdge(3,1);
- TS_ASSERT(!b);
-
- b = d_tc->addEdge(2,3);
- TS_ASSERT(b);
-
- d_context->push();
-
- b = d_tc->addEdge(6,4);
- TS_ASSERT(!b);
-
- b = d_tc->addEdge(2,6);
- TS_ASSERT(!b);
-
- b = d_tc->addEdge(4,1);
- TS_ASSERT(b);
-
- d_context->pop();
-
- b = d_tc->addEdge(4,1);
-
- TS_ASSERT(!b);
- }
-
- void test2() {
- bool b;
- b = d_tc->addEdge(1,2);
- TS_ASSERT(!b);
- b = d_tc->addEdge(1,3);
- TS_ASSERT(!b);
- b = d_tc->addEdge(1,4);
- TS_ASSERT(!b);
- b = d_tc->addEdge(1,5);
- TS_ASSERT(!b);
- b = d_tc->addEdge(1,6);
- TS_ASSERT(!b);
- b = d_tc->addEdge(1,7);
- TS_ASSERT(!b);
- b = d_tc->addEdge(1,8);
- TS_ASSERT(!b);
- b = d_tc->addEdge(1,9);
- TS_ASSERT(!b);
-
- b = d_tc->addEdge(3,2);
- TS_ASSERT(!b);
- b = d_tc->addEdge(4,7);
- TS_ASSERT(!b);
-
- b = d_tc->addEdge(2,1);
- TS_ASSERT(b);
- b = d_tc->addEdge(3,1);
- TS_ASSERT(b);
- b = d_tc->addEdge(4,1);
- TS_ASSERT(b);
- b = d_tc->addEdge(5,1);
- TS_ASSERT(b);
- b = d_tc->addEdge(6,1);
- TS_ASSERT(b);
- b = d_tc->addEdge(7,1);
- TS_ASSERT(b);
- b = d_tc->addEdge(8,1);
- TS_ASSERT(b);
- b = d_tc->addEdge(9,1);
- TS_ASSERT(b);
- }
-
-};/* class TransitiveClosureBlack */