Merge pull request #7838 from ethereum/reenable_push_tests

Reenable push tests via Yul
This commit is contained in:
Leonardo 2019-11-29 17:32:33 +01:00 committed by GitHub
commit 3fbd4911f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -87,7 +87,7 @@ BOOST_AUTO_TEST_CASE(exp_zero)
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)
{
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()
compileAndRun(sourceCode);
u256 x(42);
@ -4287,7 +4287,7 @@ BOOST_AUTO_TEST_CASE(dynamic_out_of_bounds_array_access)
contract c {
uint[] data;
function enlarge(uint amount) public returns (uint) {
while (data.length - amount > 0)
while (data.length < amount)
data.push();
return data.length;
}
@ -4296,8 +4296,7 @@ BOOST_AUTO_TEST_CASE(dynamic_out_of_bounds_array_access)
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);
ABI_CHECK(callContractFunction("length()"), encodeArgs(0));
ABI_CHECK(callContractFunction("get(uint256)", 3), bytes());
@ -4308,6 +4307,7 @@ BOOST_AUTO_TEST_CASE(dynamic_out_of_bounds_array_access)
ABI_CHECK(callContractFunction("length()"), encodeArgs(4));
ABI_CHECK(callContractFunction("set(uint256,uint256)", 4, 8), bytes());
ABI_CHECK(callContractFunction("length()"), encodeArgs(4));
);
}
BOOST_AUTO_TEST_CASE(fixed_array_cleanup)
@ -4373,8 +4373,7 @@ BOOST_AUTO_TEST_CASE(dynamic_array_cleanup)
function fullClear() public { delete dynamic; }
}
)";
/// TODO enable again after push(..) via yul was implemented.
/// ALSO_VIA_YUL()
ALSO_VIA_YUL(
compileAndRun(sourceCode);
BOOST_CHECK(storageEmpty(m_contractAddress));
ABI_CHECK(callContractFunction("fill()"), bytes());
@ -4383,6 +4382,7 @@ BOOST_AUTO_TEST_CASE(dynamic_array_cleanup)
BOOST_CHECK(!storageEmpty(m_contractAddress));
ABI_CHECK(callContractFunction("fullClear()"), bytes());
BOOST_CHECK(storageEmpty(m_contractAddress));
);
}
BOOST_AUTO_TEST_CASE(dynamic_multi_array_cleanup)
@ -6699,8 +6699,7 @@ 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");
BOOST_REQUIRE(callContractFunction("find(uint256)", u256(7)) == encodeArgs(u256(-1)));
BOOST_REQUIRE(callContractFunction("add(uint256)", u256(7)) == encodeArgs());
@ -6718,6 +6717,7 @@ BOOST_AUTO_TEST_CASE(storage_array_ref)
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(400)), encodeArgs(u256(-1)));
);
}
BOOST_AUTO_TEST_CASE(memory_types_initialisation)