Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * This file is part of the cvc5 project. 3 : : * 4 : : * Copyright (c) 2009-2026 by the authors listed in the file AUTHORS 5 : : * in the top-level source directory and their institutional affiliations. 6 : : * All rights reserved. See the file COPYING in the top-level source 7 : : * directory for licensing information. 8 : : * **************************************************************************** 9 : : * 10 : : * Black box testing of cvc5::context::CDO<>. 11 : : */ 12 : : 13 : : #include <iostream> 14 : : #include <vector> 15 : : 16 : : #include "base/check.h" 17 : : #include "context/cdlist.h" 18 : : #include "context/cdo.h" 19 : : #include "test_context.h" 20 : : 21 : : namespace cvc5::internal { 22 : : 23 : : using namespace context; 24 : : 25 : : namespace test { 26 : : 27 : : class TestContextBlackCDO : public TestContext 28 : : { 29 : : }; 30 : : 31 : 4 : TEST_F(TestContextBlackCDO, cdo) 32 : : { 33 : : // Test that push/pop maintains the original value 34 : 1 : CDO<int> a1(d_context.get()); 35 : 1 : a1 = 5; 36 [ - + ][ + - ]: 1 : ASSERT_EQ(d_context->getLevel(), 0); 37 : 1 : d_context->push(); 38 : 1 : a1 = 10; 39 [ - + ][ + - ]: 1 : ASSERT_EQ(d_context->getLevel(), 1); 40 [ - + ][ + - ]: 1 : ASSERT_EQ(a1, 10); 41 : 1 : d_context->pop(); 42 [ - + ][ + - ]: 1 : ASSERT_EQ(d_context->getLevel(), 0); 43 [ - + ][ + - ]: 1 : ASSERT_EQ(a1, 5); 44 [ + - ]: 1 : } 45 : : 46 : : } // namespace test 47 : : } // namespace cvc5::internal