Branch Coverage

src/panda/basic_string.h
Criterion Covered Total %
branch 4 68 5.8


line true false branch
103 0 0 if (!mem) throw std::bad_alloc();
444 0 0 case State::INTERNAL: return _storage.internal->refcnt == 1 ? _capacity_internal() : 0;
445 0 0 case State::EXTERNAL: return _storage.external->refcnt == 1 ? _capacity_external() : 0;
880 0 0 if (count) {
1137 0 0 if (_state == State::LITERAL) return _str; // LITERALs are NT
1138 0 0 if (shared_capacity() > _length && _str[_length] == 0) return _str; // if we have r/o space after string, let's see if it's already NT
0 0 if (shared_capacity() > _length && _str[_length] == 0) return _str; // if we have r/o space after string, let's see if it's already NT
0 0 if (shared_capacity() > _length && _str[_length] == 0) return _str; // if we have r/o space after string, let's see if it's already NT
1140 0 0 if (capacity() <= _length) const_cast(this)->_reserve_save(_length + 1); // we're in COW mode or don't have space
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");
1249 0 0 if (oth._state == State::SSO) _str = _sso + (oth._str - oth._sso);
1309 0 0 assert(capacity >= _length);
1320 0 0 if (capacity < _length) capacity = _length;
1330 0 0 if (_storage.internal->refcnt > 1) _detach_cow(capacity);
1331 0 0 else if (_storage.internal->capacity < capacity) _internal_realloc(capacity); // need to grow storage
1332 0 0 else if (_capacity_internal() < capacity) { // may not to grow storage if str is moved to the beginning
1341 0 0 if (_storage.dtor == &Alloc::deallocate && _str == _storage.internal->start) {
0 0 if (_storage.dtor == &Alloc::deallocate && _str == _storage.internal->start) {
1342 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");
1357 0 0 if (_storage.external->refcnt > 1) _detach_cow(capacity);
1358 0 0 else if (_storage.external->capacity < capacity) _external_realloc(capacity); // need to grow storage, switch to INTERNAL/SSO
1359 0 0 else if (_capacity_external() < capacity) { // may not to grow storage if str is moved to the beginning
1375 0 0 if (MAX_SSO_CHARS < capacity) {
1379 0 0 else if (_capacity_sso() < capacity) {
1486 0 0 static void _release_internal (Buffer* buf, dtor_fn dtor) { if (!--buf->refcnt) _free_internal(buf, dtor); }
1487 0 0 static void _release_external (ExternalShared* ebuf, dtor_fn dtor) { if (!--ebuf->refcnt) _free_external(ebuf, dtor); }
1496 88 3 if (!r) r = (len1 < len2) ? -1 : (len1 > len2 ? 1 : 0);
88 0 if (!r) r = (len1 < len2) ? -1 : (len1 > len2 ? 1 : 0);
0 88 if (!r) r = (len1 < len2) ? -1 : (len1 > len2 ? 1 : 0);
1563 0 0 if (llen == 0) return rhs;
1564 0 0 if (rhs.length() == 0) return basic_string(lhs, llen);