diff options
author | Lefteris Karapetsas <lefteris@refu.co> | 2015-03-13 00:31:39 +0800 |
---|---|---|
committer | Lefteris Karapetsas <lefteris@refu.co> | 2015-03-13 00:31:39 +0800 |
commit | 1bb7f3cbc3737bbdf6653d3721d01dc95a217707 (patch) | |
tree | 47c77577eaacc225084ac4cb05d2a36f01b8bb19 | |
parent | c89413f6ea0e755808ac46f12b53965a28948ace (diff) | |
download | dexon-solidity-1bb7f3cbc3737bbdf6653d3721d01dc95a217707.tar.gz dexon-solidity-1bb7f3cbc3737bbdf6653d3721d01dc95a217707.tar.zst dexon-solidity-1bb7f3cbc3737bbdf6653d3721d01dc95a217707.zip |
Small FixedBytes type fixes
- Integer Constant is explicitly convertible to FixedBytes, so using
that in the tests
-rw-r--r-- | SolidityEndToEndTest.cpp | 16 | ||||
-rw-r--r-- | SolidityNameAndTypeResolution.cpp | 1 |
2 files changed, 8 insertions, 9 deletions
diff --git a/SolidityEndToEndTest.cpp b/SolidityEndToEndTest.cpp index 5f95709c..2f965849 100644 --- a/SolidityEndToEndTest.cpp +++ b/SolidityEndToEndTest.cpp @@ -1182,14 +1182,12 @@ BOOST_AUTO_TEST_CASE(send_ether) BOOST_CHECK(callContractFunction("a(address,uint256)", address, amount) == encodeArgs(1)); BOOST_CHECK_EQUAL(m_state.balance(address), amount); } -// TODO: Note that these tests should actually be -// simply converting integer constant to bytes32. This conversion is not there -// yet. When it's implemented DO change the tests too + BOOST_AUTO_TEST_CASE(log0) { char const* sourceCode = "contract test {\n" " function a() {\n" - " log0(bytes32(1));\n" + " log0(1);\n" " }\n" "}\n"; compileAndRun(sourceCode); @@ -1204,7 +1202,7 @@ BOOST_AUTO_TEST_CASE(log1) { char const* sourceCode = "contract test {\n" " function a() {\n" - " log1(bytes32(1), bytes32(2));\n" + " log1(1, 2);\n" " }\n" "}\n"; compileAndRun(sourceCode); @@ -1220,7 +1218,7 @@ BOOST_AUTO_TEST_CASE(log2) { char const* sourceCode = "contract test {\n" " function a() {\n" - " log2(bytes32(1), bytes32(2), bytes32(3));\n" + " log2(1, 2, 3);\n" " }\n" "}\n"; compileAndRun(sourceCode); @@ -1237,7 +1235,7 @@ BOOST_AUTO_TEST_CASE(log3) { char const* sourceCode = "contract test {\n" " function a() {\n" - " log3(bytes32(1), bytes32(2), bytes32(3), bytes32(4));\n" + " log3(1, 2, 3, 4);\n" " }\n" "}\n"; compileAndRun(sourceCode); @@ -1254,7 +1252,7 @@ BOOST_AUTO_TEST_CASE(log4) { char const* sourceCode = "contract test {\n" " function a() {\n" - " log4(bytes32(1), bytes32(2), bytes32(3), bytes32(4), bytes32(5));\n" + " log4(1, 2, 3, 4, 5);\n" " }\n" "}\n"; compileAndRun(sourceCode); @@ -1271,7 +1269,7 @@ BOOST_AUTO_TEST_CASE(log_in_constructor) { char const* sourceCode = "contract test {\n" " function test() {\n" - " log1(bytes32(1), bytes32(2));\n" + " log1(1, 2);\n" " }\n" "}\n"; compileAndRun(sourceCode); diff --git a/SolidityNameAndTypeResolution.cpp b/SolidityNameAndTypeResolution.cpp index 99a1a8bc..a310800f 100644 --- a/SolidityNameAndTypeResolution.cpp +++ b/SolidityNameAndTypeResolution.cpp @@ -1358,6 +1358,7 @@ BOOST_AUTO_TEST_CASE(test_fromElementaryTypeName) BOOST_CHECK(*Type::fromElementaryTypeName(Token::UInt248) == *make_shared<IntegerType>(248, IntegerType::Modifier::Unsigned)); BOOST_CHECK(*Type::fromElementaryTypeName(Token::UInt256) == *make_shared<IntegerType>(256, IntegerType::Modifier::Unsigned)); + BOOST_CHECK(*Type::fromElementaryTypeName(Token::Byte) == *make_shared<FixedBytesType>(1)); BOOST_CHECK(*Type::fromElementaryTypeName(Token::Bytes0) == *make_shared<FixedBytesType>(0)); BOOST_CHECK(*Type::fromElementaryTypeName(Token::Bytes1) == *make_shared<FixedBytesType>(1)); BOOST_CHECK(*Type::fromElementaryTypeName(Token::Bytes2) == *make_shared<FixedBytesType>(2)); |