MCPcopy Create free account
hub / github.com/TheAlgorithms/Go / getWordBreakTestCases

Function getWordBreakTestCases

dynamic/wordbreak_test.go:15–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

13}
14
15func getWordBreakTestCases() []testCaseWordBreak {
16 return []testCaseWordBreak{
17 {"leetcode", []string{"leet", "code"}, true}, // "leetcode" can be segmented into "leet" and "code"
18 {"applepenapple", []string{"apple", "pen"}, true}, // "applepenapple" can be segmented into "apple", "pen", "apple"
19 {"catsanddog", []string{"cats", "dog", "sand", "and", "cat"}, true}, // "catsanddog" can be segmented into "cats", "and", "dog"
20 {"bb", []string{"a", "b", "bbb", "aaaa", "aaa"}, true}, // "bb" can be segmented into "b" and "b"
21 {"", []string{"cat", "dog", "sand", "and"}, true}, // Empty string can always be segmented (empty words)
22 {"applepie", []string{"apple", "pie"}, true}, // "applepie" can be segmented into "apple" and "pie"
23 {"catsandog", []string{"cats", "dog", "sand", "and", "cat"}, false}, // "catsandog" cannot be segmented
24 {"ilovecoding", []string{"i", "love", "coding"}, true}, // "ilovecoding" can be segmented into "i", "love", "coding"
25 {"cars", []string{"car", "ca", "rs"}, true}, // "cars" can be segmented into "car" and "s"
26 {"pen", []string{"pen", "pencil"}, true}, // "pen" is a direct match
27 {"apple", []string{"orange", "banana"}, false}, // "apple" is not in the word dictionary
28 }
29}
30
31func TestWordBreak(t *testing.T) {
32 t.Run("Word Break test cases", func(t *testing.T) {

Callers 1

TestWordBreakFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected