Skip to content

Commit 3502fc1

Browse files
author
Enrico Steffinlongo
committed
Add array_of_exprt unit and regression tests
1 parent 391cbd7 commit 3502fc1

File tree

1 file changed

+31
-2
lines changed

1 file changed

+31
-2
lines changed

unit/solvers/smt2_incremental/smt2_incremental_decision_procedure.cpp

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,7 @@ TEST_CASE(
171171
test.sent_commands ==
172172
std::vector<smt_commandt>{
173173
smt_set_option_commandt{smt_option_produce_modelst{true}},
174-
smt_set_logic_commandt{// NOLINTNEXTLINE(whitespace/line_length)
175-
smt_logic_allt{}},
174+
smt_set_logic_commandt{smt_logic_allt{}},
176175
test.object_size_function.declaration});
177176
test.sent_commands.clear();
178177
SECTION("Set symbol to true.")
@@ -616,4 +615,34 @@ TEST_CASE(
616615
foo_term, smt_array_theoryt::select(array_term, index_term))}};
617616
REQUIRE(test.sent_commands == expected_commands);
618617
}
618+
SECTION("array_of_exprt - all elements set to a given value")
619+
{
620+
const array_of_exprt array_of_expr{
621+
from_integer(42, value_type), array_type};
622+
test.sent_commands.clear();
623+
test.procedure.set_to(
624+
equal_exprt{
625+
foo.symbol_expr(), index_exprt{array_of_expr, index.symbol_expr()}},
626+
true);
627+
const auto foo_term = smt_identifier_termt{"foo", smt_bit_vector_sortt{8}};
628+
const auto array_term = smt_identifier_termt{
629+
"array_0",
630+
smt_array_sortt{smt_bit_vector_sortt{32}, smt_bit_vector_sortt{8}}};
631+
const auto index_term =
632+
smt_identifier_termt{"index", smt_bit_vector_sortt{32}};
633+
const auto forall_term =
634+
smt_identifier_termt{"array_0_index", smt_bit_vector_sortt{32}};
635+
const std::vector<smt_commandt> expected_commands{
636+
smt_declare_function_commandt{foo_term, {}},
637+
smt_declare_function_commandt{array_term, {}},
638+
smt_assert_commandt{smt_forall_termt{
639+
{forall_term},
640+
smt_core_theoryt::equal(
641+
smt_array_theoryt::select(array_term, forall_term),
642+
smt_bit_vector_constant_termt{42, 8})}},
643+
smt_declare_function_commandt{index_term, {}},
644+
smt_assert_commandt{smt_core_theoryt::equal(
645+
foo_term, smt_array_theoryt::select(array_term, index_term))}};
646+
REQUIRE(test.sent_commands == expected_commands);
647+
}
619648
}

0 commit comments

Comments
 (0)