LCOV - code coverage report
Current view: top level - buildbot/coverage/build/test/api/cpp - smt2_compliance.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 31 31 100.0 %
Date: 2025-02-01 11:33:18 Functions: 2 2 100.0 %
Branches: 2 4 50.0 %

           Branch data     Line data    Source code
       1                 :            : /******************************************************************************
       2                 :            :  * Top contributors (to current version):
       3                 :            :  *   Aina Niemetz, Andrew Reynolds, Morgan Deters
       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                 :            :  * A test of SMT-LIBv2 commands, checks for compliant output.
      14                 :            :  */
      15                 :            : 
      16                 :            : #include <cvc5/cvc5.h>
      17                 :            : #include <cvc5/cvc5_parser.h>
      18                 :            : 
      19                 :            : #include <cassert>
      20                 :            : #include <iostream>
      21                 :            : #include <sstream>
      22                 :            : 
      23                 :            : using namespace cvc5;
      24                 :            : using namespace cvc5::internal;
      25                 :            : using namespace cvc5::parser;
      26                 :            : using namespace std;
      27                 :            : 
      28                 :            : void testGetInfo(cvc5::Solver* solver, const char* s);
      29                 :            : 
      30                 :         10 : void testGetInfo(cvc5::Solver& solver, const char* s)
      31                 :            : {
      32                 :         20 :   SymbolManager sm(solver.getTermManager());
      33                 :         20 :   InputParser p(&solver, &sm);
      34                 :         20 :   std::stringstream ssi;
      35                 :         10 :   ssi << "(get-info " << s << ")";
      36                 :         10 :   p.setStreamInput(modes::InputLanguage::SMT_LIB_2_6, ssi, "<internal>");
      37                 :         20 :   Command c = p.nextCommand();
      38         [ -  + ]:         10 :   assert(!c.isNull());
      39                 :         10 :   std::cout << c << std::endl;
      40                 :         10 :   std::stringstream ss;
      41                 :         10 :   c.invoke(&solver, &sm, ss);
      42                 :         10 :   c = p.nextCommand();
      43         [ -  + ]:         10 :   assert(c.isNull());
      44                 :         10 :   std::cout << ss.str();
      45                 :         10 : }
      46                 :            : 
      47                 :          1 : int main()
      48                 :            : {
      49                 :          2 :   cvc5::TermManager tm;
      50                 :          1 :   cvc5::Solver solver(tm);
      51                 :          1 :   solver.setOption("input-language", "smtlib2");
      52                 :          1 :   solver.setOption("output-language", "smtlib2");
      53                 :          1 :   testGetInfo(solver, ":error-behavior");
      54                 :          1 :   testGetInfo(solver, ":name");
      55                 :          1 :   testGetInfo(solver, ":authors");
      56                 :          1 :   testGetInfo(solver, ":version");
      57                 :          1 :   testGetInfo(solver, ":status");
      58                 :          1 :   testGetInfo(solver, ":reason-unknown");
      59                 :          1 :   testGetInfo(solver, ":arbitrary-undefined-keyword");
      60                 :          1 :   testGetInfo(solver, ":<=");  // legal
      61                 :          1 :   testGetInfo(solver, ":->");  // legal
      62                 :          1 :   testGetInfo(solver, ":all-statistics");
      63                 :            : 
      64                 :          1 :   return 0;
      65                 :            : }

Generated by: LCOV version 1.14