2021-04-12 12:31:43 -07:00
|
|
|
/******************************************************************************
|
|
|
|
|
* Top contributors (to current version):
|
|
|
|
|
* Aina Niemetz, Andrew Reynolds, Tim King
|
|
|
|
|
*
|
|
|
|
|
* This file is part of the cvc5 project.
|
|
|
|
|
*
|
2025-01-23 09:54:20 -08:00
|
|
|
* Copyright (c) 2009-2025 by the authors listed in the file AUTHORS
|
2021-04-12 12:31:43 -07:00
|
|
|
* in the top-level source directory and their institutional affiliations.
|
|
|
|
|
* All rights reserved. See the file COPYING in the top-level source
|
|
|
|
|
* directory for licensing information.
|
|
|
|
|
* ****************************************************************************
|
|
|
|
|
*
|
|
|
|
|
* Black box testing of cvc5::expr::NodeSelfIterator.
|
|
|
|
|
*/
|
2021-02-09 08:01:29 -08:00
|
|
|
|
|
|
|
|
#include "expr/node.h"
|
|
|
|
|
#include "expr/node_builder.h"
|
|
|
|
|
#include "expr/node_self_iterator.h"
|
|
|
|
|
#include "test_node.h"
|
|
|
|
|
|
2022-03-29 16:23:01 -07:00
|
|
|
namespace cvc5::internal {
|
2021-02-09 08:01:29 -08:00
|
|
|
|
|
|
|
|
using namespace kind;
|
|
|
|
|
using namespace expr;
|
|
|
|
|
|
|
|
|
|
namespace test {
|
|
|
|
|
|
2021-02-25 11:44:48 -08:00
|
|
|
class TestNodeBlackNodeSelfIterator : public TestNode
|
2021-02-09 08:01:29 -08:00
|
|
|
{
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
TEST_F(TestNodeBlackNodeSelfIterator, iteration)
|
|
|
|
|
{
|
2021-04-07 13:36:15 -05:00
|
|
|
Node x = d_skolemManager->mkDummySkolem("x", *d_boolTypeNode);
|
|
|
|
|
Node y = d_skolemManager->mkDummySkolem("y", *d_boolTypeNode);
|
2021-02-09 08:01:29 -08:00
|
|
|
Node x_and_y = x.andNode(y);
|
|
|
|
|
NodeSelfIterator i = x_and_y, j = NodeSelfIterator::self(x_and_y);
|
|
|
|
|
ASSERT_NE(i, x_and_y.end());
|
|
|
|
|
ASSERT_NE(j, x_and_y.end());
|
|
|
|
|
ASSERT_EQ(*i, x_and_y);
|
|
|
|
|
ASSERT_EQ(*j, x_and_y);
|
|
|
|
|
ASSERT_EQ(*i++, x_and_y);
|
|
|
|
|
ASSERT_EQ(*j++, x_and_y);
|
|
|
|
|
ASSERT_EQ(i, NodeSelfIterator::selfEnd(x_and_y));
|
|
|
|
|
ASSERT_EQ(j, NodeSelfIterator::selfEnd(x_and_y));
|
|
|
|
|
ASSERT_EQ(i, x_and_y.end());
|
|
|
|
|
ASSERT_EQ(j, x_and_y.end());
|
|
|
|
|
|
|
|
|
|
i = x_and_y.begin();
|
|
|
|
|
ASSERT_NE(i, x_and_y.end());
|
|
|
|
|
ASSERT_EQ(*i, x);
|
|
|
|
|
ASSERT_EQ(*++i, y);
|
|
|
|
|
ASSERT_EQ(++i, x_and_y.end());
|
|
|
|
|
}
|
|
|
|
|
} // namespace test
|
2022-03-29 16:23:01 -07:00
|
|
|
} // namespace cvc5::internal
|