Branch data Line data Source code
1 : : /****************************************************************************** 2 : : * Top contributors (to current version): 3 : : * Aina Niemetz 4 : : * 5 : : * This file is part of the cvc5 project. 6 : : * 7 : : * Copyright (c) 2009-2025 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 : : * White box testing of cvc5::context::CDMap<>. 14 : : */ 15 : : 16 : : #include "base/check.h" 17 : : #include "context/cdhashmap.h" 18 : : #include "test_context.h" 19 : : 20 : : namespace cvc5::internal { 21 : : 22 : : using namespace context; 23 : : 24 : : namespace test { 25 : : 26 : : class TestContextWhiteCDHashMap : public TestContext 27 : : { 28 : : }; 29 : : 30 : 2 : TEST_F(TestContextWhiteCDHashMap, unreachable_save_and_restore) 31 : : { 32 : 1 : CDHashMap<int, int> map(d_context.get()); 33 : : 34 [ + - ][ + - ]: 1 : ASSERT_NO_THROW(map.makeCurrent()); 35 : : 36 : 1 : ASSERT_DEATH(map.update(), "Unreachable code reached"); 37 : : 38 : 1 : ASSERT_DEATH(map.save(d_context->getCMM()), "Unreachable code reached"); 39 : 1 : ASSERT_DEATH(map.restore(&map), "Unreachable code reached"); 40 : : 41 : 1 : d_context->push(); 42 : 1 : ASSERT_DEATH(map.makeCurrent(), "Unreachable code reached"); 43 : : } 44 : : 45 : : } // namespace test 46 : : } // namespace cvc5::internal