mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
style fixes
This commit is contained in:
parent
39f90683e3
commit
e75bf22733
@ -133,7 +133,8 @@ BOOST_AUTO_TEST_CASE(recursive_calls)
|
|||||||
" }\n"
|
" }\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
std::function<u256(u256)> recursive_calls_cpp = [&recursive_calls_cpp] (u256 const& n) -> u256 {
|
std::function<u256(u256)> recursive_calls_cpp = [&recursive_calls_cpp](u256 const& n) -> u256
|
||||||
|
{
|
||||||
if (n <= 1)
|
if (n <= 1)
|
||||||
return 1;
|
return 1;
|
||||||
else
|
else
|
||||||
@ -158,7 +159,8 @@ BOOST_AUTO_TEST_CASE(while_loop)
|
|||||||
"}\n";
|
"}\n";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
|
|
||||||
auto while_loop_cpp = [] (u256 const& n) -> u256 {
|
auto while_loop_cpp = [](u256 const& n) -> u256
|
||||||
|
{
|
||||||
u256 nfac = 1;
|
u256 nfac = 1;
|
||||||
u256 i = 2;
|
u256 i = 2;
|
||||||
while (i <= n)
|
while (i <= n)
|
||||||
@ -210,7 +212,8 @@ BOOST_AUTO_TEST_CASE(nested_loops)
|
|||||||
ExecutionFramework framework;
|
ExecutionFramework framework;
|
||||||
framework.compileAndRun(sourceCode);
|
framework.compileAndRun(sourceCode);
|
||||||
|
|
||||||
auto nested_loops_cpp = [] (u256 n) -> u256 {
|
auto nested_loops_cpp = [](u256 n) -> u256
|
||||||
|
{
|
||||||
while (n > 1)
|
while (n > 1)
|
||||||
{
|
{
|
||||||
if (n == 10)
|
if (n == 10)
|
||||||
@ -266,11 +269,13 @@ BOOST_AUTO_TEST_CASE(calling_other_functions)
|
|||||||
"}\n";
|
"}\n";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
|
|
||||||
auto evenStep_cpp = [] (u256 const& n) -> u256 {
|
auto evenStep_cpp = [](u256 const& n) -> u256
|
||||||
|
{
|
||||||
return n / 2;
|
return n / 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
auto oddStep_cpp = [] (u256 const& n) -> u256 {
|
auto oddStep_cpp = [](u256 const& n) -> u256
|
||||||
|
{
|
||||||
return 3 * n + 1;
|
return 3 * n + 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -343,7 +348,8 @@ BOOST_AUTO_TEST_CASE(short_circuiting)
|
|||||||
"}\n";
|
"}\n";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
|
|
||||||
auto short_circuiting_cpp = [] (u256 n) -> u256 {
|
auto short_circuiting_cpp = [](u256 n) -> u256
|
||||||
|
{
|
||||||
n == 0 || (n = 8) > 0;
|
n == 0 || (n = 8) > 0;
|
||||||
return n;
|
return n;
|
||||||
};
|
};
|
||||||
@ -362,7 +368,8 @@ BOOST_AUTO_TEST_CASE(high_bits_cleaning)
|
|||||||
" }\n"
|
" }\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
auto high_bits_cleaning_cpp = []() -> u256 {
|
auto high_bits_cleaning_cpp = []() -> u256
|
||||||
|
{
|
||||||
uint32_t x = uint32_t(0xffffffff) + 10;
|
uint32_t x = uint32_t(0xffffffff) + 10;
|
||||||
if (x >= 0xffffffff)
|
if (x >= 0xffffffff)
|
||||||
return 0;
|
return 0;
|
||||||
@ -381,7 +388,8 @@ BOOST_AUTO_TEST_CASE(sign_extension)
|
|||||||
" }\n"
|
" }\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
auto sign_extension_cpp = []() -> u256 {
|
auto sign_extension_cpp = []() -> u256
|
||||||
|
{
|
||||||
int64_t x = -int32_t(0xff);
|
int64_t x = -int32_t(0xff);
|
||||||
if (x >= 0xff)
|
if (x >= 0xff)
|
||||||
return 0;
|
return 0;
|
||||||
@ -399,7 +407,8 @@ BOOST_AUTO_TEST_CASE(small_unsigned_types)
|
|||||||
" }\n"
|
" }\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
auto small_unsigned_types_cpp = []() -> u256 {
|
auto small_unsigned_types_cpp = []() -> u256
|
||||||
|
{
|
||||||
uint32_t x = uint32_t(0xffffff) * 0xffffff;
|
uint32_t x = uint32_t(0xffffff) * 0xffffff;
|
||||||
return x / 0x100;
|
return x / 0x100;
|
||||||
};
|
};
|
||||||
@ -414,7 +423,8 @@ BOOST_AUTO_TEST_CASE(small_signed_types)
|
|||||||
" }\n"
|
" }\n"
|
||||||
"}\n";
|
"}\n";
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
auto small_signed_types_cpp = []() -> u256 {
|
auto small_signed_types_cpp = []() -> u256
|
||||||
|
{
|
||||||
return -int32_t(10) * -int64_t(20);
|
return -int32_t(10) * -int64_t(20);
|
||||||
};
|
};
|
||||||
BOOST_CHECK(testSolidityAgainstCpp(0, small_signed_types_cpp));
|
BOOST_CHECK(testSolidityAgainstCpp(0, small_signed_types_cpp));
|
||||||
|
Loading…
Reference in New Issue
Block a user