gopl.io/ch4/treesort/sort_test.go
Alan Donovan 4f0ceb5e5d Update to gobook@4fdc3c0a831c14c716c2c013e42268f6d21a9a13
Change-Id: I63623453205b84eba5680e27f68e81e99e7bbeb9
2015-12-07 12:23:42 -05:00

24 lines
420 B
Go

// 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: %v", data)
}
}