Merge PR #5399: Fix Uint#LTE

This commit is contained in:
Alexander Bezobchuk 2019-12-12 11:44:54 -05:00 committed by GitHub
parent a7e28dec6a
commit aa28dca517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 5 deletions

View File

@ -209,9 +209,9 @@ to detail this new feature and how state transitions occur.
* (docs/interfaces/) Add documentation on building interfaces for the Cosmos SDK.
* Redesigned user interface that features new dynamically generated sidebar, build-time code embedding from GitHub, new homepage as well as many other improvements.
### Bug Fixes
* (types) [\#5395](https://github.com/cosmos/cosmos-sdk/issues/5395) Fix `Uint#LTE`
* (client) [\#5303](https://github.com/cosmos/cosmos-sdk/issues/5303) Fix ignored error in tx generate only mode.
* (iavl) [\#5276](https://github.com/cosmos/cosmos-sdk/issues/5276) Fix potential race condition in `iavlIterator#Close`.
* (cli) [\#4763](https://github.com/cosmos/cosmos-sdk/issues/4763) Fix flag `--min-self-delegation` for staking `EditValidator`
@ -221,8 +221,6 @@ to detail this new feature and how state transitions occur.
* (baseapp) [\#5350](https://github.com/cosmos/cosmos-sdk/issues/5350) Allow a node to restart successfully after a `halt-height` or `halt-time`
has been triggered.
## [v0.37.4] - 2019-11-04
### Improvements

View File

@ -74,7 +74,7 @@ func (u Uint) GTE(u2 Uint) bool { return u.GT(u2) || u.Equal(u2) }
func (u Uint) LT(u2 Uint) bool { return lt(u.i, u2.i) }
// LTE returns true if first Uint is lesser than or equal to the second
func (u Uint) LTE(u2 Uint) bool { return !u.GTE(u2) }
func (u Uint) LTE(u2 Uint) bool { return !u.GT(u2) }
// Add adds Uint from another
func (u Uint) Add(u2 Uint) Uint { return NewUintFromBigInt(new(big.Int).Add(u.i, u2.i)) }

View File

@ -141,7 +141,7 @@ func TestArithUint(t *testing.T) {
}
func TestCompUint(t *testing.T) {
for d := 0; d < 1000; d++ {
for d := 0; d < 10000; d++ {
n1 := rand.Uint64()
i1 := NewUint(n1)
n2 := rand.Uint64()
@ -156,6 +156,8 @@ func TestCompUint(t *testing.T) {
{i1.LT(i2), n1 < n2},
{i1.GTE(i2), !i1.LT(i2)},
{!i1.GTE(i2), i1.LT(i2)},
{i1.LTE(i2), n1 <= n2},
{i2.LTE(i1), n2 <= n1},
}
for tcnum, tc := range cases {