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

Function getWildcardMatchingTestCases

dynamic/wildcardmatching_test.go:17–32  ·  view source on GitHub ↗

getWildcardMatchingTestCases returns a list of test cases for the Wildcard Matching problem

()

Source from the content-addressed store, hash-verified

15
16// getWildcardMatchingTestCases returns a list of test cases for the Wildcard Matching problem
17func getWildcardMatchingTestCases() []testCaseWildcardMatching {
18 return []testCaseWildcardMatching{
19 {"aa", "a*", true}, // '*' can match zero or more characters
20 {"aa", "a", false}, // No match due to no wildcard
21 {"ab", "?*", true}, // '?' matches any single character, '*' matches remaining
22 {"abcd", "a*d", true}, // '*' matches the characters between 'a' and 'd'
23 {"abcd", "a*c", false}, // No match as 'c' doesn't match the last character 'd'
24 {"abc", "*", true}, // '*' matches the entire string
25 {"abc", "a*c", true}, // '*' matches 'b'
26 {"abc", "a?c", true}, // '?' matches 'b'
27 {"abc", "a?d", false}, // '?' cannot match 'd'
28 {"", "", true}, // Both strings empty, so they match
29 {"a", "?", true}, // '?' matches any single character
30 {"a", "*", true}, // '*' matches any number of characters, including one
31 }
32}
33
34// TestIsMatch tests the IsMatch function with various test cases
35func TestIsMatch(t *testing.T) {

Callers 1

TestIsMatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected