Skip to content

Commit

Permalink
use stable sort for stable tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fzipp committed Jun 4, 2022
1 parent d664e74 commit 0198fc9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions analyze_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ func TestAnalyze(t *testing.T) {
},
{
[]string{"testdata/cases.go"},
`3 testdata c3default testdata/cases.go:32:1
`3 testdata c3nested testdata/cases.go:40:1
3 testdata c3default testdata/cases.go:32:1
3 testdata c3 testdata/cases.go:25:1
3 testdata c3nested testdata/cases.go:40:1
2 testdata c2multi testdata/cases.go:19:1
2 testdata c2default testdata/cases.go:12:1
2 testdata c2 testdata/cases.go:6:1
Expand Down
2 changes: 1 addition & 1 deletion stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (s Stats) TotalComplexity() uint64 {
func (s Stats) SortAndFilter(top, over int) Stats {
result := make(Stats, len(s))
copy(result, s)
sort.Sort(byComplexityDesc(result))
sort.Stable(byComplexityDesc(result))
for i, stat := range result {
if i == top {
return result[:i]
Expand Down

0 comments on commit 0198fc9

Please sign in to comment.