-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmallest_team_test.go
52 lines (45 loc) · 991 Bytes
/
smallest_team_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package problem1125
import (
"fmt"
"testing"
"github.com/stretchr/testify/assert"
)
type TestCase struct {
Req []string
People [][]string
Expected []int
}
var TestCases = []TestCase{
{
[]string{"java", "nodejs", "reactjs"},
[][]string{{"java"}, {"nodejs"}, {"nodejs", "reactjs"}},
[]int{0, 2},
},
{
[]string{"algorithms", "math", "java", "reactjs", "csharp", "aws"},
[][]string{
{"algorithms", "math", "java"},
{"algorithms", "math", "reactjs"},
{"java", "csharp", "aws"},
{"reactjs", "csharp"},
{"csharp", "math"},
{"aws", "java"},
},
[]int{1, 2},
},
}
func TestSmallestTeam(t *testing.T) {
assert := assert.New(t)
for _, tc := range TestCases {
want := tc.Expected
got := smallestSufficientTeam(tc.Req, tc.People)
assert.Equal(want, got, fmt.Sprintf("%+v", tc))
}
}
func BenchmarkSmallestTeam(b *testing.B) {
for i := 0; i < b.N; i++ {
for _, tc := range TestCases {
smallestSufficientTeam(tc.Req, tc.People)
}
}
}