Update to gobook@c6d7a22edd03e7738c38d5baa2174ff325d8d863
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
// Copyright © 2016 Alan A. A. Donovan & Brian W. Kernighan.
|
||||
// License: https://creativecommons.org/licenses/by-nc-sa/4.0/
|
||||
|
||||
package treesort_test
|
||||
|
||||
import (
|
||||
"math/rand"
|
||||
"sort"
|
||||
"testing"
|
||||
|
||||
"gopl.io/ch4/treesort"
|
||||
)
|
||||
|
||||
func TestSort(t *testing.T) {
|
||||
data := make([]int, 50)
|
||||
for i := range data {
|
||||
data[i] = rand.Int() % 50
|
||||
}
|
||||
treesort.Sort(data)
|
||||
if !sort.IntsAreSorted(data) {
|
||||
t.Errorf("not sorted: %s", data)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user