27
27
#include < libsolutil/Keccak256.h>
28
28
#include < boost/test/unit_test.hpp>
29
29
30
- using namespace std ;
31
30
using namespace solidity ::langutil;
32
31
33
32
namespace solidity ::frontend::test
@@ -86,9 +85,9 @@ BOOST_AUTO_TEST_CASE(storage_layout_simple)
86
85
BOOST_REQUIRE (members.memberStorageOffset (" first" ) != nullptr );
87
86
BOOST_REQUIRE (members.memberStorageOffset (" second" ) != nullptr );
88
87
BOOST_REQUIRE (members.memberStorageOffset (" wraps" ) != nullptr );
89
- BOOST_CHECK (*members.memberStorageOffset (" first" ) == make_pair (u256 (0 ), unsigned (0 )));
90
- BOOST_CHECK (*members.memberStorageOffset (" second" ) == make_pair (u256 (0 ), unsigned (16 )));
91
- BOOST_CHECK (*members.memberStorageOffset (" wraps" ) == make_pair (u256 (1 ), unsigned (0 )));
88
+ BOOST_CHECK (*members.memberStorageOffset (" first" ) == std:: make_pair (u256 (0 ), unsigned (0 )));
89
+ BOOST_CHECK (*members.memberStorageOffset (" second" ) == std:: make_pair (u256 (0 ), unsigned (16 )));
90
+ BOOST_CHECK (*members.memberStorageOffset (" wraps" ) == std:: make_pair (u256 (1 ), unsigned (0 )));
92
91
}
93
92
94
93
BOOST_AUTO_TEST_CASE (storage_layout_mapping)
@@ -114,10 +113,10 @@ BOOST_AUTO_TEST_CASE(storage_layout_mapping)
114
113
BOOST_REQUIRE (members.memberStorageOffset (" second" ) != nullptr );
115
114
BOOST_REQUIRE (members.memberStorageOffset (" third" ) != nullptr );
116
115
BOOST_REQUIRE (members.memberStorageOffset (" final" ) != nullptr );
117
- BOOST_CHECK (*members.memberStorageOffset (" first" ) == make_pair (u256 (0 ), unsigned (0 )));
118
- BOOST_CHECK (*members.memberStorageOffset (" second" ) == make_pair (u256 (1 ), unsigned (0 )));
119
- BOOST_CHECK (*members.memberStorageOffset (" third" ) == make_pair (u256 (2 ), unsigned (0 )));
120
- BOOST_CHECK (*members.memberStorageOffset (" final" ) == make_pair (u256 (3 ), unsigned (0 )));
116
+ BOOST_CHECK (*members.memberStorageOffset (" first" ) == std:: make_pair (u256 (0 ), unsigned (0 )));
117
+ BOOST_CHECK (*members.memberStorageOffset (" second" ) == std:: make_pair (u256 (1 ), unsigned (0 )));
118
+ BOOST_CHECK (*members.memberStorageOffset (" third" ) == std:: make_pair (u256 (2 ), unsigned (0 )));
119
+ BOOST_CHECK (*members.memberStorageOffset (" final" ) == std:: make_pair (u256 (3 ), unsigned (0 )));
121
120
}
122
121
123
122
BOOST_AUTO_TEST_CASE (storage_layout_arrays)
@@ -162,7 +161,7 @@ BOOST_AUTO_TEST_CASE(type_identifiers)
162
161
BOOST_CHECK_EQUAL (RationalNumberType (rational (2 * 200 , 2 * 77 )).identifier (), " t_rational_200_by_77" );
163
162
BOOST_CHECK_EQUAL (RationalNumberType (rational (-2 * 200 , 2 * 77 )).identifier (), " t_rational_minus_200_by_77" );
164
163
BOOST_CHECK_EQUAL (
165
- StringLiteralType (Literal (++id, SourceLocation{}, Token::StringLiteral, make_shared<string>(" abc - def" ))).identifier (),
164
+ StringLiteralType (Literal (++id, SourceLocation{}, Token::StringLiteral, std:: make_shared<std:: string>(" abc - def" ))).identifier (),
166
165
" t_stringliteral_196a9142ee0d40e274a6482393c762b16dd8315713207365e1e13d8d85b74fc4"
167
166
);
168
167
BOOST_CHECK_EQUAL (TypeProvider::fromElementaryTypeName (" bytes1" )->identifier (), " t_bytes1" );
@@ -183,15 +182,15 @@ BOOST_AUTO_TEST_CASE(type_identifiers)
183
182
Type const * multiArray = TypeProvider::array (DataLocation::Storage, stringArray);
184
183
BOOST_CHECK_EQUAL (multiArray->identifier (), " t_array$_t_array$_t_string_storage_$20_storage_$dyn_storage_ptr" );
185
184
186
- ContractDefinition c (++id, SourceLocation{}, make_shared<string>(" MyContract$" ), SourceLocation{}, {}, {}, {}, ContractKind::Contract);
185
+ ContractDefinition c (++id, SourceLocation{}, std:: make_shared<std:: string>(" MyContract$" ), SourceLocation{}, {}, {}, {}, ContractKind::Contract);
187
186
BOOST_CHECK_EQUAL (c.type ()->identifier (), " t_type$_t_contract$_MyContract$$$_$2_$" );
188
187
BOOST_CHECK_EQUAL (ContractType (c, true ).identifier (), " t_super$_MyContract$$$_$2" );
189
188
190
- StructDefinition s (++id, {}, make_shared<string>(" Struct" ), {}, {}, {});
189
+ StructDefinition s (++id, {}, std:: make_shared<std:: string>(" Struct" ), {}, {}, {});
191
190
s.annotation ().recursive = false ;
192
191
BOOST_CHECK_EQUAL (s.type ()->identifier (), " t_type$_t_struct$_Struct_$3_storage_ptr_$" );
193
192
194
- EnumDefinition e (++id, {}, make_shared<string>(" Enum" ), {}, {}, {});
193
+ EnumDefinition e (++id, {}, std:: make_shared<std:: string>(" Enum" ), {}, {}, {});
195
194
BOOST_CHECK_EQUAL (e.type ()->identifier (), " t_type$_t_enum$_Enum_$4_$" );
196
195
197
196
TupleType t ({e.type (), s.type (), stringArray, nullptr });
@@ -209,8 +208,8 @@ BOOST_AUTO_TEST_CASE(type_identifiers)
209
208
210
209
// TypeType is tested with contract
211
210
212
- auto emptyParams = make_shared<ParameterList>(++id, SourceLocation (), std::vector<ASTPointer<VariableDeclaration>>());
213
- ModifierDefinition mod (++id, SourceLocation{}, make_shared<string>(" modif" ), SourceLocation{}, {}, emptyParams, {}, {}, {});
211
+ auto emptyParams = std:: make_shared<ParameterList>(++id, SourceLocation (), std::vector<ASTPointer<VariableDeclaration>>());
212
+ ModifierDefinition mod (++id, SourceLocation{}, std:: make_shared<std:: string>(" modif" ), SourceLocation{}, {}, emptyParams, {}, {}, {});
214
213
BOOST_CHECK_EQUAL (ModifierType (mod).identifier (), " t_modifier$__$" );
215
214
216
215
SourceUnit su (++id, {}, {}, {}, {});
@@ -250,34 +249,34 @@ BOOST_AUTO_TEST_CASE(helper_bool_result)
250
249
{
251
250
BoolResult r1{true };
252
251
BoolResult r2 = BoolResult::err (" Failure." );
253
- r1.merge (r2, logical_and<bool >());
252
+ r1.merge (r2, std:: logical_and<bool >());
254
253
BOOST_REQUIRE_EQUAL (r1.get (), false );
255
254
BOOST_REQUIRE_EQUAL (r1.message (), " Failure." );
256
255
257
256
BoolResult r3{false };
258
257
BoolResult r4{true };
259
- r3.merge (r4, logical_and<bool >());
258
+ r3.merge (r4, std:: logical_and<bool >());
260
259
BOOST_REQUIRE_EQUAL (r3.get (), false );
261
260
BOOST_REQUIRE_EQUAL (r3.message (), " " );
262
261
263
262
BoolResult r5{true };
264
263
BoolResult r6{true };
265
- r5.merge (r6, logical_and<bool >());
264
+ r5.merge (r6, std:: logical_and<bool >());
266
265
BOOST_REQUIRE_EQUAL (r5.get (), true );
267
266
BOOST_REQUIRE_EQUAL (r5.message (), " " );
268
267
}
269
268
270
269
BOOST_AUTO_TEST_CASE (helper_string_result)
271
270
{
272
- using StringResult = util::Result<string>;
271
+ using StringResult = util::Result<std:: string>;
273
272
274
- StringResult r1{string{" Success" }};
273
+ StringResult r1{std:: string{" Success" }};
275
274
StringResult r2 = StringResult::err (" Failure" );
276
275
277
276
BOOST_REQUIRE_EQUAL (r1.get (), " Success" );
278
277
BOOST_REQUIRE_EQUAL (r2.get (), " " );
279
278
280
- r1.merge (r2, [](string const &, string const & _rhs) { return _rhs; });
279
+ r1.merge (r2, [](std:: string const &, std:: string const & _rhs) { return _rhs; });
281
280
282
281
BOOST_REQUIRE_EQUAL (r1.get (), " " );
283
282
BOOST_REQUIRE_EQUAL (r1.message (), " Failure" );
0 commit comments