]>
git.ipfire.org Git - thirdparty/squid.git/blob - src/tests/testACLMaxUserIP.cc
1 #define SQUID_UNIT_TEST 1
7 #include "testACLMaxUserIP.h"
8 #include "auth/AclMaxUserIp.h"
14 CPPUNIT_TEST_SUITE_REGISTRATION( testACLMaxUserIP
);
18 testACLMaxUserIP::testDefaults()
20 ACLMaxUserIP
anACL("max_user_ip");
21 /* 0 is not a valid maximum, so we start at 0 */
22 CPPUNIT_ASSERT(anACL
.getMaximum() == 0);
23 /* and we have no option to turn strict OFF, so start ON. */
24 CPPUNIT_ASSERT(anACL
.getStrict() == false);
25 /* an unparsed acl must not be valid - there is no sane default */
26 CPPUNIT_ASSERT(!anACL
.valid());
31 testACLMaxUserIP::testParseLine()
33 /* a config line to pass with a lead-in token to seed the parser. */
34 char * line
= xstrdup("token -s 1");
36 strtok(line
, w_space
);
37 ACLMaxUserIP
anACL("max_user_ip");
39 /* we want a maximum of one, and strict to be true */
40 CPPUNIT_ASSERT(anACL
.getMaximum() == 1);
41 CPPUNIT_ASSERT(anACL
.getStrict() == true);
42 /* the acl must be vaid */
43 CPPUNIT_ASSERT(anACL
.valid());