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
64
|
/********************* */
/*! \file strings_rewriter_white.cpp
** \verbatim
** Top contributors (to current version):
** Aina Niemetz, Not Committed Yet
** This file is part of the CVC4 project.
** Copyright (c) 2009-2020 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.\endverbatim
**
** \brief Unit tests for the strings rewriter
**
** 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 CVC4 {
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(::CVC4::String("A"));
Node bc = d_nodeManager->mkConst(::CVC4::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 CVC4
|