MCPcopy Create free account
hub / github.com/datasweet/datatable / checkTable

Function checkTable

utils_test.go:11–30  ·  view source on GitHub ↗

checkTable to check if a table contains cells

(t *testing.T, tb *datatable.DataTable, cells ...interface{})

Source from the content-addressed store, hash-verified

9
10// checkTable to check if a table contains cells
11func checkTable(t *testing.T, tb *datatable.DataTable, cells ...interface{}) {
12 ncols := tb.NumCols()
13 nrows := tb.NumRows()
14 assert.Len(t, cells, ncols*(nrows+1)) // + headers
15
16 cols := tb.Columns()
17 rows := tb.Rows()
18
19 for i, v := range cells {
20 r := i/ncols - 1
21 c := i % ncols
22
23 if r == -1 {
24 assert.Equal(t, v, cols[c], "HEADER COL #%d", r, c)
25 continue
26 }
27
28 assert.Equal(t, v, rows[r][cols[c]], "ROW #%d, COL #%d", r, c)
29 }
30}
31
32func New(t *testing.T) *datatable.DataTable {
33 tb := datatable.New("test")

Callers 15

TestNewTableFunction · 0.85
TestNewRowFunction · 0.85
TestExprColumnFunction · 0.85
TestAppendRowFunction · 0.85
TestRowsFunction · 0.85
TestRowFunction · 0.85
TestSwapRowFunction · 0.85
TestWhereFunction · 0.85
NewFunction · 0.85
TestSwapColumnFunction · 0.85
TestSortFunction · 0.85
sampleForExportFunction · 0.85

Calls 5

NumColsMethod · 0.80
NumRowsMethod · 0.80
ColumnsMethod · 0.80
RowsMethod · 0.80
LenMethod · 0.45

Tested by

no test coverage detected