MCPcopy
hub / github.com/chrislusf/glow / TestGroupByKeyMap

Function TestGroupByKeyMap

flow/dataset_map_test.go:23–37  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

21}
22
23func TestGroupByKeyMap(t *testing.T) {
24 dataset := New().Slice(
25 []int{1, 1, 2, 2, 3, 3},
26 ).Map(func(t int) (int, int) {
27 return t, t * 2
28 }).GroupByKey().Map(func(key int, values []int) []int {
29 return append([]int{key}, values...)
30 })
31
32 got := collectOutput(dataset)
33
34 if want := [][]int{{1, 2, 2}, {2, 4, 4}, {3, 6, 6}}; !reflect.DeepEqual(got, want) {
35 t.Errorf("Got %v want %v", got, want)
36 }
37}
38
39func TestCoGroupMap(t *testing.T) {
40 f := New()

Callers

nothing calls this directly

Calls 5

NewFunction · 0.85
collectOutputFunction · 0.85
MapMethod · 0.80
GroupByKeyMethod · 0.80
SliceMethod · 0.80

Tested by

no test coverage detected