diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-07-15 00:53:38 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-07-15 00:53:38 +0800 |
commit | 6b068c6726a448847d6516e4d43a0c3103bed989 (patch) | |
tree | 5ff66964cb77cbcf17957eed474d180945948a53 | |
parent | c99c60c32fea82b8f791fc8f1e1950b5ae1bb1bc (diff) | |
parent | a904cafa389c46eb5ce0961fccb424f058ac977d (diff) | |
download | dexon-solidity-6b068c6726a448847d6516e4d43a0c3103bed989.tar.gz dexon-solidity-6b068c6726a448847d6516e4d43a0c3103bed989.tar.zst dexon-solidity-6b068c6726a448847d6516e4d43a0c3103bed989.zip |
Merge branch 'develop' into client_ref
-rw-r--r-- | TestHelper.cpp | 2 | ||||
-rw-r--r-- | libsolidity/SolidityEndToEndTest.cpp | 16 | ||||
-rw-r--r-- | libsolidity/SolidityNameAndTypeResolution.cpp | 24 |
3 files changed, 41 insertions, 1 deletions
diff --git a/TestHelper.cpp b/TestHelper.cpp index 9a1b1693..2ed1ed4d 100644 --- a/TestHelper.cpp +++ b/TestHelper.cpp @@ -479,7 +479,7 @@ bytes importCode(json_spirit::mObject& _o) { bytes code; if (_o["code"].type() == json_spirit::str_type) - if (_o["code"].get_str().find_first_of("0x") != 0) + if (_o["code"].get_str().find("0x") != 0) code = compileLLL(_o["code"].get_str(), false); else code = fromHex(_o["code"].get_str().substr(2)); diff --git a/libsolidity/SolidityEndToEndTest.cpp b/libsolidity/SolidityEndToEndTest.cpp index ad217546..9f806347 100644 --- a/libsolidity/SolidityEndToEndTest.cpp +++ b/libsolidity/SolidityEndToEndTest.cpp @@ -585,6 +585,22 @@ BOOST_AUTO_TEST_CASE(inc_dec_operators) BOOST_CHECK(callContractFunction("f()") == encodeArgs(0x53866)); } +BOOST_AUTO_TEST_CASE(bytes_comparison) +{ + char const* sourceCode = R"( + contract test { + function f() returns (bool) { + bytes2 a = "a"; + bytes2 x = "aa"; + bytes2 b = "b"; + return a < x && x < b; + } + } + )"; + compileAndRun(sourceCode); + BOOST_CHECK(callContractFunction("f()") == encodeArgs(true)); +} + BOOST_AUTO_TEST_CASE(state_smoke_test) { char const* sourceCode = "contract test {\n" diff --git a/libsolidity/SolidityNameAndTypeResolution.cpp b/libsolidity/SolidityNameAndTypeResolution.cpp index 1e40ee4f..0f5e4800 100644 --- a/libsolidity/SolidityNameAndTypeResolution.cpp +++ b/libsolidity/SolidityNameAndTypeResolution.cpp @@ -2110,6 +2110,30 @@ BOOST_AUTO_TEST_CASE(literal_strings) BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); } +BOOST_AUTO_TEST_CASE(invalid_integer_literal_fraction) +{ + char const* text = R"( + contract Foo { + function f() { + var x = 1.20; + } + } + )"; + BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); +} + +BOOST_AUTO_TEST_CASE(invalid_integer_literal_exp) +{ + char const* text = R"( + contract Foo { + function f() { + var x = 1e2; + } + } + )"; + BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); +} + BOOST_AUTO_TEST_SUITE_END() } |