Coverage report for dbus/dbus-string-util.c.gcov

        -:    0:Source:dbus-string-util.c
        -:    0:Graph:.libs/dbus-string-util.gcno
        -:    0:Data:.libs/dbus-string-util.gcda
        -:    0:Runs:10868
        -:    0:Programs:3
        -:    1:/* -*- mode: C; c-file-style: "gnu" -*- */
        -:    2:/* dbus-string-util.c Would be in dbus-string.c, but not used in libdbus
        -:    3: * 
        -:    4: * Copyright (C) 2002, 2003, 2004, 2005 Red Hat, Inc.
        -:    5: *
        -:    6: * Licensed under the Academic Free License version 2.1
        -:    7: * 
        -:    8: * This program is free software; you can redistribute it and/or modify
        -:    9: * it under the terms of the GNU General Public License as published by
        -:   10: * the Free Software Foundation; either version 2 of the License, or
        -:   11: * (at your option) any later version.
        -:   12: *
        -:   13: * This program is distributed in the hope that it will be useful,
        -:   14: * but WITHOUT ANY WARRANTY; without even the implied warranty of
        -:   15: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
        -:   16: * GNU General Public License for more details.
        -:   17: * 
        -:   18: * You should have received a copy of the GNU General Public License
        -:   19: * along with this program; if not, write to the Free Software
        -:   20: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
        -:   21: *
        -:   22: */
        -:   23:
        -:   24:#include "dbus-internals.h"
        -:   25:#include "dbus-string.h"
        -:   26:#define DBUS_CAN_USE_DBUS_STRING_PRIVATE 1
        -:   27:#include "dbus-string-private.h"
        -:   28:
        -:   29:/**
        -:   30: * @addtogroup DBusString
        -:   31: * @{
        -:   32: */
        -:   33:
        -:   34:/**
        -:   35: * Returns whether a string ends with the given suffix
        -:   36: *
        -:   37: * @todo memcmp might make this faster.
        -:   38: * 
        -:   39: * @param a the string
        -:   40: * @param c_str the C-style string
        -:   41: * @returns #TRUE if the string ends with the suffix
        -:   42: */
        -:   43:dbus_bool_t
        -:   44:_dbus_string_ends_with_c_str (const DBusString *a,
        -:   45:                              const char       *c_str)
function _dbus_string_ends_with_c_str called 111809 returned 100% blocks executed 100%
   111809:   46:{
        -:   47:  const unsigned char *ap;
        -:   48:  const unsigned char *bp;
        -:   49:  const unsigned char *a_end;
        -:   50:  unsigned long c_str_len;
   111809:   51:  const DBusRealString *real_a = (const DBusRealString*) a;
   111809:   52:  DBUS_GENERIC_STRING_PREAMBLE (real_a);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
call    3 returned 100%
call    4 returned 100%
call    5 returned 100%
call    6 returned 100%
   111809:   53:  _dbus_assert (c_str != NULL);
call    0 returned 100%
        -:   54:  
   111809:   55:  c_str_len = strlen (c_str);
call    0 returned 100%
   111809:   56:  if (((unsigned long)real_a->len) < c_str_len)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
      507:   57:    return FALSE;
        -:   58:  
   111302:   59:  ap = real_a->str + (real_a->len - c_str_len);
   111302:   60:  bp = (const unsigned char*) c_str;
   111302:   61:  a_end = real_a->str + real_a->len;
   770496:   62:  while (ap != a_end)
branch  0 taken 84%
branch  1 taken 16% (fallthrough)
        -:   63:    {
   551524:   64:      if (*ap != *bp)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
     3632:   65:        return FALSE;
        -:   66:      
   547892:   67:      ++ap;
   547892:   68:      ++bp;
        -:   69:    }
        -:   70:
   107670:   71:  _dbus_assert (*ap == '\0');
call    0 returned 100%
   107670:   72:  _dbus_assert (*bp == '\0');
call    0 returned 100%
        -:   73:  
   107670:   74:  return TRUE;
        -:   75:}
        -:   76:
        -:   77:/**
        -:   78: * Find the given byte scanning backward from the given start.
        -:   79: * Sets *found to -1 if the byte is not found.
        -:   80: *
        -:   81: * @param str the string
        -:   82: * @param start the place to start scanning (will not find the byte at this point)
        -:   83: * @param byte the byte to find
        -:   84: * @param found return location for where it was found
        -:   85: * @returns #TRUE if found
        -:   86: */
        -:   87:dbus_bool_t
        -:   88:_dbus_string_find_byte_backward (const DBusString  *str,
        -:   89:                                 int                start,
        -:   90:                                 unsigned char      byte,
        -:   91:                                 int               *found)
function _dbus_string_find_byte_backward called 65 returned 100% blocks executed 100%
       65:   92:{
        -:   93:  int i;
       65:   94:  DBUS_CONST_STRING_PREAMBLE (str);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
call    3 returned 100%
call    4 returned 100%
call    5 returned 100%
call    6 returned 100%
       65:   95:  _dbus_assert (start <= real->len);
call    0 returned 100%
       65:   96:  _dbus_assert (start >= 0);
call    0 returned 100%
       65:   97:  _dbus_assert (found != NULL);
call    0 returned 100%
        -:   98:
       65:   99:  i = start - 1;
      867:  100:  while (i >= 0)
branch  0 taken 99%
branch  1 taken 1% (fallthrough)
        -:  101:    {
      799:  102:      if (real->str[i] == byte)
branch  0 taken 8% (fallthrough)
branch  1 taken 92%
       62:  103:        break;
        -:  104:      
      737:  105:      --i;
        -:  106:    }
        -:  107:
       65:  108:  if (found)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
       65:  109:    *found = i;
        -:  110:
       65:  111:  return i >= 0;
        -:  112:}
        -:  113:
        -:  114:/**
        -:  115: * Skips whitespace from start, storing the first non-whitespace in *end.
        -:  116: * (whitespace is space, tab, newline, CR).
        -:  117: *
        -:  118: * @param str the string
        -:  119: * @param start where to start
        -:  120: * @param end where to store the first non-whitespace byte index
        -:  121: */
        -:  122:void
        -:  123:_dbus_string_skip_white (const DBusString *str,
        -:  124:                         int               start,
        -:  125:                         int              *end)
function _dbus_string_skip_white called 289 returned 100% blocks executed 77%
      289:  126:{
        -:  127:  int i;
      289:  128:  DBUS_CONST_STRING_PREAMBLE (str);
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
call    3 returned 100%
call    4 returned 100%
call    5 returned 100%
call    6 returned 100%
      289:  129:  _dbus_assert (start <= real->len);
call    0 returned 100%
      289:  130:  _dbus_assert (start >= 0);
call    0 returned 100%
        -:  131:  
      289:  132:  i = start;
     1811:  133:  while (i < real->len)
branch  0 taken 81%
branch  1 taken 19% (fallthrough)
        -:  134:    {
     1233:  135:      if (!(real->str[i] == ' ' ||
branch  0 taken 29% (fallthrough)
branch  1 taken 71%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
branch  4 never executed
branch  5 never executed
branch  6 never executed
branch  7 never executed
        -:  136:            real->str[i] == '\n' ||
        -:  137:            real->str[i] == '\r' ||
        -:  138:            real->str[i] == '\t'))
    #####:  139:        break;
        -:  140:      
     1233:  141:      ++i;
        -:  142:    }
        -:  143:
      289:  144:  _dbus_assert (i == real->len || !(real->str[i] == ' ' ||
branch  0 taken 0% (fallthrough)
branch  1 taken 100%
branch  2 never executed
branch  3 never executed
branch  4 never executed
branch  5 never executed
call    6 returned 100%
        -:  145:                                    real->str[i] == '\t'));
        -:  146:  
      289:  147:  if (end)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
      289:  148:    *end = i;
      289:  149:}
        -:  150:
        -:  151:/** @} */
        -:  152:
        -:  153:#ifdef DBUS_BUILD_TESTS
        -:  154:#include "dbus-test.h"
        -:  155:#include <stdio.h>
        -:  156:
        -:  157:static void
        -:  158:test_max_len (DBusString *str,
        -:  159:              int         max_len)
function test_max_len called 35 returned 100% blocks executed 71%
       35:  160:{
       35:  161:  if (max_len > 0)
branch  0 taken 97% (fallthrough)
branch  1 taken 3%
        -:  162:    {
       34:  163:      if (!_dbus_string_set_length (str, max_len - 1))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  164:        _dbus_assert_not_reached ("setting len to one less than max should have worked");
call    0 never executed
        -:  165:    }
        -:  166:
       35:  167:  if (!_dbus_string_set_length (str, max_len))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  168:    _dbus_assert_not_reached ("setting len to max len should have worked");
call    0 never executed
        -:  169:
       35:  170:  if (_dbus_string_set_length (str, max_len + 1))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  171:    _dbus_assert_not_reached ("setting len to one more than max len should not have worked");
call    0 never executed
        -:  172:
       35:  173:  if (!_dbus_string_set_length (str, 0))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  174:    _dbus_assert_not_reached ("setting len to zero should have worked");
call    0 never executed
       35:  175:}
        -:  176:
        -:  177:static void
        -:  178:test_hex_roundtrip (const unsigned char *data,
        -:  179:                    int                  len)
function test_hex_roundtrip called 530 returned 100% blocks executed 62%
      530:  180:{
        -:  181:  DBusString orig;
        -:  182:  DBusString encoded;
        -:  183:  DBusString decoded;
        -:  184:  int end;
        -:  185:
      530:  186:  if (len < 0)
branch  0 taken 1% (fallthrough)
branch  1 taken 99%
        6:  187:    len = strlen (data);
call    0 returned 100%
        -:  188:  
      530:  189:  if (!_dbus_string_init (&orig))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  190:    _dbus_assert_not_reached ("could not init string");
call    0 never executed
        -:  191:
      530:  192:  if (!_dbus_string_init (&encoded))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  193:    _dbus_assert_not_reached ("could not init string");
call    0 never executed
        -:  194:  
      530:  195:  if (!_dbus_string_init (&decoded))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  196:    _dbus_assert_not_reached ("could not init string");
call    0 never executed
        -:  197:
      530:  198:  if (!_dbus_string_append_len (&orig, data, len))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  199:    _dbus_assert_not_reached ("couldn't append orig data");
call    0 never executed
        -:  200:
      530:  201:  if (!_dbus_string_hex_encode (&orig, 0, &encoded, 0))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  202:    _dbus_assert_not_reached ("could not encode");
call    0 never executed
        -:  203:
      530:  204:  if (!_dbus_string_hex_decode (&encoded, 0, &end, &decoded, 0))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  205:    _dbus_assert_not_reached ("could not decode");
call    0 never executed
        -:  206:    
      530:  207:  _dbus_assert (_dbus_string_get_length (&encoded) == end);
call    0 returned 100%
call    1 returned 100%
        -:  208:
      530:  209:  if (!_dbus_string_equal (&orig, &decoded))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
        -:  210:    {
        -:  211:      const char *s;
        -:  212:      
    #####:  213:      printf ("Original string %d bytes encoded %d bytes decoded %d bytes\n",
call    0 never executed
call    1 never executed
call    2 never executed
call    3 never executed
        -:  214:              _dbus_string_get_length (&orig),
        -:  215:              _dbus_string_get_length (&encoded),
        -:  216:              _dbus_string_get_length (&decoded));
    #####:  217:      printf ("Original: %s\n", data);
call    0 never executed
    #####:  218:      s = _dbus_string_get_const_data (&decoded);
call    0 never executed
    #####:  219:      printf ("Decoded: %s\n", s);
call    0 never executed
    #####:  220:      _dbus_assert_not_reached ("original string not the same as string decoded from hex");
call    0 never executed
        -:  221:    }
        -:  222:  
      530:  223:  _dbus_string_free (&orig);
call    0 returned 100%
      530:  224:  _dbus_string_free (&encoded);
call    0 returned 100%
      530:  225:  _dbus_string_free (&decoded);  
call    0 returned 100%
      530:  226:}
        -:  227:
        -:  228:typedef void (* TestRoundtripFunc) (const unsigned char *data,
        -:  229:                                    int                  len);
        -:  230:static void
        -:  231:test_roundtrips (TestRoundtripFunc func)
function test_roundtrips called 1 returned 100% blocks executed 100%
        1:  232:{
        1:  233:  (* func) ("Hello this is a string\n", -1);
call    0 returned 100%
        1:  234:  (* func) ("Hello this is a string\n1", -1);
call    0 returned 100%
        1:  235:  (* func) ("Hello this is a string\n12", -1);
call    0 returned 100%
        1:  236:  (* func) ("Hello this is a string\n123", -1);
call    0 returned 100%
        1:  237:  (* func) ("Hello this is a string\n1234", -1);
call    0 returned 100%
        1:  238:  (* func) ("Hello this is a string\n12345", -1);
call    0 returned 100%
        1:  239:  (* func) ("", 0);
call    0 returned 100%
        1:  240:  (* func) ("1", 1);
call    0 returned 100%
        1:  241:  (* func) ("12", 2);
call    0 returned 100%
        1:  242:  (* func) ("123", 3);
call    0 returned 100%
        1:  243:  (* func) ("1234", 4);
call    0 returned 100%
        1:  244:  (* func) ("12345", 5);
call    0 returned 100%
        1:  245:  (* func) ("", 1);
call    0 returned 100%
        1:  246:  (* func) ("1", 2);
call    0 returned 100%
        1:  247:  (* func) ("12", 3);
call    0 returned 100%
        1:  248:  (* func) ("123", 4);
call    0 returned 100%
        1:  249:  (* func) ("1234", 5);
call    0 returned 100%
        1:  250:  (* func) ("12345", 6);
call    0 returned 100%
        -:  251:  {
        -:  252:    unsigned char buf[512];
        -:  253:    int i;
        -:  254:    
        1:  255:    i = 0;
      514:  256:    while (i < _DBUS_N_ELEMENTS (buf))
branch  0 taken 99%
branch  1 taken 1% (fallthrough)
        -:  257:      {
      512:  258:        buf[i] = i;
      512:  259:        ++i;
        -:  260:      }
        1:  261:    i = 0;
      514:  262:    while (i < _DBUS_N_ELEMENTS (buf))
branch  0 taken 99%
branch  1 taken 1% (fallthrough)
        -:  263:      {
      512:  264:        (* func) (buf, i);
call    0 returned 100%
      512:  265:        ++i;
        -:  266:      }
        -:  267:  }
        1:  268:}
        -:  269:
        -:  270:#ifdef DBUS_BUILD_TESTS
        -:  271:/* The max length thing is sort of a historical artifact
        -:  272: * from a feature that turned out to be dumb; perhaps
        -:  273: * we should purge it entirely. The problem with
        -:  274: * the feature is that it looks like memory allocation
        -:  275: * failure, but is not a transient or resolvable failure.
        -:  276: */
        -:  277:static void
        -:  278:set_max_length (DBusString *str,
        -:  279:                int         max_length)
function set_max_length called 70 returned 100% blocks executed 100%
       70:  280:{
        -:  281:  DBusRealString *real;
        -:  282:  
       70:  283:  real = (DBusRealString*) str;
        -:  284:
       70:  285:  real->max_length = max_length;
       70:  286:}
        -:  287:#endif /* DBUS_BUILD_TESTS */
        -:  288:
        -:  289:/**
        -:  290: * @ingroup DBusStringInternals
        -:  291: * Unit test for DBusString.
        -:  292: *
        -:  293: * @todo Need to write tests for _dbus_string_copy() and
        -:  294: * _dbus_string_move() moving to/from each of start/middle/end of a
        -:  295: * string. Also need tests for _dbus_string_move_len ()
        -:  296: * 
        -:  297: * @returns #TRUE on success.
        -:  298: */
        -:  299:dbus_bool_t
        -:  300:_dbus_string_test (void)
function _dbus_string_test called 1 returned 100% blocks executed 84%
        1:  301:{
        -:  302:  DBusString str;
        -:  303:  DBusString other;
        -:  304:  int i, end;
        -:  305:  long v;
        -:  306:  double d;
        1:  307:  int lens[] = { 0, 1, 2, 3, 4, 5, 10, 16, 17, 18, 25, 31, 32, 33, 34, 35, 63, 64, 65, 66, 67, 68, 69, 70, 71, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136 };
        -:  308:  char *s;
        -:  309:  dbus_unichar_t ch;
        -:  310:  
        1:  311:  i = 0;
       37:  312:  while (i < _DBUS_N_ELEMENTS (lens))
branch  0 taken 97%
branch  1 taken 3% (fallthrough)
        -:  313:    {
       35:  314:      if (!_dbus_string_init (&str))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  315:        _dbus_assert_not_reached ("failed to init string");
call    0 never executed
        -:  316:
       35:  317:      set_max_length (&str, lens[i]);
call    0 returned 100%
        -:  318:      
       35:  319:      test_max_len (&str, lens[i]);
call    0 returned 100%
       35:  320:      _dbus_string_free (&str);
call    0 returned 100%
        -:  321:
       35:  322:      ++i;
        -:  323:    }
        -:  324:
        -:  325:  /* Test shortening and setting length */
        1:  326:  i = 0;
       37:  327:  while (i < _DBUS_N_ELEMENTS (lens))
branch  0 taken 97%
branch  1 taken 3% (fallthrough)
        -:  328:    {
        -:  329:      int j;
        -:  330:      
       35:  331:      if (!_dbus_string_init (&str))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  332:        _dbus_assert_not_reached ("failed to init string");
call    0 never executed
        -:  333:
       35:  334:      set_max_length (&str, lens[i]);
call    0 returned 100%
        -:  335:      
       35:  336:      if (!_dbus_string_set_length (&str, lens[i]))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  337:        _dbus_assert_not_reached ("failed to set string length");
call    0 never executed
        -:  338:
       35:  339:      j = lens[i];
     2254:  340:      while (j > 0)
branch  0 taken 98%
branch  1 taken 2% (fallthrough)
        -:  341:        {
     2184:  342:          _dbus_assert (_dbus_string_get_length (&str) == j);
call    0 returned 100%
call    1 returned 100%
     2184:  343:          if (j > 0)
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
        -:  344:            {
     2184:  345:              _dbus_string_shorten (&str, 1);
call    0 returned 100%
     2184:  346:              _dbus_assert (_dbus_string_get_length (&str) == (j - 1));
call    0 returned 100%
call    1 returned 100%
        -:  347:            }
     2184:  348:          --j;
        -:  349:        }
        -:  350:      
       35:  351:      _dbus_string_free (&str);
call    0 returned 100%
        -:  352:
       35:  353:      ++i;
        -:  354:    }
        -:  355:
        -:  356:  /* Test equality */
        1:  357:  if (!_dbus_string_init (&str))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  358:    _dbus_assert_not_reached ("oom");
call    0 never executed
        -:  359:
        1:  360:  if (!_dbus_string_append (&str, "Hello World"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  361:    _dbus_assert_not_reached ("oom");
call    0 never executed
        -:  362:
        1:  363:  _dbus_string_init_const (&other, "H");
call    0 returned 100%
        1:  364:  _dbus_assert (_dbus_string_equal_substring (&str, 0, 1, &other, 0));
call    0 returned 100%
call    1 returned 100%
        1:  365:  _dbus_assert (_dbus_string_equal_substring (&str, 1, 0, &other, 1));
call    0 returned 100%
call    1 returned 100%
        1:  366:  _dbus_string_init_const (&other, "Hello");
call    0 returned 100%
        1:  367:  _dbus_assert (_dbus_string_equal_substring (&str, 0, 5, &other, 0));
call    0 returned 100%
call    1 returned 100%
        1:  368:  _dbus_assert (_dbus_string_equal_substring (&str, 1, 4, &other, 1));
call    0 returned 100%
call    1 returned 100%
        1:  369:  _dbus_assert (_dbus_string_equal_substring (&str, 2, 3, &other, 2));
call    0 returned 100%
call    1 returned 100%
        1:  370:  _dbus_assert (_dbus_string_equal_substring (&str, 3, 2, &other, 3));
call    0 returned 100%
call    1 returned 100%
        1:  371:  _dbus_assert (_dbus_string_equal_substring (&str, 4, 1, &other, 4));
call    0 returned 100%
call    1 returned 100%
        1:  372:  _dbus_assert (_dbus_string_equal_substring (&str, 5, 0, &other, 5));
call    0 returned 100%
call    1 returned 100%
        -:  373:
        1:  374:  _dbus_assert (_dbus_string_equal_substring (&other, 0, 5, &str, 0));
call    0 returned 100%
call    1 returned 100%
        1:  375:  _dbus_assert (_dbus_string_equal_substring (&other, 1, 4, &str, 1));
call    0 returned 100%
call    1 returned 100%
        1:  376:  _dbus_assert (_dbus_string_equal_substring (&other, 2, 3, &str, 2));
call    0 returned 100%
call    1 returned 100%
        1:  377:  _dbus_assert (_dbus_string_equal_substring (&other, 3, 2, &str, 3));
call    0 returned 100%
call    1 returned 100%
        1:  378:  _dbus_assert (_dbus_string_equal_substring (&other, 4, 1, &str, 4));
call    0 returned 100%
call    1 returned 100%
        1:  379:  _dbus_assert (_dbus_string_equal_substring (&other, 5, 0, &str, 5));
call    0 returned 100%
call    1 returned 100%
        -:  380:
        -:  381:  
        1:  382:  _dbus_string_init_const (&other, "World");
call    0 returned 100%
        1:  383:  _dbus_assert (_dbus_string_equal_substring (&str, 6,  5, &other, 0));
call    0 returned 100%
call    1 returned 100%
        1:  384:  _dbus_assert (_dbus_string_equal_substring (&str, 7,  4, &other, 1));
call    0 returned 100%
call    1 returned 100%
        1:  385:  _dbus_assert (_dbus_string_equal_substring (&str, 8,  3, &other, 2));
call    0 returned 100%
call    1 returned 100%
        1:  386:  _dbus_assert (_dbus_string_equal_substring (&str, 9,  2, &other, 3));
call    0 returned 100%
call    1 returned 100%
        1:  387:  _dbus_assert (_dbus_string_equal_substring (&str, 10, 1, &other, 4));
call    0 returned 100%
call    1 returned 100%
        1:  388:  _dbus_assert (_dbus_string_equal_substring (&str, 11, 0, &other, 5));
call    0 returned 100%
call    1 returned 100%
        -:  389:
        1:  390:  _dbus_assert (_dbus_string_equal_substring (&other, 0, 5, &str, 6));
call    0 returned 100%
call    1 returned 100%
        1:  391:  _dbus_assert (_dbus_string_equal_substring (&other, 1, 4, &str, 7));
call    0 returned 100%
call    1 returned 100%
        1:  392:  _dbus_assert (_dbus_string_equal_substring (&other, 2, 3, &str, 8));
call    0 returned 100%
call    1 returned 100%
        1:  393:  _dbus_assert (_dbus_string_equal_substring (&other, 3, 2, &str, 9));
call    0 returned 100%
call    1 returned 100%
        1:  394:  _dbus_assert (_dbus_string_equal_substring (&other, 4, 1, &str, 10));
call    0 returned 100%
call    1 returned 100%
        1:  395:  _dbus_assert (_dbus_string_equal_substring (&other, 5, 0, &str, 11));
call    0 returned 100%
call    1 returned 100%
        -:  396:  
        1:  397:  _dbus_string_free (&str);
call    0 returned 100%
        -:  398:  
        -:  399:  /* Test appending data */
        1:  400:  if (!_dbus_string_init (&str))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  401:    _dbus_assert_not_reached ("failed to init string");
call    0 never executed
        -:  402:
        1:  403:  i = 0;
       12:  404:  while (i < 10)
branch  0 taken 91%
branch  1 taken 9% (fallthrough)
        -:  405:    {
       10:  406:      if (!_dbus_string_append (&str, "a"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  407:        _dbus_assert_not_reached ("failed to append string to string\n");
call    0 never executed
        -:  408:
       10:  409:      _dbus_assert (_dbus_string_get_length (&str) == i * 2 + 1);
call    0 returned 100%
call    1 returned 100%
        -:  410:
       10:  411:      if (!_dbus_string_append_byte (&str, 'b'))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  412:        _dbus_assert_not_reached ("failed to append byte to string\n");
call    0 never executed
        -:  413:
       10:  414:      _dbus_assert (_dbus_string_get_length (&str) == i * 2 + 2);
call    0 returned 100%
call    1 returned 100%
        -:  415:                    
       10:  416:      ++i;
        -:  417:    }
        -:  418:
        1:  419:  _dbus_string_free (&str);
call    0 returned 100%
        -:  420:
        -:  421:  /* Check steal_data */
        -:  422:  
        1:  423:  if (!_dbus_string_init (&str))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  424:    _dbus_assert_not_reached ("failed to init string");
call    0 never executed
        -:  425:
        1:  426:  if (!_dbus_string_append (&str, "Hello World"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  427:    _dbus_assert_not_reached ("could not append to string");
call    0 never executed
        -:  428:
        1:  429:  i = _dbus_string_get_length (&str);
call    0 returned 100%
        -:  430:  
        1:  431:  if (!_dbus_string_steal_data (&str, &s))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  432:    _dbus_assert_not_reached ("failed to steal data");
call    0 never executed
        -:  433:
        1:  434:  _dbus_assert (_dbus_string_get_length (&str) == 0);
call    0 returned 100%
call    1 returned 100%
        1:  435:  _dbus_assert (((int)strlen (s)) == i);
call    0 returned 100%
call    1 returned 100%
        -:  436:
        1:  437:  dbus_free (s);
call    0 returned 100%
        -:  438:
        -:  439:  /* Check move */
        -:  440:  
        1:  441:  if (!_dbus_string_append (&str, "Hello World"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  442:    _dbus_assert_not_reached ("could not append to string");
call    0 never executed
        -:  443:
        1:  444:  i = _dbus_string_get_length (&str);
call    0 returned 100%
        -:  445:
        1:  446:  if (!_dbus_string_init (&other))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  447:    _dbus_assert_not_reached ("could not init string");
call    0 never executed
        -:  448:  
        1:  449:  if (!_dbus_string_move (&str, 0, &other, 0))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  450:    _dbus_assert_not_reached ("could not move");
call    0 never executed
        -:  451:
        1:  452:  _dbus_assert (_dbus_string_get_length (&str) == 0);
call    0 returned 100%
call    1 returned 100%
        1:  453:  _dbus_assert (_dbus_string_get_length (&other) == i);
call    0 returned 100%
call    1 returned 100%
        -:  454:
        1:  455:  if (!_dbus_string_append (&str, "Hello World"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  456:    _dbus_assert_not_reached ("could not append to string");
call    0 never executed
        -:  457:  
        1:  458:  if (!_dbus_string_move (&str, 0, &other, _dbus_string_get_length (&other)))
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
    #####:  459:    _dbus_assert_not_reached ("could not move");
call    0 never executed
        -:  460:
        1:  461:  _dbus_assert (_dbus_string_get_length (&str) == 0);
call    0 returned 100%
call    1 returned 100%
        1:  462:  _dbus_assert (_dbus_string_get_length (&other) == i * 2);
call    0 returned 100%
call    1 returned 100%
        -:  463:
        1:  464:    if (!_dbus_string_append (&str, "Hello World"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  465:    _dbus_assert_not_reached ("could not append to string");
call    0 never executed
        -:  466:  
        1:  467:  if (!_dbus_string_move (&str, 0, &other, _dbus_string_get_length (&other) / 2))
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
    #####:  468:    _dbus_assert_not_reached ("could not move");
call    0 never executed
        -:  469:
        1:  470:  _dbus_assert (_dbus_string_get_length (&str) == 0);
call    0 returned 100%
call    1 returned 100%
        1:  471:  _dbus_assert (_dbus_string_get_length (&other) == i * 3);
call    0 returned 100%
call    1 returned 100%
        -:  472:  
        1:  473:  _dbus_string_free (&other);
call    0 returned 100%
        -:  474:
        -:  475:  /* Check copy */
        -:  476:  
        1:  477:  if (!_dbus_string_append (&str, "Hello World"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  478:    _dbus_assert_not_reached ("could not append to string");
call    0 never executed
        -:  479:
        1:  480:  i = _dbus_string_get_length (&str);
call    0 returned 100%
        -:  481:  
        1:  482:  if (!_dbus_string_init (&other))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  483:    _dbus_assert_not_reached ("could not init string");
call    0 never executed
        -:  484:  
        1:  485:  if (!_dbus_string_copy (&str, 0, &other, 0))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  486:    _dbus_assert_not_reached ("could not copy");
call    0 never executed
        -:  487:
        1:  488:  _dbus_assert (_dbus_string_get_length (&str) == i);
call    0 returned 100%
call    1 returned 100%
        1:  489:  _dbus_assert (_dbus_string_get_length (&other) == i);
call    0 returned 100%
call    1 returned 100%
        -:  490:
        1:  491:  if (!_dbus_string_copy (&str, 0, &other, _dbus_string_get_length (&other)))
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
    #####:  492:    _dbus_assert_not_reached ("could not copy");
call    0 never executed
        -:  493:
        1:  494:  _dbus_assert (_dbus_string_get_length (&str) == i);
call    0 returned 100%
call    1 returned 100%
        1:  495:  _dbus_assert (_dbus_string_get_length (&other) == i * 2);
call    0 returned 100%
call    1 returned 100%
        1:  496:  _dbus_assert (_dbus_string_equal_c_str (&other,
call    0 returned 100%
call    1 returned 100%
        -:  497:                                          "Hello WorldHello World"));
        -:  498:
        1:  499:  if (!_dbus_string_copy (&str, 0, &other, _dbus_string_get_length (&other) / 2))
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
    #####:  500:    _dbus_assert_not_reached ("could not copy");
call    0 never executed
        -:  501:
        1:  502:  _dbus_assert (_dbus_string_get_length (&str) == i);
call    0 returned 100%
call    1 returned 100%
        1:  503:  _dbus_assert (_dbus_string_get_length (&other) == i * 3);
call    0 returned 100%
call    1 returned 100%
        1:  504:  _dbus_assert (_dbus_string_equal_c_str (&other,
call    0 returned 100%
call    1 returned 100%
        -:  505:                                          "Hello WorldHello WorldHello World"));
        -:  506:  
        1:  507:  _dbus_string_free (&str);
call    0 returned 100%
        1:  508:  _dbus_string_free (&other);
call    0 returned 100%
        -:  509:
        -:  510:  /* Check replace */
        -:  511:
        1:  512:  if (!_dbus_string_init (&str))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  513:    _dbus_assert_not_reached ("failed to init string");
call    0 never executed
        -:  514:  
        1:  515:  if (!_dbus_string_append (&str, "Hello World"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  516:    _dbus_assert_not_reached ("could not append to string");
call    0 never executed
        -:  517:
        1:  518:  i = _dbus_string_get_length (&str);
call    0 returned 100%
        -:  519:  
        1:  520:  if (!_dbus_string_init (&other))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  521:    _dbus_assert_not_reached ("could not init string");
call    0 never executed
        -:  522:  
        1:  523:  if (!_dbus_string_replace_len (&str, 0, _dbus_string_get_length (&str),
call    0 returned 100%
call    1 returned 100%
call    2 returned 100%
branch  3 taken 0% (fallthrough)
branch  4 taken 100%
        -:  524:                                 &other, 0, _dbus_string_get_length (&other)))
    #####:  525:    _dbus_assert_not_reached ("could not replace");
call    0 never executed
        -:  526:
        1:  527:  _dbus_assert (_dbus_string_get_length (&str) == i);
call    0 returned 100%
call    1 returned 100%
        1:  528:  _dbus_assert (_dbus_string_get_length (&other) == i);
call    0 returned 100%
call    1 returned 100%
        1:  529:  _dbus_assert (_dbus_string_equal_c_str (&other, "Hello World"));
call    0 returned 100%
call    1 returned 100%
        -:  530:  
        1:  531:  if (!_dbus_string_replace_len (&str, 0, _dbus_string_get_length (&str),
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
        -:  532:                                 &other, 5, 1))
    #####:  533:    _dbus_assert_not_reached ("could not replace center space");
call    0 never executed
        -:  534:
        1:  535:  _dbus_assert (_dbus_string_get_length (&str) == i);
call    0 returned 100%
call    1 returned 100%
        1:  536:  _dbus_assert (_dbus_string_get_length (&other) == i * 2 - 1);
call    0 returned 100%
call    1 returned 100%
        1:  537:  _dbus_assert (_dbus_string_equal_c_str (&other,
call    0 returned 100%
call    1 returned 100%
        -:  538:                                          "HelloHello WorldWorld"));
        -:  539:
        -:  540:  
        1:  541:  if (!_dbus_string_replace_len (&str, 1, 1,
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
        -:  542:                                 &other,
        -:  543:                                 _dbus_string_get_length (&other) - 1,
        -:  544:                                 1))
    #####:  545:    _dbus_assert_not_reached ("could not replace end character");
call    0 never executed
        -:  546:  
        1:  547:  _dbus_assert (_dbus_string_get_length (&str) == i);
call    0 returned 100%
call    1 returned 100%
        1:  548:  _dbus_assert (_dbus_string_get_length (&other) == i * 2 - 1);
call    0 returned 100%
call    1 returned 100%
        1:  549:  _dbus_assert (_dbus_string_equal_c_str (&other,
call    0 returned 100%
call    1 returned 100%
        -:  550:                                          "HelloHello WorldWorle"));
        -:  551:  
        1:  552:  _dbus_string_free (&str);
call    0 returned 100%
        1:  553:  _dbus_string_free (&other);
call    0 returned 100%
        -:  554:  
        -:  555:  /* Check append/get unichar */
        -:  556:  
        1:  557:  if (!_dbus_string_init (&str))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  558:    _dbus_assert_not_reached ("failed to init string");
call    0 never executed
        -:  559:
        1:  560:  ch = 0;
        1:  561:  if (!_dbus_string_append_unichar (&str, 0xfffc))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  562:    _dbus_assert_not_reached ("failed to append unichar");
call    0 never executed
        -:  563:
        1:  564:  _dbus_string_get_unichar (&str, 0, &ch, &i);
call    0 returned 100%
        -:  565:
        1:  566:  _dbus_assert (ch == 0xfffc);
call    0 returned 100%
        1:  567:  _dbus_assert (i == _dbus_string_get_length (&str));
call    0 returned 100%
call    1 returned 100%
        -:  568:
        1:  569:  _dbus_string_free (&str);
call    0 returned 100%
        -:  570:
        -:  571:  /* Check insert/set/get byte */
        -:  572:  
        1:  573:  if (!_dbus_string_init (&str))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  574:    _dbus_assert_not_reached ("failed to init string");
call    0 never executed
        -:  575:
        1:  576:  if (!_dbus_string_append (&str, "Hello"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  577:    _dbus_assert_not_reached ("failed to append Hello");
call    0 never executed
        -:  578:
        1:  579:  _dbus_assert (_dbus_string_get_byte (&str, 0) == 'H');
call    0 returned 100%
call    1 returned 100%
        1:  580:  _dbus_assert (_dbus_string_get_byte (&str, 1) == 'e');
call    0 returned 100%
call    1 returned 100%
        1:  581:  _dbus_assert (_dbus_string_get_byte (&str, 2) == 'l');
call    0 returned 100%
call    1 returned 100%
        1:  582:  _dbus_assert (_dbus_string_get_byte (&str, 3) == 'l');
call    0 returned 100%
call    1 returned 100%
        1:  583:  _dbus_assert (_dbus_string_get_byte (&str, 4) == 'o');
call    0 returned 100%
call    1 returned 100%
        -:  584:
        1:  585:  _dbus_string_set_byte (&str, 1, 'q');
call    0 returned 100%
        1:  586:  _dbus_assert (_dbus_string_get_byte (&str, 1) == 'q');
call    0 returned 100%
call    1 returned 100%
        -:  587:
        1:  588:  if (!_dbus_string_insert_bytes (&str, 0, 1, 255))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  589:    _dbus_assert_not_reached ("can't insert byte");
call    0 never executed
        -:  590:
        1:  591:  if (!_dbus_string_insert_bytes (&str, 2, 4, 'Z'))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  592:    _dbus_assert_not_reached ("can't insert byte");
call    0 never executed
        -:  593:
        1:  594:  if (!_dbus_string_insert_bytes (&str, _dbus_string_get_length (&str), 1, 'W'))
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
    #####:  595:    _dbus_assert_not_reached ("can't insert byte");
call    0 never executed
        -:  596:  
        1:  597:  _dbus_assert (_dbus_string_get_byte (&str, 0) == 255);
call    0 returned 100%
call    1 returned 100%
        1:  598:  _dbus_assert (_dbus_string_get_byte (&str, 1) == 'H');
call    0 returned 100%
call    1 returned 100%
        1:  599:  _dbus_assert (_dbus_string_get_byte (&str, 2) == 'Z');
call    0 returned 100%
call    1 returned 100%
        1:  600:  _dbus_assert (_dbus_string_get_byte (&str, 3) == 'Z');
call    0 returned 100%
call    1 returned 100%
        1:  601:  _dbus_assert (_dbus_string_get_byte (&str, 4) == 'Z');
call    0 returned 100%
call    1 returned 100%
        1:  602:  _dbus_assert (_dbus_string_get_byte (&str, 5) == 'Z');
call    0 returned 100%
call    1 returned 100%
        1:  603:  _dbus_assert (_dbus_string_get_byte (&str, 6) == 'q');
call    0 returned 100%
call    1 returned 100%
        1:  604:  _dbus_assert (_dbus_string_get_byte (&str, 7) == 'l');
call    0 returned 100%
call    1 returned 100%
        1:  605:  _dbus_assert (_dbus_string_get_byte (&str, 8) == 'l');
call    0 returned 100%
call    1 returned 100%
        1:  606:  _dbus_assert (_dbus_string_get_byte (&str, 9) == 'o');
call    0 returned 100%
call    1 returned 100%
        1:  607:  _dbus_assert (_dbus_string_get_byte (&str, 10) == 'W');
call    0 returned 100%
call    1 returned 100%
        -:  608:
        1:  609:  _dbus_string_free (&str);
call    0 returned 100%
        -:  610:  
        -:  611:  /* Check append/parse int/double */
        -:  612:  
        1:  613:  if (!_dbus_string_init (&str))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  614:    _dbus_assert_not_reached ("failed to init string");
call    0 never executed
        -:  615:
        1:  616:  if (!_dbus_string_append_int (&str, 27))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  617:    _dbus_assert_not_reached ("failed to append int");
call    0 never executed
        -:  618:
        1:  619:  i = _dbus_string_get_length (&str);
call    0 returned 100%
        -:  620:
        1:  621:  if (!_dbus_string_parse_int (&str, 0, &v, &end))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  622:    _dbus_assert_not_reached ("failed to parse int");
call    0 never executed
        -:  623:
        1:  624:  _dbus_assert (v == 27);
call    0 returned 100%
        1:  625:  _dbus_assert (end == i);
call    0 returned 100%
        -:  626:
        1:  627:  _dbus_string_free (&str);
call    0 returned 100%
        -:  628:  
        1:  629:  if (!_dbus_string_init (&str))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  630:    _dbus_assert_not_reached ("failed to init string");
call    0 never executed
        -:  631:  
        1:  632:  if (!_dbus_string_append_double (&str, 50.3))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  633:    _dbus_assert_not_reached ("failed to append float");
call    0 never executed
        -:  634:
        1:  635:  i = _dbus_string_get_length (&str);
call    0 returned 100%
        -:  636:
        1:  637:  if (!_dbus_string_parse_double (&str, 0, &d, &end))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  638:    _dbus_assert_not_reached ("failed to parse float");
call    0 never executed
        -:  639:
        1:  640:  _dbus_assert (d > (50.3 - 1e-6) && d < (50.3 + 1e-6));
branch  0 taken 100% (fallthrough)
branch  1 taken 0%
branch  2 taken 100% (fallthrough)
branch  3 taken 0%
call    4 returned 100%
        1:  641:  _dbus_assert (end == i);
call    0 returned 100%
        -:  642:
        1:  643:  _dbus_string_free (&str);
call    0 returned 100%
        -:  644:
        -:  645:  /* Test find */
        1:  646:  if (!_dbus_string_init (&str))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  647:    _dbus_assert_not_reached ("failed to init string");
call    0 never executed
        -:  648:
        1:  649:  if (!_dbus_string_append (&str, "Hello"))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  650:    _dbus_assert_not_reached ("couldn't append to string");
call    0 never executed
        -:  651:  
        1:  652:  if (!_dbus_string_find (&str, 0, "He", &i))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  653:    _dbus_assert_not_reached ("didn't find 'He'");
call    0 never executed
        1:  654:  _dbus_assert (i == 0);
call    0 returned 100%
        -:  655:
        1:  656:  if (!_dbus_string_find (&str, 0, "Hello", &i))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  657:    _dbus_assert_not_reached ("didn't find 'Hello'");
call    0 never executed
        1:  658:  _dbus_assert (i == 0);
call    0 returned 100%
        -:  659:  
        1:  660:  if (!_dbus_string_find (&str, 0, "ello", &i))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  661:    _dbus_assert_not_reached ("didn't find 'ello'");
call    0 never executed
        1:  662:  _dbus_assert (i == 1);
call    0 returned 100%
        -:  663:
        1:  664:  if (!_dbus_string_find (&str, 0, "lo", &i))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  665:    _dbus_assert_not_reached ("didn't find 'lo'");
call    0 never executed
        1:  666:  _dbus_assert (i == 3);
call    0 returned 100%
        -:  667:
        1:  668:  if (!_dbus_string_find (&str, 2, "lo", &i))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  669:    _dbus_assert_not_reached ("didn't find 'lo'");
call    0 never executed
        1:  670:  _dbus_assert (i == 3);
call    0 returned 100%
        -:  671:
        1:  672:  if (_dbus_string_find (&str, 4, "lo", &i))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  673:    _dbus_assert_not_reached ("did find 'lo'");
call    0 never executed
        -:  674:  
        1:  675:  if (!_dbus_string_find (&str, 0, "l", &i))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  676:    _dbus_assert_not_reached ("didn't find 'l'");
call    0 never executed
        1:  677:  _dbus_assert (i == 2);
call    0 returned 100%
        -:  678:
        1:  679:  if (!_dbus_string_find (&str, 0, "H", &i))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  680:    _dbus_assert_not_reached ("didn't find 'H'");
call    0 never executed
        1:  681:  _dbus_assert (i == 0);
call    0 returned 100%
        -:  682:
        1:  683:  if (!_dbus_string_find (&str, 0, "", &i))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  684:    _dbus_assert_not_reached ("didn't find ''");
call    0 never executed
        1:  685:  _dbus_assert (i == 0);
call    0 returned 100%
        -:  686:  
        1:  687:  if (_dbus_string_find (&str, 0, "Hello!", NULL))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  688:    _dbus_assert_not_reached ("Did find 'Hello!'");
call    0 never executed
        -:  689:
        1:  690:  if (_dbus_string_find (&str, 0, "Oh, Hello", NULL))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  691:    _dbus_assert_not_reached ("Did find 'Oh, Hello'");
call    0 never executed
        -:  692:  
        1:  693:  if (_dbus_string_find (&str, 0, "ill", NULL))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  694:    _dbus_assert_not_reached ("Did find 'ill'");
call    0 never executed
        -:  695:
        1:  696:  if (_dbus_string_find (&str, 0, "q", NULL))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  697:    _dbus_assert_not_reached ("Did find 'q'");
call    0 never executed
        -:  698:
        1:  699:  if (!_dbus_string_find_to (&str, 0, 2, "He", NULL))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  700:    _dbus_assert_not_reached ("Didn't find 'He'");
call    0 never executed
        -:  701:
        1:  702:  if (_dbus_string_find_to (&str, 0, 2, "Hello", NULL))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  703:    _dbus_assert_not_reached ("Did find 'Hello'");
call    0 never executed
        -:  704:
        1:  705:  if (!_dbus_string_find_byte_backward (&str, _dbus_string_get_length (&str), 'H', &i))
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
    #####:  706:    _dbus_assert_not_reached ("Did not find 'H'");
call    0 never executed
        1:  707:  _dbus_assert (i == 0);
call    0 returned 100%
        -:  708:
        1:  709:  if (!_dbus_string_find_byte_backward (&str, _dbus_string_get_length (&str), 'o', &i))
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
    #####:  710:    _dbus_assert_not_reached ("Did not find 'o'");
call    0 never executed
        1:  711:  _dbus_assert (i == _dbus_string_get_length (&str) - 1);
call    0 returned 100%
call    1 returned 100%
        -:  712:
        1:  713:  if (_dbus_string_find_byte_backward (&str, _dbus_string_get_length (&str) - 1, 'o', &i))
call    0 returned 100%
call    1 returned 100%
branch  2 taken 0% (fallthrough)
branch  3 taken 100%
    #####:  714:    _dbus_assert_not_reached ("Did find 'o'");
call    0 never executed
        1:  715:  _dbus_assert (i == -1);
call    0 returned 100%
        -:  716:
        1:  717:  if (_dbus_string_find_byte_backward (&str, 1, 'e', &i))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  718:    _dbus_assert_not_reached ("Did find 'e'");
call    0 never executed
        1:  719:  _dbus_assert (i == -1);
call    0 returned 100%
        -:  720:
        1:  721:  if (!_dbus_string_find_byte_backward (&str, 2, 'e', &i))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  722:    _dbus_assert_not_reached ("Didn't find 'e'");
call    0 never executed
        1:  723:  _dbus_assert (i == 1);
call    0 returned 100%
        -:  724:  
        1:  725:  _dbus_string_free (&str);
call    0 returned 100%
        -:  726:
        -:  727:  /* Hex encoding */
        1:  728:  _dbus_string_init_const (&str, "cafebabe, this is a bogus hex string");
call    0 returned 100%
        1:  729:  if (!_dbus_string_init (&other))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  730:    _dbus_assert_not_reached ("could not init string");
call    0 never executed
        -:  731:
        1:  732:  if (!_dbus_string_hex_decode (&str, 0, &end, &other, 0))
call    0 returned 100%
branch  1 taken 0% (fallthrough)
branch  2 taken 100%
    #####:  733:    _dbus_assert_not_reached ("deccoded bogus hex string with no error");
call    0 never executed
        -:  734:
        1:  735:  _dbus_assert (end == 8);
call    0 returned 100%
        -:  736:
        1:  737:  _dbus_string_free (&other);
call    0 returned 100%
        -:  738:
        1:  739:  test_roundtrips (test_hex_roundtrip);
call    0 returned 100%
        -:  740:  
        1:  741:  _dbus_string_free (&str);
call    0 returned 100%
        -:  742:  
        1:  743:  return TRUE;
        -:  744:}
        -:  745:
        -:  746:#endif /* DBUS_BUILD_TESTS */