collectCoverageStats collects the coverage stats from the EvalDetails and stores them in the CoverageStats map of the Program.
(details *cel.EvalDetails, p *Program)
| 1045 | // collectCoverageStats collects the coverage stats from the EvalDetails and stores them in the |
| 1046 | // CoverageStats map of the Program. |
| 1047 | func collectCoverageStats(details *cel.EvalDetails, p *Program) { |
| 1048 | if details == nil || details.State() == nil { |
| 1049 | return |
| 1050 | } |
| 1051 | if p.CoverageStats == nil { |
| 1052 | p.CoverageStats = make(map[int64]set) |
| 1053 | } |
| 1054 | state := details.State() |
| 1055 | for _, id := range state.IDs() { |
| 1056 | value, found := state.Value(id) |
| 1057 | if !found { |
| 1058 | continue |
| 1059 | } |
| 1060 | if _, ok := p.CoverageStats[id]; !ok { |
| 1061 | p.CoverageStats[id] = make(set) |
| 1062 | } |
| 1063 | p.CoverageStats[id][value] = struct{}{} |
| 1064 | } |
| 1065 | // Propagate visitedness after collecting direct observations |
| 1066 | propagateVisitedness(p.Ast, p.CoverageStats, state) |
| 1067 | } |
| 1068 | |
| 1069 | // propagateVisitedness implements two rules for extending the coverage report: |
| 1070 | // - If a node is visited, all its ancestors are visited. |
no test coverage detected