package acl_test import ( "testing" acl "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/grpc" acltest "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/acl/test" ) func BenchmarkTable_StableMarshal(b *testing.B) { const size = 4 tb := new(acl.EACLTable) rs := acltest.GenerateRecords(true) for i := range rs { fs := make([]*acl.EACLRecord_Filter, size) for j := range fs { fs[j] = acltest.GenerateFilter(false) } ts := make([]*acl.EACLRecord_Target, size) for j := range ts { ts[j] = acltest.GenerateTarget(false) } rs[i].SetFilters(fs) rs[i].SetTargets(ts) } tb.SetRecords(rs) b.ReportAllocs() for i := 0; i < b.N; i++ { if len(tb.StableMarshal(nil)) != tb.StableSize() { b.FailNow() } } }