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

Function New

utils_test.go:32–52  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

30}
31
32func New(t *testing.T) *datatable.DataTable {
33 tb := datatable.New("test")
34 tb.AddColumn("champ", datatable.String, datatable.Values("Malzahar", "Xerath", "Teemo"))
35 tb.AddColumn("champion", datatable.String, datatable.Expr("upper(`champ`)"))
36 tb.AddColumn("win", datatable.Int, datatable.Values(10, 20, 666))
37 tb.AddColumn("loose", datatable.Int, datatable.Values(6, 5, 666))
38 tb.AddColumn("winRate", datatable.String, datatable.Expr("(`win` * 100 / (`win` + `loose`)) ~ \" %\""))
39 tb.AddColumn("sum", datatable.Float64, datatable.Expr("sum(`win`)"))
40 tb.AddColumn("ok", datatable.Bool, datatable.Expr("true"))
41 tb.AddColumn("hidden", datatable.Bool, datatable.Expr("false"))
42 tb.HideColumn("hidden")
43
44 checkTable(t, tb,
45 "champ", "champion", "win", "loose", "winRate", "sum", "ok",
46 "Malzahar", "MALZAHAR", 10, 6, "62.5 %", 696.0, true,
47 "Xerath", "XERATH", 20, 5, "80 %", 696.0, true,
48 "Teemo", "TEEMO", 666, 666, "50 %", 696.0, true,
49 )
50
51 return tb
52}

Callers 12

TestNewTableFunction · 0.92
TestNewRowFunction · 0.92
TestExprColumnFunction · 0.92
TestAppendRowFunction · 0.92
TestRowsFunction · 0.92
TestRowFunction · 0.92
TestSwapRowFunction · 0.92
TestSwapColumnFunction · 0.92
sampleForExportFunction · 0.92
sampleForJoinFunction · 0.92
sampleForConcatFunction · 0.92
ImportFunction · 0.92

Calls 5

ValuesFunction · 0.92
ExprFunction · 0.92
checkTableFunction · 0.85
AddColumnMethod · 0.80
HideColumnMethod · 0.80

Tested by

no test coverage detected