GCC Code Coverage Report
Directory: . Exec Total Coverage
File: test/unit/context/cdo_black.cpp Lines: 13 13 100.0 %
Date: 2021-03-22 Branches: 23 86 26.7 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file cdo_black.cpp
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Aina Niemetz, Dejan Jovanovic, Andres Noetzli
6
 ** This file is part of the CVC4 project.
7
 ** Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 ** in the top-level source directory and their institutional affiliations.
9
 ** All rights reserved.  See the file COPYING in the top-level source
10
 ** directory for licensing information.\endverbatim
11
 **
12
 ** \brief Black box testing of CVC4::context::CDO<>.
13
 **
14
 ** Black box testing of CVC4::context::CDO<>.
15
 **/
16
17
#include <iostream>
18
#include <vector>
19
20
#include "base/check.h"
21
#include "context/cdlist.h"
22
#include "context/cdo.h"
23
#include "test_context.h"
24
25
namespace CVC4 {
26
27
using namespace context;
28
29
namespace test {
30
31
4
class TestContextBlackCDO : public TestContext
32
{
33
};
34
35
10
TEST_F(TestContextBlackCDO, cdo)
36
{
37
  // Test that push/pop maintains the original value
38
4
  CDO<int> a1(d_context.get());
39
2
  a1 = 5;
40
2
  ASSERT_EQ(d_context->getLevel(), 0);
41
2
  d_context->push();
42
2
  a1 = 10;
43
2
  ASSERT_EQ(d_context->getLevel(), 1);
44
2
  ASSERT_EQ(a1, 10);
45
2
  d_context->pop();
46
2
  ASSERT_EQ(d_context->getLevel(), 0);
47
2
  ASSERT_EQ(a1, 5);
48
}
49
50
}  // namespace test
51
6
}  // namespace CVC4