diff options
author | Andres Noetzli <andres.noetzli@gmail.com> | 2018-11-07 17:04:52 -0800 |
---|---|---|
committer | Andrew Reynolds <andrew.j.reynolds@gmail.com> | 2018-11-07 19:04:52 -0600 |
commit | 7b0efcd75f471b4252c65b8d18aa4c3266649626 (patch) | |
tree | e063874d6f0eb3bda404fda9433807100427c8e7 /test | |
parent | e38d8cfd44d29547be464c8e7a6b9ad2ce7b9fe1 (diff) |
Evaluator: add support for str.code (#2696)
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/theory/evaluator_white.h | 24 |
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))); + } + } }; |