From 41710acbca530af60a43e8e77971922505ac2f24 Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Thu, 9 Jul 2020 13:14:33 +0200 Subject: [PATCH] More semantic tests. --- .../libsolidity/semanticTests/literals/denominations.sol | 9 +++++++++ test/libsolidity/semanticTests/literals/ether.sol | 9 +++++++++ test/libsolidity/semanticTests/literals/wei.sol | 9 +++++++++ 3 files changed, 27 insertions(+) create mode 100644 test/libsolidity/semanticTests/literals/denominations.sol create mode 100644 test/libsolidity/semanticTests/literals/ether.sol create mode 100644 test/libsolidity/semanticTests/literals/wei.sol diff --git a/test/libsolidity/semanticTests/literals/denominations.sol b/test/libsolidity/semanticTests/literals/denominations.sol new file mode 100644 index 000000000..256525cb9 --- /dev/null +++ b/test/libsolidity/semanticTests/literals/denominations.sol @@ -0,0 +1,9 @@ +contract C { + uint constant x = 1 ether + 1 gwei + 1 wei; + + function f() public view returns(uint) { return x; } +} +// ==== +// compileViaYul: also +// ---- +// f() -> 1000000001000000001 diff --git a/test/libsolidity/semanticTests/literals/ether.sol b/test/libsolidity/semanticTests/literals/ether.sol new file mode 100644 index 000000000..f03171796 --- /dev/null +++ b/test/libsolidity/semanticTests/literals/ether.sol @@ -0,0 +1,9 @@ +contract C { + uint constant x = 1 ether; + + function f() public view returns(uint) { return x; } +} +// ==== +// compileViaYul: also +// ---- +// f() -> 1000000000000000000 diff --git a/test/libsolidity/semanticTests/literals/wei.sol b/test/libsolidity/semanticTests/literals/wei.sol new file mode 100644 index 000000000..59af2a3d7 --- /dev/null +++ b/test/libsolidity/semanticTests/literals/wei.sol @@ -0,0 +1,9 @@ +contract C { + uint constant x = 1 wei; + + function f() public view returns(uint) { return x; } +} +// ==== +// compileViaYul: also +// ---- +// f() -> 1