Branch Coverage

xs/main.xs
Criterion Covered Total %
branch 75 204 36.7


line true false branch
21 0 5 if (query_cache) {
22 0 0 hash = query_cache.value();
23 0 0 hash.clear();
25 5 0 hash = Hash::create();
26 5 0 query_cache = Ref::create(hash);
29 5 0 auto end = uri->query().cend();
30 5 0 for (auto it = uri->query().cbegin(); it != end; ++it) hash.store(it->first, Simple(it->second));
15 5 for (auto it = uri->query().cbegin(); it != end; ++it) hash.store(it->first, Simple(it->second));
15 0 for (auto it = uri->query().cbegin(); it != end; ++it) hash.store(it->first, Simple(it->second));
15 0 for (auto it = uri->query().cbegin(); it != end; ++it) hash.store(it->first, Simple(it->second));
32 5 0 query_cache_rev = uri->query().rev;
36 1 5 if (!query_cache || query_cache_rev != uri->query().rev) sync_query_hash(uri);
0 1 if (!query_cache || query_cache_rev != uri->query().rev) sync_query_hash(uri);
5 1 if (!query_cache || query_cache_rev != uri->query().rev) sync_query_hash(uri);
46 118 0 uri_class_map[scheme] = Stash(perl_class);
50 19 0 auto it = uri_class_map.find(uri->scheme());
51 2 17 if (it == uri_class_map.end()) return Stash();
52 17 0 else return it->second;
57 136 0 Object(sv).payload_attach(data, &data_marker);
62 136 0 delete data;
71 0 5 if (val.is_array_ref()) {
72 0 0 Array arr = val;
73 0 0 if (replace) uri->query().erase(key);
0 0 if (replace) uri->query().erase(key);
0 0 if (replace) uri->query().erase(key);
74 0 0 auto end = arr.end();
75 0 0 for (auto it = arr.begin(); it != end; ++it) {
0 0 for (auto it = arr.begin(); it != end; ++it) {
76 0 0 if (!*it) continue;
0 0 if (!*it) continue;
77 0 0 uri->query().emplace(key, xs::in(*it));
0 0 uri->query().emplace(key, xs::in(*it));
0 0 uri->query().emplace(key, xs::in(*it));
0 0 uri->query().emplace(key, xs::in(*it));
80 1 4 else if (replace) uri->param(key, xs::in(val));
1 0 else if (replace) uri->param(key, xs::in(val));
81 4 0 else uri->query().emplace(key, xs::in(val));
4 0 else uri->query().emplace(key, xs::in(val));
86 2 0 for (auto it = hash.begin(); it != end; ++it) {
6 2 for (auto it = hash.begin(); it != end; ++it) {
87 6 0 string key(it->key());
88 6 0 auto val = it->value();
89 6 0 if (val.is_array_ref()) {
1 5 if (val.is_array_ref()) {
90 1 0 Array arr = val;
91 1 0 auto end = arr.end();
92 1 0 for (auto it = arr.begin(); it != end; ++it) {
3 1 for (auto it = arr.begin(); it != end; ++it) {
93 3 0 if (!*it) continue;
0 3 if (!*it) continue;
94 3 0 query->emplace(key, xs::in(*it));
3 0 query->emplace(key, xs::in(*it));
3 0 query->emplace(key, xs::in(*it));
97 5 0 else query->emplace(key, xs::in(val));
5 0 else query->emplace(key, xs::in(val));
102 2 1 if (replace) {
104 2 0 hash2query(hash, &query);
105 2 0 uri->query(query);
109 1 0 for (auto it = hash.begin(); it != end; ++it) add_param(uri, string(it->key()), it->value());
1 1 for (auto it = hash.begin(); it != end; ++it) add_param(uri, string(it->key()), it->value());
1 0 for (auto it = hash.begin(); it != end; ++it) add_param(uri, string(it->key()), it->value());
1 0 for (auto it = hash.begin(); it != end; ++it) add_param(uri, string(it->key()), it->value());
1 0 for (auto it = hash.begin(); it != end; ++it) add_param(uri, string(it->key()), it->value());
114 6 9 if (items == 1) {
115 3 3 if (SvROK(*sp)) {
116 3 0 Hash hash = *sp;
117 3 0 if (hash) add_query_hash(uri, hash, replace);
3 0 if (hash) add_query_hash(uri, hash, replace);
119 0 3 else if (replace) uri->query(xs::in(*sp));
0 0 else if (replace) uri->query(xs::in(*sp));
120 3 0 else uri->add_query(xs::in(*sp));
124 3 9 for (; sp < spe; sp += 2) add_param(uri, xs::in(*sp), *(sp+1), replace);
3 0 for (; sp < spe; sp += 2) add_param(uri, xs::in(*sp), *(sp+1), replace);
3 0 for (; sp < spe; sp += 2) add_param(uri, xs::in(*sp), *(sp+1), replace);
134 13 0 xs::at_perl_destroy([]{
136 13 0 });
141 19 0 }
144 1 0 register_perl_scheme(scheme, perl_class);
149 0 0 for (int i = 0; i < 1000; ++i) {
150 0 0 URI u(str, flags);
156 0 0 auto uri = URI(str);
157 0 0 printf("scheme=%s\n", uri.scheme().c_str());
0 0 printf("scheme=%s\n", uri.scheme().c_str());
158 0 0 printf("userinfo=%s\n", uri.user_info().c_str());
0 0 printf("userinfo=%s\n", uri.user_info().c_str());
159 0 0 printf("host=%s\n", uri.host().c_str());
0 0 printf("host=%s\n", uri.host().c_str());
160 0 0 printf("port=%d\n", uri.port());
161 0 0 printf("path=%s\n", uri.path().c_str());
0 0 printf("path=%s\n", uri.path().c_str());
162 0 0 printf("query=%s\n", uri.raw_query().c_str());
0 0 printf("query=%s\n", uri.raw_query().c_str());
0 0 printf("query=%s\n", uri.raw_query().c_str());
163 0 0 printf("fragment=%s\n", uri.fragment().c_str());
0 0 printf("fragment=%s\n", uri.fragment().c_str());
168 0 0 for (int i = 0; i < 1000; ++i) {
169 0 0 u.query_string(str);
170 0 0 u.query();
177 0 0 for (int i = 0; i < 1000; ++i) {
178 0 0 encode_uri_component(str, dest);
185 0 0 for (int i = 0; i < 1000; ++i) {
186 0 0 decode_uri_component(str, dest);