@@ -99,49 +99,55 @@ TestCase::TestResult TestCase::checkResult(std::ostream& _stream, const std::str
9999
100100void EVMVersionRestrictedTestCase::processEVMVersionSetting ()
101101{
102- std::string versionString = m_reader.stringSetting (" EVMVersion" , " any" );
103- if (versionString == " any" )
102+ std::string versionSetting = m_reader.stringSetting (" EVMVersion" , " any" );
103+ if (versionSetting == " any" )
104104 return ;
105105
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- }
106+ // Multiple space-separated constraints are allowed and all of them have to be satisfied.
107+ std::istringstream versionConstraints (versionSetting);
108+ std::string versionString;
109+ while (versionConstraints >> versionString)
110+ {
111+ std::string comparator;
112+ size_t versionBegin = 0 ;
113+ for (auto character: versionString)
114+ if (!isalpha (character, std::locale::classic ()) && character != ' @' )
115+ {
116+ comparator += character;
117+ versionBegin++;
118+ }
119+ else
120+ break ;
121+
122+ versionString = versionString.substr (versionBegin);
123+ std::optional<langutil::EVMVersion> version;
124+ if (versionString == " current" )
125+ version = std::make_optional<langutil::EVMVersion>();
126+ else
127+ version = langutil::EVMVersion::fromString (versionString);
128+ if (!version)
129+ BOOST_THROW_EXCEPTION (std::runtime_error{" Invalid EVM version: \" " + versionString + " \" " });
130+
131+ langutil::EVMVersion evmVersion = solidity::test::CommonOptions::get ().evmVersion ();
132+ bool comparisonResult;
133+ if (comparator == " >" )
134+ comparisonResult = evmVersion > version;
135+ else if (comparator == " >=" )
136+ comparisonResult = evmVersion >= version;
137+ else if (comparator == " <" )
138+ comparisonResult = evmVersion < version;
139+ else if (comparator == " <=" )
140+ comparisonResult = evmVersion <= version;
141+ else if (comparator == " =" )
142+ comparisonResult = evmVersion == version;
143+ else if (comparator == " !" )
144+ comparisonResult = !(evmVersion == version);
114145 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 ;
146+ BOOST_THROW_EXCEPTION (std::runtime_error{" Invalid EVM comparator: \" " + comparator + " \" " });
147+
148+ if (!comparisonResult)
149+ m_shouldRun = false ;
150+ }
145151}
146152
147153EVMVersionRestrictedTestCase::EVMVersionRestrictedTestCase (std::string const & _filename):
0 commit comments