Branch Coverage

/root/.cpan/build/URI-XS-2.1.2-0/clib/src/panda/uri/URI.h
Criterion Covered Total %
branch 56 96 58.3


line true false branch
18 0 14 struct URIError : std::logic_error {
22 0 14 struct WrongScheme : URIError {
54 37 0 URI temp(source, flags);
55 32 5 if (temp.scheme_info) return temp.scheme_info->creator(temp);
32 0 if (temp.scheme_info) return temp.scheme_info->creator(temp);
56 5 0 else return new URI(temp);
5 0 else return new URI(temp);
60 1 0 if (source.scheme_info) return source.scheme_info->creator(source);
61 0 0 else return new URI(source);
65 614 0 URI (const string& s, int flags = 0) : scheme_info(NULL), _port(0), _qrev(1), _flags(flags) { parse(s); }
67 7 0 URI (const URI& s) { assign(s); }
76 0 0 string path_info () const { return _path ? decode_uri_component(_path) : string(); }
79 34 4 uint16_t default_port () const { return scheme_info ? scheme_info->default_port : 0; }
80 14 38 uint16_t port () const { return _port ? _port : default_port(); }
81 24 4 bool secure () const { return scheme_info ? scheme_info->secure : false; }
135 2 2 if (path && path.front() != '/') {
0 2 if (path && path.front() != '/') {
0 4 if (path && path.front() != '/') {
189 2 2 if (!_port) return _host;
194 14 0 string ret(_host.length() + 6); // port is 5 chars max
195 14 0 if (_host) ret += _host;
14 0 if (_host) ret += _host;
196 14 0 ret += ':';
197 14 0 char* buf = ret.buf(); // has exactly 5 bytes left
200 14 0 auto res = to_chars(ptr_start, buf + ret.capacity(), port());
14 0 auto res = to_chars(ptr_start, buf + ret.capacity(), port());
207 0 4 if (!newloc) {
214 0 4 if (delim == string::npos) _host.assign(newloc);
217 0 4 if (ipv6end != string::npos && ipv6end > delim) _host.assign(newloc);
0 0 if (ipv6end != string::npos && ipv6end > delim) _host.assign(newloc);
231 7 3 for (auto it = begin; it != end; ++it) {
232 1 6 if (!it->length()) continue;
233 6 0 _path += '/';
234 6 0 _encode_uri_component_append(*it, _path, URIComponent::path_segment);
244 7 0 if (_path != uri._path || _host != uri._host || _user_info != uri._user_info || _fragment != uri._fragment || _scheme != uri._scheme) return false;
7 0 if (_path != uri._path || _host != uri._host || _user_info != uri._user_info || _fragment != uri._fragment || _scheme != uri._scheme) return false;
7 0 if (_path != uri._path || _host != uri._host || _user_info != uri._user_info || _fragment != uri._fragment || _scheme != uri._scheme) return false;
7 0 if (_path != uri._path || _host != uri._host || _user_info != uri._user_info || _fragment != uri._fragment || _scheme != uri._scheme) return false;
0 7 if (_path != uri._path || _host != uri._host || _user_info != uri._user_info || _fragment != uri._fragment || _scheme != uri._scheme) return false;
0 7 if (_path != uri._path || _host != uri._host || _user_info != uri._user_info || _fragment != uri._fragment || _scheme != uri._scheme) return false;
245 0 7 if (_port != uri._port && port() != uri.port()) return false;
0 0 if (_port != uri._port && port() != uri.port()) return false;
0 7 if (_port != uri._port && port() != uri.port()) return false;
259 0 660 virtual ~URI () {}
285 134 39 bool has_ok_qstr () const { return !_qrev || _qrev == _query.rev; }
127 7 bool has_ok_qstr () const { return !_qrev || _qrev == _query.rev; }
307 7 166 void sync_query_string () const { if (!has_ok_qstr()) compile_query(); }
308 15 70 void sync_query () const { if (!has_ok_query()) parse_query(); }