| 149 | } |
| 150 | |
| 151 | void 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 | |
| 173 | int usLDAPFilterTest(int /*argc*/, char* /*argv*/[]) |
| 174 | { |
no test coverage detected