(t *testing.T)
| 6 | ) |
| 7 | |
| 8 | func 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 | } |
nothing calls this directly
no test coverage detected