Skip to content

Commit

Permalink
Add missing overrides in unit tests (cvc5#2362)
Browse files Browse the repository at this point in the history
  • Loading branch information
4tXJ7f authored and aniemetz committed Aug 23, 2018
1 parent 860ae58 commit 11a3420
Show file tree
Hide file tree
Showing 42 changed files with 242 additions and 248 deletions.
4 changes: 2 additions & 2 deletions test/unit/base/map_util_black.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ using std::string;
class MapUtilBlack : public CxxTest::TestSuite
{
public:
void setUp() {}
void tearDown() {}
void setUp() override {}
void tearDown() override {}

// Returns a map containing {"key"->"value", "other"->"entry"}.
static const std::map<string, string>& DefaultMap()
Expand Down
4 changes: 2 additions & 2 deletions test/unit/context/cdlist_black.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class CDListBlack : public CxxTest::TestSuite {
Context* d_context;

public:
void setUp() { d_context = new Context(); }
void setUp() override { d_context = new Context(); }

void tearDown() { delete d_context; }
void tearDown() override { delete d_context; }

// test at different sizes. this triggers grow() behavior differently.
// grow() was completely broken in revision 256
Expand Down
5 changes: 3 additions & 2 deletions test/unit/context/cdmap_black.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,15 @@ class CDMapBlack : public CxxTest::TestSuite {
Context* d_context;

public:
void setUp() {
void setUp() override
{
d_context = new Context;
// Debug.on("context");
// Debug.on("gc");
// Debug.on("pushpop");
}

void tearDown() { delete d_context; }
void tearDown() override { delete d_context; }

// Returns the elements in a CDHashMap.
static std::map<int, int> GetElements(const CDHashMap<int, int>& map) {
Expand Down
14 changes: 5 additions & 9 deletions test/unit/context/cdmap_white.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,13 @@ class CDMapWhite : public CxxTest::TestSuite {

Context* d_context;

public:
public:
void setUp() override { d_context = new Context; }

void setUp() {
d_context = new Context;
}

void tearDown() {
delete d_context;
}
void tearDown() override { delete d_context; }

void testUnreachableSaveAndRestore() {
void testUnreachableSaveAndRestore()
{
CDHashMap<int, int> map(d_context);

TS_ASSERT_THROWS_NOTHING(map.makeCurrent());
Expand Down
14 changes: 5 additions & 9 deletions test/unit/context/cdo_black.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,13 @@ class CDOBlack : public CxxTest::TestSuite {

Context* d_context;

public:
public:
void setUp() override { d_context = new Context; }

void setUp() {
d_context = new Context;
}

void tearDown() {
delete d_context;
}
void tearDown() override { delete d_context; }

void testIntCDO() {
void testIntCDO()
{
// Test that push/pop maintains the original value
CDO<int> a1(d_context);
a1 = 5;
Expand Down
33 changes: 12 additions & 21 deletions test/unit/context/context_black.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,10 @@ struct MyContextNotifyObj : public ContextNotifyObj {
ContextNotifyObj(context, pre),
nCalls(0) {
}

virtual ~MyContextNotifyObj() {}

void contextNotifyPop() {
++nCalls;
}
~MyContextNotifyObj() override {}

void contextNotifyPop() override { ++nCalls; }
};

class MyContextObj : public ContextObj {
Expand Down Expand Up @@ -75,18 +73,15 @@ class MyContextObj : public ContextObj {
nSaves(0) {
}

virtual ~MyContextObj() {
destroy();
}
~MyContextObj() override { destroy(); }

ContextObj* save(ContextMemoryManager* pcmm) {
ContextObj* save(ContextMemoryManager* pcmm) override
{
++nSaves;
return new(pcmm) MyContextObj(*this);
}

void restore(ContextObj* contextObj) {
nCalls = notify.nCalls;
}
void restore(ContextObj* contextObj) override { nCalls = notify.nCalls; }

void makeCurrent() {
ContextObj::makeCurrent();
Expand All @@ -99,17 +94,13 @@ class ContextBlack : public CxxTest::TestSuite {

Context* d_context;

public:
public:
void setUp() override { d_context = new Context; }

void setUp() {
d_context = new Context;
}

void tearDown() {
delete d_context;
}
void tearDown() override { delete d_context; }

void testContextPushPop() {
void testContextPushPop()
{
// Test what happens when the context is popped below 0
// the interface doesn't declare any exceptions
d_context->push();
Expand Down
14 changes: 5 additions & 9 deletions test/unit/context/context_mm_black.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,11 @@ class ContextBlack : public CxxTest::TestSuite {

ContextMemoryManager* d_cmm;

public:
public:
void setUp() override { d_cmm = new ContextMemoryManager(); }

void setUp() {
d_cmm = new ContextMemoryManager();
}

void testPushPop() {
void testPushPop()
{
#ifdef CVC4_DEBUG_CONTEXT_MEMORY_MANAGER
#warning "Using the debug context memory manager, omitting unit tests"
#else
Expand Down Expand Up @@ -96,7 +94,5 @@ class ContextBlack : public CxxTest::TestSuite {
#endif /* __CVC4__CONTEXT__CONTEXT_MM_H */
}

void tearDown() {
delete d_cmm;
}
void tearDown() override { delete d_cmm; }
};
16 changes: 6 additions & 10 deletions test/unit/context/context_white.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,14 @@ class ContextWhite : public CxxTest::TestSuite {

Context* d_context;

public:
public:
void setUp() override { d_context = new Context; }

void setUp() {
d_context = new Context;
}

void tearDown() {
delete d_context;
}
void tearDown() override { delete d_context; }

void testContextSimple() {
Scope *s = d_context->getTopScope();
void testContextSimple()
{
Scope* s = d_context->getTopScope();

TS_ASSERT(s == d_context->getBottomScope());
TS_ASSERT(d_context->getLevel() == 0);
Expand Down
9 changes: 5 additions & 4 deletions test/unit/expr/attribute_black.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@ class AttributeBlack : public CxxTest::TestSuite {
SmtEngine* d_smtEngine;
SmtScope* d_scope;

public:

void setUp() {
public:
void setUp() override
{
d_exprManager = new ExprManager();
d_nodeManager = NodeManager::fromExprManager(d_exprManager);
d_smtEngine = new SmtEngine(d_exprManager);
d_scope = new SmtScope(d_smtEngine);
}

void tearDown() {
void tearDown() override
{
delete d_scope;
delete d_smtEngine;
delete d_exprManager;
Expand Down
9 changes: 5 additions & 4 deletions test/unit/expr/attribute_white.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,18 @@ class AttributeWhite : public CxxTest::TestSuite {
TypeNode* d_booleanType;
SmtEngine* d_smtEngine;

public:

void setUp() {
public:
void setUp() override
{
d_em = new ExprManager();
d_nm = NodeManager::fromExprManager(d_em);
d_smtEngine = new SmtEngine(d_em);
d_scope = new SmtScope(d_smtEngine);
d_booleanType = new TypeNode(d_nm->booleanType());
}

void tearDown() {
void tearDown() override
{
delete d_booleanType;
delete d_scope;
delete d_smtEngine;
Expand Down
20 changes: 10 additions & 10 deletions test/unit/expr/expr_manager_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,19 @@ class ExprManagerPublic : public CxxTest::TestSuite {
return vars;
}

public:
void setUp() override { d_exprManager = new ExprManager; }

public:
void setUp() {
d_exprManager = new ExprManager;
}


void tearDown() {
try {
void tearDown() override
{
try
{
delete d_exprManager;
} catch(Exception e) {
}
catch (Exception e)
{
cerr << "Exception during tearDown():" << endl << e;
throw ;
throw;
}
}

Expand Down
24 changes: 14 additions & 10 deletions test/unit/expr/expr_public.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,12 @@ class ExprPublic : public CxxTest::TestSuite {
Expr* r1;
Expr* r2;

public:

void setUp() {
try {

char *argv[2];
public:
void setUp() override
{
try
{
char* argv[2];
argv[0] = strdup("");
argv[1] = strdup("--output-language=ast");
Options::parseOptions(&opts, 2, argv);
Expand All @@ -64,12 +64,13 @@ class ExprPublic : public CxxTest::TestSuite {

d_em = new ExprManager(opts);

a_bool = new Expr(d_em->mkVar("a",d_em->booleanType()));
a_bool = new Expr(d_em->mkVar("a", d_em->booleanType()));
b_bool = new Expr(d_em->mkVar("b", d_em->booleanType()));
c_bool_and = new Expr(d_em->mkExpr(AND, *a_bool, *b_bool));
and_op = new Expr(d_em->mkConst(AND));
plus_op = new Expr(d_em->mkConst(PLUS));
fun_type = new Type(d_em->mkFunctionType(d_em->booleanType(), d_em->booleanType()));
fun_type = new Type(
d_em->mkFunctionType(d_em->booleanType(), d_em->booleanType()));
fun_op = new Expr(d_em->mkVar("f", *fun_type));
d_apply_fun_bool = new Expr(d_em->mkExpr(APPLY_UF, *fun_op, *a_bool));
null = new Expr();
Expand All @@ -78,13 +79,16 @@ class ExprPublic : public CxxTest::TestSuite {
i2 = new Expr(d_em->mkConst(Rational(23)));
r1 = new Expr(d_em->mkConst(Rational(1, 5)));
r2 = new Expr(d_em->mkConst(Rational("0")));
} catch(Exception e) {
}
catch (Exception e)
{
cerr << "Exception during setUp():" << endl << e;
throw;
}
}

void tearDown() {
void tearDown() override
{
try {
delete r2;
delete r1;
Expand Down
10 changes: 6 additions & 4 deletions test/unit/expr/kind_black.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,15 @@ class KindBlack : public CxxTest::TestSuite {
//easier to define in setup
int beyond;
Kind unknown;
public:
void setUp() {

public:
void setUp() override
{
undefined = UNDEFINED_KIND;
null = NULL_EXPR;
last = LAST_KIND;
beyond = ((int) LAST_KIND) + 1;
unknown = (Kind) beyond;
beyond = ((int)LAST_KIND) + 1;
unknown = (Kind)beyond;
}


Expand Down
6 changes: 4 additions & 2 deletions test/unit/expr/node_black.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ class NodeBlack : public CxxTest::TestSuite {
TypeNode* d_realType;

public:
void setUp() {
void setUp() override
{
char* argv[2];
argv[0] = strdup("");
argv[1] = strdup("--output-language=ast");
Expand All @@ -70,7 +71,8 @@ class NodeBlack : public CxxTest::TestSuite {
d_realType = new TypeNode(d_nodeManager->realType());
}

void tearDown() {
void tearDown() override
{
delete d_realType;
delete d_booleanType;
delete d_scope;
Expand Down
9 changes: 5 additions & 4 deletions test/unit/expr/node_builder_black.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ class NodeBuilderBlack : public CxxTest::TestSuite {
TypeNode* d_integerType;
TypeNode* d_realType;

public:

void setUp() {
public:
void setUp() override
{
d_nm = new NodeManager(NULL);
d_scope = new NodeManagerScope(d_nm);

Expand All @@ -52,7 +52,8 @@ class NodeBuilderBlack : public CxxTest::TestSuite {
d_realType = new TypeNode(d_nm->realType());
}

void tearDown() {
void tearDown() override
{
delete d_integerType;
delete d_booleanType;
delete d_realType;
Expand Down
Loading

0 comments on commit 11a3420

Please sign in to comment.