MCPcopy Create free account
hub / github.com/argotorg/solidity / processEVMVersionSetting

Method processEVMVersionSetting

test/TestCase.cpp:100–145  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

98}
99
100void EVMVersionRestrictedTestCase::processEVMVersionSetting()
101{
102 std::string versionString = m_reader.stringSetting("EVMVersion", "any");
103 if (versionString == "any")
104 return;
105
106 std::string comparator;
107 size_t versionBegin = 0;
108 for (auto character: versionString)
109 if (!isalpha(character, std::locale::classic()) && character != '@')
110 {
111 comparator += character;
112 versionBegin++;
113 }
114 else
115 break;
116
117 versionString = versionString.substr(versionBegin);
118 std::optional<langutil::EVMVersion> version;
119 if (versionString == "current")
120 version = std::make_optional<langutil::EVMVersion>();
121 else
122 version = langutil::EVMVersion::fromString(versionString);
123 if (!version)
124 BOOST_THROW_EXCEPTION(std::runtime_error{"Invalid EVM version: \"" + versionString + "\""});
125
126 langutil::EVMVersion evmVersion = solidity::test::CommonOptions::get().evmVersion();
127 bool comparisonResult;
128 if (comparator == ">")
129 comparisonResult = evmVersion > version;
130 else if (comparator == ">=")
131 comparisonResult = evmVersion >= version;
132 else if (comparator == "<")
133 comparisonResult = evmVersion < version;
134 else if (comparator == "<=")
135 comparisonResult = evmVersion <= version;
136 else if (comparator == "=")
137 comparisonResult = evmVersion == version;
138 else if (comparator == "!")
139 comparisonResult = !(evmVersion == version);
140 else
141 BOOST_THROW_EXCEPTION(std::runtime_error{"Invalid EVM comparator: \"" + comparator + "\""});
142
143 if (!comparisonResult)
144 m_shouldRun = false;
145}
146
147void EVMVersionRestrictedTestCase::processBytecodeFormatSetting()
148{

Callers

nothing calls this directly

Calls 3

getFunction · 0.85
stringSettingMethod · 0.80
evmVersionMethod · 0.45

Tested by

no test coverage detected