This commit is contained in:
chriseth 2019-01-23 11:12:49 +01:00
parent e3791d6dcf
commit 14b553897e

View File

@ -219,6 +219,30 @@ BOOST_AUTO_TEST_CASE(type_identifiers)
BOOST_CHECK_EQUAL(InaccessibleDynamicType().identifier(), "t_inaccessible");
}
BOOST_AUTO_TEST_CASE(encoded_sizes)
{
BOOST_CHECK_EQUAL(IntegerType(16).calldataEncodedSize(true), 32);
BOOST_CHECK_EQUAL(IntegerType(16).calldataEncodedSize(false), 2);
BOOST_CHECK_EQUAL(FixedBytesType(16).calldataEncodedSize(true), 32);
BOOST_CHECK_EQUAL(FixedBytesType(16).calldataEncodedSize(false), 16);
BOOST_CHECK_EQUAL(BoolType().calldataEncodedSize(true), 32);
BOOST_CHECK_EQUAL(BoolType().calldataEncodedSize(false), 1);
shared_ptr<ArrayType> uint24Array = make_shared<ArrayType>(
DataLocation::Memory,
make_shared<IntegerType>(24),
9
);
BOOST_CHECK_EQUAL(uint24Array->calldataEncodedSize(true), 9 * 32);
BOOST_CHECK_EQUAL(uint24Array->calldataEncodedSize(false), 9 * 32);
ArrayType twoDimArray(DataLocation::Memory, uint24Array, 3);
BOOST_CHECK_EQUAL(twoDimArray.calldataEncodedSize(true), 9 * 3 * 32);
BOOST_CHECK_EQUAL(twoDimArray.calldataEncodedSize(false), 9 * 3 * 32);
}
BOOST_AUTO_TEST_SUITE_END()
}