Branch Coverage

src/panda/time/tzparse.cc
Criterion Covered Total %
branch 95 124 76.6


line true false branch
112 0 1251 if (bodyV1_size == -1) return false;
115 1251 0 if (version >= 2) {
117 0 1251 if (tzparse_headerV2(ptr, end, head, &version) == -1) return false;
118 1251 0 result = tzparse_bodyV2(ptr, end, head, zone);
120 0 0 result = tzparse_bodyV1(ptr, end, head, zone);
132 4 1323 if (tzparse_rule_abbrev(rulestr, rule->outer.abbrev) != ParseResult::OK) return false;
133 6 1317 if (tzparse_rule_time(rulestr, &rule->outer.gmt_offset) != ParseResult::OK) return false;
138 1 1316 if ((result = tzparse_rule_abbrev(rulestr, rule->inner.abbrev)) == ParseResult::ERROR) return false;
139 836 480 if (result == ParseResult::ABSENT) return *rulestr == '\0';
141 0 480 if ((result = tzparse_rule_time(rulestr, &rule->inner.gmt_offset)) == ParseResult::ERROR) return false;
142 470 10 if (result == ParseResult::ABSENT) rule->inner.gmt_offset = rule->outer.gmt_offset + 3600;
144 478 2 if (*rulestr == ',') {
149 11 467 if (tzparse_rule_switch(rulestr, &rule->outer.type, &rule->outer.end) != ParseResult::OK) return false;
150 1 466 if (*rulestr != ',') return false;
152 3 463 if (tzparse_rule_switch(rulestr, &rule->inner.type, &rule->inner.end) != ParseResult::OK) return false;
154 459 4 if (rule->outer.type != Timezone::Rule::Zone::Switch::DATE || rule->inner.type != Timezone::Rule::Zone::Switch::DATE) {
0 459 if (rule->outer.type != Timezone::Rule::Zone::Switch::DATE || rule->inner.type != Timezone::Rule::Zone::Switch::DATE) {
158 72 387 else if (rule->outer.end.mon > rule->inner.end.mon) {
172 2082 0 while (*str && *str != '>') str++;
1581 501 while (*str && *str != '>') str++;
173 0 501 if (*str != '>') return ParseResult::ERROR;
177 5501 842 while ((c = *str) && !isdigit(c) && c != ',' && c != '+' && c != '-') str++;
5026 475 while ((c = *str) && !isdigit(c) && c != ',' && c != '+' && c != '-') str++;
4596 430 while ((c = *str) && !isdigit(c) && c != ',' && c != '+' && c != '-') str++;
4593 3 while ((c = *str) && !isdigit(c) && c != ',' && c != '+' && c != '-') str++;
4202 391 while ((c = *str) && !isdigit(c) && c != ',' && c != '+' && c != '-') str++;
4202 2141 while ((c = *str) && !isdigit(c) && c != ',' && c != '+' && c != '-') str++;
181 501 2141 if (*str == '>') str++;
183 836 1806 if (!len) return ParseResult::ABSENT;
184 3 1803 if (len < ZONE_ABBR_MIN) return ParseResult::ERROR;
195 476 1666 if (str == st) return ParseResult::ABSENT;
196 858 808 int sign = (*dest >= 0 ? 1 : -1);
197 80 1586 if (*str == ':') {
200 3 77 if (str == st) return ParseResult::ERROR;
201 16 61 if (*str == ':') {
204 3 13 if (str == st) return ParseResult::ERROR;
215 934 10 if (*str == 'M') {
219 934 0 if (st == str || swdate->mon < 0 || swdate->mon > 11 || *str != '.') return ParseResult::ERROR;
934 0 if (st == str || swdate->mon < 0 || swdate->mon > 11 || *str != '.') return ParseResult::ERROR;
934 0 if (st == str || swdate->mon < 0 || swdate->mon > 11 || *str != '.') return ParseResult::ERROR;
0 934 if (st == str || swdate->mon < 0 || swdate->mon > 11 || *str != '.') return ParseResult::ERROR;
222 934 0 if (st == str || swdate->yday < 1 || swdate->yday > 5 || *str != '.') return ParseResult::ERROR;
931 3 if (st == str || swdate->yday < 1 || swdate->yday > 5 || *str != '.') return ParseResult::ERROR;
930 1 if (st == str || swdate->yday < 1 || swdate->yday > 5 || *str != '.') return ParseResult::ERROR;
0 930 if (st == str || swdate->yday < 1 || swdate->yday > 5 || *str != '.') return ParseResult::ERROR;
225 930 0 if (st == str || swdate->wday < 0 || swdate->wday > 6) return ParseResult::ERROR;
929 1 if (st == str || swdate->wday < 0 || swdate->wday > 6) return ParseResult::ERROR;
1 928 if (st == str || swdate->wday < 0 || swdate->wday > 6) return ParseResult::ERROR;
227 8 2 else if (*str == 'J') {
231 8 0 if (st == str || swdate->yday < 1 || swdate->yday > 365) return ParseResult::ERROR;
8 0 if (st == str || swdate->yday < 1 || swdate->yday > 365) return ParseResult::ERROR;
0 8 if (st == str || swdate->yday < 1 || swdate->yday > 365) return ParseResult::ERROR;
235 0 2 if (st == str || swdate->yday < 0 || swdate->yday > 365) return ParseResult::ERROR;
0 0 if (st == str || swdate->yday < 0 || swdate->yday > 365) return ParseResult::ERROR;
0 0 if (st == str || swdate->yday < 0 || swdate->yday > 365) return ParseResult::ERROR;
238 339 597 if (*str == '/') {
241 6 333 if (tzparse_rule_time(str, &when) != ParseResult::OK) return ParseResult::ERROR;
243 333 0 if (when < -604799 || when > 604799) return ParseResult::ERROR;
0 333 if (when < -604799 || when > 604799) return ParseResult::ERROR;
244 328 5 int sign = when >= 0 ? 1 : -1;
262 26 0 }};
26 0 }};