Merge pull request #8075 from ethereum/refactor-namespaces

Refactor namespaces
This commit is contained in:
Daniel Kirchner
2020-01-07 16:52:20 +01:00
committed by GitHub
544 changed files with 2881 additions and 3548 deletions
+4 -8
View File
@@ -29,13 +29,11 @@
#include <string>
using namespace std;
using namespace dev::test;
using namespace solidity;
using namespace solidity::util;
using namespace solidity::test;
namespace dev
{
namespace solidity
{
namespace test
namespace solidity::frontend::test
{
namespace
@@ -455,6 +453,4 @@ BOOST_AUTO_TEST_CASE(auction_bidding)
BOOST_AUTO_TEST_SUITE_END()
}
}
} // end namespaces
+7 -10
View File
@@ -22,9 +22,7 @@
#include <functional>
namespace dev
{
namespace test
namespace solidity::test
{
class ContractInterface
@@ -58,7 +56,7 @@ protected:
BOOST_CHECK(call(_name + "(string,address,bool)", u256(0x60), _arg2, _arg3, _arg1.length(), _arg1).empty());
}
void callStringBytes32(std::string const& _name, std::string const& _arg1, h256 const& _arg2)
void callStringBytes32(std::string const& _name, std::string const& _arg1, util::h256 const& _arg2)
{
BOOST_CHECK(call(_name + "(string,bytes32)", u256(0x40), _arg2, _arg1.length(), _arg1).empty());
}
@@ -68,25 +66,25 @@ protected:
bytes const& ret = call(_name + "(string)", u256(0x20), _arg.length(), _arg);
BOOST_REQUIRE(ret.size() == 0x20);
BOOST_CHECK(std::count(ret.begin(), ret.begin() + 12, 0) == 12);
return u160(u256(h256(ret)));
return u160(u256(util::h256(ret)));
}
std::string callAddressReturnsString(std::string const& _name, u160 const& _arg)
{
bytesConstRef const ret(&call(_name + "(address)", _arg));
BOOST_REQUIRE(ret.size() >= 0x40);
u256 offset(h256(ret.cropped(0, 0x20)));
u256 offset(util::h256(ret.cropped(0, 0x20)));
BOOST_REQUIRE_EQUAL(offset, 0x20);
u256 len(h256(ret.cropped(0x20, 0x20)));
u256 len(util::h256(ret.cropped(0x20, 0x20)));
BOOST_REQUIRE_EQUAL(ret.size(), 0x40 + ((len + 0x1f) / 0x20) * 0x20);
return ret.cropped(0x40, size_t(len)).toString();
}
h256 callStringReturnsBytes32(std::string const& _name, std::string const& _arg)
util::h256 callStringReturnsBytes32(std::string const& _name, std::string const& _arg)
{
bytes const& ret = call(_name + "(string)", u256(0x20), _arg.length(), _arg);
BOOST_REQUIRE(ret.size() == 0x20);
return h256(ret);
return util::h256(ret);
}
private:
@@ -94,6 +92,5 @@ private:
ExecutionFramework& m_framework;
};
}
} // end namespaces
+4 -8
View File
@@ -35,13 +35,11 @@
#include <test/libsolidity/SolidityExecutionFramework.h>
using namespace std;
using namespace dev::test;
using namespace solidity;
using namespace solidity::util;
using namespace solidity::test;
namespace dev
{
namespace solidity
{
namespace test
namespace solidity::frontend::test
{
namespace
@@ -249,6 +247,4 @@ BOOST_AUTO_TEST_CASE(disown)
BOOST_AUTO_TEST_SUITE_END()
}
}
} // end namespaces
+5 -10
View File
@@ -35,13 +35,10 @@
#include <test/libsolidity/SolidityExecutionFramework.h>
using namespace std;
using namespace dev::test;
using namespace solidity::test;
using namespace solidity::util;
namespace dev
{
namespace solidity
{
namespace test
namespace solidity::frontend::test
{
static char const* walletCode = R"DELIMITER(
@@ -467,7 +464,7 @@ BOOST_AUTO_TEST_CASE(creation)
{
deployWallet(200);
BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(m_sender, h256::AlignRight)) == encodeArgs(true));
bool v2 = dev::test::Options::get().useABIEncoderV2;
bool v2 = solidity::test::Options::get().useABIEncoderV2;
BOOST_REQUIRE(callContractFunction("isOwner(address)", ~h256(m_sender, h256::AlignRight)) == (v2 ? encodeArgs() : encodeArgs(false)));
}
@@ -590,7 +587,7 @@ BOOST_AUTO_TEST_CASE(revoke_addOwner)
BOOST_REQUIRE(callContractFunction("changeRequirement(uint256)", u256(3)) == encodeArgs());
// add a new owner
Address deployer = m_sender;
h256 opHash = dev::keccak256(FixedHash<4>(dev::keccak256("addOwner(address)")).asBytes() + h256(0x33).asBytes());
h256 opHash = util::keccak256(FixedHash<4>(util::keccak256("addOwner(address)")).asBytes() + h256(0x33).asBytes());
BOOST_REQUIRE(callContractFunction("addOwner(address)", h256(0x33)) == encodeArgs());
BOOST_REQUIRE(callContractFunction("isOwner(address)", h256(0x33)) == encodeArgs(false));
m_sender = account(0);
@@ -703,6 +700,4 @@ BOOST_AUTO_TEST_CASE(daylimit_constructor)
BOOST_AUTO_TEST_SUITE_END()
}
}
} // end namespaces