|
@@ -61,9 +61,8 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://user@aria2.sf.net/path/";
|
|
uri = "http://user@aria2.sf.net/path/";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
- (1 << USR_USERINFO) | (1 << USR_USER));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
+ (1 << USR_USERINFO) | (1 << USR_USER));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USERINFO, uri));
|
|
@@ -72,10 +71,9 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://user:pass@aria2.sf.net/path/";
|
|
uri = "http://user:pass@aria2.sf.net/path/";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
- (1 << USR_USERINFO) | (1 << USR_USER) |
|
|
|
|
- (1 << USR_PASSWD));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
+ (1 << USR_USERINFO) | (1 << USR_USER) |
|
|
|
|
+ (1 << USR_PASSWD));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user:pass"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user:pass"), mkstr(res, USR_USERINFO, uri));
|
|
@@ -89,10 +87,9 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://user@foo.com:pass@aria2.sf.net/path/";
|
|
uri = "http://user@foo.com:pass@aria2.sf.net/path/";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
- (1 << USR_USERINFO) | (1 << USR_USER) |
|
|
|
|
- (1 << USR_PASSWD));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
+ (1 << USR_USERINFO) | (1 << USR_USER) |
|
|
|
|
+ (1 << USR_PASSWD));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user@foo.com:pass"),
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user@foo.com:pass"),
|
|
@@ -104,9 +101,8 @@ void UriSplitTest::testUriSplit()
|
|
uri = "https://aria2.sf.net:443/path/";
|
|
uri = "https://aria2.sf.net:443/path/";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
- (1 << USR_PATH));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
+ (1 << USR_PATH));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("https"), mkstr(res, USR_SCHEME, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("https"), mkstr(res, USR_SCHEME, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
|
|
@@ -116,10 +112,9 @@ void UriSplitTest::testUriSplit()
|
|
uri = "https://user:pass@aria2.sf.net:443/path/";
|
|
uri = "https://user:pass@aria2.sf.net:443/path/";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
- (1 << USR_PATH) | (1 << USR_USERINFO) | (1 << USR_USER) |
|
|
|
|
- (1 << USR_PASSWD));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
+ (1 << USR_PATH) | (1 << USR_USERINFO) |
|
|
|
|
+ (1 << USR_USER) | (1 << USR_PASSWD));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user:pass"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user:pass"), mkstr(res, USR_USERINFO, uri));
|
|
@@ -131,9 +126,9 @@ void UriSplitTest::testUriSplit()
|
|
uri = "https://user@aria2.sf.net:443/path/";
|
|
uri = "https://user@aria2.sf.net:443/path/";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
- (1 << USR_PATH) | (1 << USR_USERINFO) | (1 << USR_USER));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
+ (1 << USR_PATH) | (1 << USR_USERINFO) |
|
|
|
|
+ (1 << USR_USER));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2.sf.net"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/path/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USERINFO, uri));
|
|
@@ -157,9 +152,8 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://user@aria2";
|
|
uri = "http://user@aria2";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_USERINFO) |
|
|
|
|
- (1 << USR_USER));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) |
|
|
|
|
+ (1 << USR_USERINFO) | (1 << USR_USER));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
@@ -167,9 +161,9 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://user:@aria2";
|
|
uri = "http://user:@aria2";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_USERINFO) |
|
|
|
|
- (1 << USR_USER) | (1 << USR_PASSWD));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) |
|
|
|
|
+ (1 << USR_USERINFO) | (1 << USR_USER) |
|
|
|
|
+ (1 << USR_PASSWD));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user:"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user:"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
@@ -178,9 +172,8 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://aria2/?foo#bar";
|
|
uri = "http://aria2/?foo#bar";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
- (1 << USR_QUERY) | (1 << USR_FRAGMENT));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
+ (1 << USR_QUERY) | (1 << USR_FRAGMENT));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("foo"), mkstr(res, USR_QUERY, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("foo"), mkstr(res, USR_QUERY, uri));
|
|
@@ -207,9 +200,8 @@ void UriSplitTest::testUriSplit()
|
|
uri = "https://aria2:443?foo";
|
|
uri = "https://aria2:443?foo";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
- (1 << USR_QUERY));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
+ (1 << USR_QUERY));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("foo"), mkstr(res, USR_QUERY, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("foo"), mkstr(res, USR_QUERY, uri));
|
|
CPPUNIT_ASSERT_EQUAL((uint16_t)443, res.port);
|
|
CPPUNIT_ASSERT_EQUAL((uint16_t)443, res.port);
|
|
@@ -218,9 +210,8 @@ void UriSplitTest::testUriSplit()
|
|
uri = "https://aria2:443#bar";
|
|
uri = "https://aria2:443#bar";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
- (1 << USR_FRAGMENT));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
+ (1 << USR_FRAGMENT));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("bar"), mkstr(res, USR_FRAGMENT, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("bar"), mkstr(res, USR_FRAGMENT, uri));
|
|
CPPUNIT_ASSERT_EQUAL((uint16_t)443, res.port);
|
|
CPPUNIT_ASSERT_EQUAL((uint16_t)443, res.port);
|
|
@@ -229,10 +220,9 @@ void UriSplitTest::testUriSplit()
|
|
uri = "https://user:pass@aria2:443?foo";
|
|
uri = "https://user:pass@aria2:443?foo";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
- (1 << USR_QUERY) | (1 << USR_USERINFO) | (1 << USR_USER) |
|
|
|
|
- (1 << USR_PASSWD));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
+ (1 << USR_QUERY) | (1 << USR_USERINFO) |
|
|
|
|
+ (1 << USR_USER) | (1 << USR_PASSWD));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("pass"), mkstr(res, USR_PASSWD, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("pass"), mkstr(res, USR_PASSWD, uri));
|
|
@@ -243,10 +233,9 @@ void UriSplitTest::testUriSplit()
|
|
uri = "https://user:pass@aria2:443#bar";
|
|
uri = "https://user:pass@aria2:443#bar";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
- (1 << USR_FRAGMENT) | (1 << USR_USERINFO) |
|
|
|
|
- (1 << USR_USER) | (1 << USR_PASSWD));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
+ (1 << USR_FRAGMENT) | (1 << USR_USERINFO) |
|
|
|
|
+ (1 << USR_USER) | (1 << USR_PASSWD));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("pass"), mkstr(res, USR_PASSWD, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("pass"), mkstr(res, USR_PASSWD, uri));
|
|
@@ -257,10 +246,9 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://user:pass@aria2?foo";
|
|
uri = "http://user:pass@aria2?foo";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_QUERY) |
|
|
|
|
- (1 << USR_USERINFO) | (1 << USR_USER) |
|
|
|
|
- (1 << USR_PASSWD));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_QUERY) |
|
|
|
|
+ (1 << USR_USERINFO) | (1 << USR_USER) |
|
|
|
|
+ (1 << USR_PASSWD));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("pass"), mkstr(res, USR_PASSWD, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("pass"), mkstr(res, USR_PASSWD, uri));
|
|
@@ -270,10 +258,9 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://user:pass@aria2#bar";
|
|
uri = "http://user:pass@aria2#bar";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_FRAGMENT) |
|
|
|
|
- (1 << USR_USERINFO) | (1 << USR_USER) |
|
|
|
|
- (1 << USR_PASSWD));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) |
|
|
|
|
+ (1 << USR_FRAGMENT) | (1 << USR_USERINFO) |
|
|
|
|
+ (1 << USR_USER) | (1 << USR_PASSWD));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("pass"), mkstr(res, USR_PASSWD, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("pass"), mkstr(res, USR_PASSWD, uri));
|
|
@@ -283,9 +270,8 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://aria2/?";
|
|
uri = "http://aria2/?";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
- (1 << USR_QUERY));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
+ (1 << USR_QUERY));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string(""), mkstr(res, USR_QUERY, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string(""), mkstr(res, USR_QUERY, uri));
|
|
@@ -294,9 +280,8 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://aria2/#";
|
|
uri = "http://aria2/#";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
- (1 << USR_FRAGMENT));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
+ (1 << USR_FRAGMENT));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string(""), mkstr(res, USR_FRAGMENT, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string(""), mkstr(res, USR_FRAGMENT, uri));
|
|
@@ -305,9 +290,8 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://aria2/?#";
|
|
uri = "http://aria2/?#";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
- (1 << USR_QUERY) | (1 << USR_FRAGMENT));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
+ (1 << USR_QUERY) | (1 << USR_FRAGMENT));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("aria2"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string(""), mkstr(res, USR_QUERY, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string(""), mkstr(res, USR_QUERY, uri));
|
|
@@ -333,9 +317,8 @@ void UriSplitTest::testUriSplit()
|
|
uri = "https://user@[::1]";
|
|
uri = "https://user@[::1]";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_USERINFO) |
|
|
|
|
- (1 << USR_USER));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) |
|
|
|
|
+ (1 << USR_USERINFO) | (1 << USR_USER));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("::1"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("::1"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
@@ -345,9 +328,9 @@ void UriSplitTest::testUriSplit()
|
|
uri = "https://user:pass@[::1]";
|
|
uri = "https://user:pass@[::1]";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_USERINFO) |
|
|
|
|
- (1 << USR_USER) | (1 << USR_PASSWD));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) |
|
|
|
|
+ (1 << USR_USERINFO) | (1 << USR_USER) |
|
|
|
|
+ (1 << USR_PASSWD));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("::1"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("::1"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user:pass"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user:pass"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user"), mkstr(res, USR_USER, uri));
|
|
@@ -357,18 +340,16 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://aria2/f";
|
|
uri = "http://aria2/f";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
- (1 << USR_BASENAME));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
+ (1 << USR_BASENAME));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/f"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/f"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("f"), mkstr(res, USR_BASENAME, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("f"), mkstr(res, USR_BASENAME, uri));
|
|
|
|
|
|
uri = "http://[::1]/f";
|
|
uri = "http://[::1]/f";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
- (1 << USR_BASENAME));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
+ (1 << USR_BASENAME));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("::1"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("::1"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/f"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/f"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("f"), mkstr(res, USR_BASENAME, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("f"), mkstr(res, USR_BASENAME, uri));
|
|
@@ -376,9 +357,8 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://[::1]:8080/f";
|
|
uri = "http://[::1]:8080/f";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
- (1 << USR_PATH) | (1 << USR_BASENAME));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PORT) |
|
|
|
|
+ (1 << USR_PATH) | (1 << USR_BASENAME));
|
|
CPPUNIT_ASSERT_EQUAL((uint16_t)8080, res.port);
|
|
CPPUNIT_ASSERT_EQUAL((uint16_t)8080, res.port);
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/f"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/f"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("f"), mkstr(res, USR_BASENAME, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("f"), mkstr(res, USR_BASENAME, uri));
|
|
@@ -386,10 +366,10 @@ void UriSplitTest::testUriSplit()
|
|
uri = "https://user:pass@host/f";
|
|
uri = "https://user:pass@host/f";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_USERINFO) |
|
|
|
|
- (1 << USR_USER) | (1 << USR_PASSWD) | (1 << USR_PATH) |
|
|
|
|
- (1 << USR_BASENAME));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) |
|
|
|
|
+ (1 << USR_USERINFO) | (1 << USR_USER) |
|
|
|
|
+ (1 << USR_PASSWD) | (1 << USR_PATH) |
|
|
|
|
+ (1 << USR_BASENAME));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("host"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("host"), mkstr(res, USR_HOST, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user:pass"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("user:pass"), mkstr(res, USR_USERINFO, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/f"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/f"), mkstr(res, USR_PATH, uri));
|
|
@@ -398,9 +378,8 @@ void UriSplitTest::testUriSplit()
|
|
uri = "http://aria2/index.html?foo";
|
|
uri = "http://aria2/index.html?foo";
|
|
memset(&res, 0, sizeof(res));
|
|
memset(&res, 0, sizeof(res));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
CPPUNIT_ASSERT_EQUAL(0, uri_split(&res, uri));
|
|
- CHECK_FIELD_SET(res,
|
|
|
|
- (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
- (1 << USR_QUERY) | (1 << USR_BASENAME));
|
|
|
|
|
|
+ CHECK_FIELD_SET(res, (1 << USR_SCHEME) | (1 << USR_HOST) | (1 << USR_PATH) |
|
|
|
|
+ (1 << USR_QUERY) | (1 << USR_BASENAME));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/index.html"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("/index.html"), mkstr(res, USR_PATH, uri));
|
|
CPPUNIT_ASSERT_EQUAL(std::string("index.html"),
|
|
CPPUNIT_ASSERT_EQUAL(std::string("index.html"),
|
|
mkstr(res, USR_BASENAME, uri));
|
|
mkstr(res, USR_BASENAME, uri));
|