(t *testing.T)
| 6 | ) |
| 7 | |
| 8 | func TestAbbreviation(t *testing.T) { |
| 9 | tests := []struct { |
| 10 | a string |
| 11 | b string |
| 12 | expected bool |
| 13 | }{ |
| 14 | {"uOHlGMdUBc", "uOalGMdUBCasdcavsdf", false}, |
| 15 | {"kotgDIUagj", "DIU", true}, |
| 16 | {"WPTffVkSNl", "WPTVSN", true}, |
| 17 | {"CoJsPURrVX", "CPUVX", false}, |
| 18 | {"xasreDHndqvCnFfX", "DHndqvCnFX", false}, |
| 19 | {"XFEaWCxpeepGjOnCCsFh", "XFEAWCPEPGOCCSF", true}, |
| 20 | {"", "", true}, |
| 21 | {"a", "", true}, |
| 22 | {"a", "b", false}, |
| 23 | {"a", "a", false}, |
| 24 | {"A", "A", true}, |
| 25 | } |
| 26 | count := len(tests) |
| 27 | for i := 0; i < count; i++ { |
| 28 | name := fmt.Sprintf( |
| 29 | "Test case #%d: string a = \"%s\", string b = \"%s\"", |
| 30 | i+1, |
| 31 | tests[i].a, |
| 32 | tests[i].b, |
| 33 | ) |
| 34 | t.Run(name, func(t *testing.T) { |
| 35 | result := Abbreviation(tests[i].a, tests[i].b) |
| 36 | if result != tests[i].expected { |
| 37 | t.Errorf("Expected the %t, got %t", tests[i].expected, result) |
| 38 | } |
| 39 | }) |
| 40 | } |
| 41 | } |
nothing calls this directly
no test coverage detected