summaryrefslogtreecommitdiff
path: root/test/NsCookieParserTest.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-06-28 00:25:06 +0900
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2013-06-29 23:09:09 +0900
commit5a223115e09cd568169fe2efd71d09689a980335 (patch)
tree61250fc5f89229e4ecc63d70ae2069207388fea0 /test/NsCookieParserTest.cc
parent0b1e05b13bfd7cfbf75b299c1f32cdd6e6aed953 (diff)
Rewrite CookieStorage
Diffstat (limited to 'test/NsCookieParserTest.cc')
-rw-r--r--test/NsCookieParserTest.cc100
1 files changed, 50 insertions, 50 deletions
diff --git a/test/NsCookieParserTest.cc b/test/NsCookieParserTest.cc
index 832badca..33003fc7 100644
--- a/test/NsCookieParserTest.cc
+++ b/test/NsCookieParserTest.cc
@@ -33,58 +33,58 @@ void NsCookieParserTest::testParse()
{
NsCookieParser parser;
time_t now = 0;
- std::vector<Cookie> cookies = parser.parse(A2_TEST_DIR"/nscookietest.txt", now);
+ auto cookies = parser.parse(A2_TEST_DIR"/nscookietest.txt", now);
CPPUNIT_ASSERT_EQUAL((size_t)5, cookies.size());
- Cookie c = cookies[0];
- CPPUNIT_ASSERT_EQUAL(std::string("JSESSIONID"), c.getName());
- CPPUNIT_ASSERT_EQUAL(std::string("123456789"), c.getValue());
- CPPUNIT_ASSERT_EQUAL((time_t)INT32_MAX, c.getExpiryTime());
- CPPUNIT_ASSERT(c.getPersistent());
- CPPUNIT_ASSERT_EQUAL(std::string("localhost"), c.getDomain());
- CPPUNIT_ASSERT(c.getHostOnly());
- CPPUNIT_ASSERT_EQUAL(std::string("/"), c.getPath());
- CPPUNIT_ASSERT(c.getSecure());
-
- c = cookies[1];
- CPPUNIT_ASSERT_EQUAL(std::string("user"), c.getName());
- CPPUNIT_ASSERT_EQUAL(std::string("me"), c.getValue());
- CPPUNIT_ASSERT_EQUAL((time_t)1000, c.getExpiryTime());
- CPPUNIT_ASSERT(c.getPersistent());
- CPPUNIT_ASSERT_EQUAL(std::string("expired"), c.getDomain());
- CPPUNIT_ASSERT(c.getHostOnly());
- CPPUNIT_ASSERT_EQUAL(std::string("/"), c.getPath());
- CPPUNIT_ASSERT(!c.getSecure());
-
- c = cookies[2];
- CPPUNIT_ASSERT_EQUAL(std::string("passwd"), c.getName());
- CPPUNIT_ASSERT_EQUAL(std::string("secret"), c.getValue());
- CPPUNIT_ASSERT_EQUAL(std::numeric_limits<time_t>::max(), c.getExpiryTime());
- CPPUNIT_ASSERT(!c.getPersistent());
- CPPUNIT_ASSERT_EQUAL(std::string("192.168.0.1"), c.getDomain());
- CPPUNIT_ASSERT(c.getHostOnly());
- CPPUNIT_ASSERT_EQUAL(std::string("/cgi-bin"), c.getPath());
- CPPUNIT_ASSERT(!c.getSecure());
-
- c = cookies[3];
- CPPUNIT_ASSERT_EQUAL(std::string("TAX"), c.getName());
- CPPUNIT_ASSERT_EQUAL(std::string("1000"), c.getValue());
- CPPUNIT_ASSERT((time_t)INT32_MAX <= c.getExpiryTime());
- CPPUNIT_ASSERT(c.getPersistent());
- CPPUNIT_ASSERT_EQUAL(std::string("overflow"), c.getDomain());
- CPPUNIT_ASSERT(c.getHostOnly());
- CPPUNIT_ASSERT_EQUAL(std::string("/"), c.getPath());
- CPPUNIT_ASSERT(!c.getSecure());
-
- c = cookies[4];
- CPPUNIT_ASSERT_EQUAL(std::string("novalue"), c.getName());
- CPPUNIT_ASSERT_EQUAL(std::string(""), c.getValue());
- CPPUNIT_ASSERT_EQUAL((time_t)INT32_MAX, c.getExpiryTime());
- CPPUNIT_ASSERT(c.getPersistent());
- CPPUNIT_ASSERT_EQUAL(std::string("example.org"), c.getDomain());
- CPPUNIT_ASSERT(!c.getHostOnly());
- CPPUNIT_ASSERT_EQUAL(std::string("/"), c.getPath());
- CPPUNIT_ASSERT(!c.getSecure());
+ auto c = cookies[0].get();
+ CPPUNIT_ASSERT_EQUAL(std::string("JSESSIONID"), c->getName());
+ CPPUNIT_ASSERT_EQUAL(std::string("123456789"), c->getValue());
+ CPPUNIT_ASSERT_EQUAL((time_t)INT32_MAX, c->getExpiryTime());
+ CPPUNIT_ASSERT(c->getPersistent());
+ CPPUNIT_ASSERT_EQUAL(std::string("localhost"), c->getDomain());
+ CPPUNIT_ASSERT(c->getHostOnly());
+ CPPUNIT_ASSERT_EQUAL(std::string("/"), c->getPath());
+ CPPUNIT_ASSERT(c->getSecure());
+
+ c = cookies[1].get();
+ CPPUNIT_ASSERT_EQUAL(std::string("user"), c->getName());
+ CPPUNIT_ASSERT_EQUAL(std::string("me"), c->getValue());
+ CPPUNIT_ASSERT_EQUAL((time_t)1000, c->getExpiryTime());
+ CPPUNIT_ASSERT(c->getPersistent());
+ CPPUNIT_ASSERT_EQUAL(std::string("expired"), c->getDomain());
+ CPPUNIT_ASSERT(c->getHostOnly());
+ CPPUNIT_ASSERT_EQUAL(std::string("/"), c->getPath());
+ CPPUNIT_ASSERT(!c->getSecure());
+
+ c = cookies[2].get();
+ CPPUNIT_ASSERT_EQUAL(std::string("passwd"), c->getName());
+ CPPUNIT_ASSERT_EQUAL(std::string("secret"), c->getValue());
+ CPPUNIT_ASSERT_EQUAL(std::numeric_limits<time_t>::max(), c->getExpiryTime());
+ CPPUNIT_ASSERT(!c->getPersistent());
+ CPPUNIT_ASSERT_EQUAL(std::string("192.168.0.1"), c->getDomain());
+ CPPUNIT_ASSERT(c->getHostOnly());
+ CPPUNIT_ASSERT_EQUAL(std::string("/cgi-bin"), c->getPath());
+ CPPUNIT_ASSERT(!c->getSecure());
+
+ c = cookies[3].get();
+ CPPUNIT_ASSERT_EQUAL(std::string("TAX"), c->getName());
+ CPPUNIT_ASSERT_EQUAL(std::string("1000"), c->getValue());
+ CPPUNIT_ASSERT((time_t)INT32_MAX <= c->getExpiryTime());
+ CPPUNIT_ASSERT(c->getPersistent());
+ CPPUNIT_ASSERT_EQUAL(std::string("overflow"), c->getDomain());
+ CPPUNIT_ASSERT(c->getHostOnly());
+ CPPUNIT_ASSERT_EQUAL(std::string("/"), c->getPath());
+ CPPUNIT_ASSERT(!c->getSecure());
+
+ c = cookies[4].get();
+ CPPUNIT_ASSERT_EQUAL(std::string("novalue"), c->getName());
+ CPPUNIT_ASSERT_EQUAL(std::string(""), c->getValue());
+ CPPUNIT_ASSERT_EQUAL((time_t)INT32_MAX, c->getExpiryTime());
+ CPPUNIT_ASSERT(c->getPersistent());
+ CPPUNIT_ASSERT_EQUAL(std::string("example.org"), c->getDomain());
+ CPPUNIT_ASSERT(!c->getHostOnly());
+ CPPUNIT_ASSERT_EQUAL(std::string("/"), c->getPath());
+ CPPUNIT_ASSERT(!c->getSecure());
}
void NsCookieParserTest::testParse_fileNotFound()