gitee.com/quant1x/num@v0.3.2/median_test.go (about)

     1  package num
     2  
     3  import (
     4  	"fmt"
     5  	"testing"
     6  )
     7  
     8  func TestMedian(t *testing.T) {
     9  	fmt.Println(Median([]int8{}))
    10  	d1 := []float32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
    11  	d2 := []float64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
    12  	d3 := []int32{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
    13  	d4 := []int64{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}
    14  	fmt.Println(Median(d1))
    15  	fmt.Println(Median(d2))
    16  	fmt.Println(Median(d3))
    17  	fmt.Println(Median(d4))
    18  }