Convert storge access tests to new explicit slot / offset access.

This commit is contained in:
chriseth 2017-04-12 11:12:02 +02:00
parent dfaab73efe
commit 4afd54b235

View File

@ -7426,15 +7426,19 @@ BOOST_AUTO_TEST_CASE(inline_assembly_storage_access)
uint16 x; uint16 x;
uint16 public y; uint16 public y;
uint public z; uint public z;
function f() { function f() returns (bool) {
// we know that z is aligned because it is too large, so we just discard its uint off;
// intra-slot offset value assembly {
assembly { 7 z pop sstore } sstore(z$slot, 7)
off := z$offset
}
assert(off == 0);
return true;
} }
} }
)"; )";
compileAndRun(sourceCode, 0, "C"); compileAndRun(sourceCode, 0, "C");
BOOST_CHECK(callContractFunction("f()") == encodeArgs()); BOOST_CHECK(callContractFunction("f()") == encodeArgs(true));
BOOST_CHECK(callContractFunction("z()") == encodeArgs(u256(7))); BOOST_CHECK(callContractFunction("z()") == encodeArgs(u256(7)));
} }