Skip to content

Commit de250f9

Browse files
committed
Add comment on constructed expression as C source expressions
To make the intention of each test section clearer.
1 parent b15fe4e commit de250f9

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

unit/solvers/smt2_incremental/object_tracking.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ TEST_CASE("find_object_base_expression", "[core][smt2_incremental]")
1717
const std::size_t pointer_bits = 64;
1818
SECTION("Address of symbol")
1919
{
20+
// Constructed address of expression should be equivalent to the following
21+
// C expression - `&base`.
2022
const typet base_type = unsignedbv_typet{8};
2123
const symbol_exprt object_base{"base", base_type};
2224
const address_of_exprt address_of{
@@ -26,6 +28,8 @@ TEST_CASE("find_object_base_expression", "[core][smt2_incremental]")
2628
}
2729
SECTION("Address of index")
2830
{
31+
// Constructed address of expression should be equivalent to the following
32+
// C expression - `&(base[index])`.
2933
const unsignedbv_typet element_type{8};
3034
const signedbv_typet index_type{pointer_bits};
3135
const array_typet base_type{element_type, from_integer(42, index_type)};
@@ -39,6 +43,8 @@ TEST_CASE("find_object_base_expression", "[core][smt2_incremental]")
3943
}
4044
SECTION("Address of struct member")
4145
{
46+
// Constructed address of expression should be equivalent to the following
47+
// C expression - `&(base.baz)`.
4248
const struct_tag_typet base_type{"structt"};
4349
const symbol_exprt object_base{"base", base_type};
4450
const unsignedbv_typet member_type{8};
@@ -50,6 +56,8 @@ TEST_CASE("find_object_base_expression", "[core][smt2_incremental]")
5056
}
5157
SECTION("Address of index of struct member")
5258
{
59+
// Constructed address of expression should be equivalent to the following
60+
// C expression - `&(base.baz[index])`.
5361
const struct_tag_typet base_type{"structt"};
5462
const symbol_exprt object_base{"base", base_type};
5563

@@ -66,6 +74,8 @@ TEST_CASE("find_object_base_expression", "[core][smt2_incremental]")
6674
}
6775
SECTION("Address of struct member at index")
6876
{
77+
// Constructed address of expression should be equivalent to the following
78+
// C expression - `&(base[index].qux)`.
6979
const struct_tag_typet element_type{"struct_elementt"};
7080
const signedbv_typet index_type{pointer_bits};
7181
const array_typet base_type{element_type, from_integer(42, index_type)};

0 commit comments

Comments
 (0)