From 57303f1749c197155689f14446a72d75173d3839 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Fri, 23 Apr 2021 11:37:52 +0100 Subject: [PATCH] Add more tests --- .../semanticTests/fixedPoint/arrays.sol | 16 ++++++++++++++++ .../semanticTests/fixedPoint/constants.sol | 8 ++++++++ .../semanticTests/fixedPoint/state_variables.sol | 1 + .../semanticTests/fixedPoint/variables.sol | 11 +++++++++++ 4 files changed, 36 insertions(+) create mode 100644 test/libsolidity/semanticTests/fixedPoint/arrays.sol create mode 100644 test/libsolidity/semanticTests/fixedPoint/constants.sol create mode 100644 test/libsolidity/semanticTests/fixedPoint/variables.sol diff --git a/test/libsolidity/semanticTests/fixedPoint/arrays.sol b/test/libsolidity/semanticTests/fixedPoint/arrays.sol new file mode 100644 index 000000000..138f67e95 --- /dev/null +++ b/test/libsolidity/semanticTests/fixedPoint/arrays.sol @@ -0,0 +1,16 @@ +contract C { + function f() public pure returns (fixed[2] memory ret) { + ret[0] = 0.00000000000001; + ret[1] = 11111111111111.1; + } + function g() public pure returns (fixed[] memory ret) { + ret = new fixed(3); + ret[0] = 998.888888; + ret[1] = 44.1100000000011; + ret[2] = 888888888888888888.4400001; + } +} +// ---- +// f() -> +// g() -> + diff --git a/test/libsolidity/semanticTests/fixedPoint/constants.sol b/test/libsolidity/semanticTests/fixedPoint/constants.sol new file mode 100644 index 000000000..9b9ec4d9a --- /dev/null +++ b/test/libsolidity/semanticTests/fixedPoint/constants.sol @@ -0,0 +1,8 @@ +contract C { + function f() public pure returns (fixed) { + return 99.101 * 3.1; + } +} +// ---- +// f() -> + diff --git a/test/libsolidity/semanticTests/fixedPoint/state_variables.sol b/test/libsolidity/semanticTests/fixedPoint/state_variables.sol index dddca498e..3fecfc851 100644 --- a/test/libsolidity/semanticTests/fixedPoint/state_variables.sol +++ b/test/libsolidity/semanticTests/fixedPoint/state_variables.sol @@ -8,4 +8,5 @@ contract C { } } // ---- +// z() -> // f() -> diff --git a/test/libsolidity/semanticTests/fixedPoint/variables.sol b/test/libsolidity/semanticTests/fixedPoint/variables.sol new file mode 100644 index 000000000..5ced8e71b --- /dev/null +++ b/test/libsolidity/semanticTests/fixedPoint/variables.sol @@ -0,0 +1,11 @@ +contract C { + function f() public pure returns (fixed) { + return 1.33; + } + function g(fixed f1, fixed f2) public pure returns (fixed, fixed, fixed) { + return (f2, 0.0000333, f1); + } +} +// ---- +// f() -> +// g(fixed128x80,fixed128x80): 9.871, 88888888.0 ->