Unity 全流程开发热门游戏BallSort,助力迈入游戏高薪领域

download:Unity 全流程开发热门游戏BallSort,助力迈入游戏高薪领域 func TestQuickSort3(t *testing.T) {
values := []int{5}
QuickSort(values)
if values[0] != 5 {
t.Error("QuickSort() failed. Got", values, "Expected 5")
}
}
bubble_test.go
// bubble_test.go
package bubblesort
import "testing"
func TestBubbleSort1(t *testing.T) {
values := []int{5, 4, 3, 2, 1}
BubbleSort(values)
if values[0] != 1 || values[1] != 2 || values[2] != 3 || values[3] != 4 ||
values[4] !=5 {
t.Error("BubbleSort() failed. Got", values, "Expected 1 2 3 4 5")
}
}
func TestBubbleSort2(t *testing.T) {
values := []int{5, 5, 3, 2, 1}
BubbleSort(values)
if values[0] != 1 || values[1] != 2 || values[2] != 3 || values[3] != 5 ||
values[4] !=5 {
t.Error("BubbleSort() failed. Got", values, "Expected 1 2 3 5 5")
}
}
func TestBubbleSort3(t *testing.T) {
values := []int{5}
BubbleSort(values)
if values[0] != 5 {
t.Error("BubbleSort() failed. Got", values, "Expected 5")
}
}
運轉前準備:
準備“unsorted.dat”文件。
運轉過程:
go build sorter/slgorithms/qsortgo build sorter/algorithms/bubblesortgo test sorter/algorithms/qsortgo test sorter/algorithms/bubblesortgo install sorter/algorithms/qsortgo install sorter/algorithms/bubblesortgo build sortergo install sorter
運轉結果:
【Unity 全流程开发热门游戏BallSort,助力迈入游戏高薪领域】輸出文件:sorted.dat

    推荐阅读