Branch Coverage

/usr/local/lib/perl5/site_perl/5.26.1/x86_64-linux/XS/libpanda.x/i/panda/basic_string.h
Criterion Covered Total %
branch 22 152 14.4


line true false branch
103 0 0 if (!mem) throw std::bad_alloc();
343 0 0 if (std::is_same::value && this == (void*)&source) return *this;
351 0 4 if (std::is_same::value && this == (void*)&source)
362 0 0 if (std::is_same::value && this == (void*)&source) return *this;
421 8 0 operator std::basic_string () const { return std::basic_string(_str, _length); }
474 0 0 if (offset > _length) throw std::out_of_range("basic_string::offset");
0 0 if (offset > _length) throw std::out_of_range("basic_string::offset");
475 0 0 if (length > _length - offset) _length = _length - offset;
549 0 4 if (pos > _length) throw std::out_of_range("basic_string::erase");
0 0 if (pos > _length) throw std::out_of_range("basic_string::erase");
551 0 4 if (count > _length - pos) { // remove trail
558 4 0 if (pos == 0) { // remove head
566 0 0 if (_storage.any->refcnt == 1) {
569 0 0 if (pos >= _length - pos) traits_type::move(_str + pos, _str + pos + count, _length - pos); // tail is shorter
683 0 3 if (pos >= _length) return npos;
685 2 1 if (ptr) return ptr - _str;
849 400 0 if (count) {
859 751 0 if (str._length) { // can't call append(const CharT*, size_type) because otherwise if &str == this a fuckup would occur
880 260 0 if (count) {
1006 0 0 if (this == &str) {
1007 0 0 const basic_string tmp(str);
1008 0 0 return replace(pos, remove_count, tmp._str, tmp._length);
1041 0 0 if (pos >= _length) {
1042 0 0 if (pos == _length) return append(s, insert_count);
1043 0 0 throw std::out_of_range("basic_string::replace");
1045 0 0 if (remove_count >= _length - pos) {
1049 0 0 if (insert_count == 0) {
1050 0 0 if (remove_count == 0) return *this;
1129 65 0 basic_string ret(maxsz);
1130 65 0 auto res = to_chars(ret._str, ret._str + maxsz, value, base);
1131 0 65 assert(!res.ec);
1154 0 0 if (capacity <= MAX_SSO_CHARS) {
1158 0 0 if (capacity > MAX_SIZE) throw std::length_error("basic_string::_new_auto");
0 0 if (capacity > MAX_SIZE) throw std::length_error("basic_string::_new_auto");
1182 0 0 if (pos) traits_type::copy(ibuf->start, _str, pos);
1239 0 0 if (offset > oth._length) throw std::out_of_range("basic_string::assign");
0 0 if (offset > oth._length) throw std::out_of_range("basic_string::assign");
1240 0 0 if (length > oth._length - offset) length = oth._length - offset;
1249 0 0 if (oth._state == State::SSO) _str = _sso + (oth._str - oth._sso);
1299 3 3 if (_storage.any->refcnt > 1) _detach_cow(_length);
1315 0 0 assert(capacity >= _length);
1326 0 0 if (capacity < _length) capacity = _length;
1336 0 0 if (_storage.internal->refcnt > 1) _detach_cow(capacity);
1337 0 0 else if (_storage.internal->capacity < capacity) _internal_realloc(capacity); // need to grow storage
1338 0 0 else if (_capacity_internal() < capacity) { // may not to grow storage if str is moved to the beginning
1347 0 0 if (_storage.dtor == &Alloc::deallocate && _str == _storage.internal->start) {
0 0 if (_storage.dtor == &Alloc::deallocate && _str == _storage.internal->start) {
1348 0 0 if (capacity > MAX_SIZE) throw std::length_error("basic_string::_internal_realloc");
0 0 if (capacity > MAX_SIZE) throw std::length_error("basic_string::_internal_realloc");
1363 0 0 if (_storage.external->refcnt > 1) _detach_cow(capacity);
1364 0 0 else if (_storage.external->capacity < capacity) _external_realloc(capacity); // need to grow storage, switch to INTERNAL/SSO
1365 0 0 else if (_capacity_external() < capacity) { // may not to grow storage if str is moved to the beginning
1381 0 0 if (MAX_SSO_CHARS < capacity) {
1385 0 0 else if (_capacity_sso() < capacity) {
1399 0 0 if (_storage.internal->refcnt > 1) {
1403 0 0 else if (newlen > _storage.internal->capacity) {
1412 0 0 if (_storage.external->refcnt > 1) {
1416 0 0 else if (newlen > _storage.external->capacity) {
1428 0 0 if (newlen > MAX_SSO_CHARS) _new_internal_from_sso(newlen, pos, remove_count, insert_count);
1439 0 0 if (pos) traits_type::copy(_str, old_str, pos);
1444 0 0 if (remove_count >= insert_count) {
1452 0 0 if (has_head_space && has_tail_space) { // move what is shorter
0 0 if (has_head_space && has_tail_space) { // move what is shorter
1453 0 0 if (pos > _length - pos - remove_count) { // tail is shorter
1456 0 0 if (pos) traits_type::move(_str - extra_count, _str, pos);
1460 0 0 else if (has_head_space) {
1461 0 0 if (pos) traits_type::move(_str - extra_count, _str, pos);
1464 0 0 else if (has_tail_space) {
1468 0 0 if (pos) traits_type::move(ptr_start, _str, pos);
1492 0 0 static void _release_internal (Buffer* buf, dtor_fn dtor) { if (!--buf->refcnt) _free_internal(buf, dtor); }
1493 0 0 static void _release_external (ExternalShared* ebuf, dtor_fn dtor) { if (!--ebuf->refcnt) _free_external(ebuf, dtor); }
1502 168 67 if (!r) r = (len1 < len2) ? -1 : (len1 > len2 ? 1 : 0);
155 13 if (!r) r = (len1 < len2) ? -1 : (len1 > len2 ? 1 : 0);
10 145 if (!r) r = (len1 < len2) ? -1 : (len1 > len2 ? 1 : 0);
1569 0 0 if (llen == 0) return rhs;
1570 0 0 if (rhs.length() == 0) return basic_string(lhs, llen);