aboutsummaryrefslogtreecommitdiffstats
path: root/SolidityTypes.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-03-17 00:52:19 +0800
committerchriseth <c@ethdev.com>2015-03-18 01:13:28 +0800
commita05b307f4e8f37baef6a60a5ea841e7caa678f4a (patch)
treeb37700c440ed9b015eaa815e32855e3e8c79fa47 /SolidityTypes.cpp
parent8e61b06b2a426eb257a2b252cbe584d90bb440b3 (diff)
downloaddexon-solidity-a05b307f4e8f37baef6a60a5ea841e7caa678f4a.tar
dexon-solidity-a05b307f4e8f37baef6a60a5ea841e7caa678f4a.tar.gz
dexon-solidity-a05b307f4e8f37baef6a60a5ea841e7caa678f4a.tar.bz2
dexon-solidity-a05b307f4e8f37baef6a60a5ea841e7caa678f4a.tar.lz
dexon-solidity-a05b307f4e8f37baef6a60a5ea841e7caa678f4a.tar.xz
dexon-solidity-a05b307f4e8f37baef6a60a5ea841e7caa678f4a.tar.zst
dexon-solidity-a05b307f4e8f37baef6a60a5ea841e7caa678f4a.zip
Packing for arrays.
Diffstat (limited to 'SolidityTypes.cpp')
-rw-r--r--SolidityTypes.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/SolidityTypes.cpp b/SolidityTypes.cpp
index 8defd1d8..6b630647 100644
--- a/SolidityTypes.cpp
+++ b/SolidityTypes.cpp
@@ -75,6 +75,17 @@ BOOST_AUTO_TEST_CASE(storage_layout_mapping)
BOOST_CHECK(*members.getMemberStorageOffset("final") == make_pair(u256(3), unsigned(0)));
}
+BOOST_AUTO_TEST_CASE(storage_layout_arrays)
+{
+ BOOST_CHECK(ArrayType(ArrayType::Location::Storage, make_shared<FixedBytesType>(1), 32).getStorageSize() == 1);
+ BOOST_CHECK(ArrayType(ArrayType::Location::Storage, make_shared<FixedBytesType>(1), 33).getStorageSize() == 2);
+ BOOST_CHECK(ArrayType(ArrayType::Location::Storage, make_shared<FixedBytesType>(2), 31).getStorageSize() == 2);
+ BOOST_CHECK(ArrayType(ArrayType::Location::Storage, make_shared<FixedBytesType>(7), 8).getStorageSize() == 2);
+ BOOST_CHECK(ArrayType(ArrayType::Location::Storage, make_shared<FixedBytesType>(7), 9).getStorageSize() == 3);
+ BOOST_CHECK(ArrayType(ArrayType::Location::Storage, make_shared<FixedBytesType>(31), 9).getStorageSize() == 9);
+ BOOST_CHECK(ArrayType(ArrayType::Location::Storage, make_shared<FixedBytesType>(32), 9).getStorageSize() == 9);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}