Testing Bucket Sort Implementation in hello-algo
This test suite validates the bucket sort implementation for floating-point numbers in Go, focusing on sorting values in the range [0, 1). The test ensures correct sorting behavior and output verification for the bucket sort algorithm.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
krahets/hello-algo
zh-hant/codes/go/chapter_sorting/bucket_sort_test.go
// File: bucket_sort_test.go
// Created Time: 2023-03-27
// Author: Reanon ([email protected])
package chapter_sorting
import (
"fmt"
"testing"
)
func TestBucketSort(t *testing.T) {
// 設輸入資料為浮點數,範圍為 [0, 1)
nums := []float64{0.49, 0.96, 0.82, 0.09, 0.57, 0.43, 0.91, 0.75, 0.15, 0.37}
bucketSort(nums)
fmt.Println("桶排序完成後 nums = ", nums)
}