mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Allows additional EVMVersion comparators in isoltest.
This commit is contained in:
parent
eac0048176
commit
15d753a3e0
@ -116,19 +116,35 @@ bool EVMVersionRestrictedTestCase::validateSettings(langutil::EVMVersion _evmVer
|
|||||||
if (versionString.empty())
|
if (versionString.empty())
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
char comparator = versionString.front();
|
string comparator;
|
||||||
versionString = versionString.substr(1);
|
size_t versionBegin = 0;
|
||||||
|
for (auto character: versionString)
|
||||||
|
if (!isalpha(character))
|
||||||
|
{
|
||||||
|
comparator += character;
|
||||||
|
versionBegin++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
|
versionString = versionString.substr(versionBegin);
|
||||||
boost::optional<langutil::EVMVersion> version = langutil::EVMVersion::fromString(versionString);
|
boost::optional<langutil::EVMVersion> version = langutil::EVMVersion::fromString(versionString);
|
||||||
if (!version)
|
if (!version)
|
||||||
throw runtime_error("Invalid EVM version: \"" + versionString + "\"");
|
throw runtime_error("Invalid EVM version: \"" + versionString + "\"");
|
||||||
|
|
||||||
switch (comparator)
|
if (comparator == ">")
|
||||||
{
|
return _evmVersion > version;
|
||||||
case '>': return version < _evmVersion;
|
else if (comparator == ">=")
|
||||||
case '<': return _evmVersion < version;
|
return _evmVersion >= version;
|
||||||
case '=': return _evmVersion == version;
|
else if (comparator == "<")
|
||||||
case '!': return !(_evmVersion == version);
|
return _evmVersion < version;
|
||||||
}
|
else if (comparator == "<=")
|
||||||
throw runtime_error(string{"Invalid EVM comparator: \""} + comparator + "\"");
|
return _evmVersion <= version;
|
||||||
|
else if (comparator == "=")
|
||||||
|
return _evmVersion == version;
|
||||||
|
else if (comparator == "!")
|
||||||
|
return !(_evmVersion == version);
|
||||||
|
else
|
||||||
|
throw runtime_error("Invalid EVM comparator: \"" + comparator + "\"");
|
||||||
return false; // not reached
|
return false; // not reached
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,6 @@ contract C {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// EVMVersion: >byzantium
|
// EVMVersion: >=constantinople
|
||||||
// ----
|
// ----
|
||||||
// f(uint256): 7 -> 28
|
// f(uint256): 7 -> 28
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
let d := and(shr(247, calldataload(0)), 0xff)
|
let d := and(shr(247, calldataload(0)), 0xff)
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// EVMVersion: >byzantium
|
// EVMVersion: >=constantinople
|
||||||
// step: expressionSimplifier
|
// step: expressionSimplifier
|
||||||
// ----
|
// ----
|
||||||
// {
|
// {
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
let d := shr(255, calldataload(3))
|
let d := shr(255, calldataload(3))
|
||||||
}
|
}
|
||||||
// ====
|
// ====
|
||||||
// EVMVersion: >byzantium
|
// EVMVersion: >=constantinople
|
||||||
// step: expressionSimplifier
|
// step: expressionSimplifier
|
||||||
// ----
|
// ----
|
||||||
// {
|
// {
|
||||||
|
Loading…
Reference in New Issue
Block a user