LCOV - code coverage report
Current view: top level - buildbot/coverage/build/test/api/cpp - reset_assertions.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 22 22 100.0 %
Date: 2025-01-01 12:37:16 Functions: 1 1 100.0 %
Branches: 0 0 -

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * Top contributors (to current version):
       3                 :            :  *   Aina Niemetz, Andres Noetzli, Mathias Preiner
       4                 :            :  *
       5                 :            :  * This file is part of the cvc5 project.
       6                 :            :  *
       7                 :            :  * Copyright (c) 2009-2024 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                 :            :  * A simple test for cvc5::Solver::resetAssertions()
      14                 :            :  *
      15                 :            :  * This indirectly also tests some corner cases w.r.t. context-dependent
      16                 :            :  * datastructures: resetAssertions() pops the contexts to zero but some
      17                 :            :  * context-dependent datastructures are created at leevel 1, which the
      18                 :            :  * datastructure needs to handle properly problematic.
      19                 :            :  */
      20                 :            : 
      21                 :            : #include <cvc5/cvc5.h>
      22                 :            : 
      23                 :            : #include <iostream>
      24                 :            : #include <sstream>
      25                 :            : 
      26                 :            : using namespace cvc5;
      27                 :            : 
      28                 :          1 : int main()
      29                 :            : {
      30                 :          2 :   TermManager tm;
      31                 :          2 :   Solver slv(tm);
      32                 :          1 :   slv.setOption("incremental", "true");
      33                 :            : 
      34                 :          2 :   Sort real = tm.getRealSort();
      35                 :          2 :   Term x = tm.mkConst(real, "x");
      36                 :          2 :   Term four = tm.mkReal(4);
      37                 :          5 :   Term xEqFour = tm.mkTerm(Kind::EQUAL, {x, four});
      38                 :          1 :   slv.assertFormula(xEqFour);
      39                 :          1 :   std::cout << slv.checkSat() << std::endl;
      40                 :            : 
      41                 :          1 :   slv.resetAssertions();
      42                 :            : 
      43                 :          2 :   Sort elementType = tm.getIntegerSort();
      44                 :          2 :   Sort indexType = tm.getIntegerSort();
      45                 :          2 :   Sort arrayType = tm.mkArraySort(indexType, elementType);
      46                 :          2 :   Term array = tm.mkConst(arrayType, "array");
      47                 :          2 :   Term fourInt = tm.mkInteger(4);
      48                 :          5 :   Term arrayAtFour = tm.mkTerm(Kind::SELECT, {array, fourInt});
      49                 :          2 :   Term ten = tm.mkInteger(10);
      50                 :          4 :   Term arrayAtFour_eq_ten = tm.mkTerm(Kind::EQUAL, {arrayAtFour, ten});
      51                 :          1 :   slv.assertFormula(arrayAtFour_eq_ten);
      52                 :          1 :   std::cout << slv.checkSat() << std::endl;
      53                 :          1 : }

Generated by: LCOV version 1.14