本文整理汇总了C++中Cookie::getVersion方法的典型用法代码示例。如果您正苦于以下问题:C++ Cookie::getVersion方法的具体用法?C++ Cookie::getVersion怎么用?C++ Cookie::getVersion使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cookie
的用法示例。
在下文中一共展示了Cookie::getVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assertTrue
TEST(CookieDecoderTest, testDecodingCommaSeparatedClientSideCookies) {
String source =
"$Version=\"1\"; session_id=\"1234\", " +
"$Version=\"1\"; session_id=\"1111\"; $Domain=\".cracker.edu\"";
Set<Cookie> cookies = CookieDecoder.decode(source);
Iterator<Cookie> it = cookies.iterator();
Cookie c;
assertTrue(it.hasNext());
c = it.next();
assertEquals(1, c.getVersion());
assertEquals("session_id", c.getName());
assertEquals("1234", c.getValue());
assertNull(c.getPath());
assertNull(c.getComment());
assertNull(c.getCommentUrl());
assertNull(c.getDomain());
assertTrue(c.getPorts().isEmpty());
assertEquals(Long.MIN_VALUE, c.getMaxAge());
assertTrue(it.hasNext());
c = it.next();
assertEquals(1, c.getVersion());
assertEquals("session_id", c.getName());
assertEquals("1111", c.getValue());
assertEquals(".cracker.edu", c.getDomain());
assertNull(c.getPath());
assertNull(c.getComment());
assertNull(c.getCommentUrl());
assertTrue(c.getPorts().isEmpty());
assertEquals(Long.MIN_VALUE, c.getMaxAge());
assertFalse(it.hasNext());
}
示例2: assertEquals
TEST(CookieDecoderTest, testDecodingClientSideCookies) {
String source = "$Version=\"1\"; " +
"Part_Number=\"Riding_Rocket_0023\"; $Path=\"/acme/ammo\"; " +
"Part_Number=\"Rocket_Launcher_0001\"; $Path=\"/acme\"";
Set<Cookie> cookies = CookieDecoder.decode(source);
Iterator<Cookie> it = cookies.iterator();
Cookie c;
c = it.next();
assertEquals(1, c.getVersion());
assertEquals("Part_Number", c.getName());
assertEquals("Rocket_Launcher_0001", c.getValue());
assertEquals("/acme", c.getPath());
assertNull(c.getComment());
assertNull(c.getCommentUrl());
assertNull(c.getDomain());
assertTrue(c.getPorts().isEmpty());
assertEquals(Long.MIN_VALUE, c.getMaxAge());
c = it.next();
assertEquals(1, c.getVersion());
assertEquals("Part_Number", c.getName());
assertEquals("Riding_Rocket_0023", c.getValue());
assertEquals("/acme/ammo", c.getPath());
assertNull(c.getComment());
assertNull(c.getCommentUrl());
assertNull(c.getDomain());
assertTrue(c.getPorts().isEmpty());
assertEquals(Long.MIN_VALUE, c.getMaxAge());
assertFalse(it.hasNext());
}