summaryrefslogtreecommitdiff
path: root/test/unit
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2019-01-29 10:17:06 -0800
committerGitHub <noreply@github.com>2019-01-29 10:17:06 -0800
commit1eaf6cf987fa1452528dc0598ca7235be735ba3b (patch)
treec327198308289e343aabf576ff3e3a05637aa166 /test/unit
parent467ef8692009f440bda74083d476131ff1e88b51 (diff)
Strings: Remove redundant replace rewrite (#2822)
Pulling the first constant string from a replace if there is no overlap with the search term is subsumed by the rewrite using `stripConstantEndpoints()`.
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/theory/theory_strings_rewriter_white.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/unit/theory/theory_strings_rewriter_white.h b/test/unit/theory/theory_strings_rewriter_white.h
index 59d36d9e8..5f08ce741 100644
--- a/test/unit/theory/theory_strings_rewriter_white.h
+++ b/test/unit/theory/theory_strings_rewriter_white.h
@@ -495,6 +495,7 @@ class TheoryStringsRewriterWhite : public CxxTest::TestSuite
Node empty = d_nm->mkConst(::CVC4::String(""));
Node a = d_nm->mkConst(::CVC4::String("A"));
+ Node ab = d_nm->mkConst(::CVC4::String("AB"));
Node b = d_nm->mkConst(::CVC4::String("B"));
Node c = d_nm->mkConst(::CVC4::String("C"));
Node d = d_nm->mkConst(::CVC4::String("D"));
@@ -625,6 +626,19 @@ class TheoryStringsRewriterWhite : public CxxTest::TestSuite
b);
repl = d_nm->mkNode(kind::STRING_STRREPL, b, x, b);
differentNormalForms(repl_repl, repl);
+
+ {
+ // Same normal form:
+ //
+ // (str.replace (str.++ "AB" x) "C" y)
+ //
+ // (str.++ "AB" (str.replace x "C" y))
+ Node lhs = d_nm->mkNode(
+ kind::STRING_STRREPL, d_nm->mkNode(kind::STRING_CONCAT, ab, x), c, y);
+ Node rhs = d_nm->mkNode(
+ kind::STRING_CONCAT, ab, d_nm->mkNode(kind::STRING_STRREPL, x, c, y));
+ sameNormalForm(lhs, rhs);
+ }
}
void testRewriteContains()
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback