LCOV - code coverage report
Current view: top level - buildbot/coverage/build/test/unit/printer - smt2_printer_black.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 21 21 100.0 %
Date: 2026-08-08 10:35:08 Functions: 9 9 100.0 %
Branches: 3 6 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                 :            :  * Black box testing of the SMT2 printer.
      11                 :            :  */
      12                 :            : 
      13                 :            : #include <cvc5/cvc5.h>
      14                 :            : 
      15                 :            : #include <iostream>
      16                 :            : 
      17                 :            : #include "expr/node.h"
      18                 :            : #include "expr/node_manager.h"
      19                 :            : #include "options/language.h"
      20                 :            : #include "smt/solver_engine.h"
      21                 :            : #include "test_smt.h"
      22                 :            : #include "util/regexp.h"
      23                 :            : #include "util/string.h"
      24                 :            : 
      25                 :            : namespace cvc5::internal {
      26                 :            : 
      27                 :            : using namespace kind;
      28                 :            : 
      29                 :            : namespace test {
      30                 :            : 
      31                 :            : class TestPrinterBlackSmt2 : public TestSmt
      32                 :            : {
      33                 :            :  protected:
      34                 :          2 :   void checkToString(TNode n, const std::string& expected)
      35                 :            :   {
      36                 :          2 :     std::stringstream ss;
      37                 :          2 :     options::ioutils::applyNodeDepth(ss, -1);
      38                 :          2 :     options::ioutils::applyOutputLanguage(ss, Language::LANG_SMTLIB_V2_6);
      39                 :          2 :     ss << n;
      40 [ -  + ][ +  - ]:          4 :     ASSERT_EQ(ss.str(), expected);
      41         [ +  - ]:          2 :   }
      42                 :            : };
      43                 :            : 
      44                 :          4 : TEST_F(TestPrinterBlackSmt2, regexp_repeat)
      45                 :            : {
      46                 :          1 :   Node n = d_nodeManager->mkNode(
      47                 :          2 :       d_nodeManager->mkConst(RegExpRepeat(5)),
      48                 :          1 :       d_nodeManager->mkNode(Kind::STRING_TO_REGEXP,
      49                 :          4 :                             d_nodeManager->mkConst(String("x"))));
      50                 :          1 :   checkToString(n, "((_ re.^ 5) (str.to_re \"x\"))");
      51                 :          1 : }
      52                 :            : 
      53                 :          4 : TEST_F(TestPrinterBlackSmt2, regexp_loop)
      54                 :            : {
      55                 :          1 :   Node n = d_nodeManager->mkNode(
      56                 :          2 :       d_nodeManager->mkConst(RegExpLoop(1, 3)),
      57                 :          1 :       d_nodeManager->mkNode(Kind::STRING_TO_REGEXP,
      58                 :          4 :                             d_nodeManager->mkConst(String("x"))));
      59                 :          1 :   checkToString(n, "((_ re.loop 1 3) (str.to_re \"x\"))");
      60                 :          1 : }
      61                 :            : }  // namespace test
      62                 :            : }  // namespace cvc5::internal

Generated by: LCOV version 1.14