Closed cyjaysong closed 3 years ago
Merging #131 (2550589) into master (1ed65f9) will increase coverage by
0.02%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## master #131 +/- ##
==========================================
+ Coverage 96.24% 96.26% +0.02%
==========================================
Files 10 10
Lines 665 669 +4
==========================================
+ Hits 640 644 +4
Misses 25 25
Impacted Files | Coverage Δ | |
---|---|---|
lib/src/iterable.dart | 99.57% <100.00%> (+<0.01%) |
:arrow_up: |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 1ed65f9...2550589. Read the comment docs.
@passsy
please add tests showing the bug
List<int> intList = [3, 1, 2];
List<double> doubleList = [3.1, 1.2, 2.3];
List<BigInt> bigintList = [BigInt.from(3), BigInt.from(1), BigInt.from(2)];
print('min in intList: ${intList.min()}');
print('min in doubleList: ${doubleList.min()}');
print('min in bigintList: ${bigintList.min()}');
print('int data compareTo result: ${1.compareTo(3)}');
print('double data compareTo result: ${1.2.compareTo(3.1)}');
print('BigInt data compareTo result: ${BigInt.from(1).compareTo(BigInt.from(3))}');
// min in intList: 1
// min in doubleList: 1.2
// min in bigintList: 2
// int data compareTo result: -1
// double data compareTo result: -1
// BigInt data compareTo result: -2
Although the result range of the CompareTo function for int and double types is [-1,0,1], dart does not specify that it must be this way (as far as I know). If this rule is used by default, it may cause errors in the comparison results of other types of data
@passsy
I added the tests, and can confirm that it fixes minBy
Hope you can release the new version as soon as possible
fix compareTo function