@@ -113,7 +113,8 @@ TEST_CASE(
113113 const cbmc_invariants_should_throwt invariants_throw;
114114
115115 REQUIRE_THROWS_MATCHES (
116- duplicate_per_byte (array_of_exprt{true_exprt{}, array_type}, input_type),
116+ duplicate_per_byte (
117+ array_of_exprt{true_exprt{}, array_type}, input_type, test.ns ),
117118 invariant_failedt,
118119 invariant_failure_containing (
119120 " Condition: (init_type_as_bitvector && "
@@ -128,7 +129,8 @@ TEST_CASE(
128129 const cbmc_invariants_should_throwt invariants_throw;
129130
130131 REQUIRE_THROWS_MATCHES (
131- duplicate_per_byte (from_integer (0 , unsignedbv_typet{10 }), input_type),
132+ duplicate_per_byte (
133+ from_integer (0 , unsignedbv_typet{10 }), input_type, test.ns ),
132134 invariant_failedt,
133135 invariant_failure_containing (
134136 " init_type_as_bitvector->get_width() <= config.ansi_c.char_width" ));
@@ -170,15 +172,17 @@ TEST_CASE(
170172 typet output_type = unsignedbv_typet{output_size};
171173 const auto result = duplicate_per_byte (
172174 from_integer (init_expr_value, unsignedbv_typet{init_expr_size}),
173- output_type);
175+ output_type,
176+ test.ns );
174177 const auto expected =
175178 from_integer (output_expected_value, unsignedbv_typet{output_size});
176179 REQUIRE (result == expected);
177180
178181 // Check that signed-bv values are replicated including the sign bit.
179182 const auto result_with_signed_init_type = duplicate_per_byte (
180183 from_integer (init_expr_value, signedbv_typet{init_expr_size}),
181- output_type);
184+ output_type,
185+ test.ns );
182186 REQUIRE (result_with_signed_init_type == result);
183187 }
184188
@@ -187,15 +191,17 @@ TEST_CASE(
187191 typet output_type = signedbv_typet{output_size};
188192 const auto result = duplicate_per_byte (
189193 from_integer (init_expr_value, unsignedbv_typet{init_expr_size}),
190- output_type);
194+ output_type,
195+ test.ns );
191196 const auto expected =
192197 from_integer (output_expected_value, signedbv_typet{output_size});
193198 REQUIRE (result == expected);
194199
195200 // Check that signed-bv values are replicated including the sign bit.
196201 const auto result_with_signed_init_type = duplicate_per_byte (
197202 from_integer (init_expr_value, signedbv_typet{init_expr_size}),
198- output_type);
203+ output_type,
204+ test.ns );
199205 REQUIRE (result_with_signed_init_type == result);
200206 }
201207
@@ -205,7 +211,8 @@ TEST_CASE(
205211 const pointer_typet output_type{bool_typet{}, output_size};
206212 const auto result = duplicate_per_byte (
207213 from_integer (init_expr_value, signedbv_typet{init_expr_size}),
208- output_type);
214+ output_type,
215+ test.ns );
209216 auto expected =
210217 from_integer (output_expected_value, unsignedbv_typet{output_size});
211218 // Forcing the type to be pointer_typet otherwise from_integer fails when
@@ -219,11 +226,13 @@ TEST_CASE(
219226 // Check that replicating to a float_value is same as unsigned_bv.
220227 const auto result = duplicate_per_byte (
221228 from_integer (init_expr_value, unsignedbv_typet{init_expr_size}),
222- float_type ());
229+ float_type (),
230+ test.ns );
223231 const auto expected_unsigned_value =
224232 expr_try_dynamic_cast<constant_exprt>(duplicate_per_byte (
225233 from_integer (init_expr_value, unsignedbv_typet{init_expr_size}),
226- unsignedbv_typet{float_type ().get_width ()}));
234+ unsignedbv_typet{float_type ().get_width ()},
235+ test.ns ));
227236 REQUIRE (expected_unsigned_value);
228237 const auto expected =
229238 constant_exprt{expected_unsigned_value->get_value (), float_type ()};
@@ -250,13 +259,13 @@ TEST_CASE(
250259 SECTION (" Testing with init size " + std::to_string (init_expr_size))
251260 {
252261 const auto init_expr = plus_exprt{
253- from_integer ( 1 , unsignedbv_typet{init_expr_size}) ,
262+ symbol_exprt{ " a_symbol " , unsignedbv_typet{init_expr_size}} ,
254263 from_integer (2 , unsignedbv_typet{init_expr_size})};
255264 SECTION (" filling signedbv of size " + std::to_string (output_size))
256265 {
257266 typet output_type = signedbv_typet{output_size};
258267
259- const auto result = duplicate_per_byte (init_expr, output_type);
268+ const auto result = duplicate_per_byte (init_expr, output_type, test. ns );
260269
261270 const auto casted_init_expr =
262271 typecast_exprt::conditional_cast (init_expr, output_type);
@@ -269,7 +278,7 @@ TEST_CASE(
269278 SECTION (" filling unsignedbv of size " + std::to_string (output_size))
270279 {
271280 typet output_type = unsignedbv_typet{output_size};
272- const auto result = duplicate_per_byte (init_expr, output_type);
281+ const auto result = duplicate_per_byte (init_expr, output_type, test. ns );
273282
274283 const auto casted_init_expr =
275284 typecast_exprt::conditional_cast (init_expr, output_type);
@@ -284,7 +293,7 @@ TEST_CASE(
284293 // Check that replicating a pointer_value is same as unsigned_bv modulo a
285294 // byte_extract outside.
286295 const pointer_typet output_type{bool_typet{}, output_size};
287- const auto result = duplicate_per_byte (init_expr, output_type);
296+ const auto result = duplicate_per_byte (init_expr, output_type, test. ns );
288297 const auto unsigned_corr_type = unsignedbv_typet{output_size};
289298 const auto unsigned_init_expr =
290299 typecast_exprt::conditional_cast (init_expr, unsigned_corr_type);
@@ -306,7 +315,7 @@ TEST_CASE(
306315 const std::size_t float_replication_count =
307316 (float_type ().get_width () + config.ansi_c .char_width - 1 ) /
308317 config.ansi_c .char_width ;
309- const auto result = duplicate_per_byte (init_expr, float_type ());
318+ const auto result = duplicate_per_byte (init_expr, float_type (), test. ns );
310319 const auto unsigned_corr_type =
311320 unsignedbv_typet{float_type ().get_width ()};
312321 const auto unsigned_init_expr =
@@ -412,8 +421,8 @@ TEST_CASE(
412421 const auto result =
413422 expr_initializer (input_type, test.loc , test.ns , init_value);
414423 REQUIRE (result.has_value ());
415- const auto expected =
416- duplicate_per_byte ( init_value, unsignedbv_typet{input_type_size});
424+ const auto expected = duplicate_per_byte (
425+ init_value, unsignedbv_typet{input_type_size}, test. ns );
417426 REQUIRE (result.value () == expected);
418427 }
419428 }
@@ -460,7 +469,7 @@ TEST_CASE(
460469 expr_initializer (input_type, test.loc , test.ns , init_value);
461470 REQUIRE (result.has_value ());
462471 const auto expected = duplicate_per_byte (
463- init_value, pointer_typet{bool_typet{}, input_type_size});
472+ init_value, pointer_typet{bool_typet{}, input_type_size}, test. ns );
464473 REQUIRE (result.value () == expected);
465474 }
466475 }
@@ -499,7 +508,8 @@ TEST_CASE("expr_initializer on float type", "[core][util][expr_initializer]")
499508 const auto result =
500509 expr_initializer (input_type, test.loc , test.ns , init_value);
501510 REQUIRE (result.has_value ());
502- const auto expected = duplicate_per_byte (init_value, float_type ());
511+ const auto expected =
512+ duplicate_per_byte (init_value, float_type (), test.ns );
503513 REQUIRE (result.value () == expected);
504514 }
505515 }
@@ -562,13 +572,13 @@ TEST_CASE(
562572 from_integer (0xAB , signedbv_typet{config.ansi_c .char_width });
563573 const auto result =
564574 expr_initializer (enum_type, test.loc , test.ns , init_value);
565- const auto expected = duplicate_per_byte (init_value, enum_type);
575+ const auto expected = duplicate_per_byte (init_value, enum_type, test. ns );
566576 REQUIRE (result.has_value ());
567577 REQUIRE (result.value () == expected);
568578
569579 const auto tag_result =
570580 expr_initializer (c_enum_tag_type, test.loc , test.ns , init_value);
571- auto tag_expected = duplicate_per_byte (init_value, enum_type);
581+ auto tag_expected = duplicate_per_byte (init_value, enum_type, test. ns );
572582 tag_expected.type () = c_enum_tag_type;
573583 REQUIRE (tag_result.has_value ());
574584 REQUIRE (tag_result.value () == tag_expected);
@@ -624,7 +634,7 @@ TEST_CASE(
624634 expr_initializer (array_type, test.loc , test.ns , init_value);
625635 REQUIRE (result.has_value ());
626636 std::vector<exprt> array_values{
627- elem_count, duplicate_per_byte (init_value, inner_type)};
637+ elem_count, duplicate_per_byte (init_value, inner_type, test. ns )};
628638 const auto expected = array_exprt{
629639 array_values,
630640 array_typet{
@@ -678,7 +688,7 @@ TEST_CASE(
678688 expr_initializer (array_type, test.loc , test.ns , init_value);
679689 REQUIRE (result.has_value ());
680690 const auto expected = array_of_exprt{
681- duplicate_per_byte (init_value, inner_type),
691+ duplicate_per_byte (init_value, inner_type, test. ns ),
682692 array_typet{
683693 inner_type, side_effect_expr_nondett{signedbv_typet{8 }, test.loc }}};
684694 REQUIRE (result.value () == expected);
@@ -750,7 +760,7 @@ TEST_CASE(
750760 expr_initializer (array_type, test.loc , test.ns , init_value);
751761 REQUIRE (result.has_value ());
752762 std::vector<exprt> inner_array_values{
753- elem_count, duplicate_per_byte (init_value, inner_type)};
763+ elem_count, duplicate_per_byte (init_value, inner_type, test. ns )};
754764 const auto inner_expected = array_exprt{
755765 inner_array_values,
756766 array_typet{
@@ -847,12 +857,13 @@ TEST_CASE(
847857 expr_initializer (struct_type, test.loc , test.ns , init_value);
848858 REQUIRE (result.has_value ());
849859 const exprt::operandst expected_inner_struct_fields{
850- duplicate_per_byte (init_value, signedbv_typet{32 }),
851- duplicate_per_byte (init_value, unsignedbv_typet{16 })};
860+ duplicate_per_byte (init_value, signedbv_typet{32 }, test. ns ),
861+ duplicate_per_byte (init_value, unsignedbv_typet{16 }, test. ns )};
852862 const struct_exprt expected_inner_struct_expr{
853863 expected_inner_struct_fields, inner_struct_type};
854864 const exprt::operandst expected_struct_fields{
855- duplicate_per_byte (init_value, bool_typet{}), expected_inner_struct_expr};
865+ duplicate_per_byte (init_value, bool_typet{}, test.ns ),
866+ expected_inner_struct_expr};
856867 const struct_exprt expected_struct_expr{
857868 expected_struct_fields, struct_type};
858869 REQUIRE (result.value () == expected_struct_expr);
@@ -935,7 +946,9 @@ TEST_CASE("expr_initializer on union type", "[core][util][expr_initializer]")
935946 expr_initializer (union_type, test.loc , test.ns , init_value);
936947 REQUIRE (result.has_value ());
937948 const union_exprt expected_union{
938- " foo" , duplicate_per_byte (init_value, signedbv_typet{256 }), union_type};
949+ " foo" ,
950+ duplicate_per_byte (init_value, signedbv_typet{256 }, test.ns ),
951+ union_type};
939952 REQUIRE (result.value () == expected_union);
940953
941954 const auto union_tag_type =
@@ -945,7 +958,7 @@ TEST_CASE("expr_initializer on union type", "[core][util][expr_initializer]")
945958 REQUIRE (tag_result.has_value ());
946959 const union_exprt expected_union_tag{
947960 " foo" ,
948- duplicate_per_byte (init_value, signedbv_typet{256 }),
961+ duplicate_per_byte (init_value, signedbv_typet{256 }, test. ns ),
949962 union_tag_type};
950963 REQUIRE (tag_result.value () == expected_union_tag);
951964 }
@@ -1024,7 +1037,8 @@ TEST_CASE("expr_initializer on string type", "[core][util][expr_initializer]")
10241037 const auto result =
10251038 expr_initializer (string_type, test.loc , test.ns , init_value);
10261039 REQUIRE (result.has_value ());
1027- const auto expected_string = duplicate_per_byte (init_value, string_type);
1040+ const auto expected_string =
1041+ duplicate_per_byte (init_value, string_type, test.ns );
10281042 REQUIRE (result.value () == expected_string);
10291043 }
10301044}
0 commit comments