github.com/jgbaldwinbrown/perf@v0.1.1/pkg/stats/sample_test.go (about)

     1  // Copyright 2015 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  package stats
     6  
     7  import "testing"
     8  
     9  func TestSamplePercentile(t *testing.T) {
    10  	s := Sample{Xs: []float64{15, 20, 35, 40, 50}}
    11  	testFunc(t, "Percentile", s.Percentile, map[float64]float64{
    12  		-1:  15,
    13  		0:   15,
    14  		.05: 15,
    15  		.30: 19.666666666666666,
    16  		.40: 27,
    17  		.95: 50,
    18  		1:   50,
    19  		2:   50,
    20  	})
    21  }