|
6 | 6 | #include <util/exception_utils.h>
|
7 | 7 | #include <util/make_unique.h>
|
8 | 8 | #include <util/namespace.h>
|
| 9 | +#include <util/string_constant.h> |
9 | 10 | #include <util/symbol_table.h>
|
10 | 11 |
|
11 | 12 | #include <solvers/smt2_incremental/ast/smt_commands.h>
|
@@ -683,6 +684,53 @@ TEST_CASE(
|
683 | 684 | }
|
684 | 685 | }
|
685 | 686 |
|
| 687 | +TEST_CASE( |
| 688 | + "smt2_incremental_decision_proceduret string literal commands.", |
| 689 | + "[core][smt2_incremental]") |
| 690 | +{ |
| 691 | + auto test = decision_procedure_test_environmentt::make(); |
| 692 | + const string_constantt constant{"Chips"}; |
| 693 | + const typet array_type = constant.to_array_expr().type(); |
| 694 | + const symbolt fish{"fish", array_type, ID_C}; |
| 695 | + test.symbol_table.insert(fish); |
| 696 | + test.sent_commands.clear(); |
| 697 | + test.procedure.set_to(equal_exprt{fish.symbol_expr(), constant}, true); |
| 698 | + const smt_array_sortt expected_sort{ |
| 699 | + smt_bit_vector_sortt{32}, smt_bit_vector_sortt{8}}; |
| 700 | + const smt_identifier_termt expected_fish{"fish", expected_sort}; |
| 701 | + const smt_identifier_termt expected_chips{"array_0", expected_sort}; |
| 702 | + const std::vector<smt_commandt> expected_commands{ |
| 703 | + smt_declare_function_commandt{expected_fish, {}}, |
| 704 | + smt_declare_function_commandt{expected_chips, {}}, |
| 705 | + smt_assert_commandt{smt_core_theoryt::equal( |
| 706 | + smt_array_theoryt::select( |
| 707 | + expected_chips, smt_bit_vector_constant_termt{0, 32}), |
| 708 | + smt_bit_vector_constant_termt{'C', 8})}, |
| 709 | + smt_assert_commandt{smt_core_theoryt::equal( |
| 710 | + smt_array_theoryt::select( |
| 711 | + expected_chips, smt_bit_vector_constant_termt{1, 32}), |
| 712 | + smt_bit_vector_constant_termt{'h', 8})}, |
| 713 | + smt_assert_commandt{smt_core_theoryt::equal( |
| 714 | + smt_array_theoryt::select( |
| 715 | + expected_chips, smt_bit_vector_constant_termt{2, 32}), |
| 716 | + smt_bit_vector_constant_termt{'i', 8})}, |
| 717 | + smt_assert_commandt{smt_core_theoryt::equal( |
| 718 | + smt_array_theoryt::select( |
| 719 | + expected_chips, smt_bit_vector_constant_termt{3, 32}), |
| 720 | + smt_bit_vector_constant_termt{'p', 8})}, |
| 721 | + smt_assert_commandt{smt_core_theoryt::equal( |
| 722 | + smt_array_theoryt::select( |
| 723 | + expected_chips, smt_bit_vector_constant_termt{4, 32}), |
| 724 | + smt_bit_vector_constant_termt{'s', 8})}, |
| 725 | + smt_assert_commandt{smt_core_theoryt::equal( |
| 726 | + smt_array_theoryt::select( |
| 727 | + expected_chips, smt_bit_vector_constant_termt{5, 32}), |
| 728 | + smt_bit_vector_constant_termt{'\0', 8})}, |
| 729 | + smt_assert_commandt{ |
| 730 | + smt_core_theoryt::equal(expected_fish, expected_chips)}}; |
| 731 | + REQUIRE(test.sent_commands == expected_commands); |
| 732 | +} |
| 733 | + |
686 | 734 | TEST_CASE(
|
687 | 735 | "smt2_incremental_decision_proceduret multi-ary with_exprt introduces "
|
688 | 736 | "correct number of indexes.",
|
|
0 commit comments