| 20 | using namespace us; |
| 21 | |
| 22 | int TestParsing() |
| 23 | { |
| 24 | // WELL FORMED Expr |
| 25 | try |
| 26 | { |
| 27 | US_TEST_OUTPUT(<< "Parsing (cn=Babs Jensen)") |
| 28 | LDAPFilter ldap( "(cn=Babs Jensen)" ); |
| 29 | US_TEST_OUTPUT(<< "Parsing (!(cn=Tim Howes))") |
| 30 | ldap = LDAPFilter( "(!(cn=Tim Howes))" ); |
| 31 | US_TEST_OUTPUT(<< "Parsing " << std::string("(&(") + ServiceConstants::OBJECTCLASS() + "=Person)(|(sn=Jensen)(cn=Babs J*)))") |
| 32 | ldap = LDAPFilter( std::string("(&(") + ServiceConstants::OBJECTCLASS() + "=Person)(|(sn=Jensen)(cn=Babs J*)))" ); |
| 33 | US_TEST_OUTPUT(<< "Parsing (o=univ*of*mich*)") |
| 34 | ldap = LDAPFilter( "(o=univ*of*mich*)" ); |
| 35 | } |
| 36 | catch (const std::invalid_argument& e) |
| 37 | { |
| 38 | US_TEST_OUTPUT(<< e.what()); |
| 39 | return EXIT_FAILURE; |
| 40 | } |
| 41 | |
| 42 | |
| 43 | // MALFORMED Expr |
| 44 | try |
| 45 | { |
| 46 | US_TEST_OUTPUT( << "Parsing malformed expr: cn=Babs Jensen)") |
| 47 | LDAPFilter ldap( "cn=Babs Jensen)" ); |
| 48 | return EXIT_FAILURE; |
| 49 | } |
| 50 | catch (const std::invalid_argument&) |
| 51 | { |
| 52 | } |
| 53 | |
| 54 | return EXIT_SUCCESS; |
| 55 | } |
| 56 | |
| 57 | |
| 58 | int TestEvaluate() |
no test coverage detected