Commit 98891386 authored by Iskander Sharipov's avatar Iskander Sharipov Committed by Ian Lance Taylor

sort: replace Errorf+FailNow with Fatalf

Change-Id: I4f8d0178e780b86d1f551b367e2ddac3789be5aa
Reviewed-on: https://go-review.googlesource.com/c/go/+/168880
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: default avatarIan Lance Taylor <iant@golang.org>
parent cf952e9e
...@@ -323,8 +323,7 @@ func (d *testingData) Less(i, j int) bool { ...@@ -323,8 +323,7 @@ func (d *testingData) Less(i, j int) bool {
} }
func (d *testingData) Swap(i, j int) { func (d *testingData) Swap(i, j int) {
if d.nswap >= d.maxswap { if d.nswap >= d.maxswap {
d.t.Errorf("%s: used %d swaps sorting slice of %d", d.desc, d.nswap, len(d.data)) d.t.Fatalf("%s: used %d swaps sorting slice of %d", d.desc, d.nswap, len(d.data))
d.t.FailNow()
} }
d.nswap++ d.nswap++
d.data[i], d.data[j] = d.data[j], d.data[i] d.data[i], d.data[j] = d.data[j], d.data[i]
...@@ -433,9 +432,7 @@ func testBentleyMcIlroy(t *testing.T, sort func(Interface), maxswap func(int) in ...@@ -433,9 +432,7 @@ func testBentleyMcIlroy(t *testing.T, sort func(Interface), maxswap func(int) in
// mutating method Sort can call is TestingData.swap, // mutating method Sort can call is TestingData.swap,
// it suffices here just to check that the final slice is sorted. // it suffices here just to check that the final slice is sorted.
if !IntsAreSorted(mdata) { if !IntsAreSorted(mdata) {
t.Errorf("%s: ints not sorted", desc) t.Fatalf("%s: ints not sorted\n\t%v", desc, mdata)
t.Errorf("\t%v", mdata)
t.FailNow()
} }
} }
} }
...@@ -517,8 +514,7 @@ func TestAdversary(t *testing.T) { ...@@ -517,8 +514,7 @@ func TestAdversary(t *testing.T) {
// Check data is fully populated and sorted. // Check data is fully populated and sorted.
for i, v := range d.data { for i, v := range d.data {
if v != i { if v != i {
t.Errorf("adversary data not fully sorted") t.Fatalf("adversary data not fully sorted")
t.FailNow()
} }
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment