File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed
Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -2072,6 +2072,19 @@ mod tests {
20722072
20732073 let d = Decimal :: MAX ;
20742074 assert_eq ! ( d. to_uint_floor( ) , Uint128 :: new( 340282366920938463463 ) ) ;
2075+
2076+ // Does the same as the old workaround `Uint128::one() * my_decimal`.
2077+ // This block can be deleted as part of https://github.com/CosmWasm/cosmwasm/issues/1485.
2078+ let tests = vec ! [
2079+ Decimal :: from_str( "12.345" ) . unwrap( ) ,
2080+ Decimal :: from_str( "0.98451384" ) . unwrap( ) ,
2081+ Decimal :: from_str( "178.0" ) . unwrap( ) ,
2082+ Decimal :: MIN ,
2083+ Decimal :: MAX ,
2084+ ] ;
2085+ for my_decimal in tests. into_iter ( ) {
2086+ assert_eq ! ( my_decimal. to_uint_floor( ) , Uint128 :: one( ) * my_decimal) ;
2087+ }
20752088 }
20762089
20772090 #[ test]
Original file line number Diff line number Diff line change @@ -2223,6 +2223,19 @@ mod tests {
22232223 Uint256 :: from_str( "115792089237316195423570985008687907853269984665640564039457" )
22242224 . unwrap( )
22252225 ) ;
2226+
2227+ // Does the same as the old workaround `Uint256::one() * my_decimal`.
2228+ // This block can be deleted as part of https://github.com/CosmWasm/cosmwasm/issues/1485.
2229+ let tests = vec ! [
2230+ Decimal256 :: from_str( "12.345" ) . unwrap( ) ,
2231+ Decimal256 :: from_str( "0.98451384" ) . unwrap( ) ,
2232+ Decimal256 :: from_str( "178.0" ) . unwrap( ) ,
2233+ Decimal256 :: MIN ,
2234+ Decimal256 :: MAX ,
2235+ ] ;
2236+ for my_decimal in tests. into_iter ( ) {
2237+ assert_eq ! ( my_decimal. to_uint_floor( ) , Uint256 :: one( ) * my_decimal) ;
2238+ }
22262239 }
22272240
22282241 #[ test]
You can’t perform that action at this time.
0 commit comments