void URITestObject::test<4>() { // scheme w/o paths checkParts(LLURI("mailto:[email protected]"), "mailto", "*****@*****.**", "", ""); checkParts(LLURI("silly://abc/def?foo"), "silly", "//abc/def?foo", "", ""); }
void URITestObject::test<6>() { // path section checkParts(LLURI("http://host/a/b/"), "http", "//host/a/b/", "host", "/a/b/"); checkParts(LLURI("http://host/a%3Fb/"), "http", "//host/a?b/", "host", "/a?b/"); checkParts(LLURI("http://host/a:b/"), "http", "//host/a:b/", "host", "/a:b/"); }
void URITestObject::test<8>() { LLSD path; path.append("x"); path.append("123"); checkParts(LLURI::buildHTTP("host", path), "http", "//host/x/123", "host", "/x/123"); LLSD query; query["123"] = "12"; query["abcd"] = "abc"; checkParts(LLURI::buildHTTP("host", path, query), "http", "//host/x/123?123=12&abcd=abc", "host", "/x/123", "123=12&abcd=abc"); }
void URITestObject::test<7>() { // query string checkParts(LLURI("http://host/?"), "http", "//host/?", "host", "/", ""); checkParts(LLURI("http://host/?x"), "http", "//host/?x", "host", "/", "x"); checkParts(LLURI("http://host/??"), "http", "//host/??", "host", "/", "?"); checkParts(LLURI("http://host/?%3F"), "http", "//host/??", "host", "/", "?"); }
void URITestObject::test<5>() { // authority section checkParts(LLURI("http:///"), "http", "///", "", "/"); checkParts(LLURI("http://abc"), "http", "//abc", "abc", ""); checkParts(LLURI("http://a%2Fb/cd"), "http", "//a/b/cd", "a/b", "/cd"); checkParts(LLURI("http://host?"), "http", "//host?", "host", ""); }
void URITestObject::test<12>() { // test funky host_port values that are actually prefixes checkParts(LLURI::buildHTTP("http://example.com:8080", LLSD()), "http", "//example.com:8080", "example.com:8080", ""); checkParts(LLURI::buildHTTP("http://example.com:8080/", LLSD()), "http", "//example.com:8080/", "example.com:8080", "/"); checkParts(LLURI::buildHTTP("http://example.com:8080/a/b", LLSD()), "http", "//example.com:8080/a/b", "example.com:8080", "/a/b"); }
void testGraph () { int graphNb = 10000; int size = 6; int edgeNb = size*(size-1)/2; Graph *graph; bool error = false; int first = 0; int last = std::pow(2,edgeNb); VERBOSE = false; if (graphNb >= 0) { first = graphNb; last = graphNb+1; VERBOSE = true; } for (int index = first; index < last && !error; index++) { std::cout << "GRAPH " << index << std::endl; graph = new Graph (size); graph->buildFromBinary(index); if (graphNb >= 0) { graph->print(); } graph->buildDataStructure(); if (graphNb >= 0) { graph->printDataStructure(); } bool errorParts = checkParts(graph); error = error || errorParts; delete graph; } if (error) { std::cout << "ERROR: there has been an error!" << std::endl; } else { std::cout << "-> CHECK SUCCESSFUL!" << std::endl; } }
void URITestObject::test<9>() { // test unescaped path components LLSD path; path.append("x@*//*$&^"); path.append("123"); checkParts(LLURI::buildHTTP("host", path), "http", "//host/x@*//*$&^/123", "host", "/x@*//*$&^/123"); }
void URITestObject::test<11>() { // test unescaped host components LLSD path; path.append("x"); path.append("123"); LLSD query; query["123"] = "12"; query["abcd"] = "abc"; checkParts(LLURI::buildHTTP("hi123*33--}{:portstuffs", path, query), "http", "//hi123*33--}{:portstuffs/x/123?123=12&abcd=abc", "hi123*33--}{:portstuffs", "/x/123", "123=12&abcd=abc"); }
void URITestObject::test<10>() { // test unescaped query components LLSD path; path.append("x"); path.append("123"); LLSD query; query["123"] = "?&*#//"; query["**@&?//"] = "abc"; checkParts(LLURI::buildHTTP("host", path, query), "http", "//host/x/123?**@&?//=abc&123=?&*#//", "host", "/x/123", "**@&?//=abc&123=?&*#//"); }
void URITestObject::test<3>() { // no scheme checkParts(LLURI("foo"), "", "foo", "", ""); checkParts(LLURI("foo%3A"), "", "foo:", "", ""); }
void URITestObject::test<2>() { // empty string checkParts(LLURI(""), "", "", "", ""); }