1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Aina Niemetz, Andrew Reynolds, Tim King |
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::expr::NodeSelfIterator. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include "expr/node.h" |
17 |
|
#include "expr/node_builder.h" |
18 |
|
#include "expr/node_self_iterator.h" |
19 |
|
#include "test_node.h" |
20 |
|
|
21 |
|
namespace cvc5 { |
22 |
|
|
23 |
|
using namespace kind; |
24 |
|
using namespace expr; |
25 |
|
|
26 |
|
namespace test { |
27 |
|
|
28 |
4 |
class TestNodeBlackNodeSelfIterator : public TestNode |
29 |
|
{ |
30 |
|
}; |
31 |
|
|
32 |
10 |
TEST_F(TestNodeBlackNodeSelfIterator, iteration) |
33 |
|
{ |
34 |
4 |
Node x = d_skolemManager->mkDummySkolem("x", *d_boolTypeNode); |
35 |
4 |
Node y = d_skolemManager->mkDummySkolem("y", *d_boolTypeNode); |
36 |
4 |
Node x_and_y = x.andNode(y); |
37 |
4 |
NodeSelfIterator i = x_and_y, j = NodeSelfIterator::self(x_and_y); |
38 |
2 |
ASSERT_NE(i, x_and_y.end()); |
39 |
2 |
ASSERT_NE(j, x_and_y.end()); |
40 |
2 |
ASSERT_EQ(*i, x_and_y); |
41 |
2 |
ASSERT_EQ(*j, x_and_y); |
42 |
2 |
ASSERT_EQ(*i++, x_and_y); |
43 |
2 |
ASSERT_EQ(*j++, x_and_y); |
44 |
2 |
ASSERT_EQ(i, NodeSelfIterator::selfEnd(x_and_y)); |
45 |
2 |
ASSERT_EQ(j, NodeSelfIterator::selfEnd(x_and_y)); |
46 |
2 |
ASSERT_EQ(i, x_and_y.end()); |
47 |
2 |
ASSERT_EQ(j, x_and_y.end()); |
48 |
|
|
49 |
2 |
i = x_and_y.begin(); |
50 |
2 |
ASSERT_NE(i, x_and_y.end()); |
51 |
2 |
ASSERT_EQ(*i, x); |
52 |
2 |
ASSERT_EQ(*++i, y); |
53 |
2 |
ASSERT_EQ(++i, x_and_y.end()); |
54 |
|
} |
55 |
|
} // namespace test |
56 |
8736 |
} // namespace cvc5 |