예제 #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")
}
예제 #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")
}
예제 #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")
}