2018-02-23 10:56:08 +01:00
|
|
|
package metrics
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
2023-06-19 02:53:15 -04:00
|
|
|
|
|
|
|
"golang.org/x/exp/slices"
|
2018-02-23 10:56:08 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestMetricsSorting(t *testing.T) {
|
2023-06-19 02:53:15 -04:00
|
|
|
var namedMetrics = []namedMetric{
|
2018-02-23 10:56:08 +01:00
|
|
|
{name: "zzz"},
|
|
|
|
{name: "bbb"},
|
|
|
|
{name: "fff"},
|
|
|
|
{name: "ggg"},
|
|
|
|
}
|
|
|
|
|
2023-08-12 01:04:12 +03:00
|
|
|
slices.SortFunc(namedMetrics, namedMetric.cmp)
|
2018-02-23 10:56:08 +01:00
|
|
|
for i, name := range []string{"bbb", "fff", "ggg", "zzz"} {
|
|
|
|
if namedMetrics[i].name != name {
|
|
|
|
t.Fail()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|