aboutsummaryrefslogtreecommitdiffstats
path: root/SolidityTypes.cpp
diff options
context:
space:
mode:
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()
}