diff options
author | chriseth <c@ethdev.com> | 2017-03-04 02:26:54 +0800 |
---|---|---|
committer | chriseth <c@ethdev.com> | 2017-03-13 20:30:23 +0800 |
commit | 592cec7e9074313e7ce5539769c065ecf5cbba12 (patch) | |
tree | 72a26e95183f4356f68e9ae5c02756062a58415d /test/libsolidity/SolidityEndToEndTest.cpp | |
parent | 4077e56a2fad49227e7fe4c1ed4ff81462fc6a9a (diff) | |
download | dexon-solidity-592cec7e9074313e7ce5539769c065ecf5cbba12.tar.gz dexon-solidity-592cec7e9074313e7ce5539769c065ecf5cbba12.tar.zst dexon-solidity-592cec7e9074313e7ce5539769c065ecf5cbba12.zip |
Disallow constants that are neither value types nor strings.
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 50 |
1 files changed, 26 insertions, 24 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 552352e4..831840e2 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -4576,31 +4576,33 @@ BOOST_AUTO_TEST_CASE(assignment_to_const_var_involving_keccak) BOOST_CHECK(callContractFunction("f()") == encodeArgs(dev::keccak256("abc"))); } -BOOST_AUTO_TEST_CASE(assignment_to_const_array_vars) -{ - char const* sourceCode = R"( - contract C { - uint[3] constant x = [uint(1), 2, 3]; - uint constant y = x[0] + x[1] + x[2]; - function f() returns (uint) { return y; } - } - )"; - compileAndRun(sourceCode); - BOOST_CHECK(callContractFunction("f()") == encodeArgs(1 + 2 + 3)); -} +// Disabled until https://github.com/ethereum/solidity/issues/715 is implemented +//BOOST_AUTO_TEST_CASE(assignment_to_const_array_vars) +//{ +// char const* sourceCode = R"( +// contract C { +// uint[3] constant x = [uint(1), 2, 3]; +// uint constant y = x[0] + x[1] + x[2]; +// function f() returns (uint) { return y; } +// } +// )"; +// compileAndRun(sourceCode); +// BOOST_CHECK(callContractFunction("f()") == encodeArgs(1 + 2 + 3)); +//} -BOOST_AUTO_TEST_CASE(constant_struct) -{ - char const* sourceCode = R"( - contract C { - struct S { uint x; uint[] y; } - S constant x = S(5, new uint[](4)); - function f() returns (uint) { return x.x; } - } - )"; - compileAndRun(sourceCode); - BOOST_CHECK(callContractFunction("f()") == encodeArgs(5)); -} +// Disabled until https://github.com/ethereum/solidity/issues/715 is implemented +//BOOST_AUTO_TEST_CASE(constant_struct) +//{ +// char const* sourceCode = R"( +// contract C { +// struct S { uint x; uint[] y; } +// S constant x = S(5, new uint[](4)); +// function f() returns (uint) { return x.x; } +// } +// )"; +// compileAndRun(sourceCode); +// BOOST_CHECK(callContractFunction("f()") == encodeArgs(5)); +//} BOOST_AUTO_TEST_CASE(packed_storage_structs_uint) { |