File tree Expand file tree Collapse file tree 4 files changed +23
-2
lines changed
Expand file tree Collapse file tree 4 files changed +23
-2
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ class smt2_convt : public stack_decision_proceduret
8282
8383 std::size_t get_number_of_solver_calls () const override ;
8484
85+ static std::string convert_identifier (const irep_idt &identifier);
86+
8587protected:
8688 const namespacet &ns;
8789 std::ostream &out;
@@ -136,8 +138,6 @@ class smt2_convt : public stack_decision_proceduret
136138 void convert_with (const with_exprt &expr);
137139 void convert_update (const exprt &expr);
138140
139- std::string convert_identifier (const irep_idt &identifier);
140-
141141 void convert_expr (const exprt &);
142142 void convert_type (const typet &);
143143 void convert_literal (const literalt);
Original file line number Diff line number Diff line change @@ -84,6 +84,7 @@ SRC += analyses/ai/ai.cpp \
8484 solvers/sat/external_sat.cpp \
8585 solvers/sat/satcheck_cadical.cpp \
8686 solvers/sat/satcheck_minisat2.cpp \
87+ solvers/smt2/smt2_conv.cpp \
8788 solvers/strings/array_pool/array_pool.cpp \
8889 solvers/strings/string_constraint_generator_valueof/calculate_max_string_length.cpp \
8990 solvers/strings/string_constraint_generator_valueof/get_numeric_value_from_character.cpp \
Original file line number Diff line number Diff line change 1+ solvers/smt2
2+ testing-utils
Original file line number Diff line number Diff line change 1+ // Author: Diffblue Ltd.
2+
3+ #include < testing-utils/use_catch.h>
4+
5+ #include < solvers/smt2/smt2_conv.h>
6+
7+ TEST_CASE (
8+ " smt2_convt::convert_identifier character escaping." ,
9+ " [core][solvers][smt2]" )
10+ {
11+ const auto no_escaping_characters = " abcdefghijklmnopqrstuvwxyz0123456789$" ;
12+ CHECK (
13+ smt2_convt::convert_identifier (no_escaping_characters) ==
14+ no_escaping_characters);
15+ CHECK (smt2_convt::convert_identifier (" \\ " ) == " &92;" );
16+ CHECK (smt2_convt::convert_identifier (" |" ) == " &124;" );
17+ CHECK (smt2_convt::convert_identifier (" &" ) == " &38;" );
18+ }
You can’t perform that action at this time.
0 commit comments