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

Generated by: LCOV version 1.14