(b *testing.B)
| 71 | } |
| 72 | |
| 73 | func BenchmarkAddPolicySmall(b *testing.B) { |
| 74 | e, _ := NewEnforcer("examples/basic_model.conf") |
| 75 | |
| 76 | // 100 roles, 10 resources. |
| 77 | for i := 0; i < 100; i++ { |
| 78 | _, _ = e.AddPolicy(fmt.Sprintf("user%d", i), fmt.Sprintf("data%d", i/10), "read") |
| 79 | } |
| 80 | |
| 81 | b.ResetTimer() |
| 82 | for i := 0; i < b.N; i++ { |
| 83 | _, _ = e.AddPolicy(fmt.Sprintf("user%d", rand.Intn(100)+100), fmt.Sprintf("data%d", (rand.Intn(100)+100)/10), "read") |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | func BenchmarkAddPolicyMedium(b *testing.B) { |
| 88 | e, _ := NewEnforcer("examples/basic_model.conf") |
nothing calls this directly
no test coverage detected
searching dependent graphs…