aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 9a837113..c2f96aaa 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -2345,6 +2345,24 @@ BOOST_AUTO_TEST_CASE(constructor_static_array_argument)
ABI_CHECK(callContractFunction("b(uint256)", u256(2)), encodeArgs(u256(4)));
}
+BOOST_AUTO_TEST_CASE(constant_var_as_array_length)
+{
+ char const* sourceCode = R"(
+ contract C {
+ uint constant LEN = 3;
+ uint[LEN] public a;
+
+ function C(uint[LEN] _a) {
+ a = _a;
+ }
+ }
+ )";
+ compileAndRun(sourceCode, 0, "C", encodeArgs(u256(1), u256(2), u256(3)));
+ ABI_CHECK(callContractFunction("a(uint256)", u256(0)), encodeArgs(u256(1)));
+ ABI_CHECK(callContractFunction("a(uint256)", u256(1)), encodeArgs(u256(2)));
+ ABI_CHECK(callContractFunction("a(uint256)", u256(2)), encodeArgs(u256(3)));
+}
+
BOOST_AUTO_TEST_CASE(functions_called_by_constructor)
{
char const* sourceCode = R"(