aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-08-15 16:49:39 +0800
committerGitHub <noreply@github.com>2018-08-15 16:49:39 +0800
commitb9752b236b474e384a297fe832cf0efb161e8deb (patch)
tree5c5d61fae37024a3ba2fea5bd7eaf0d455e6e043 /test
parent3c5226cefb9f883277530decedc08e2e48ed3050 (diff)
parent3fa8829845bf55df812f81356a3ec43149836bb5 (diff)
downloaddexon-solidity-b9752b236b474e384a297fe832cf0efb161e8deb.tar
dexon-solidity-b9752b236b474e384a297fe832cf0efb161e8deb.tar.gz
dexon-solidity-b9752b236b474e384a297fe832cf0efb161e8deb.tar.bz2
dexon-solidity-b9752b236b474e384a297fe832cf0efb161e8deb.tar.lz
dexon-solidity-b9752b236b474e384a297fe832cf0efb161e8deb.tar.xz
dexon-solidity-b9752b236b474e384a297fe832cf0efb161e8deb.tar.zst
dexon-solidity-b9752b236b474e384a297fe832cf0efb161e8deb.zip
Merge pull request #4797 from bakaoh/issue4718
Fixes #4718: High CPU usage when using large variable names
Diffstat (limited to 'test')
-rw-r--r--test/libdevcore/StringUtils.cpp1
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/573_similar_name_longer_than_80_not_suggested.sol7
-rw-r--r--test/libsolidity/syntaxTests/nameAndTypeResolution/574_similar_name_shorter_than_80_suggested.sol7
3 files changed, 15 insertions, 0 deletions
diff --git a/test/libdevcore/StringUtils.cpp b/test/libdevcore/StringUtils.cpp
index 94f1b753..76c11b82 100644
--- a/test/libdevcore/StringUtils.cpp
+++ b/test/libdevcore/StringUtils.cpp
@@ -48,6 +48,7 @@ BOOST_AUTO_TEST_CASE(test_similarity)
BOOST_CHECK_EQUAL(stringWithinDistance("abc", "abcdef", 2), false);
BOOST_CHECK_EQUAL(stringWithinDistance("abcd", "wxyz", 2), false);
BOOST_CHECK_EQUAL(stringWithinDistance("", "", 2), true);
+ BOOST_CHECK_EQUAL(stringWithinDistance("YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY", "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYZ", 2, 6400), false);
}
BOOST_AUTO_TEST_CASE(test_dldistance)
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/573_similar_name_longer_than_80_not_suggested.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/573_similar_name_longer_than_80_not_suggested.sol
new file mode 100644
index 00000000..c6719d8c
--- /dev/null
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/573_similar_name_longer_than_80_not_suggested.sol
@@ -0,0 +1,7 @@
+contract test {
+ function f() public {
+ int YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY = YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY;
+ }
+}
+// ----
+// DeclarationError: (146-236): Undeclared identifier.
diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/574_similar_name_shorter_than_80_suggested.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/574_similar_name_shorter_than_80_suggested.sol
new file mode 100644
index 00000000..61fb2d82
--- /dev/null
+++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/574_similar_name_shorter_than_80_suggested.sol
@@ -0,0 +1,7 @@
+contract test {
+ function f() public {
+ int YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY = YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY;
+ }
+}
+// ----
+// DeclarationError: (137-216): Undeclared identifier. Did you mean "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"? \ No newline at end of file