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

Function Test_wordBreak

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

Source from the content-addressed store, hash-verified

6)
7
8func Test_wordBreak(t *testing.T) {
9 type args struct {
10 s string
11 wordDict []string
12 }
13 tests := []struct {
14 name string
15 args args
16 want bool
17 }{
18 {
19 name: "word break problem",
20 args: args{
21 s: "leetcode",
22 wordDict: []string{
23 "leet", "code",
24 },
25 },
26 want: true,
27 },
28 {
29 name: "word break problem",
30 args: args{
31 s: "applepenapple",
32 wordDict: []string{
33 "apple", "pen",
34 },
35 },
36 want: true,
37 },
38 {
39 name: "word break problem",
40 args: args{
41 s: "catsandog",
42 wordDict: []string{
43 "cats", "dog", "sand", "and", "cat",
44 },
45 },
46 want: false,
47 },
48 }
49 for _, tt := range tests {
50 t.Run(tt.name, func(t *testing.T) {
51 assert.Equal(t, tt.want, wordBreak(tt.args.s, tt.args.wordDict))
52 assert.Equal(t, tt.want, wordBreak0(tt.args.s, tt.args.wordDict))
53 })
54 }
55}

Callers

nothing calls this directly

Calls 2

wordBreakFunction · 0.85
wordBreak0Function · 0.85

Tested by

no test coverage detected