Validating Merge Sort Algorithm Implementation in hello-algo
This test suite validates the implementation of merge sort algorithm in Go, focusing on array sorting functionality. It examines the correctness of the mergeSort function through unit testing and output verification.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
krahets/hello-algo
zh-hant/codes/go/chapter_sorting/merge_sort_test.go
// File: merge_sort_test.go
// Created Time: 2022-12-13
// Author: msk397 ([email protected])
package chapter_sorting
import (
"fmt"
"testing"
)
func TestMergeSort(t *testing.T) {
nums := []int{7, 3, 2, 6, 0, 1, 5, 4}
mergeSort(nums, 0, len(nums)-1)
fmt.Println("合併排序完成後 nums = ", nums)
}