(states: readonly (UnderstandingState | undefined)[])
| 78 | |
| 79 | /** Add up the exploration counts of the states a tour's steps resolved to. */ |
| 80 | export function sumCoverage(states: readonly (UnderstandingState | undefined)[]): TourCoverage { |
| 81 | let visited = 0; |
| 82 | let total = 0; |
| 83 | let symbols = 0; |
| 84 | for (const state of states) { |
| 85 | if (state === undefined) { |
| 86 | continue; |
| 87 | } |
| 88 | symbols += 1; |
| 89 | visited += state.exploration.visited; |
| 90 | total += state.exploration.total; |
| 91 | } |
| 92 | return { visited, total, percent: coveragePercent(visited, total), symbols }; |
| 93 | } |
| 94 | |
| 95 | /** |
| 96 | * The item a step's arrival marks, or undefined when there is nothing to mark. |
no test coverage detected