@@ -669,3 +669,68 @@ TEST_CASE(
669
669
REQUIRE (test.sent_commands == expected_commands);
670
670
}
671
671
}
672
+
673
+ TEST_CASE (
674
+ " smt2_incremental_decision_proceduret multi-ary with_exprt introduces "
675
+ " correct number of indexes." ,
676
+ " [core][smt2_incremental]" )
677
+ {
678
+ auto test = decision_procedure_test_environmentt::make ();
679
+ const signedbv_typet index_type{32 };
680
+ const signedbv_typet value_type{8 };
681
+ const array_typet array_type{value_type, from_integer (3 , index_type)};
682
+ const auto original_array_symbol =
683
+ make_test_symbol (" original_array" , array_type);
684
+ const auto result_array_symbol = make_test_symbol (" result_array" , array_type);
685
+ with_exprt with_expr{
686
+ original_array_symbol.symbol_expr (),
687
+ from_integer (0 , index_type),
688
+ from_integer (0 , value_type)};
689
+ with_expr.add_to_operands (
690
+ from_integer (1 , index_type), from_integer (1 , value_type));
691
+ with_expr.add_to_operands (
692
+ from_integer (2 , index_type), from_integer (2 , value_type));
693
+ const equal_exprt equal_expr{result_array_symbol.symbol_expr (), with_expr};
694
+ test.sent_commands .clear ();
695
+ test.procedure .set_to (equal_expr, true );
696
+
697
+ const smt_bit_vector_sortt smt_index_sort{32 };
698
+ const smt_bit_vector_sortt smt_value_sort{8 };
699
+ const smt_array_sortt smt_array_sort{smt_index_sort, smt_value_sort};
700
+ const smt_identifier_termt smt_original_array_term{
701
+ " original_array" , smt_array_sort};
702
+ const smt_identifier_termt smt_result_array_term{
703
+ " result_array" , smt_array_sort};
704
+ const smt_identifier_termt index_0_term{" index_0" , smt_index_sort};
705
+ const smt_identifier_termt index_1_term{" index_1" , smt_index_sort};
706
+ const smt_identifier_termt index_2_term{" index_2" , smt_index_sort};
707
+ const smt_termt store_term = smt_array_theoryt::store (
708
+ smt_array_theoryt::store (
709
+ smt_array_theoryt::store (
710
+ smt_original_array_term,
711
+ index_0_term,
712
+ smt_bit_vector_constant_termt{0 , smt_value_sort}),
713
+ index_1_term,
714
+ smt_bit_vector_constant_termt{1 , smt_value_sort}),
715
+ index_2_term,
716
+ smt_bit_vector_constant_termt{2 , smt_value_sort});
717
+ const auto smt_assertion = smt_assert_commandt{
718
+ smt_core_theoryt::equal (smt_result_array_term, store_term)};
719
+ const std::vector<smt_commandt> expected_commands{
720
+ smt_declare_function_commandt (smt_result_array_term, {}),
721
+ smt_declare_function_commandt (smt_original_array_term, {}),
722
+ smt_define_function_commandt{
723
+ index_0_term.identifier (),
724
+ {},
725
+ smt_bit_vector_constant_termt{0 , smt_index_sort}},
726
+ smt_define_function_commandt{
727
+ index_1_term.identifier (),
728
+ {},
729
+ smt_bit_vector_constant_termt{1 , smt_index_sort}},
730
+ smt_define_function_commandt{
731
+ index_2_term.identifier (),
732
+ {},
733
+ smt_bit_vector_constant_termt{2 , smt_index_sort}},
734
+ smt_assertion};
735
+ REQUIRE (test.sent_commands == expected_commands);
736
+ }
0 commit comments