diff options
author | Christian <c@ethdev.com> | 2014-11-04 22:07:33 +0800 |
---|---|---|
committer | Christian <c@ethdev.com> | 2014-11-06 09:22:24 +0800 |
commit | e22cad4d35559cb76449a215ca519f9c0b812c7a (patch) | |
tree | 264a284a5ade04043e59c6d1a6035b531eaa2b01 | |
parent | 4b9dcd95ce5a33440de5014896bfeb99f6436c76 (diff) | |
download | dexon-solidity-e22cad4d35559cb76449a215ca519f9c0b812c7a.tar.gz dexon-solidity-e22cad4d35559cb76449a215ca519f9c0b812c7a.tar.zst dexon-solidity-e22cad4d35559cb76449a215ca519f9c0b812c7a.zip |
Tests for type conversion at comparison.
-rw-r--r-- | solidityNameAndTypeResolution.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/solidityNameAndTypeResolution.cpp b/solidityNameAndTypeResolution.cpp index 9e34e6d0..f46ad673 100644 --- a/solidityNameAndTypeResolution.cpp +++ b/solidityNameAndTypeResolution.cpp @@ -162,6 +162,22 @@ BOOST_AUTO_TEST_CASE(type_checking_function_call) BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); } +BOOST_AUTO_TEST_CASE(type_conversion_for_comparison) +{ + char const* text = "contract test {\n" + " function f() { uint32(2) == int64(2); }" + "}\n"; + BOOST_CHECK_NO_THROW(parseTextAndResolveNames(text)); +} + +BOOST_AUTO_TEST_CASE(type_conversion_for_comparison_invalid) +{ + char const* text = "contract test {\n" + " function f() { int32(2) == uint64(2); }" + "}\n"; + BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError); +} + BOOST_AUTO_TEST_CASE(type_inference_explicit_conversion) { char const* text = "contract test {\n" |