Merge pull request #1070 from ethereum/devversion

Fix problems with version strings.
This commit is contained in:
chriseth 2016-09-09 10:30:29 +02:00 committed by GitHub
commit fb86d90e08
5 changed files with 9 additions and 7 deletions

View File

@ -58,12 +58,14 @@ bytes dev::solidity::binaryVersion()
solAssert(i < VersionString.size() && VersionString[i] == '.', "");
++i;
ret.push_back(byte(parseDecimal()));
solAssert(i < VersionString.size() && VersionString[i] == '-', "");
solAssert(i < VersionString.size() && (VersionString[i] == '-' || VersionString[i] == '+'), "");
++i;
size_t commitpos = VersionString.find("commit.");
solAssert(commitpos != string::npos, "");
i = commitpos + 7;
solAssert(i + 7 < VersionString.size(), "");
bytes commitHash = fromHex(VersionString.substr(i, 8));
if (commitHash.empty())
commitHash = bytes(4, 0);
solAssert(!commitHash.empty(), "");
ret += commitHash;
solAssert(ret.size() == 1 + 3 + 4, "");

View File

@ -39,7 +39,7 @@ namespace
{
static char const* registrarCode = R"DELIMITER(
pragma solidity ^0.3.5;
pragma solidity ^0.4.0;
contract NameRegister {
function addr(string _name) constant returns (address o_owner);

View File

@ -52,7 +52,7 @@ static char const* registrarCode = R"DELIMITER(
// @authors:
// Gav Wood <g@ethdev.com>
pragma solidity ^0.3.5;
pragma solidity ^0.4.0;
contract Registrar {
event Changed(string indexed name);

View File

@ -55,7 +55,7 @@ static char const* walletCode = R"DELIMITER(
// some number (specified in constructor) of the set of owners (specified in the constructor, modifiable) before the
// interior is executed.
pragma solidity ^0.3.5;
pragma solidity ^0.4.0;
contract multiowned {

View File

@ -5961,7 +5961,7 @@ BOOST_AUTO_TEST_CASE(version_stamp_for_libraries)
bytes runtimeCode = compileAndRun(sourceCode, 0, "lib");
BOOST_CHECK(runtimeCode.size() >= 8);
BOOST_CHECK_EQUAL(runtimeCode[0], int(Instruction::PUSH6)); // might change once we switch to 1.x.x
BOOST_CHECK_EQUAL(runtimeCode[1], 3); // might change once we switch away from x.3.x
BOOST_CHECK_EQUAL(runtimeCode[1], 4); // might change once we switch away from x.4.x
BOOST_CHECK_EQUAL(runtimeCode[7], int(Instruction::POP));
}