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

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Aina Niemetz, Dejan Jovanovic, Andres Noetzli
4
 *
5
 * This file is part of the cvc5 project.
6
 *
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.
11
 * ****************************************************************************
12
 *
13
 * Black box testing of cvc5::context::CDO<>.
14
 */
15
16
#include <iostream>
17
#include <vector>
18
19
#include "base/check.h"
20
#include "context/cdlist.h"
21
#include "context/cdo.h"
22
#include "test_context.h"
23
24
namespace cvc5 {
25
26
using namespace context;
27
28
namespace test {
29
30
4
class TestContextBlackCDO : public TestContext
31
{
32
};
33
34
10
TEST_F(TestContextBlackCDO, cdo)
35
{
36
  // Test that push/pop maintains the original value
37
4
  CDO<int> a1(d_context.get());
38
2
  a1 = 5;
39
2
  ASSERT_EQ(d_context->getLevel(), 0);
40
2
  d_context->push();
41
2
  a1 = 10;
42
2
  ASSERT_EQ(d_context->getLevel(), 1);
43
2
  ASSERT_EQ(a1, 10);
44
2
  d_context->pop();
45
2
  ASSERT_EQ(d_context->getLevel(), 0);
46
2
  ASSERT_EQ(a1, 5);
47
}
48
49
}  // namespace test
50
6
}  // namespace cvc5