aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiana Husikyan <liana@ethdev.com>2015-06-04 20:09:19 +0800
committerLiana Husikyan <liana@ethdev.com>2015-06-04 20:09:19 +0800
commit1f3e93785ea94c6897190399e29b1977198445ba (patch)
treeab3aef0cca030de38ff8edc1877f2d741c2e108f
parent0e664b05aa71641619101de51d16cf5baea6fdf7 (diff)
downloaddexon-solidity-1f3e93785ea94c6897190399e29b1977198445ba.tar.gz
dexon-solidity-1f3e93785ea94c6897190399e29b1977198445ba.tar.zst
dexon-solidity-1f3e93785ea94c6897190399e29b1977198445ba.zip
fixed assigning negative number to unsigned
-rw-r--r--libsolidity/SolidityNameAndTypeResolution.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/libsolidity/SolidityNameAndTypeResolution.cpp b/libsolidity/SolidityNameAndTypeResolution.cpp
index 4f7b82ec..3691868c 100644
--- a/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -1866,6 +1866,16 @@ BOOST_AUTO_TEST_CASE(negative_integers_to_unsigned)
BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
}
+BOOST_AUTO_TEST_CASE(positive_integers_to_unsigned_out_of_bound)
+{
+ char const* sourceCode = R"(
+ contract test {
+ uint8 public x = 700;
+ }
+ )";
+ BOOST_CHECK_THROW(parseTextAndResolveNames(sourceCode), TypeError);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}