(b *testing.B)
| 233 | } |
| 234 | |
| 235 | func BenchmarkCompile(b *testing.B) { |
| 236 | for _, tst := range policyTests { |
| 237 | r := newRunner(tst.name, tst.expr, tst.parseOpts) |
| 238 | env, ast, iss := r.compile(b, tst.envOpts, []CompilerOption{}) |
| 239 | if iss.Err() != nil { |
| 240 | b.Fatalf("Compile() failed: %v", iss.Err()) |
| 241 | } |
| 242 | r.setup(b, env, ast) |
| 243 | r.bench(b) |
| 244 | } |
| 245 | } |
| 246 | |
| 247 | func parsePolicySource(t testing.TB, name string, policySource string, parseOpts ...ParserOption) *Policy { |
| 248 | t.Helper() |