@@ -129,4 +129,54 @@ TEST_CASE("smt get-value response validation", "[core][smt2_incremental]")
129
129
smt_identifier_termt{" a" , smt_bit_vector_sortt{8 }},
130
130
smt_bit_vector_constant_termt{42 , 8 }}}});
131
131
}
132
+ SECTION (" Multiple valuation pairs." )
133
+ {
134
+ const response_or_errort<smt_responset> two_pair_response =
135
+ validate_smt_response (*smt2irep (" ((a true) (b false))" ).parsed_output );
136
+ CHECK (
137
+ *two_pair_response.get_if_valid () ==
138
+ smt_get_value_responset{{smt_get_value_responset::valuation_pairt{
139
+ smt_identifier_termt{" a" , smt_bool_sortt{}},
140
+ smt_bool_literal_termt{true }},
141
+ smt_get_value_responset::valuation_pairt{
142
+ smt_identifier_termt{" b" , smt_bool_sortt{}},
143
+ smt_bool_literal_termt{false }}}});
144
+ }
145
+ SECTION (" Invalid terms." )
146
+ {
147
+ const response_or_errort<smt_responset> empty_value_response =
148
+ validate_smt_response (*smt2irep (" ((a ())))" ).parsed_output );
149
+ CHECK (
150
+ *empty_value_response.get_if_error () ==
151
+ std::vector<std::string>{" Unrecognised SMT term - \"\" ." });
152
+ const response_or_errort<smt_responset> pair_value_response =
153
+ validate_smt_response (*smt2irep (" ((a (#xF00D #xBAD))))" ).parsed_output );
154
+ CHECK (
155
+ *pair_value_response.get_if_error () ==
156
+ std::vector<std::string>{" Unrecognised SMT term - \"\n "
157
+ " 0: #xF00D\n "
158
+ " 1: #xBAD\" ." });
159
+ const response_or_errort<smt_responset> two_pair_value_response =
160
+ validate_smt_response (
161
+ *smt2irep (" ((a (#xF00D #xBAD)) (b (#xDEAD #xFA11)))" ).parsed_output );
162
+ CHECK (
163
+ *two_pair_value_response.get_if_error () ==
164
+ std::vector<std::string>{" Unrecognised SMT term - \"\n "
165
+ " 0: #xF00D\n "
166
+ " 1: #xBAD\" ." ,
167
+ " Unrecognised SMT term - \"\n "
168
+ " 0: #xDEAD\n "
169
+ " 1: #xFA11\" ." });
170
+ const response_or_errort<smt_responset> empty_descriptor_response =
171
+ validate_smt_response (*smt2irep (" ((() true))" ).parsed_output );
172
+ CHECK (
173
+ *empty_descriptor_response.get_if_error () ==
174
+ std::vector<std::string>{" Expected identifier, found - \"\" ." });
175
+ const response_or_errort<smt_responset> empty_pair =
176
+ validate_smt_response (*smt2irep (" ((() ())))" ).parsed_output );
177
+ CHECK (
178
+ *empty_pair.get_if_error () ==
179
+ std::vector<std::string>{" Expected identifier, found - \"\" ." ,
180
+ " Unrecognised SMT term - \"\" ." });
181
+ }
132
182
}
0 commit comments