Esempio n. 1
0
func TestQuickSort(t *testing.T) {
	assert := assert.New(t)
	var n int = fixture.RandomOneInt()
	input := fixture.GenerateArray(n)
	expected := fixture.GetExpectedResult(input)

	QuickSort(input, 0, n-1)

	assert.Equal(expected, input, "Quick sort error")
}
Esempio n. 2
0
func TestSelectionSort(t *testing.T) {
	assert := assert.New(t)
	var n int = fixture.RandomOneInt()
	input := fixture.GenerateArray(n)
	expected := fixture.GetExpectedResult(input)

	SelectionSort(input, n)

	assert.Equal(expected, input, "Selection sort error")
}
Esempio n. 3
0
func TestShellSort(t *testing.T) {
	assert := assert.New(t)
	var n int = fixture.RandomOneInt()
	input := fixture.GenerateArray(n)
	expected := fixture.GetExpectedResult(input)
	step := []int{7, 5, 3, 1}

	ShellSort(input, n, step)

	assert.Equal(expected, input, "Shell sort error")
}