aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2017-01-25 00:38:06 +0800
committerchriseth <c@ethdev.com>2017-01-25 06:37:48 +0800
commit1316bb75651ea365c5246277d2dfd3d366be9070 (patch)
tree8c46bf1a45ca85bcd1da2d8ef8b2556e22cf5634 /test
parentba9a04500217e301bec63cab4e0c0f1d9322646d (diff)
downloaddexon-solidity-1316bb75651ea365c5246277d2dfd3d366be9070.tar.gz
dexon-solidity-1316bb75651ea365c5246277d2dfd3d366be9070.tar.zst
dexon-solidity-1316bb75651ea365c5246277d2dfd3d366be9070.zip
Warn about invalid checksums of addresses.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/SolidityNameAndTypeResolution.cpp49
1 files changed, 49 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityNameAndTypeResolution.cpp b/test/libsolidity/SolidityNameAndTypeResolution.cpp
index ce241c78..b6067ea5 100644
--- a/test/libsolidity/SolidityNameAndTypeResolution.cpp
+++ b/test/libsolidity/SolidityNameAndTypeResolution.cpp
@@ -4983,6 +4983,55 @@ BOOST_AUTO_TEST_CASE(constructible_internal_constructor)
success(text);
}
+BOOST_AUTO_TEST_CASE(address_checksum_type_deduction)
+{
+ char const* text = R"(
+ contract C {
+ function f() {
+ var x = 0xfA0bFc97E48458494Ccd857e1A85DC91F7F0046E;
+ x.send(2);
+ }
+ }
+ )";
+ success(text);
+}
+
+BOOST_AUTO_TEST_CASE(invalid_address_checksum)
+{
+ char const* text = R"(
+ contract C {
+ function f() {
+ var x = 0xFA0bFc97E48458494Ccd857e1A85DC91F7F0046E;
+ }
+ }
+ )";
+ CHECK_WARNING(text, "checksum");
+}
+
+BOOST_AUTO_TEST_CASE(invalid_address_no_checksum)
+{
+ char const* text = R"(
+ contract C {
+ function f() {
+ var x = 0xfa0bfc97e48458494ccd857e1a85dc91f7f0046e;
+ }
+ }
+ )";
+ CHECK_WARNING(text, "checksum");
+}
+
+BOOST_AUTO_TEST_CASE(invalid_address_length)
+{
+ char const* text = R"(
+ contract C {
+ function f() {
+ var x = 0xA0bFc97E48458494Ccd857e1A85DC91F7F0046E;
+ }
+ }
+ )";
+ CHECK_WARNING(text, "checksum");
+}
+
BOOST_AUTO_TEST_SUITE_END()
}