mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
[test] Update for fixed point type size checks.
This commit is contained in:
parent
cbc2acf83e
commit
096a1c9ab7
@ -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.
|
||||
|
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user