mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
update tests
This commit is contained in:
parent
4cdb6c809a
commit
d24f6fd34b
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @date 2017
|
* @date 2017
|
||||||
* Common functions the iulia tests.
|
* Common functions the Yul tests.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/libjulia/Common.h>
|
#include <test/libjulia/Common.h>
|
||||||
@ -52,9 +52,9 @@ void dev::julia::test::printErrors(ErrorList const& _errors, Scanner const& _sca
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pair<shared_ptr<Block>, shared_ptr<assembly::AsmAnalysisInfo>> dev::julia::test::parse(string const& _source, bool _julia)
|
pair<shared_ptr<Block>, shared_ptr<assembly::AsmAnalysisInfo>> dev::julia::test::parse(string const& _source, bool _yul)
|
||||||
{
|
{
|
||||||
auto flavour = _julia ? assembly::AsmFlavour::IULIA : assembly::AsmFlavour::Strict;
|
auto flavour = _yul ? assembly::AsmFlavour::Yul : assembly::AsmFlavour::Strict;
|
||||||
ErrorList errors;
|
ErrorList errors;
|
||||||
ErrorReporter errorReporter(errors);
|
ErrorReporter errorReporter(errors);
|
||||||
auto scanner = make_shared<Scanner>(CharStream(_source), "");
|
auto scanner = make_shared<Scanner>(CharStream(_source), "");
|
||||||
@ -83,13 +83,13 @@ pair<shared_ptr<Block>, shared_ptr<assembly::AsmAnalysisInfo>> dev::julia::test:
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
assembly::Block dev::julia::test::disambiguate(string const& _source, bool _julia)
|
assembly::Block dev::julia::test::disambiguate(string const& _source, bool _yul)
|
||||||
{
|
{
|
||||||
auto result = parse(_source, _julia);
|
auto result = parse(_source, _yul);
|
||||||
return boost::get<Block>(Disambiguator(*result.second)(*result.first));
|
return boost::get<Block>(Disambiguator(*result.second)(*result.first));
|
||||||
}
|
}
|
||||||
|
|
||||||
string dev::julia::test::format(string const& _source, bool _julia)
|
string dev::julia::test::format(string const& _source, bool _yul)
|
||||||
{
|
{
|
||||||
return assembly::AsmPrinter(_julia)(*parse(_source, _julia).first);
|
return assembly::AsmPrinter(_yul)(*parse(_source, _yul).first);
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @date 2017
|
* @date 2017
|
||||||
* Common functions the iulia tests.
|
* Common functions the Yul tests.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
@ -46,9 +46,9 @@ namespace test
|
|||||||
|
|
||||||
void printErrors(solidity::ErrorList const& _errors, solidity::Scanner const& _scanner);
|
void printErrors(solidity::ErrorList const& _errors, solidity::Scanner const& _scanner);
|
||||||
std::pair<std::shared_ptr<solidity::assembly::Block>, std::shared_ptr<solidity::assembly::AsmAnalysisInfo>>
|
std::pair<std::shared_ptr<solidity::assembly::Block>, std::shared_ptr<solidity::assembly::AsmAnalysisInfo>>
|
||||||
parse(std::string const& _source, bool _julia = true);
|
parse(std::string const& _source, bool _yul = true);
|
||||||
solidity::assembly::Block disambiguate(std::string const& _source, bool _julia = true);
|
solidity::assembly::Block disambiguate(std::string const& _source, bool _yul = true);
|
||||||
std::string format(std::string const& _source, bool _julia = true);
|
std::string format(std::string const& _source, bool _yul = true);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @date 2017
|
* @date 2017
|
||||||
* Unit tests for the iulia name disambiguator.
|
* Unit tests for the Yul name disambiguator.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/libjulia/Common.h>
|
#include <test/libjulia/Common.h>
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
*/
|
*/
|
||||||
/**
|
/**
|
||||||
* @date 2017
|
* @date 2017
|
||||||
* Unit tests for parsing Julia.
|
* Unit tests for parsing Yul.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <test/Options.h>
|
#include <test/Options.h>
|
||||||
@ -52,7 +52,7 @@ bool parse(string const& _source, ErrorReporter& errorReporter)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
auto scanner = make_shared<Scanner>(CharStream(_source));
|
auto scanner = make_shared<Scanner>(CharStream(_source));
|
||||||
auto parserResult = assembly::Parser(errorReporter, assembly::AsmFlavour::IULIA).parse(scanner, false);
|
auto parserResult = assembly::Parser(errorReporter, assembly::AsmFlavour::Yul).parse(scanner, false);
|
||||||
if (parserResult)
|
if (parserResult)
|
||||||
{
|
{
|
||||||
assembly::AsmAnalysisInfo analysisInfo;
|
assembly::AsmAnalysisInfo analysisInfo;
|
||||||
@ -61,7 +61,7 @@ bool parse(string const& _source, ErrorReporter& errorReporter)
|
|||||||
errorReporter,
|
errorReporter,
|
||||||
dev::test::Options::get().evmVersion(),
|
dev::test::Options::get().evmVersion(),
|
||||||
boost::none,
|
boost::none,
|
||||||
assembly::AsmFlavour::IULIA
|
assembly::AsmFlavour::Yul
|
||||||
)).analyze(*parserResult);
|
)).analyze(*parserResult);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user