GCC Code Coverage Report
Directory: . Exec Total Coverage
File: test/unit/printer/smt2_printer_black.cpp Lines: 18 18 100.0 %
Date: 2021-05-22 Branches: 39 86 45.3 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Aina Niemetz, Andres Noetzli
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 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
 * Black box testing of the SMT2 printer.
14
 */
15
16
#include <iostream>
17
18
#include "api/cpp/cvc5.h"
19
#include "expr/node.h"
20
#include "expr/node_manager.h"
21
#include "options/language.h"
22
#include "smt/smt_engine.h"
23
#include "test_smt.h"
24
25
namespace cvc5 {
26
27
using namespace kind;
28
29
namespace test {
30
31
8
class TestPrinterBlackSmt2 : public TestSmt
32
{
33
 protected:
34
4
  void checkToString(TNode n, const std::string& expected)
35
  {
36
8
    std::stringstream ss;
37
    ss << Node::setdepth(-1)
38
4
       << Node::setlanguage(language::output::LANG_SMTLIB_V2_6) << n;
39
4
    ASSERT_EQ(ss.str(), expected);
40
  }
41
};
42
43
11
TEST_F(TestPrinterBlackSmt2, regexp_repeat)
44
{
45
  Node n = d_nodeManager->mkNode(
46
4
      d_nodeManager->mkConst(RegExpRepeat(5)),
47
6
      d_nodeManager->mkNode(STRING_TO_REGEXP,
48
14
                            d_nodeManager->mkConst(String("x"))));
49
2
  checkToString(n, "((_ re.^ 5) (str.to_re \"x\"))");
50
2
}
51
52
11
TEST_F(TestPrinterBlackSmt2, regexp_loop)
53
{
54
  Node n = d_nodeManager->mkNode(
55
4
      d_nodeManager->mkConst(RegExpLoop(1, 3)),
56
6
      d_nodeManager->mkNode(STRING_TO_REGEXP,
57
14
                            d_nodeManager->mkConst(String("x"))));
58
2
  checkToString(n, "((_ re.loop 1 3) (str.to_re \"x\"))");
59
2
}
60
}  // namespace test
61
26903
}  // namespace cvc5