package tide import ( "fmt" "strconv" ) // Coverage is the recorded/passing/failing/unrecorded table over manifest routes. type Coverage struct { Total int Recorded int Passing int Failing int Unrecorded int Pending int Ported int ResumeRemaining int Rows []CoverageRow Diffs []string } // CoverageRow is one manifest route's outcome. type CoverageRow struct { ID string Status string Outcome string } // CoverageHeaders is the table header for CLI output. func CoverageHeaders() []string { return []string{"route", "status", "outcome"} } // CoverageRows renders the coverage table. func (c Coverage) CoverageRows() [][]string { rows := make([][]string, 0, len(c.Rows)) for _, r := range c.Rows { rows = append(rows, []string{r.ID, r.Status, r.Outcome}) } return rows } // SummaryLine is a one-line recorded/passing/failing/unrecorded report. func (c Coverage) SummaryLine() string { return fmt.Sprintf("recorded %d/%d passing %d failing %d unrecorded %d", c.Recorded, c.Total, c.Passing, c.Failing, c.Unrecorded) } func (c Coverage) ResumeLine() string { if c.ResumeRemaining <= 0 { return "manifest recording complete" } return "resume remaining " + strconv.Itoa(c.ResumeRemaining) }