49 : str_www_google_com(
"www.google.com"),
50 www_google_com(
"www.google.com"),
51 str_http_www_google_com(
"http://www.google.com"),
52 http_www_google_com(
"http://www.google.com"),
53 str_https_www_google_com_query(
"https://www.google.com/search?q=c%2B%2B"),
54 https_www_google_com_query(
"https://www.google.com/search?q=c%2B%2B"),
55 index_html(
"index.html"),
56 str_barra_barra_str(
"//str"),
57 barra_barra_str(
"//str")
63 str_http_www_google_com,
64 str_https_www_google_com_query,
69 https_www_google_com_query,
83 inline
string norm(const
string & p) {
90 BOOST_CHECK_NO_THROW(
Uri(
"../index.html") );
91 BOOST_CHECK_NO_THROW(
Uri(
"././../index.html?q=home#frg") );
99 BOOST_CHECK_EQUAL(
Uri(str_www_google_com),
Uri(str_www_google_com) );
100 BOOST_CHECK_EQUAL(
Uri(str_https_www_google_com_query),
Uri(str_https_www_google_com_query) );
101 BOOST_CHECK_EQUAL(
Uri(barra_barra_str),
Uri(barra_barra_str) );
106 Uri c(https_www_google_com_query);
107 BOOST_CHECK_EQUAL( c, https_www_google_com_query );
109 BOOST_CHECK_EQUAL( c, www_google_com );
111 BOOST_CHECK_EQUAL( c,
Uri(
".") );
116 Uri c_google(www_google_com), c_barres(barra_barra_str);
117 BOOST_CHECK_EQUAL( www_google_com, c_google );
118 BOOST_CHECK_EQUAL( barra_barra_str, c_barres );
123 Uri abs(
"http://www.example.com"),
124 rel(
"../index.html"),
125 ruta_abs(
"/index.html");
131 const Uri & u = https_www_google_com_query;
132 const Uri nu1(Uri::normalitza(u));
133 const Uri nu2(Uri::normalitza(u));
134 const Uri nunu(Uri::normalitza(nu1));
136 BOOST_CHECK_EQUAL( nu1, nu2 );
137 BOOST_CHECK_EQUAL( nu1, nunu );
147 BOOST_CHECK_EQUAL(
norm(
"http://www.google.com/.."),
148 "http://www.google.com/");
153 BOOST_CHECK_EQUAL(
norm(
"/"),
"/" );
155 #if 0 // TODO: Les dobles barres tenen un significat especial!
156 BOOST_CHECK_EQUAL(
norm(
"//"),
"/" );
157 BOOST_CHECK_EQUAL(
norm(
"//.//"),
"/" );
158 BOOST_CHECK_EQUAL(
norm(
"///"),
"/" );
159 BOOST_CHECK_EQUAL(
norm(
"/index.html"),
"/index.html");
160 BOOST_CHECK_EQUAL(
norm(
"//index.html"),
"/index.html");
166 BOOST_CHECK_EQUAL(
norm(
"."),
"" );
167 BOOST_CHECK_EQUAL(
norm(
"./.."),
"" );
168 BOOST_CHECK_EQUAL(
norm(
"../index.html"),
"/index.html");
169 BOOST_CHECK_EQUAL(
norm(
"dir/../index.html"),
"/index.html");
171 BOOST_CHECK_EQUAL(
norm(
"index.html"),
"/index.html");
175 BOOST_CHECK_EQUAL(
string(
Uri(s)), s );
192 BOOST_CHECK_EQUAL( r,
"/" );
194 BOOST_CHECK_EQUAL(
"http://example.com",
201 BOOST_CHECK_EQUAL( r,
"%2F" );
203 BOOST_CHECK_EQUAL(
"http%3A%2F%2Fexample%2Ecom",
207 BOOST_AUTO_TEST_SUITE_END()