MCPcopy Create free account
hub / github.com/cel-expr/cel-cpp / StatsForNode

Method StatsForNode

tools/branch_coverage.cc:139–168  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

137};
138
139BranchCoverage::NodeCoverageStats BranchCoverageImpl::StatsForNode(
140 int64_t expr_id) const {
141 BranchCoverage::NodeCoverageStats stats{
142 /*is_boolean=*/false,
143 /*evaluation_count=*/0,
144 /*error_count=*/0,
145 /*boolean_true_count=*/0,
146 /*boolean_false_count=*/0,
147 };
148
149 absl::MutexLock lock(coverage_nodes_mu_);
150 auto it = coverage_nodes_.find(expr_id);
151 if (it != coverage_nodes_.end()) {
152 const CoverageNode& coverage_node = it->second;
153 stats.evaluation_count = coverage_node.evaluate_count;
154 absl::visit(absl::Overload([&](const ConstantNode& cov) {},
155 [&](const OtherNode& cov) {
156 stats.error_count = cov.result_error;
157 },
158 [&](const BoolNode& cov) {
159 stats.is_boolean = true;
160 stats.boolean_true_count = cov.result_true;
161 stats.boolean_false_count = cov.result_false;
162 stats.error_count = cov.result_error;
163 }),
164 coverage_node.kind);
165 return stats;
166 }
167 return stats;
168}
169
170const NavigableProtoAst& BranchCoverageImpl::ast() const { return ast_; }
171

Callers 1

TESTFunction · 0.80

Calls 1

endMethod · 0.45

Tested by 1

TESTFunction · 0.64