Пример #1
0
func testSortInt(n, max int, t *testing.T) {
	if n > max {
		t.Fatal("testSortInt: n > max")
	}
	arr := rand.GenKRandomLessN(n, max)
	SortInt(arr, max)

	if !sort.IsSorted(sort.IntSlice(arr)) {
		t.Errorf("SortInt error %d intergers less than %d\n", n, max)
	}
}
Пример #2
0
func init() {
	const nSeq = 12
	data = make([][]int, nSeq)

	data[0] = []int{0}
	data[1] = []int{1, 0}

	for i := 2; i < nSeq; i++ {
		n := int(1<<uint32(i)) + rand.Rand(0, 5)
		data[i] = rand.GenKRandomLessN(n, n)
	}
}