diff options
author | Morgan Deters <mdeters@gmail.com> | 2010-04-09 16:25:32 +0000 |
---|---|---|
committer | Morgan Deters <mdeters@gmail.com> | 2010-04-09 16:25:32 +0000 |
commit | e390a4207d3858927354b3d4b40d540c00f8064c (patch) | |
tree | 589fd13ed8f6ba835cd79a2894092860b66b7696 /test/unit/context/context_black.h | |
parent | c3a6ff8c6e4a0c743cd33eb29931f837eeb2959e (diff) |
added experimental "make lcov" target (it runs only unit tests); better coverage for util and context classes; implemented some output functionality that was missing; reclassified some tests white -> black or black -> public; other minor fixes
Diffstat (limited to 'test/unit/context/context_black.h')
-rw-r--r-- | test/unit/context/context_black.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/test/unit/context/context_black.h b/test/unit/context/context_black.h index 549d99369..37c94aaad 100644 --- a/test/unit/context/context_black.h +++ b/test/unit/context/context_black.h @@ -60,4 +60,55 @@ public: d_context->push(); i = 5; } + + void testPreNotify() { + struct MyContextNotifyObj : ContextNotifyObj { + int nCalls; + + MyContextNotifyObj(Context* context, bool pre) : + ContextNotifyObj(context, pre), + nCalls(0) { + } + + void notify() { + ++nCalls; + } + } a(d_context, true), b(d_context, false); + + { + MyContextNotifyObj c(d_context, true), d(d_context, false); + + TS_ASSERT_EQUALS(a.nCalls, 0); + TS_ASSERT_EQUALS(b.nCalls, 0); + TS_ASSERT_EQUALS(c.nCalls, 0); + TS_ASSERT_EQUALS(d.nCalls, 0); + + d_context->push(); + d_context->push(); + + TS_ASSERT_EQUALS(a.nCalls, 0); + TS_ASSERT_EQUALS(b.nCalls, 0); + TS_ASSERT_EQUALS(c.nCalls, 0); + TS_ASSERT_EQUALS(d.nCalls, 0); + + d_context->pop(); + + TS_ASSERT_EQUALS(a.nCalls, 1); + TS_ASSERT_EQUALS(b.nCalls, 1); + TS_ASSERT_EQUALS(c.nCalls, 1); + TS_ASSERT_EQUALS(d.nCalls, 1); + + d_context->pop(); + + TS_ASSERT_EQUALS(a.nCalls, 2); + TS_ASSERT_EQUALS(b.nCalls, 2); + TS_ASSERT_EQUALS(c.nCalls, 2); + TS_ASSERT_EQUALS(d.nCalls, 2); + } + + // we do this to get full code coverage of destruction paths + delete d_context; + + d_context = NULL; + } }; |