Beispiel #1
0
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
}
Beispiel #2
0
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
}
Beispiel #3
0
func (resolver *paramResolver) createProtoStepTable(table *table, dataTableLookup *argLookup) *gauge_messages.ProtoTable {
	protoTable := new(gauge_messages.ProtoTable)
	protoTable.Headers = &gauge_messages.ProtoTableRow{Cells: table.headers}
	tableRows := make([]*gauge_messages.ProtoTableRow, 0)
	for i := 0; i < len(table.columns[0]); i++ {
		row := make([]string, 0)
		for _, header := range table.headers {
			tableCell := table.get(header)[i]
			value := tableCell.value
			if tableCell.cellType == dynamic {
				//if concept has a table with dynamic cell, fetch from datatable
				value = dataTableLookup.getArg(tableCell.value).value
			}
			row = append(row, value)
		}
		tableRows = append(tableRows, &gauge_messages.ProtoTableRow{Cells: row})
	}
	protoTable.Rows = tableRows
	return protoTable
}
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)
	}
}