Branch Coverage

src/panda/from_chars.cc
Criterion Covered Total %
branch 254 346 73.4


line true false branch
12 4608 18 for (auto& val : _index) val = 255;
13 180 18 for (int i = 0; i <= 9; ++i) _index['0' + i] = i;
14 468 18 for (int i = 0; i <= 25; ++i) _index['a' + i] = i+10;
15 468 18 for (int i = 0; i <= 25; ++i) _index['A' + i] = i+10;
16 180 18 for (int i = 0; i <= 9; ++i) _rindex[i] = '0' + i;
17 468 18 for (int i = 0; i <= 25; ++i) _rindex[i + 10] = 'a' + i;
42 0 0 for (; ptr != end; ++ptr) {
1724 230 for (; ptr != end; ++ptr) {
200 29 for (; ptr != end; ++ptr) {
145 29 for (; ptr != end; ++ptr) {
123 29 for (; ptr != end; ++ptr) {
45 0 0 if (val >= base) break;
23 1701 if (val >= base) break;
17 183 if (val >= base) break;
17 128 if (val >= base) break;
17 106 if (val >= base) break;
46 0 0 if (res > maxmp) { overflow = true; res = max; break; }
4 1697 if (res > maxmp) { overflow = true; res = max; break; }
4 179 if (res > maxmp) { overflow = true; res = max; break; }
4 124 if (res > maxmp) { overflow = true; res = max; break; }
4 102 if (res > maxmp) { overflow = true; res = max; break; }
48 0 0 if (val > (UT)(max - res)) { overflow = true; res = max; break; }
4 1693 if (val > (UT)(max - res)) { overflow = true; res = max; break; }
4 175 if (val > (UT)(max - res)) { overflow = true; res = max; break; }
4 120 if (val > (UT)(max - res)) { overflow = true; res = max; break; }
4 98 if (val > (UT)(max - res)) { overflow = true; res = max; break; }
52 0 0 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
0 0 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
0 0 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
8 253 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
167 8 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
0 167 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
8 46 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
204 8 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
0 204 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
8 46 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
224 8 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
0 224 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
8 46 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
232 8 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
0 232 if (overflow) for (; ptr != end; ++ptr) if ((sizeof(UC) > 1 && *ptr > 255) || _index[*ptr] >= base) break; // move to the end of the number
62 0 0 if (base < 2 || base > 36) base = 10;
0 0 if (base < 2 || base > 36) base = 10;
228 2 if (base < 2 || base > 36) base = 10;
1 227 if (base < 2 || base > 36) base = 10;
21 2 if (base < 2 || base > 36) base = 10;
1 20 if (base < 2 || base > 36) base = 10;
21 2 if (base < 2 || base > 36) base = 10;
1 20 if (base < 2 || base > 36) base = 10;
21 2 if (base < 2 || base > 36) base = 10;
1 20 if (base < 2 || base > 36) base = 10;
64 0 0 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
0 0 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
0 0 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
246 1 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
17 229 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
17 230 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
35 1 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
13 22 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
13 23 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
35 1 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
13 22 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
13 23 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
35 1 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
13 22 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
13 23 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
70 0 0 if (ptr - tmp == 0) return {s, make_error_code(std::errc::invalid_argument)};
7 223 if (ptr - tmp == 0) return {s, make_error_code(std::errc::invalid_argument)};
6 17 if (ptr - tmp == 0) return {s, make_error_code(std::errc::invalid_argument)};
6 17 if (ptr - tmp == 0) return {s, make_error_code(std::errc::invalid_argument)};
6 17 if (ptr - tmp == 0) return {s, make_error_code(std::errc::invalid_argument)};
71 0 0 if (overflow) return {(const C*)ptr, make_error_code(std::errc::result_out_of_range)};
2 221 if (overflow) return {(const C*)ptr, make_error_code(std::errc::result_out_of_range)};
2 15 if (overflow) return {(const C*)ptr, make_error_code(std::errc::result_out_of_range)};
2 15 if (overflow) return {(const C*)ptr, make_error_code(std::errc::result_out_of_range)};
2 15 if (overflow) return {(const C*)ptr, make_error_code(std::errc::result_out_of_range)};
81 0 0 if (base < 2 || base > 36) base = 10;
0 0 if (base < 2 || base > 36) base = 10;
29 2 if (base < 2 || base > 36) base = 10;
1 28 if (base < 2 || base > 36) base = 10;
29 2 if (base < 2 || base > 36) base = 10;
1 28 if (base < 2 || base > 36) base = 10;
29 2 if (base < 2 || base > 36) base = 10;
1 28 if (base < 2 || base > 36) base = 10;
29 2 if (base < 2 || base > 36) base = 10;
1 28 if (base < 2 || base > 36) base = 10;
83 0 0 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
0 0 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
0 0 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
57 1 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
27 30 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
27 31 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
57 1 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
27 30 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
27 31 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
57 1 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
27 30 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
27 31 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
57 1 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
27 30 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
27 31 while (ptr != end && _is_space(*ptr)) ++ptr; // skip whitespaces in the beginning
86 0 0 if (ptr != end && *ptr == '-') { ++ptr; minus = true; }
0 0 if (ptr != end && *ptr == '-') { ++ptr; minus = true; }
30 1 if (ptr != end && *ptr == '-') { ++ptr; minus = true; }
12 18 if (ptr != end && *ptr == '-') { ++ptr; minus = true; }
30 1 if (ptr != end && *ptr == '-') { ++ptr; minus = true; }
12 18 if (ptr != end && *ptr == '-') { ++ptr; minus = true; }
30 1 if (ptr != end && *ptr == '-') { ++ptr; minus = true; }
12 18 if (ptr != end && *ptr == '-') { ++ptr; minus = true; }
30 1 if (ptr != end && *ptr == '-') { ++ptr; minus = true; }
12 18 if (ptr != end && *ptr == '-') { ++ptr; minus = true; }
90 0 0 if (minus) {
12 19 if (minus) {
12 19 if (minus) {
12 19 if (minus) {
12 19 if (minus) {
98 0 0 if (ptr - tmp == 0) return {s, make_error_code(std::errc::invalid_argument)};
4 27 if (ptr - tmp == 0) return {s, make_error_code(std::errc::invalid_argument)};
4 27 if (ptr - tmp == 0) return {s, make_error_code(std::errc::invalid_argument)};
4 27 if (ptr - tmp == 0) return {s, make_error_code(std::errc::invalid_argument)};
4 27 if (ptr - tmp == 0) return {s, make_error_code(std::errc::invalid_argument)};
99 0 0 if (overflow) return {(const C*)ptr, make_error_code(std::errc::result_out_of_range)};
6 21 if (overflow) return {(const C*)ptr, make_error_code(std::errc::result_out_of_range)};
6 21 if (overflow) return {(const C*)ptr, make_error_code(std::errc::result_out_of_range)};
6 21 if (overflow) return {(const C*)ptr, make_error_code(std::errc::result_out_of_range)};
6 21 if (overflow) return {(const C*)ptr, make_error_code(std::errc::result_out_of_range)};
116 0 0 do {
0 0 do {
23 6 do {
22 6 do {
13 6 do {
15 9 do {
8 6 do {
8 6 do {
6 6 do {
6 6 do {
125 0 0 if (base < 2 || base > 36) base = 10;
0 0 if (base < 2 || base > 36) base = 10;
6 0 if (base < 2 || base > 36) base = 10;
0 6 if (base < 2 || base > 36) base = 10;
6 0 if (base < 2 || base > 36) base = 10;
0 6 if (base < 2 || base > 36) base = 10;
6 0 if (base < 2 || base > 36) base = 10;
0 6 if (base < 2 || base > 36) base = 10;
6 0 if (base < 2 || base > 36) base = 10;
0 6 if (base < 2 || base > 36) base = 10;
131 0 0 if (dend - d < len) return {dend, make_error_code(std::errc::value_too_large)};
1 5 if (dend - d < len) return {dend, make_error_code(std::errc::value_too_large)};
1 5 if (dend - d < len) return {dend, make_error_code(std::errc::value_too_large)};
1 5 if (dend - d < len) return {dend, make_error_code(std::errc::value_too_large)};
1 5 if (dend - d < len) return {dend, make_error_code(std::errc::value_too_large)};
139 0 0 if (base < 2 || base > 36) base = 10;
0 0 if (base < 2 || base > 36) base = 10;
6 0 if (base < 2 || base > 36) base = 10;
0 6 if (base < 2 || base > 36) base = 10;
9 0 if (base < 2 || base > 36) base = 10;
0 9 if (base < 2 || base > 36) base = 10;
6 0 if (base < 2 || base > 36) base = 10;
0 6 if (base < 2 || base > 36) base = 10;
6 0 if (base < 2 || base > 36) base = 10;
0 6 if (base < 2 || base > 36) base = 10;
145 0 0 if (value >= 0) begin = _compile(end, value, base);
6 0 if (value >= 0) begin = _compile(end, value, base);
9 0 if (value >= 0) begin = _compile(end, value, base);
6 0 if (value >= 0) begin = _compile(end, value, base);
6 0 if (value >= 0) begin = _compile(end, value, base);
153 0 0 if (dend - d < len) return {dend, make_error_code(std::errc::value_too_large)};
1 5 if (dend - d < len) return {dend, make_error_code(std::errc::value_too_large)};
1 8 if (dend - d < len) return {dend, make_error_code(std::errc::value_too_large)};
1 5 if (dend - d < len) return {dend, make_error_code(std::errc::value_too_large)};
1 5 if (dend - d < len) return {dend, make_error_code(std::errc::value_too_large)};
169 18 0 }
18 0 }