| 12 | } |
| 13 | |
| 14 | func getInterleavingTestCases() []testCaseInterleaving { |
| 15 | return []testCaseInterleaving{ |
| 16 | {"aab", "axy", "aaxaby", true}, // Valid interleaving |
| 17 | {"aab", "axy", "abaaxy", false}, // Invalid interleaving |
| 18 | {"", "", "", true}, // All empty strings |
| 19 | {"abc", "", "abc", true}, // Only s1 matches s3 |
| 20 | {"", "xyz", "xyz", true}, // Only s2 matches s3 |
| 21 | {"abc", "xyz", "abxcyz", true}, // Valid interleaving |
| 22 | {"aaa", "aaa", "aaaaaa", true}, // Identical strings |
| 23 | {"aaa", "aaa", "aaaaaaa", false}, // Extra character |
| 24 | {"abc", "def", "abcdef", true}, // Concatenation order |
| 25 | {"abc", "def", "adbcef", true}, // Valid mixed interleaving |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | func TestIsInterleave(t *testing.T) { |
| 30 | t.Run("Interleaving Strings test cases", func(t *testing.T) { |