summaryrefslogtreecommitdiff
path: root/test/unit/theory
diff options
context:
space:
mode:
authorAndres Noetzli <andres.noetzli@gmail.com>2018-11-07 17:04:52 -0800
committerAndrew Reynolds <andrew.j.reynolds@gmail.com>2018-11-07 19:04:52 -0600
commit7b0efcd75f471b4252c65b8d18aa4c3266649626 (patch)
treee063874d6f0eb3bda404fda9433807100427c8e7 /test/unit/theory
parente38d8cfd44d29547be464c8e7a6b9ad2ce7b9fe1 (diff)
Evaluator: add support for str.code (#2696)
Diffstat (limited to 'test/unit/theory')
-rw-r--r--test/unit/theory/evaluator_white.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/unit/theory/evaluator_white.h b/test/unit/theory/evaluator_white.h
index 73556c388..9dc6f9520 100644
--- a/test/unit/theory/evaluator_white.h
+++ b/test/unit/theory/evaluator_white.h
@@ -156,4 +156,28 @@ class TheoryEvaluatorWhite : public CxxTest::TestSuite
TS_ASSERT_EQUALS(r, Rewriter::rewrite(n));
}
}
+
+ void testCode()
+ {
+ Node a = d_nm->mkConst(String("A"));
+ Node empty = d_nm->mkConst(String(""));
+
+ std::vector<Node> args;
+ std::vector<Node> vals;
+ Evaluator eval;
+
+ // (str.code "A") ---> 65
+ {
+ Node n = d_nm->mkNode(kind::STRING_CODE, a);
+ Node r = eval.eval(n, args, vals);
+ TS_ASSERT_EQUALS(r, d_nm->mkConst(Rational(65)));
+ }
+
+ // (str.code "") ---> -1
+ {
+ Node n = d_nm->mkNode(kind::STRING_CODE, empty);
+ Node r = eval.eval(n, args, vals);
+ TS_ASSERT_EQUALS(r, d_nm->mkConst(Rational(-1)));
+ }
+ }
};
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback