LCOV - code coverage report
Current view: top level - buildbot/coverage/build/src/smt - model.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 39 39 100.0 %
Date: 2026-04-26 10:45:53 Functions: 10 10 100.0 %
Branches: 9 18 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                 :            :  * Implementation of Model class.
      11                 :            :  */
      12                 :            : 
      13                 :            : #include "smt/model.h"
      14                 :            : 
      15                 :            : #include "options/base_options.h"
      16                 :            : #include "options/io_utils.h"
      17                 :            : #include "printer/printer.h"
      18                 :            : 
      19                 :            : namespace cvc5::internal {
      20                 :            : namespace smt {
      21                 :            : 
      22                 :        241 : Model::Model(bool isKnownSat, const std::string& inputName)
      23                 :        241 :     : d_inputName(inputName), d_isKnownSat(isKnownSat)
      24                 :            : {
      25                 :        241 : }
      26                 :            : 
      27                 :        241 : std::ostream& operator<<(std::ostream& out, const Model& m)
      28                 :            : {
      29                 :        241 :   options::ioutils::Scope scope(out);
      30                 :        241 :   options::ioutils::applyDagThresh(out, 0);
      31                 :        241 :   Printer::getPrinter(out)->toStream(out, m);
      32                 :        241 :   return out;
      33                 :        241 : }
      34                 :            : 
      35                 :        200 : const std::vector<Node>& Model::getDomainElements(TypeNode tn) const
      36                 :            : {
      37                 :            :   std::map<TypeNode, std::vector<Node>>::const_iterator it =
      38                 :        200 :       d_domainElements.find(tn);
      39 [ -  + ][ -  + ]:        200 :   Assert(it != d_domainElements.end());
                 [ -  - ]
      40                 :        200 :   return it->second;
      41                 :            : }
      42                 :            : 
      43                 :        447 : Node Model::getValue(TNode n) const
      44                 :            : {
      45                 :        447 :   std::map<Node, Node>::const_iterator it = d_declareTermValues.find(n);
      46 [ -  + ][ -  + ]:        447 :   Assert(it != d_declareTermValues.end());
                 [ -  - ]
      47                 :        894 :   return it->second;
      48                 :            : }
      49                 :            : 
      50                 :        241 : bool Model::getHeapModel(Node& h, Node& nilEq) const
      51                 :            : {
      52 [ +  + ][ -  + ]:        241 :   if (d_sepHeap.isNull() || d_sepNilEq.isNull())
                 [ +  + ]
      53                 :            :   {
      54                 :        240 :     return false;
      55                 :            :   }
      56                 :          1 :   h = d_sepHeap;
      57                 :          1 :   nilEq = d_sepNilEq;
      58                 :          1 :   return true;
      59                 :            : }
      60                 :            : 
      61                 :        200 : void Model::addDeclarationSort(TypeNode tn, const std::vector<Node>& elements)
      62                 :            : {
      63                 :        200 :   d_declareSorts.push_back(tn);
      64                 :        200 :   d_domainElements[tn] = elements;
      65                 :        200 : }
      66                 :            : 
      67                 :        447 : void Model::addDeclarationTerm(Node n, Node value)
      68                 :            : {
      69                 :        447 :   d_declareTerms.push_back(n);
      70                 :        447 :   d_declareTermValues[n] = value;
      71                 :        447 : }
      72                 :            : 
      73                 :          1 : void Model::setHeapModel(Node h, Node nilEq)
      74                 :            : {
      75                 :          1 :   d_sepHeap = h;
      76                 :          1 :   d_sepNilEq = nilEq;
      77                 :          1 : }
      78                 :            : 
      79                 :        241 : const std::vector<TypeNode>& Model::getDeclaredSorts() const
      80                 :            : {
      81                 :        241 :   return d_declareSorts;
      82                 :            : }
      83                 :            : 
      84                 :        241 : const std::vector<Node>& Model::getDeclaredTerms() const
      85                 :            : {
      86                 :        241 :   return d_declareTerms;
      87                 :            : }
      88                 :            : 
      89                 :            : }  // namespace smt
      90                 :            : }  // namespace cvc5::internal

Generated by: LCOV version 1.14