github.com/jgbaldwinbrown/perf@v0.1.1/benchunit/parse_test.go (about) 1 // Copyright 2022 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 benchunit 6 7 import "testing" 8 9 func TestClassOf(t *testing.T) { 10 test := func(unit string, cls Class) { 11 t.Helper() 12 got := ClassOf(unit) 13 if got != cls { 14 t.Errorf("for %s, want %s, got %s", unit, cls, got) 15 } 16 } 17 test("ns/op", Decimal) 18 test("sec/op", Decimal) 19 test("sec/B", Decimal) 20 test("sec/B/B", Decimal) 21 test("sec/disk-B", Decimal) 22 23 test("B/op", Binary) 24 test("bytes/op", Binary) 25 test("B/s", Binary) 26 test("B/sec", Binary) 27 test("sec/B*B", Binary) // Discouraged 28 test("disk-B/sec", Binary) 29 test("disk-B/sec", Binary) 30 }