GCC Code Coverage Report
Directory: . Exec Total Coverage
File: test/unit/theory/strings_rewriter_white.cpp Lines: 15 15 100.0 %
Date: 2021-05-22 Branches: 47 110 42.7 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Aina Niemetz
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
 * Unit tests for the strings rewriter.
14
 */
15
16
#include <iostream>
17
#include <memory>
18
#include <vector>
19
20
#include "expr/node.h"
21
#include "expr/node_manager.h"
22
#include "test_smt.h"
23
#include "theory/rewriter.h"
24
#include "theory/strings/strings_rewriter.h"
25
26
namespace cvc5 {
27
28
using namespace kind;
29
using namespace theory;
30
using namespace theory::strings;
31
32
namespace test {
33
34
4
class TestTheoryWhiteStringsRewriter : public TestSmt
35
{
36
};
37
38
10
TEST_F(TestTheoryWhiteStringsRewriter, rewrite_leq)
39
{
40
4
  TypeNode intType = d_nodeManager->integerType();
41
4
  TypeNode strType = d_nodeManager->stringType();
42
43
4
  Node a = d_nodeManager->mkConst(::cvc5::String("A"));
44
4
  Node bc = d_nodeManager->mkConst(::cvc5::String("BC"));
45
4
  Node x = d_nodeManager->mkVar("x", strType);
46
4
  Node y = d_nodeManager->mkVar("y", strType);
47
48
4
  Node ax = d_nodeManager->mkNode(STRING_CONCAT, a, x);
49
4
  Node bcy = d_nodeManager->mkNode(STRING_CONCAT, bc, y);
50
51
  {
52
4
    Node leq = d_nodeManager->mkNode(STRING_LEQ, ax, bcy);
53
2
    ASSERT_EQ(Rewriter::rewrite(leq), d_nodeManager->mkConst(true));
54
  }
55
56
  {
57
4
    Node leq = d_nodeManager->mkNode(STRING_LEQ, bcy, ax);
58
2
    ASSERT_EQ(Rewriter::rewrite(leq), d_nodeManager->mkConst(false));
59
  }
60
}
61
62
}  // namespace test
63
15938
}  // namespace cvc5