Testing Selection Sort Implementation in hello-algo
This test suite validates the implementation of Selection Sort algorithm in Go, ensuring correct sorting behavior for integer arrays. The tests verify the sorting functionality through a basic test case with duplicate elements.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
krahets/hello-algo
zh-hant/codes/go/chapter_sorting/selection_sort_test.go
// File: selection_sort_test.go
// Created Time: 2023-05-29
// Author: Reanon ([email protected])
package chapter_sorting
import (
"fmt"
"testing"
)
func TestSelectionSort(t *testing.T) {
nums := []int{4, 1, 3, 1, 5, 2}
selectionSort(nums)
fmt.Println("選擇排序完成後 nums = ", nums)
}