@@ -20,7 +20,7 @@ Author: Michael Tautschnig
20
20
#include < util/std_expr.h>
21
21
#include < util/symbol_table.h>
22
22
23
- TEST_CASE (" Simplify pointer_offset(address of array index)" )
23
+ TEST_CASE (" Simplify pointer_offset(address of array index)" , " [core][util] " )
24
24
{
25
25
config.set_arch (" none" );
26
26
@@ -42,7 +42,7 @@ TEST_CASE("Simplify pointer_offset(address of array index)")
42
42
REQUIRE (offset_value==1 );
43
43
}
44
44
45
- TEST_CASE (" Simplify const pointer offset" )
45
+ TEST_CASE (" Simplify const pointer offset" , " [core][util] " )
46
46
{
47
47
config.set_arch (" none" );
48
48
@@ -63,7 +63,7 @@ TEST_CASE("Simplify const pointer offset")
63
63
REQUIRE (offset_value==1234 );
64
64
}
65
65
66
- TEST_CASE (" Simplify byte extract" )
66
+ TEST_CASE (" Simplify byte extract" , " [core][util] " )
67
67
{
68
68
// this test does require a proper architecture to be set so that byte extract
69
69
// uses adequate endianness
@@ -84,7 +84,7 @@ TEST_CASE("Simplify byte extract")
84
84
REQUIRE (simp == s);
85
85
}
86
86
87
- TEST_CASE (" expr2bits and bits2expr respect bit order" )
87
+ TEST_CASE (" expr2bits and bits2expr respect bit order" , " [core][util] " )
88
88
{
89
89
symbol_tablet symbol_table;
90
90
namespacet ns (symbol_table);
@@ -109,7 +109,7 @@ TEST_CASE("expr2bits and bits2expr respect bit order")
109
109
REQUIRE (deadbeef == *should_be_deadbeef2);
110
110
}
111
111
112
- TEST_CASE (" Simplify extractbit" )
112
+ TEST_CASE (" Simplify extractbit" , " [core][util] " )
113
113
{
114
114
// this test does require a proper architecture to be set so that byte extract
115
115
// uses adequate endianness
@@ -139,7 +139,7 @@ TEST_CASE("Simplify extractbit")
139
139
REQUIRE (eb2 == true_exprt ());
140
140
}
141
141
142
- TEST_CASE (" Simplify extractbits" )
142
+ TEST_CASE (" Simplify extractbits" , " [core][util] " )
143
143
{
144
144
// this test does require a proper architecture to be set so that byte extract
145
145
// uses adequate endianness
@@ -158,7 +158,7 @@ TEST_CASE("Simplify extractbits")
158
158
REQUIRE (eb == from_integer (0xbe , unsignedbv_typet (8 )));
159
159
}
160
160
161
- TEST_CASE (" Simplify shift" )
161
+ TEST_CASE (" Simplify shift" , " [core][util] " )
162
162
{
163
163
const symbol_tablet symbol_table;
164
164
const namespacet ns (symbol_table);
@@ -207,12 +207,40 @@ TEST_CASE("Simplify dynamic object comparison", "[core][util]")
207
207
REQUIRE (simplify_expr (compare_null_through_cast, ns) == false_exprt ());
208
208
209
209
dynamic_object_exprt other_dynamic_object (signedbv_typet (8 ));
210
- dynamic_object .set_instance (2 );
210
+ other_dynamic_object .set_instance (2 );
211
211
address_of_exprt address_of_other_dynamic_object (other_dynamic_object);
212
212
213
213
equal_exprt compare_pointer_objects (
214
214
pointer_object (address_of_dynamic_object),
215
215
pointer_object (address_of_other_dynamic_object));
216
216
217
217
REQUIRE (simplify_expr (compare_pointer_objects, ns) == false_exprt ());
218
+
219
+ symbol_exprt s{" foo" , signedbv_typet{8 }};
220
+ address_of_exprt address_of_symbol{s};
221
+
222
+ equal_exprt compare_symbol_dynamic{address_of_dynamic_object,
223
+ address_of_symbol};
224
+
225
+ REQUIRE (simplify_expr (compare_symbol_dynamic, ns) == false_exprt{});
226
+ }
227
+
228
+ TEST_CASE (" Simplify pointer_object equality" , " [core][util]" )
229
+ {
230
+ // this test requires a proper architecture to be set up so that pointers have
231
+ // a width
232
+ const cmdlinet cmdline;
233
+ config.set (cmdline);
234
+
235
+ symbol_tablet symbol_table;
236
+ namespacet ns (symbol_table);
237
+
238
+ exprt p_o_void =
239
+ pointer_object (null_pointer_exprt{pointer_type (empty_typet{})});
240
+ exprt p_o_int =
241
+ pointer_object (null_pointer_exprt{pointer_type (signedbv_typet (32 ))});
242
+
243
+ exprt simp = simplify_expr (equal_exprt{p_o_void, p_o_int}, ns);
244
+
245
+ REQUIRE (simp.is_true ());
218
246
}
0 commit comments