summaryrefslogtreecommitdiff
path: root/test/unit/theory/strings_rewriter_white.cpp
blob: bc6f400c070421a3a693c7e6d713a65d9615b079 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/******************************************************************************
 * Top contributors (to current version):
 *   Aina Niemetz
 *
 * This file is part of the cvc5 project.
 *
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
 * in the top-level source directory and their institutional affiliations.
 * All rights reserved.  See the file COPYING in the top-level source
 * directory for licensing information.
 * ****************************************************************************
 *
 * Unit tests for the strings rewriter.
 */

#include <iostream>
#include <memory>
#include <vector>

#include "expr/node.h"
#include "expr/node_manager.h"
#include "test_smt.h"
#include "theory/rewriter.h"
#include "theory/strings/strings_rewriter.h"

namespace cvc5 {

using namespace kind;
using namespace theory;
using namespace theory::strings;

namespace test {

class TestTheoryWhiteStringsRewriter : public TestSmt
{
};

TEST_F(TestTheoryWhiteStringsRewriter, rewrite_leq)
{
  TypeNode intType = d_nodeManager->integerType();
  TypeNode strType = d_nodeManager->stringType();

  Node a = d_nodeManager->mkConst(::cvc5::String("A"));
  Node bc = d_nodeManager->mkConst(::cvc5::String("BC"));
  Node x = d_nodeManager->mkVar("x", strType);
  Node y = d_nodeManager->mkVar("y", strType);

  Node ax = d_nodeManager->mkNode(STRING_CONCAT, a, x);
  Node bcy = d_nodeManager->mkNode(STRING_CONCAT, bc, y);

  {
    Node leq = d_nodeManager->mkNode(STRING_LEQ, ax, bcy);
    ASSERT_EQ(Rewriter::rewrite(leq), d_nodeManager->mkConst(true));
  }

  {
    Node leq = d_nodeManager->mkNode(STRING_LEQ, bcy, ax);
    ASSERT_EQ(Rewriter::rewrite(leq), d_nodeManager->mkConst(false));
  }
}

}  // namespace test
}  // namespace cvc5
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback