mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #7838 from ethereum/reenable_push_tests
Reenable push tests via Yul
This commit is contained in:
commit
3fbd4911f4
@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(exp_zero)
|
|||||||
testContractAgainstCppOnRange("f(uint256)", [](u256 const&) -> u256 { return u256(1); }, 0, 16);
|
testContractAgainstCppOnRange("f(uint256)", [](u256 const&) -> u256 { return u256(1); }, 0, 16);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* let's add this back when I figure out the correct type conversion.
|
/* TODO let's add this back when I figure out the correct type conversion.
|
||||||
BOOST_AUTO_TEST_CASE(conditional_expression_string_literal)
|
BOOST_AUTO_TEST_CASE(conditional_expression_string_literal)
|
||||||
{
|
{
|
||||||
char const* sourceCode = R"(
|
char const* sourceCode = R"(
|
||||||
@ -3068,7 +3068,7 @@ BOOST_AUTO_TEST_CASE(event_dynamic_nested_array_storage_v2)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
/// TODO enable again after push(..) via yul was implemented.
|
/// TODO enable again after push(..) via yul is implemented for nested arrays.
|
||||||
/// ALSO_VIA_YUL()
|
/// ALSO_VIA_YUL()
|
||||||
compileAndRun(sourceCode);
|
compileAndRun(sourceCode);
|
||||||
u256 x(42);
|
u256 x(42);
|
||||||
@ -4287,7 +4287,7 @@ BOOST_AUTO_TEST_CASE(dynamic_out_of_bounds_array_access)
|
|||||||
contract c {
|
contract c {
|
||||||
uint[] data;
|
uint[] data;
|
||||||
function enlarge(uint amount) public returns (uint) {
|
function enlarge(uint amount) public returns (uint) {
|
||||||
while (data.length - amount > 0)
|
while (data.length < amount)
|
||||||
data.push();
|
data.push();
|
||||||
return data.length;
|
return data.length;
|
||||||
}
|
}
|
||||||
@ -4296,18 +4296,18 @@ BOOST_AUTO_TEST_CASE(dynamic_out_of_bounds_array_access)
|
|||||||
function length() public returns (uint) { return data.length; }
|
function length() public returns (uint) { return data.length; }
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
/// TODO enable again after push(..) via yul was implemented.
|
ALSO_VIA_YUL(
|
||||||
/// ALSO_VIA_YUL()
|
compileAndRun(sourceCode);
|
||||||
compileAndRun(sourceCode);
|
ABI_CHECK(callContractFunction("length()"), encodeArgs(0));
|
||||||
ABI_CHECK(callContractFunction("length()"), encodeArgs(0));
|
ABI_CHECK(callContractFunction("get(uint256)", 3), bytes());
|
||||||
ABI_CHECK(callContractFunction("get(uint256)", 3), bytes());
|
ABI_CHECK(callContractFunction("enlarge(uint256)", 4), encodeArgs(4));
|
||||||
ABI_CHECK(callContractFunction("enlarge(uint256)", 4), encodeArgs(4));
|
ABI_CHECK(callContractFunction("length()"), encodeArgs(4));
|
||||||
ABI_CHECK(callContractFunction("length()"), encodeArgs(4));
|
ABI_CHECK(callContractFunction("set(uint256,uint256)", 3, 4), encodeArgs(true));
|
||||||
ABI_CHECK(callContractFunction("set(uint256,uint256)", 3, 4), encodeArgs(true));
|
ABI_CHECK(callContractFunction("get(uint256)", 3), encodeArgs(4));
|
||||||
ABI_CHECK(callContractFunction("get(uint256)", 3), encodeArgs(4));
|
ABI_CHECK(callContractFunction("length()"), encodeArgs(4));
|
||||||
ABI_CHECK(callContractFunction("length()"), encodeArgs(4));
|
ABI_CHECK(callContractFunction("set(uint256,uint256)", 4, 8), bytes());
|
||||||
ABI_CHECK(callContractFunction("set(uint256,uint256)", 4, 8), bytes());
|
ABI_CHECK(callContractFunction("length()"), encodeArgs(4));
|
||||||
ABI_CHECK(callContractFunction("length()"), encodeArgs(4));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(fixed_array_cleanup)
|
BOOST_AUTO_TEST_CASE(fixed_array_cleanup)
|
||||||
@ -4373,16 +4373,16 @@ BOOST_AUTO_TEST_CASE(dynamic_array_cleanup)
|
|||||||
function fullClear() public { delete dynamic; }
|
function fullClear() public { delete dynamic; }
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
/// TODO enable again after push(..) via yul was implemented.
|
ALSO_VIA_YUL(
|
||||||
/// ALSO_VIA_YUL()
|
compileAndRun(sourceCode);
|
||||||
compileAndRun(sourceCode);
|
BOOST_CHECK(storageEmpty(m_contractAddress));
|
||||||
BOOST_CHECK(storageEmpty(m_contractAddress));
|
ABI_CHECK(callContractFunction("fill()"), bytes());
|
||||||
ABI_CHECK(callContractFunction("fill()"), bytes());
|
BOOST_CHECK(!storageEmpty(m_contractAddress));
|
||||||
BOOST_CHECK(!storageEmpty(m_contractAddress));
|
ABI_CHECK(callContractFunction("halfClear()"), bytes());
|
||||||
ABI_CHECK(callContractFunction("halfClear()"), bytes());
|
BOOST_CHECK(!storageEmpty(m_contractAddress));
|
||||||
BOOST_CHECK(!storageEmpty(m_contractAddress));
|
ABI_CHECK(callContractFunction("fullClear()"), bytes());
|
||||||
ABI_CHECK(callContractFunction("fullClear()"), bytes());
|
BOOST_CHECK(storageEmpty(m_contractAddress));
|
||||||
BOOST_CHECK(storageEmpty(m_contractAddress));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(dynamic_multi_array_cleanup)
|
BOOST_AUTO_TEST_CASE(dynamic_multi_array_cleanup)
|
||||||
@ -6699,25 +6699,25 @@ BOOST_AUTO_TEST_CASE(storage_array_ref)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)";
|
)";
|
||||||
/// TODO enable again after push(..) via yul was implemented.
|
ALSO_VIA_YUL(
|
||||||
/// ALSO_VIA_YUL()
|
compileAndRun(sourceCode, 0, "Store");
|
||||||
compileAndRun(sourceCode, 0, "Store");
|
BOOST_REQUIRE(callContractFunction("find(uint256)", u256(7)) == encodeArgs(u256(-1)));
|
||||||
BOOST_REQUIRE(callContractFunction("find(uint256)", u256(7)) == encodeArgs(u256(-1)));
|
BOOST_REQUIRE(callContractFunction("add(uint256)", u256(7)) == encodeArgs());
|
||||||
BOOST_REQUIRE(callContractFunction("add(uint256)", u256(7)) == encodeArgs());
|
BOOST_REQUIRE(callContractFunction("find(uint256)", u256(7)) == encodeArgs(u256(0)));
|
||||||
BOOST_REQUIRE(callContractFunction("find(uint256)", u256(7)) == encodeArgs(u256(0)));
|
ABI_CHECK(callContractFunction("add(uint256)", u256(11)), encodeArgs());
|
||||||
ABI_CHECK(callContractFunction("add(uint256)", u256(11)), encodeArgs());
|
ABI_CHECK(callContractFunction("add(uint256)", u256(17)), encodeArgs());
|
||||||
ABI_CHECK(callContractFunction("add(uint256)", u256(17)), encodeArgs());
|
ABI_CHECK(callContractFunction("add(uint256)", u256(27)), encodeArgs());
|
||||||
ABI_CHECK(callContractFunction("add(uint256)", u256(27)), encodeArgs());
|
ABI_CHECK(callContractFunction("add(uint256)", u256(31)), encodeArgs());
|
||||||
ABI_CHECK(callContractFunction("add(uint256)", u256(31)), encodeArgs());
|
ABI_CHECK(callContractFunction("add(uint256)", u256(32)), encodeArgs());
|
||||||
ABI_CHECK(callContractFunction("add(uint256)", u256(32)), encodeArgs());
|
ABI_CHECK(callContractFunction("add(uint256)", u256(66)), encodeArgs());
|
||||||
ABI_CHECK(callContractFunction("add(uint256)", u256(66)), encodeArgs());
|
ABI_CHECK(callContractFunction("add(uint256)", u256(177)), encodeArgs());
|
||||||
ABI_CHECK(callContractFunction("add(uint256)", u256(177)), encodeArgs());
|
ABI_CHECK(callContractFunction("find(uint256)", u256(7)), encodeArgs(u256(0)));
|
||||||
ABI_CHECK(callContractFunction("find(uint256)", u256(7)), encodeArgs(u256(0)));
|
ABI_CHECK(callContractFunction("find(uint256)", u256(27)), encodeArgs(u256(3)));
|
||||||
ABI_CHECK(callContractFunction("find(uint256)", u256(27)), encodeArgs(u256(3)));
|
ABI_CHECK(callContractFunction("find(uint256)", u256(32)), encodeArgs(u256(5)));
|
||||||
ABI_CHECK(callContractFunction("find(uint256)", u256(32)), encodeArgs(u256(5)));
|
ABI_CHECK(callContractFunction("find(uint256)", u256(176)), encodeArgs(u256(-1)));
|
||||||
ABI_CHECK(callContractFunction("find(uint256)", u256(176)), encodeArgs(u256(-1)));
|
ABI_CHECK(callContractFunction("find(uint256)", u256(0)), encodeArgs(u256(-1)));
|
||||||
ABI_CHECK(callContractFunction("find(uint256)", u256(0)), encodeArgs(u256(-1)));
|
ABI_CHECK(callContractFunction("find(uint256)", u256(400)), encodeArgs(u256(-1)));
|
||||||
ABI_CHECK(callContractFunction("find(uint256)", u256(400)), encodeArgs(u256(-1)));
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOST_AUTO_TEST_CASE(memory_types_initialisation)
|
BOOST_AUTO_TEST_CASE(memory_types_initialisation)
|
||||||
|
Loading…
Reference in New Issue
Block a user