Reenable push tests via Yul

This commit is contained in:
Leonardo Alt 2019-11-28 16:31:20 +01:00
parent 0914db8b9f
commit 84f806e75d

View File

@ -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,8 +4296,7 @@ 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());
@ -4308,6 +4307,7 @@ BOOST_AUTO_TEST_CASE(dynamic_out_of_bounds_array_access)
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,8 +4373,7 @@ 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());
@ -4383,6 +4382,7 @@ BOOST_AUTO_TEST_CASE(dynamic_array_cleanup)
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,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"); 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());
@ -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(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)