diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-05-16 12:27:14 +0900 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2016-05-16 12:27:14 +0900 |
| commit | 9727b5b256bb12cff42e6aa230ba2020a933562f (patch) | |
| tree | 4fe70a0d78d3a5cd11a80b2dfd8f521db47032ee /test | |
| parent | 8897d7ec702fca9780033db42db48cced2580112 (diff) | |
| parent | cc8375f0b04918ace028bf58e09f9e25a0440c23 (diff) | |
Merge branch 'master' into dynamic-select-file
Diffstat (limited to 'test')
| -rw-r--r-- | test/CookieStorageTest.cc | 4 | ||||
| -rw-r--r-- | test/NsCookieParserTest.cc | 4 | ||||
| -rw-r--r-- | test/UtilTest2.cc | 19 | ||||
| -rw-r--r-- | test/chromium_cookies.sqlite | bin | 3072 -> 3072 bytes | |||
| -rw-r--r-- | test/nscookietest.txt | 4 |
5 files changed, 25 insertions, 6 deletions
diff --git a/test/CookieStorageTest.cc b/test/CookieStorageTest.cc index b9e741b6..a9966a64 100644 --- a/test/CookieStorageTest.cc +++ b/test/CookieStorageTest.cc @@ -328,10 +328,10 @@ void CookieStorageTest::testLoad() 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_EQUAL((time_t)1463304912, c->getExpiryTime()); CPPUNIT_ASSERT(c->getPersistent()); CPPUNIT_ASSERT_EQUAL(std::string("/"), c->getPath()); - CPPUNIT_ASSERT_EQUAL(std::string("overflow"), c->getDomain()); + CPPUNIT_ASSERT_EQUAL(std::string("something"), c->getDomain()); CPPUNIT_ASSERT(!c->getSecure()); } diff --git a/test/NsCookieParserTest.cc b/test/NsCookieParserTest.cc index 45d81004..23fb4016 100644 --- a/test/NsCookieParserTest.cc +++ b/test/NsCookieParserTest.cc @@ -69,9 +69,9 @@ void NsCookieParserTest::testParse() 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_EQUAL((time_t)1463304912, c->getExpiryTime()); CPPUNIT_ASSERT(c->getPersistent()); - CPPUNIT_ASSERT_EQUAL(std::string("overflow"), c->getDomain()); + CPPUNIT_ASSERT_EQUAL(std::string("something"), c->getDomain()); CPPUNIT_ASSERT(c->getHostOnly()); CPPUNIT_ASSERT_EQUAL(std::string("/"), c->getPath()); CPPUNIT_ASSERT(!c->getSecure()); diff --git a/test/UtilTest2.cc b/test/UtilTest2.cc index 03a28411..544df0d5 100644 --- a/test/UtilTest2.cc +++ b/test/UtilTest2.cc @@ -66,6 +66,7 @@ class UtilTest2 : public CppUnit::TestFixture { CPPUNIT_TEST(testInPrivateAddress); CPPUNIT_TEST(testSecfmt); CPPUNIT_TEST(testTlsHostnameMatch); + CPPUNIT_TEST(testParseDoubleNoThrow); CPPUNIT_TEST_SUITE_END(); private: @@ -115,6 +116,7 @@ public: void testInPrivateAddress(); void testSecfmt(); void testTlsHostnameMatch(); + void testParseDoubleNoThrow(); }; CPPUNIT_TEST_SUITE_REGISTRATION(UtilTest2); @@ -978,4 +980,21 @@ void UtilTest2::testTlsHostnameMatch() CPPUNIT_ASSERT(!util::tlsHostnameMatch("xn--*.a.b", "xn--c.a.b")); } +void UtilTest2::testParseDoubleNoThrow() +{ + double n; + + CPPUNIT_ASSERT(util::parseDoubleNoThrow(n, " 123 ")); + CPPUNIT_ASSERT_EQUAL(123., n); + + CPPUNIT_ASSERT(util::parseDoubleNoThrow(n, "3.14")); + CPPUNIT_ASSERT_EQUAL(3.14, n); + + CPPUNIT_ASSERT(util::parseDoubleNoThrow(n, "-3.14")); + CPPUNIT_ASSERT_EQUAL(-3.14, n); + + CPPUNIT_ASSERT(!util::parseDoubleNoThrow(n, "")); + CPPUNIT_ASSERT(!util::parseDoubleNoThrow(n, "123x")); +} + } // namespace aria2 diff --git a/test/chromium_cookies.sqlite b/test/chromium_cookies.sqlite Binary files differindex c3e98fc8..e653715b 100644 --- a/test/chromium_cookies.sqlite +++ b/test/chromium_cookies.sqlite diff --git a/test/nscookietest.txt b/test/nscookietest.txt index 7b7d9e84..5eed9f33 100644 --- a/test/nscookietest.txt +++ b/test/nscookietest.txt @@ -5,5 +5,5 @@ expired FALSE / FALSE 1000 user me 192.168.0.1 TRUE /cgi-bin FALSE 0 passwd secret badformat -overflow FALSE / FALSE 9223372036854775807 TAX 1000 -.example.org TRUE / FALSE 2147483647 novalue +something FALSE / FALSE 1463304912.5 TAX 1000 +.example.org TRUE / FALSE 2147483647.123 novalue |
