aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2018-11-19 22:53:26 +0800
committerGitHub <noreply@github.com>2018-11-19 22:53:26 +0800
commitd3f66ca0fab130e801b012bd192e1e8e97fb3761 (patch)
treeb671dcda3fca233f9213da5a217c83c6ddcf534e /test/libsolidity
parent5be45e736d2b111c9352ca2990a1c7a653c60c55 (diff)
parent06c3f0953ae9f9921683f80349c7b1bbddcb3a9f (diff)
downloaddexon-solidity-d3f66ca0fab130e801b012bd192e1e8e97fb3761.tar.gz
dexon-solidity-d3f66ca0fab130e801b012bd192e1e8e97fb3761.tar.zst
dexon-solidity-d3f66ca0fab130e801b012bd192e1e8e97fb3761.zip
Merge pull request #5309 from ethereum/smt_bound_functions
[SMTChecker] Support bound function calls
Diffstat (limited to 'test/libsolidity')
-rw-r--r--test/libsolidity/smtCheckerTests/functions/functions_bound_1.sol19
-rw-r--r--test/libsolidity/smtCheckerTests/functions/functions_bound_1_fail.sol21
-rw-r--r--test/libsolidity/smtCheckerTests/functions/functions_library_1.sol18
-rw-r--r--test/libsolidity/smtCheckerTests/functions/functions_library_1_fail.sol20
4 files changed, 78 insertions, 0 deletions
diff --git a/test/libsolidity/smtCheckerTests/functions/functions_bound_1.sol b/test/libsolidity/smtCheckerTests/functions/functions_bound_1.sol
new file mode 100644
index 00000000..5e9722de
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/functions/functions_bound_1.sol
@@ -0,0 +1,19 @@
+pragma experimental SMTChecker;
+
+library L
+{
+ function add(uint x, uint y) internal pure returns (uint) {
+ require(x < 1000);
+ require(y < 1000);
+ return x + y;
+ }
+}
+
+contract C
+{
+ using L for uint;
+ function f(uint x) public pure {
+ uint y = x.add(999);
+ assert(y < 10000);
+ }
+}
diff --git a/test/libsolidity/smtCheckerTests/functions/functions_bound_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_bound_1_fail.sol
new file mode 100644
index 00000000..99c785d0
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/functions/functions_bound_1_fail.sol
@@ -0,0 +1,21 @@
+pragma experimental SMTChecker;
+
+library L
+{
+ function add(uint x, uint y) internal pure returns (uint) {
+ require(x < 1000);
+ require(y < 1000);
+ return x + y;
+ }
+}
+
+contract C
+{
+ using L for uint;
+ function f(uint x) public pure {
+ uint y = x.add(999);
+ assert(y < 1000);
+ }
+}
+// ----
+// Warning: (261-277): Assertion violation happens here
diff --git a/test/libsolidity/smtCheckerTests/functions/functions_library_1.sol b/test/libsolidity/smtCheckerTests/functions/functions_library_1.sol
new file mode 100644
index 00000000..2ceb9e60
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/functions/functions_library_1.sol
@@ -0,0 +1,18 @@
+pragma experimental SMTChecker;
+
+library L
+{
+ function add(uint x, uint y) internal pure returns (uint) {
+ require(x < 1000);
+ require(y < 1000);
+ return x + y;
+ }
+}
+
+contract C
+{
+ function f(uint x) public pure {
+ uint y = L.add(x, 999);
+ assert(y < 10000);
+ }
+}
diff --git a/test/libsolidity/smtCheckerTests/functions/functions_library_1_fail.sol b/test/libsolidity/smtCheckerTests/functions/functions_library_1_fail.sol
new file mode 100644
index 00000000..32419700
--- /dev/null
+++ b/test/libsolidity/smtCheckerTests/functions/functions_library_1_fail.sol
@@ -0,0 +1,20 @@
+pragma experimental SMTChecker;
+
+library L
+{
+ function add(uint x, uint y) internal pure returns (uint) {
+ require(x < 1000);
+ require(y < 1000);
+ return x + y;
+ }
+}
+
+contract C
+{
+ function f(uint x) public pure {
+ uint y = L.add(x, 999);
+ assert(y < 1000);
+ }
+}
+// ----
+// Warning: (245-261): Assertion violation happens here