void FileSystemTestCase::UrlParsing() { static const struct Data { const wxChar *url; const wxChar *protocol, *left, *right, *anchor; } data[] = { // simple case: { wxT("http://www.root.cz/index.html"), wxT("http"), wxT(""), wxT("//www.root.cz/index.html"), wxT("")}, // anchors: { wxT("http://www.root.cz/index.html#lbl"), wxT("http"), wxT(""), wxT("//www.root.cz/index.html"), wxT("lbl")}, // file is default protocol: { wxT("testfile.html"), wxT("file"), wxT(""), wxT("testfile.html"), wxT("")}, // stacked protocols: { wxT("file:myzipfile.zip#zip:index.htm"), wxT("zip"), wxT("file:myzipfile.zip"), wxT("index.htm"), wxT("")}, // changes to ':' parsing often break things: { wxT("file:a#b:foo"), wxT("b"), wxT("file:a"), wxT("foo"), wxT("")} }; UrlTester tst; for ( size_t n = 0; n < WXSIZEOF(data); n++ ) { const Data& d = data[n]; CPPUNIT_ASSERT( tst.Protocol(d.url) == d.protocol ); CPPUNIT_ASSERT( tst.LeftLocation(d.url) == d.left ); CPPUNIT_ASSERT( tst.RightLocation(d.url) == d.right ); CPPUNIT_ASSERT( tst.Anchor(d.url) == d.anchor ); } }
void FileSystemTestCase::UrlParsing() { static const struct Data { const wxChar *url; const wxChar *protocol, *left, *right, *anchor; } data[] = { // simple case: { wxT("http://www.root.cz/index.html"), wxT("http"), wxT(""), wxT("//www.root.cz/index.html"), wxT("")}, // anchors: { wxT("http://www.root.cz/index.html#lbl"), wxT("http"), wxT(""), wxT("//www.root.cz/index.html"), wxT("lbl")}, // file is default protocol: { wxT("testfile.html"), wxT("file"), wxT(""), wxT("testfile.html"), wxT("")}, // stacked protocols: { wxT("file:myzipfile.zip#zip:index.htm"), wxT("zip"), wxT("file:myzipfile.zip"), wxT("index.htm"), wxT("")}, // changes to ':' parsing often break things: { wxT("file:a#b:foo"), wxT("b"), wxT("file:a"), wxT("foo"), wxT("")} }; UrlTester tst; #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ for ( size_t n = 0; n < WXSIZEOF(data); n++ ) { const Data& d = data[n]; CPPUNIT_ASSERT( tst.Protocol(d.url) == d.protocol ); CPPUNIT_ASSERT( tst.LeftLocation(d.url) == d.left ); CPPUNIT_ASSERT( tst.RightLocation(d.url) == d.right ); CPPUNIT_ASSERT( tst.Anchor(d.url) == d.anchor ); } }