aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorbakaoh <tatattai@gmail.com>2018-08-10 18:31:19 +0800
committerchriseth <chris@ethereum.org>2018-08-15 16:23:08 +0800
commit3fa8829845bf55df812f81356a3ec43149836bb5 (patch)
tree16bb5707241fffa03f93513fffcaada49c083274 /test
parentf82893450d36d1e2d136b0cbd4449ff955410fb5 (diff)
downloaddexon-solidity-3fa8829845bf55df812f81356a3ec43149836bb5.tar
dexon-solidity-3fa8829845bf55df812f81356a3ec43149836bb5.tar.gz
dexon-solidity-3fa8829845bf55df812f81356a3ec43149836bb5.tar.bz2
dexon-solidity-3fa8829845bf55df812f81356a3ec43149836bb5.tar.lz
dexon-solidity-3fa8829845bf55df812f81356a3ec43149836bb5.tar.xz
dexon-solidity-3fa8829845bf55df812f81356a3ec43149836bb5.tar.zst
dexon-solidity-3fa8829845bf55df812f81356a3ec43149836bb5.zip
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