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

Method runTest

test/libsolidity/SemanticTest.cpp:355–537  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

353}
354
355TestCase::TestResult SemanticTest::runTest(
356 std::ostream& _stream,
357 std::string const& _linePrefix,
358 bool _formatted,
359 bool _isYulRun,
360 bool _isSSACFGRun
361)
362{
363 bool success = true;
364 m_gasCostFailure = false;
365 m_isSSACFGRun = _isSSACFGRun;
366
367 selectVM(evmc_capabilities::EVMC_CAPABILITY_EVM1);
368
369 reset();
370
371 m_compileViaYul = _isYulRun;
372 m_compileViaSSACFG = _isSSACFGRun;
373
374 if (_isSSACFGRun)
375 AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via SSA Yul: " << std::endl;
376 else if (_isYulRun)
377 AnsiColorized(_stream, _formatted, {BOLD, CYAN}) << _linePrefix << "Running via Yul: " << std::endl;
378
379 for (TestFunctionCall& test: m_tests)
380 test.reset();
381
382 std::map<std::string, solidity::test::Address> libraries;
383
384 bool constructed = false;
385
386 for (TestFunctionCall& test: m_tests)
387 {
388 if (constructed)
389 {
390 soltestAssert(
391 test.call().kind != FunctionCall::Kind::Library,
392 "Libraries have to be deployed before any other call."
393 );
394 soltestAssert(
395 test.call().kind != FunctionCall::Kind::Constructor,
396 "Constructor has to be the first function call expect for library deployments."
397 );
398 }
399 else if (test.call().kind == FunctionCall::Kind::Library)
400 {
401 soltestAssert(
402 deploy(test.call().signature, 0, {}, libraries) && m_transactionSuccessful,
403 "Failed to deploy library " + test.call().signature);
404 // For convenience, in semantic tests we assume that an unqualified name like `L` is equivalent to one
405 // with an empty source unit name (`:L`). This is fine because the compiler never uses unqualified
406 // names in the Yul code it produces and does not allow `linkersymbol()` at all in inline assembly.
407 libraries[test.call().libraryFile + ":" + test.call().signature] = m_contractAddress;
408 continue;
409 }
410 else
411 {
412 if (test.call().kind == FunctionCall::Kind::Constructor)

Callers

nothing calls this directly

Calls 15

AnsiColorizedClass · 0.85
setFailureMethod · 0.80
setRawBytesMethod · 0.80
atMethod · 0.80
interfaceSymbolsMethod · 0.80
lastContractNameMethod · 0.80
supportsReturndataMethod · 0.80
setContractABIMethod · 0.80
setSideEffectsMethod · 0.80
resetMethod · 0.45
callMethod · 0.45
rawBytesMethod · 0.45

Tested by

no test coverage detected