GCC Code Coverage Report
Directory: . Exec Total Coverage
File: test/unit/node/node_self_iterator_black.cpp Lines: 22 22 100.0 %
Date: 2021-03-22 Branches: 84 280 30.0 %

Line Exec Source
1
/*********************                                                        */
2
/*! \file node_self_iterator_black.cpp
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Aina Niemetz, Tim King, Morgan Deters
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::expr::NodeSelfIterator
13
 **
14
 ** Black box testing of CVC4::expr::NodeSelfIterator
15
 **/
16
17
#include "expr/node.h"
18
#include "expr/node_builder.h"
19
#include "expr/node_self_iterator.h"
20
#include "test_node.h"
21
22
namespace CVC4 {
23
24
using namespace kind;
25
using namespace expr;
26
27
namespace test {
28
29
4
class TestNodeBlackNodeSelfIterator : public TestNode
30
{
31
};
32
33
10
TEST_F(TestNodeBlackNodeSelfIterator, iteration)
34
{
35
4
  Node x = d_nodeManager->mkSkolem("x", *d_boolTypeNode);
36
4
  Node y = d_nodeManager->mkSkolem("y", *d_boolTypeNode);
37
4
  Node x_and_y = x.andNode(y);
38
4
  NodeSelfIterator i = x_and_y, j = NodeSelfIterator::self(x_and_y);
39
2
  ASSERT_NE(i, x_and_y.end());
40
2
  ASSERT_NE(j, x_and_y.end());
41
2
  ASSERT_EQ(*i, x_and_y);
42
2
  ASSERT_EQ(*j, x_and_y);
43
2
  ASSERT_EQ(*i++, x_and_y);
44
2
  ASSERT_EQ(*j++, x_and_y);
45
2
  ASSERT_EQ(i, NodeSelfIterator::selfEnd(x_and_y));
46
2
  ASSERT_EQ(j, NodeSelfIterator::selfEnd(x_and_y));
47
2
  ASSERT_EQ(i, x_and_y.end());
48
2
  ASSERT_EQ(j, x_and_y.end());
49
50
2
  i = x_and_y.begin();
51
2
  ASSERT_NE(i, x_and_y.end());
52
2
  ASSERT_EQ(*i, x);
53
2
  ASSERT_EQ(*++i, y);
54
2
  ASSERT_EQ(++i, x_and_y.end());
55
}
56
}  // namespace test
57
8560
}  // namespace CVC4