aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--SolidityNameAndTypeResolution.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/SolidityNameAndTypeResolution.cpp b/SolidityNameAndTypeResolution.cpp
index a48b62d0..6e6254eb 100644
--- a/SolidityNameAndTypeResolution.cpp
+++ b/SolidityNameAndTypeResolution.cpp
@@ -1292,6 +1292,24 @@ BOOST_AUTO_TEST_CASE(array_copy_with_different_types_dynamic_static)
BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
}
+BOOST_AUTO_TEST_CASE(storage_variable_initialization_with_incorrect_type_int)
+{
+ char const* text = R"(
+ contract c {
+ uint8 a = 1000;
+ })";
+ BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
+}
+
+BOOST_AUTO_TEST_CASE(storage_variable_initialization_with_incorrect_type_string)
+{
+ char const* text = R"(
+ contract c {
+ uint a = "abc";
+ })";
+ BOOST_CHECK_THROW(parseTextAndResolveNames(text), TypeError);
+}
+
BOOST_AUTO_TEST_SUITE_END()
}