github.com/theQRL/go-zond@v0.1.1/metrics/writer_test.go (about) 1 package metrics 2 3 import ( 4 "testing" 5 6 "golang.org/x/exp/slices" 7 ) 8 9 func TestMetricsSorting(t *testing.T) { 10 var namedMetrics = []namedMetric{ 11 {name: "zzz"}, 12 {name: "bbb"}, 13 {name: "fff"}, 14 {name: "ggg"}, 15 } 16 17 slices.SortFunc(namedMetrics, namedMetric.cmp) 18 for i, name := range []string{"bbb", "fff", "ggg", "zzz"} { 19 if namedMetrics[i].name != name { 20 t.Fail() 21 } 22 } 23 }