LCOV - code coverage report
Current view: top level - buildbot/coverage/build/test/unit/context - cdo_black.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 12 12 100.0 %
Date: 2026-05-01 10:46:14 Functions: 4 4 100.0 %
Branches: 11 22 50.0 %

           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

Generated by: LCOV version 1.14