1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Aina Niemetz, Andres Noetzli, Andrew Reynolds |
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 skolem cache of the theory of strings. |
14 |
|
*/ |
15 |
|
|
16 |
|
#include <memory> |
17 |
|
|
18 |
|
#include "expr/node.h" |
19 |
|
#include "test_smt.h" |
20 |
|
#include "theory/strings/skolem_cache.h" |
21 |
|
#include "util/rational.h" |
22 |
|
#include "util/string.h" |
23 |
|
|
24 |
|
namespace cvc5 { |
25 |
|
|
26 |
|
using namespace theory::strings; |
27 |
|
|
28 |
|
namespace test { |
29 |
|
|
30 |
4 |
class TestTheoryBlackStringsSkolemCache : public TestSmt |
31 |
|
{ |
32 |
|
}; |
33 |
|
|
34 |
10 |
TEST_F(TestTheoryBlackStringsSkolemCache, mkSkolemCached) |
35 |
|
{ |
36 |
4 |
Node zero = d_nodeManager->mkConst(Rational(0)); |
37 |
4 |
Node n = d_skolemManager->mkDummySkolem("n", d_nodeManager->integerType()); |
38 |
4 |
Node a = d_skolemManager->mkDummySkolem("a", d_nodeManager->stringType()); |
39 |
4 |
Node b = d_skolemManager->mkDummySkolem("b", d_nodeManager->stringType()); |
40 |
4 |
Node c = d_skolemManager->mkDummySkolem("c", d_nodeManager->stringType()); |
41 |
4 |
Node d = d_skolemManager->mkDummySkolem("d", d_nodeManager->stringType()); |
42 |
|
Node sa = d_nodeManager->mkNode( |
43 |
|
kind::STRING_SUBSTR, |
44 |
|
a, |
45 |
|
zero, |
46 |
4 |
d_nodeManager->mkNode(kind::STRING_INDEXOF, a, b, zero)); |
47 |
4 |
Node sc = d_nodeManager->mkNode(kind::STRING_SUBSTR, c, zero, n); |
48 |
|
|
49 |
4 |
SkolemCache sk; |
50 |
|
|
51 |
|
// Check that skolems are shared between: |
52 |
|
// |
53 |
|
// SK_FIRST_CTN(a, b) |
54 |
|
// |
55 |
|
// SK_FIRST_CTN(a, b) |
56 |
|
{ |
57 |
4 |
Node s1 = sk.mkSkolemCached(a, b, SkolemCache::SK_FIRST_CTN_PRE, "foo"); |
58 |
4 |
Node s2 = sk.mkSkolemCached(a, b, SkolemCache::SK_FIRST_CTN_PRE, "foo"); |
59 |
2 |
ASSERT_EQ(s1, s2); |
60 |
|
} |
61 |
|
} |
62 |
|
} // namespace test |
63 |
268836 |
} // namespace cvc5 |