| 621 | BENCHMARK(BM_Comprehension_Trace)->Range(1, 1 << 20); |
| 622 | |
| 623 | void BM_HasMap(benchmark::State& state) { |
| 624 | google::protobuf::Arena arena; |
| 625 | Activation activation; |
| 626 | ASSERT_OK_AND_ASSIGN(ParsedExpr parsed_expr, |
| 627 | Parse("has(request.path) && !has(request.ip)")); |
| 628 | |
| 629 | RuntimeOptions options = GetOptions(); |
| 630 | auto runtime = StandardRuntimeOrDie(options); |
| 631 | |
| 632 | ASSERT_OK_AND_ASSIGN(auto cel_expr, ProtobufRuntimeAdapter::CreateProgram( |
| 633 | *runtime, parsed_expr)); |
| 634 | |
| 635 | auto map_builder = cel::NewMapValueBuilder(&arena); |
| 636 | |
| 637 | ASSERT_THAT( |
| 638 | map_builder->Put(cel::StringValue("path"), cel::StringValue("path")), |
| 639 | IsOk()); |
| 640 | |
| 641 | activation.InsertOrAssignValue("request", std::move(*map_builder).Build()); |
| 642 | |
| 643 | for (auto _ : state) { |
| 644 | ASSERT_OK_AND_ASSIGN(cel::Value result, |
| 645 | cel_expr->Evaluate(&arena, activation)); |
| 646 | ASSERT_TRUE(InstanceOf<BoolValue>(result) && |
| 647 | Cast<BoolValue>(result).NativeValue()); |
| 648 | } |
| 649 | } |
| 650 | |
| 651 | BENCHMARK(BM_HasMap); |
| 652 |
nothing calls this directly
no test coverage detected