aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLeonardo Alt <leo@ethereum.org>2018-04-27 20:13:18 +0800
committerLeonardo Alt <leo@ethereum.org>2018-04-27 20:13:18 +0800
commitd43436cfec7cb1820f8f588a8a877e1cbf48b919 (patch)
tree5ada7cbca03af1984bb457bf5142b9cd98cb0bf6 /test
parentab251c7e7d18a03184ab11e2d1c99d05af7d97f9 (diff)
downloaddexon-solidity-d43436cfec7cb1820f8f588a8a877e1cbf48b919.tar
dexon-solidity-d43436cfec7cb1820f8f588a8a877e1cbf48b919.tar.gz
dexon-solidity-d43436cfec7cb1820f8f588a8a877e1cbf48b919.tar.bz2
dexon-solidity-d43436cfec7cb1820f8f588a8a877e1cbf48b919.tar.lz
dexon-solidity-d43436cfec7cb1820f8f588a8a877e1cbf48b919.tar.xz
dexon-solidity-d43436cfec7cb1820f8f588a8a877e1cbf48b919.tar.zst
dexon-solidity-d43436cfec7cb1820f8f588a8a877e1cbf48b919.zip
Add syntax tests and Changelog entry
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/syntaxTests/types/bool_ops.sol53
1 files changed, 53 insertions, 0 deletions
diff --git a/test/libsolidity/syntaxTests/types/bool_ops.sol b/test/libsolidity/syntaxTests/types/bool_ops.sol
new file mode 100644
index 00000000..91033906
--- /dev/null
+++ b/test/libsolidity/syntaxTests/types/bool_ops.sol
@@ -0,0 +1,53 @@
+contract C {
+ function f(bool a, bool b) public pure {
+ bool c;
+ // OK
+ c = !a;
+ c = !b;
+ c = a == b;
+ c = a != b;
+ c = a || b;
+ c = a && b;
+
+ // Not OK
+ c = a > b;
+ c = a < b;
+ c = a >= b;
+ c = a <= b;
+ c = a & b;
+ c = a | b;
+ c = a ^ b;
+ c = ~a;
+ c = ~b;
+ c = a + b;
+ c = a - b;
+ c = -a;
+ c = -b;
+ c = a * b;
+ c = a / b;
+ c = a ** b;
+ c = a % b;
+ c = a << b;
+ c = a >> b;
+ }
+}
+// ----
+// TypeError: (231-236): Operator > not compatible with types bool and bool
+// TypeError: (250-255): Operator < not compatible with types bool and bool
+// TypeError: (269-275): Operator >= not compatible with types bool and bool
+// TypeError: (289-295): Operator <= not compatible with types bool and bool
+// TypeError: (309-314): Operator & not compatible with types bool and bool
+// TypeError: (328-333): Operator | not compatible with types bool and bool
+// TypeError: (347-352): Operator ^ not compatible with types bool and bool
+// TypeError: (366-368): Unary operator ~ cannot be applied to type bool
+// TypeError: (382-384): Unary operator ~ cannot be applied to type bool
+// TypeError: (398-403): Operator + not compatible with types bool and bool
+// TypeError: (417-422): Operator - not compatible with types bool and bool
+// TypeError: (436-438): Unary operator - cannot be applied to type bool
+// TypeError: (452-454): Unary operator - cannot be applied to type bool
+// TypeError: (468-473): Operator * not compatible with types bool and bool
+// TypeError: (487-492): Operator / not compatible with types bool and bool
+// TypeError: (506-512): Operator ** not compatible with types bool and bool
+// TypeError: (526-531): Operator % not compatible with types bool and bool
+// TypeError: (545-551): Operator << not compatible with types bool and bool
+// TypeError: (565-571): Operator >> not compatible with types bool and bool