func TableFrom(protoTable *gauge_messages.ProtoTable) *gauge.Table { table := &gauge.Table{} table.AddHeaders(protoTable.GetHeaders().GetCells()) for _, row := range protoTable.GetRows() { table.AddRowValues(row.GetCells()) } return table }
func makeTableCopy(table *gauge_messages.ProtoTable) *gauge_messages.ProtoTable { copiedTable := &gauge_messages.ProtoTable{} copiedTable.Headers = makeProtoTableRowCopy(table.GetHeaders()) copiedRows := make([]*gauge_messages.ProtoTableRow, 0) for _, tableRow := range table.GetRows() { copiedRows = append(copiedRows, makeProtoTableRowCopy(tableRow)) } copiedTable.Rows = copiedRows return copiedTable }
func compareTable(table1 *gauge_messages.ProtoTable, table2 *gauge_messages.ProtoTable, c *C) { compareTableRow(table1.GetHeaders(), table2.GetHeaders(), c) c.Assert(len(table1.GetRows()), Equals, len(table2.GetRows())) for i, row := range table1.GetRows() { compareTableRow(row, table2.GetRows()[i], c) } }