type Float64Slice … func (fs Float64Slice) Len() int { … } func (fs Float64Slice) Less(i, j int) bool { … } func (fs Float64Slice) Swap(i, j int) { … } type weightedHistogramSpecFunc … // exerciseWeightedHistograms exercises a given collection of WeightedHistograms. // Each histogram is given by a function that returns it, so that we can test // that the Vec functions return the same result for the same input. // For each histogram, with N upper bounds, the exercise provides two 2N+1 values: // the upper bounds and values halfway between them (extended below the bottom and above // the top). For the Jth value, there are J*m1 calls to ObserveWithWeight with m1 // chosen so that m1 * sum[1 <= J <= 2N+1] J is large enough to trigger several // considerations of spilling from sumHot to sumCold. // The ObserveWithWeight calls to the various histograms are interleaved to check // that there is no interference between them. func exerciseWeightedHistograms(t *testing.T, whSpecs ...weightedHistogramSpecFunc) { … } type weightedHistogramObs … type whExerciseExpectation … func whosPick(whos []weightedHistogramObs) ([]weightedHistogramObs, weightedHistogramObs) { … } func TestOneWeightedHistogram(t *testing.T) { … } func TestWeightedHistogramVec(t *testing.T) { … } func BenchmarkWeightedHistogram(b *testing.B) { … } func BenchmarkHistogram(b *testing.B) { … }