(b *testing.B)
| 122 | } |
| 123 | |
| 124 | func BenchmarkRemovePolicySmall(b *testing.B) { |
| 125 | e, _ := NewEnforcer("examples/basic_model.conf") |
| 126 | |
| 127 | // 100 roles, 10 resources. |
| 128 | for i := 0; i < 100; i++ { |
| 129 | _, _ = e.AddPolicy(fmt.Sprintf("user%d", i), fmt.Sprintf("data%d", i/10), "read") |
| 130 | } |
| 131 | |
| 132 | b.ResetTimer() |
| 133 | for i := 0; i < b.N; i++ { |
| 134 | _, _ = e.RemovePolicy(fmt.Sprintf("user%d", rand.Intn(100)), fmt.Sprintf("data%d", rand.Intn(100)/10), "read") |
| 135 | } |
| 136 | } |
| 137 | |
| 138 | func BenchmarkRemovePolicyMedium(b *testing.B) { |
| 139 | e, _ := NewEnforcer("examples/basic_model.conf") |
nothing calls this directly
no test coverage detected
searching dependent graphs…