MCPcopy Create free account
hub / github.com/austingebauer/go-leetcode / Test_majorityElement

Function Test_majorityElement

majority_element_ii_229/solution_test.go:8–45  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

6)
7
8func Test_majorityElement(t *testing.T) {
9 type args struct {
10 nums []int
11 }
12 tests := []struct {
13 name string
14 args args
15 want []int
16 }{
17 {
18 name: "majority element ii",
19 args: args{
20 nums: []int{
21 3, 2, 3,
22 },
23 },
24 want: []int{
25 3,
26 },
27 },
28 {
29 name: "majority element ii",
30 args: args{
31 nums: []int{
32 1, 1, 1, 3, 3, 2, 2, 2,
33 },
34 },
35 want: []int{
36 1, 2,
37 },
38 },
39 }
40 for _, tt := range tests {
41 t.Run(tt.name, func(t *testing.T) {
42 assert.Equal(t, tt.want, majorityElement(tt.args.nums))
43 })
44 }
45}

Callers

nothing calls this directly

Calls 1

majorityElementFunction · 0.70

Tested by

no test coverage detected