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

Function TestEvaluate

Modules/CppMicroServices/test/usLDAPFilterTest.cpp:58–131  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56
57
58int TestEvaluate()
59{
60 // EVALUATE
61 try
62 {
63 LDAPFilter ldap( "(Cn=Babs Jensen)" );
64 ServiceProperties props;
65 bool eval = false;
66
67 // Several values
68 props["cn"] = std::string("Babs Jensen");
69 props["unused"] = std::string("Jansen");
70 US_TEST_OUTPUT(<< "Evaluating expr: " << ldap.ToString())
71 eval = ldap.Match(props);
72 if (!eval)
73 {
74 return EXIT_FAILURE;
75 }
76
77 // WILDCARD
78 ldap = LDAPFilter( "(cn=Babs *)" );
79 props.clear();
80 props["cn"] = std::string("Babs Jensen");
81 US_TEST_OUTPUT(<< "Evaluating wildcard expr: " << ldap.ToString())
82 eval = ldap.Match(props);
83 if ( !eval )
84 {
85 return EXIT_FAILURE;
86 }
87
88 // NOT FOUND
89 ldap = LDAPFilter( "(cn=Babs *)" );
90 props.clear();
91 props["unused"] = std::string("New");
92 US_TEST_OUTPUT(<< "Expr not found test: " << ldap.ToString())
93 eval = ldap.Match(props);
94 if ( eval )
95 {
96 return EXIT_FAILURE;
97 }
98
99 // std::vector with integer values
100 ldap = LDAPFilter( " ( |(cn=Babs *)(sn=1) )" );
101 props.clear();
102 std::vector<Any> list;
103 list.push_back(std::string("Babs Jensen"));
104 list.push_back(std::string("1"));
105 props["sn"] = list;
106 US_TEST_OUTPUT(<< "Evaluating vector expr: " << ldap.ToString())
107 eval = ldap.Match(props);
108 if (!eval)
109 {
110 return EXIT_FAILURE;
111 }
112
113 // wrong case
114 ldap = LDAPFilter( "(cN=Babs *)" );
115 props.clear();

Callers 1

usLDAPFilterTestFunction · 0.85

Calls 5

MatchCaseMethod · 0.80
whatMethod · 0.80
ToStringMethod · 0.45
MatchMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected