MCPcopy Create free account
hub / github.com/MITK/MITK / TestBoolComparison

Function TestBoolComparison

Modules/CppMicroServices/test/usLDAPFilterTest.cpp:151–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

149}
150
151void TestBoolComparison()
152{
153 // Regression: std::equal only checked pattern.size() characters, so a
154 // shorter pattern could falsely match a longer bool literal. Both
155 // "(key=tru)" and "(key=fals)" must reject bool true/false.
156 ServiceProperties propsTrue;
157 propsTrue["key"] = true;
158 ServiceProperties propsFalse;
159 propsFalse["key"] = false;
160
161 US_TEST_CONDITION( LDAPFilter("(key=true)").Match(propsTrue),
162 "full bool literal matches true")
163 US_TEST_CONDITION(!LDAPFilter("(key=tru)").Match(propsTrue),
164 "truncated bool pattern must not match true")
165 US_TEST_CONDITION(!LDAPFilter("(key=trueX)").Match(propsTrue),
166 "longer bool pattern must not match true")
167 US_TEST_CONDITION( LDAPFilter("(key=false)").Match(propsFalse),
168 "full bool literal matches false")
169 US_TEST_CONDITION(!LDAPFilter("(key=fals)").Match(propsFalse),
170 "truncated bool pattern must not match false")
171}
172
173int usLDAPFilterTest(int /*argc*/, char* /*argv*/[])
174{

Callers 1

usLDAPFilterTestFunction · 0.85

Calls 1

MatchMethod · 0.45

Tested by

no test coverage detected