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-03-28 10:41:09 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                 :        239 : Model::Model(bool isKnownSat, const std::string& inputName)
      23                 :        239 :     : d_inputName(inputName), d_isKnownSat(isKnownSat)
      24                 :            : {
      25                 :        239 : }
      26                 :            : 
      27                 :        239 : std::ostream& operator<<(std::ostream& out, const Model& m) {
      28                 :        239 :   options::ioutils::Scope scope(out);
      29                 :        239 :   options::ioutils::applyDagThresh(out, 0);
      30                 :        239 :   Printer::getPrinter(out)->toStream(out, m);
      31                 :        239 :   return out;
      32                 :        239 : }
      33                 :            : 
      34                 :        200 : const std::vector<Node>& Model::getDomainElements(TypeNode tn) const
      35                 :            : {
      36                 :            :   std::map<TypeNode, std::vector<Node>>::const_iterator it =
      37                 :        200 :       d_domainElements.find(tn);
      38 [ -  + ][ -  + ]:        200 :   Assert(it != d_domainElements.end());
                 [ -  - ]
      39                 :        200 :   return it->second;
      40                 :            : }
      41                 :            : 
      42                 :        445 : Node Model::getValue(TNode n) const
      43                 :            : {
      44                 :        445 :   std::map<Node, Node>::const_iterator it = d_declareTermValues.find(n);
      45 [ -  + ][ -  + ]:        445 :   Assert(it != d_declareTermValues.end());
                 [ -  - ]
      46                 :        890 :   return it->second;
      47                 :            : }
      48                 :            : 
      49                 :        239 : bool Model::getHeapModel(Node& h, Node& nilEq) const
      50                 :            : {
      51 [ +  + ][ -  + ]:        239 :   if (d_sepHeap.isNull() || d_sepNilEq.isNull())
                 [ +  + ]
      52                 :            :   {
      53                 :        238 :     return false;
      54                 :            :   }
      55                 :          1 :   h = d_sepHeap;
      56                 :          1 :   nilEq = d_sepNilEq;
      57                 :          1 :   return true;
      58                 :            : }
      59                 :            : 
      60                 :        200 : void Model::addDeclarationSort(TypeNode tn, const std::vector<Node>& elements)
      61                 :            : {
      62                 :        200 :   d_declareSorts.push_back(tn);
      63                 :        200 :   d_domainElements[tn] = elements;
      64                 :        200 : }
      65                 :            : 
      66                 :        445 : void Model::addDeclarationTerm(Node n, Node value)
      67                 :            : {
      68                 :        445 :   d_declareTerms.push_back(n);
      69                 :        445 :   d_declareTermValues[n] = value;
      70                 :        445 : }
      71                 :            : 
      72                 :          1 : void Model::setHeapModel(Node h, Node nilEq)
      73                 :            : {
      74                 :          1 :   d_sepHeap = h;
      75                 :          1 :   d_sepNilEq = nilEq;
      76                 :          1 : }
      77                 :            : 
      78                 :        239 : const std::vector<TypeNode>& Model::getDeclaredSorts() const
      79                 :            : {
      80                 :        239 :   return d_declareSorts;
      81                 :            : }
      82                 :            : 
      83                 :        239 : const std::vector<Node>& Model::getDeclaredTerms() const
      84                 :            : {
      85                 :        239 :   return d_declareTerms;
      86                 :            : }
      87                 :            : 
      88                 :            : }  // namespace smt
      89                 :            : }  // namespace cvc5::internal

Generated by: LCOV version 1.14