From 096a1c9ab7233d797065705c59658f8979aa446e Mon Sep 17 00:00:00 2001 From: Alexander Arlt Date: Wed, 4 Aug 2021 15:26:35 -0500 Subject: [PATCH] [test] Update for fixed point type size checks. --- .../fixed_point/conversion_rational_invalid.sol | 16 ++++++++-------- .../313_fixed_type_size_capabilities.sol | 10 +++++----- .../declaring_fixed_and_ufixed_variables.sol | 6 +++--- .../declaring_fixed_literal_variables.sol | 4 ++-- .../types/too_small_negative_numbers.sol | 4 ++-- 5 files changed, 20 insertions(+), 20 deletions(-) diff --git a/test/libsolidity/syntaxTests/fixed_point/conversion_rational_invalid.sol b/test/libsolidity/syntaxTests/fixed_point/conversion_rational_invalid.sol index af8e0e2e6..7a2f227b4 100644 --- a/test/libsolidity/syntaxTests/fixed_point/conversion_rational_invalid.sol +++ b/test/libsolidity/syntaxTests/fixed_point/conversion_rational_invalid.sol @@ -1,10 +1,10 @@ // implicit conversions fixed64x2 constant a = 1.123; ufixed64x2 constant b = -1.123; -fixed64x28 constant c = 1; -fixed64x28 constant d = -1; +fixed64x19 constant c = 1; +fixed64x19 constant d = -1; ufixed256x77 constant e = 1/3; -ufixed256x77 constant f = -1; +ufixed256x4 constant f = -1; // explicit conversions fixed64x2 constant g = fixed64x2(2**64); @@ -13,9 +13,9 @@ ufixed64x2 constant h = ufixed64x2(-1); // ---- // TypeError 2326: (47-52): Type rational_const 1123 / 1000 is not implicitly convertible to expected type fixed64x2. Try converting to type ufixed16x3 or use an explicit conversion. // TypeError 2326: (78-84): Type rational_const -1123 / 1000 is not implicitly convertible to expected type ufixed64x2. Try converting to type fixed16x3 or use an explicit conversion. -// TypeError 7407: (110-111): Type int_const 1 is not implicitly convertible to expected type fixed64x28. -// TypeError 7407: (137-139): Type int_const -1 is not implicitly convertible to expected type fixed64x28. +// TypeError 7407: (110-111): Type int_const 1 is not implicitly convertible to expected type fixed64x19. +// TypeError 7407: (137-139): Type int_const -1 is not implicitly convertible to expected type fixed64x19. // TypeError 4426: (167-170): Type rational_const 1 / 3 is not implicitly convertible to expected type ufixed256x77, but it can be explicitly converted. -// TypeError 7407: (198-200): Type int_const -1 is not implicitly convertible to expected type ufixed256x77. -// TypeError 9640: (250-266): Explicit type conversion not allowed from "int_const 18446744073709551616" to "fixed64x2". Value is too large. -// TypeError 9640: (292-306): Explicit type conversion not allowed from "int_const -1" to "ufixed64x2". Value is too small. +// TypeError 7407: (197-199): Type int_const -1 is not implicitly convertible to expected type ufixed256x4. +// TypeError 9640: (249-265): Explicit type conversion not allowed from "int_const 18446744073709551616" to "fixed64x2". Value is too large. +// TypeError 9640: (291-305): Explicit type conversion not allowed from "int_const -1" to "ufixed64x2". Value is too small. diff --git a/test/libsolidity/syntaxTests/nameAndTypeResolution/313_fixed_type_size_capabilities.sol b/test/libsolidity/syntaxTests/nameAndTypeResolution/313_fixed_type_size_capabilities.sol index 148e7e672..937b3f135 100644 --- a/test/libsolidity/syntaxTests/nameAndTypeResolution/313_fixed_type_size_capabilities.sol +++ b/test/libsolidity/syntaxTests/nameAndTypeResolution/313_fixed_type_size_capabilities.sol @@ -1,14 +1,14 @@ contract test { function f() public { ufixed256x1 a = 123456781234567979695948382928485849359686494864095409282048094275023098123.5; - ufixed256x77 b = 0.920890746623327805482905058466021565416131529487595827354393978494366605267637; - ufixed224x78 c = 0.000000000001519884736399797998492268541131529487595827354393978494366605267646; + ufixed256x77 b = 0.920890746623327805482790505466021565416131529487595827354393978494366605267637; + ufixed224x67 c = 0.0001178860664374434257558003517679482519889396811442020918468012309; fixed256x1 d = -123456781234567979695948382928485849359686494864095409282048094275023098123.5; - fixed256x76 e = -0.93322335481643744342575580035176794825198893968114429702091846411734101080123; - fixed256x79 g = -0.0001178860664374434257558003517679482519889396811442970209184641173410108012309; + fixed256x76 e = -0.93322335481643744342575580351767948251988939681144297020918464117341010801223; + fixed256x77 g = -0.00011788606643744342575580035176794825198893968114420209184641173410108012309; a; b; c; d; e; g; } } // ---- // TypeError 5107: (153-250): Type rational_const 9208...(70 digits omitted)...7637 / 1000...(71 digits omitted)...0000 is not implicitly convertible to expected type ufixed256x77, but it can be explicitly converted. -// TypeError 5107: (470-566): Type rational_const -933...(70 digits omitted)...0123 / 1000...(70 digits omitted)...0000 is not implicitly convertible to expected type fixed256x76, but it can be explicitly converted. +// TypeError 5107: (459-555): Type rational_const -933...(70 digits omitted)...1223 / 1000...(70 digits omitted)...0000 is not implicitly convertible to expected type fixed256x76, but it can be explicitly converted. diff --git a/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol b/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol index 93bc7e524..b64067c53 100644 --- a/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol +++ b/test/libsolidity/syntaxTests/parsing/declaring_fixed_and_ufixed_variables.sol @@ -1,7 +1,7 @@ contract A { - fixed40x40 storeMe; - function f(ufixed, fixed32x32) public pure { - ufixed8x8 a; + fixed128x4 storeMe; + function f(ufixed, fixed128x3) public pure { + ufixed128x2 a; fixed b; a; b; } diff --git a/test/libsolidity/syntaxTests/parsing/declaring_fixed_literal_variables.sol b/test/libsolidity/syntaxTests/parsing/declaring_fixed_literal_variables.sol index a9675f3f1..1c38b8791 100644 --- a/test/libsolidity/syntaxTests/parsing/declaring_fixed_literal_variables.sol +++ b/test/libsolidity/syntaxTests/parsing/declaring_fixed_literal_variables.sol @@ -1,5 +1,5 @@ contract A { - fixed40x40 pi = 3.14; + fixed128x1 pi = 3.14; } // ---- -// TypeError 2326: (33-37): Type rational_const 157 / 50 is not implicitly convertible to expected type fixed40x40. Try converting to type ufixed16x2 or use an explicit conversion. +// TypeError 2326: (33-37): Type rational_const 157 / 50 is not implicitly convertible to expected type fixed128x1. Try converting to type ufixed16x2 or use an explicit conversion. diff --git a/test/libsolidity/syntaxTests/types/too_small_negative_numbers.sol b/test/libsolidity/syntaxTests/types/too_small_negative_numbers.sol index fa0ceac11..1a6e227cd 100644 --- a/test/libsolidity/syntaxTests/types/too_small_negative_numbers.sol +++ b/test/libsolidity/syntaxTests/types/too_small_negative_numbers.sol @@ -1,5 +1,5 @@ contract C { - fixed8x80 a = -1e-100; + fixed a = -1e-100; } // ---- -// TypeError 4426: (29-36): Type rational_const -1 / 1000...(93 digits omitted)...0000 is not implicitly convertible to expected type fixed8x80, but it can be explicitly converted. +// TypeError 2326: (25-32): Type rational_const -1 / 1000...(93 digits omitted)...0000 is not implicitly convertible to expected type fixed128x18. Try converting to type fixed8x80 or use an explicit conversion.