From 932915633bb7f5985023f80a8c704cf8c5f979fa Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Wed, 11 Apr 2018 23:20:40 +0200 Subject: Add tests for literal operations as well. --- test/libsolidity/syntaxTests/literalOperations/division_by_zero.sol | 5 +++++ .../syntaxTests/literalOperations/division_by_zero_complex.sol | 5 +++++ test/libsolidity/syntaxTests/literalOperations/mod_zero.sol | 5 +++++ test/libsolidity/syntaxTests/literalOperations/mod_zero_complex.sol | 5 +++++ 4 files changed, 20 insertions(+) create mode 100644 test/libsolidity/syntaxTests/literalOperations/division_by_zero.sol create mode 100644 test/libsolidity/syntaxTests/literalOperations/division_by_zero_complex.sol create mode 100644 test/libsolidity/syntaxTests/literalOperations/mod_zero.sol create mode 100644 test/libsolidity/syntaxTests/literalOperations/mod_zero_complex.sol (limited to 'test') diff --git a/test/libsolidity/syntaxTests/literalOperations/division_by_zero.sol b/test/libsolidity/syntaxTests/literalOperations/division_by_zero.sol new file mode 100644 index 00000000..b52b4c51 --- /dev/null +++ b/test/libsolidity/syntaxTests/literalOperations/division_by_zero.sol @@ -0,0 +1,5 @@ +contract C { + uint constant a = 1 / 0; +} +// ---- +// TypeError: (35-40): Operator / not compatible with types int_const 1 and int_const 0 diff --git a/test/libsolidity/syntaxTests/literalOperations/division_by_zero_complex.sol b/test/libsolidity/syntaxTests/literalOperations/division_by_zero_complex.sol new file mode 100644 index 00000000..8cc3b6f2 --- /dev/null +++ b/test/libsolidity/syntaxTests/literalOperations/division_by_zero_complex.sol @@ -0,0 +1,5 @@ +contract C { + uint constant a = 1 / ((1+3)-4); +} +// ---- +// TypeError: (35-48): Operator / not compatible with types int_const 1 and int_const 0 diff --git a/test/libsolidity/syntaxTests/literalOperations/mod_zero.sol b/test/libsolidity/syntaxTests/literalOperations/mod_zero.sol new file mode 100644 index 00000000..1bbbc3fc --- /dev/null +++ b/test/libsolidity/syntaxTests/literalOperations/mod_zero.sol @@ -0,0 +1,5 @@ +contract C { + uint constant b3 = 1 % 0; +} +// ---- +// TypeError: (36-41): Operator % not compatible with types int_const 1 and int_const 0 diff --git a/test/libsolidity/syntaxTests/literalOperations/mod_zero_complex.sol b/test/libsolidity/syntaxTests/literalOperations/mod_zero_complex.sol new file mode 100644 index 00000000..4899cac3 --- /dev/null +++ b/test/libsolidity/syntaxTests/literalOperations/mod_zero_complex.sol @@ -0,0 +1,5 @@ +contract C { + uint constant b3 = 1 % (-4+((2)*2)); +} +// ---- +// TypeError: (36-52): Operator % not compatible with types int_const 1 and int_const 0 -- cgit