summaryrefslogtreecommitdiff
path: root/test/unit/context
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2018-08-23 16:28:21 -0700
committerAina Niemetz <aina.niemetz@gmail.com>2018-08-23 16:28:21 -0700
commit11a34205808098e503f145b2a779078dd509729e (patch)
treebd4a69d62192273d4de237d8c7252448cef41c95 /test/unit/context
parent860ae582f334bea2835806b0d5044ca1b6e90d76 (diff)
Add missing overrides in unit tests (#2362)
Diffstat (limited to 'test/unit/context')
-rw-r--r--test/unit/context/cdlist_black.h4
-rw-r--r--test/unit/context/cdmap_black.h5
-rw-r--r--test/unit/context/cdmap_white.h14
-rw-r--r--test/unit/context/cdo_black.h14
-rw-r--r--test/unit/context/context_black.h33
-rw-r--r--test/unit/context/context_mm_black.h14
-rw-r--r--test/unit/context/context_white.h16
7 files changed, 38 insertions, 62 deletions
diff --git a/test/unit/context/cdlist_black.h b/test/unit/context/cdlist_black.h
index 7545fa808..8a31f70ca 100644
--- a/test/unit/context/cdlist_black.h
+++ b/test/unit/context/cdlist_black.h
@@ -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
diff --git a/test/unit/context/cdmap_black.h b/test/unit/context/cdmap_black.h
index 8cc1b73c2..2d2b3f409 100644
--- a/test/unit/context/cdmap_black.h
+++ b/test/unit/context/cdmap_black.h
@@ -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) {
diff --git a/test/unit/context/cdmap_white.h b/test/unit/context/cdmap_white.h
index 232eb55a8..0f111cd61 100644
--- a/test/unit/context/cdmap_white.h
+++ b/test/unit/context/cdmap_white.h
@@ -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());
diff --git a/test/unit/context/cdo_black.h b/test/unit/context/cdo_black.h
index f5666173d..2838ae322 100644
--- a/test/unit/context/cdo_black.h
+++ b/test/unit/context/cdo_black.h
@@ -33,17 +33,13 @@ private:
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;
diff --git a/test/unit/context/context_black.h b/test/unit/context/context_black.h
index 63b60edc9..b4be4197c 100644
--- a/test/unit/context/context_black.h
+++ b/test/unit/context/context_black.h
@@ -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 {
@@ -75,18 +73,15 @@ public:
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();
@@ -99,17 +94,13 @@ private:
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();
diff --git a/test/unit/context/context_mm_black.h b/test/unit/context/context_mm_black.h
index ed64b5eac..beace137e 100644
--- a/test/unit/context/context_mm_black.h
+++ b/test/unit/context/context_mm_black.h
@@ -33,13 +33,11 @@ private:
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
@@ -96,7 +94,5 @@ public:
#endif /* __CVC4__CONTEXT__CONTEXT_MM_H */
}
- void tearDown() {
- delete d_cmm;
- }
+ void tearDown() override { delete d_cmm; }
};
diff --git a/test/unit/context/context_white.h b/test/unit/context/context_white.h
index 64e6e184b..2c1ef8e71 100644
--- a/test/unit/context/context_white.h
+++ b/test/unit/context/context_white.h
@@ -29,18 +29,14 @@ private:
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);
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback