MCPcopy Create free account
hub / github.com/cppcheck-opensource/cppcheck / matchglob

Method matchglob

test/testutils.cpp:84–114  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

82 }
83
84 void matchglob() const {
85 ASSERT_EQUALS(true, ::matchglob("*", "xyz"));
86 ASSERT_EQUALS(true, ::matchglob("x*", "xyz"));
87 ASSERT_EQUALS(true, ::matchglob("*z", "xyz"));
88 ASSERT_EQUALS(true, ::matchglob("*y*", "xyz"));
89 ASSERT_EQUALS(true, ::matchglob("*y*", "yz"));
90 ASSERT_EQUALS(false, ::matchglob("*y*", "abc"));
91 ASSERT_EQUALS(true, ::matchglob("*", "x/y/z"));
92 ASSERT_EQUALS(true, ::matchglob("*/y/z", "x/y/z"));
93
94 ASSERT_EQUALS(true, ::matchglob("**", ""));
95 ASSERT_EQUALS(true, ::matchglob("**", "abcdefg"));
96 ASSERT_EQUALS(true, ::matchglob("**", "abcde/foo/bar"));
97 ASSERT_EQUALS(false, ::matchglob("*/**", "abcde"));
98 ASSERT_EQUALS(true, ::matchglob("*/**", "abcde/foo"));
99 ASSERT_EQUALS(true, ::matchglob("*/**", "abcde/foo/bar"));
100
101 ASSERT_EQUALS(false, ::matchglob("?", "xyz"));
102 ASSERT_EQUALS(false, ::matchglob("x?", "xyz"));
103 ASSERT_EQUALS(false, ::matchglob("?z", "xyz"));
104 ASSERT_EQUALS(true, ::matchglob("?y?", "xyz"));
105 ASSERT_EQUALS(true, ::matchglob("?/?/?", "x/y/z"));
106
107 ASSERT_EQUALS(true, ::matchglob("??", "xy"));
108 ASSERT_EQUALS(false, ::matchglob("??", "x"));
109 ASSERT_EQUALS(false, ::matchglob("??", "xyz"));
110
111 ASSERT_EQUALS(true, ::matchglob("????", "wxyz"));
112 ASSERT_EQUALS(false, ::matchglob("????", "xyz"));
113 ASSERT_EQUALS(false, ::matchglob("????", "vwxyz"));
114 }
115
116 void isStringLiteral() const {
117 // empty

Callers

nothing calls this directly

Calls 1

matchglobFunction · 0.85

Tested by

no test coverage detected