Coverage report for dbus/dbus-marshal-byteswap-util.c.gcov
-: 0:Source:dbus-marshal-byteswap-util.c
-: 0:Graph:.libs/dbus-marshal-byteswap-util.gcno
-: 0:Data:.libs/dbus-marshal-byteswap-util.gcda
-: 0:Runs:768
-: 0:Programs:1
-: 1:/* -*- mode: C; c-file-style: "gnu" -*- */
-: 2:/* dbus-marshal-byteswap-util.c Would be in dbus-marshal-byteswap.c but tests/bus only
-: 3: *
-: 4: * Copyright (C) 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 <config.h>
-: 25:
-: 26:#ifdef DBUS_BUILD_TESTS
-: 27:#include "dbus-marshal-byteswap.h"
-: 28:#include "dbus-test.h"
-: 29:#include <stdio.h>
-: 30:
-: 31:static void
-: 32:do_byteswap_test (int byte_order)
function do_byteswap_test called 2 returned 100% blocks executed 71%
2: 33:{
-: 34: int sequence;
-: 35: DBusString signature;
-: 36: DBusString body;
-: 37: int opposite_order;
-: 38:
2: 39: if (!_dbus_string_init (&signature) || !_dbus_string_init (&body))
call 0 returned 100%
branch 1 taken 100% (fallthrough)
branch 2 taken 0%
call 3 returned 100%
branch 4 taken 0% (fallthrough)
branch 5 taken 100%
#####: 40: _dbus_assert_not_reached ("oom");
call 0 never executed
-: 41:
2: 42: opposite_order = byte_order == DBUS_LITTLE_ENDIAN ? DBUS_BIG_ENDIAN : DBUS_LITTLE_ENDIAN;
branch 0 taken 50% (fallthrough)
branch 1 taken 50%
-: 43:
2: 44: sequence = 0;
244: 45: while (dbus_internal_do_not_use_generate_bodies (sequence,
call 0 returned 100%
branch 1 taken 99%
branch 2 taken 1% (fallthrough)
-: 46: byte_order,
-: 47: &signature, &body))
-: 48: {
-: 49: DBusString copy;
-: 50: DBusTypeReader body_reader;
-: 51: DBusTypeReader copy_reader;
-: 52:
240: 53: if (!_dbus_string_init (©))
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
#####: 54: _dbus_assert_not_reached ("oom");
call 0 never executed
-: 55:
240: 56: if (!_dbus_string_copy (&body, 0, ©, 0))
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
#####: 57: _dbus_assert_not_reached ("oom");
call 0 never executed
-: 58:
240: 59: _dbus_marshal_byteswap (&signature, 0,
call 0 returned 100%
-: 60: byte_order,
-: 61: opposite_order,
-: 62: ©, 0);
-: 63:
240: 64: _dbus_type_reader_init (&body_reader, byte_order, &signature, 0,
call 0 returned 100%
-: 65: &body, 0);
240: 66: _dbus_type_reader_init (©_reader, opposite_order, &signature, 0,
call 0 returned 100%
-: 67: ©, 0);
-: 68:
240: 69: if (!_dbus_type_reader_equal_values (&body_reader, ©_reader))
call 0 returned 100%
branch 1 taken 0% (fallthrough)
branch 2 taken 100%
-: 70: {
#####: 71: _dbus_verbose_bytes_of_string (&signature, 0,
call 0 never executed
call 1 never executed
-: 72: _dbus_string_get_length (&signature));
#####: 73: _dbus_verbose_bytes_of_string (&body, 0,
call 0 never executed
call 1 never executed
-: 74: _dbus_string_get_length (&body));
#####: 75: _dbus_verbose_bytes_of_string (©, 0,
call 0 never executed
call 1 never executed
-: 76: _dbus_string_get_length (©));
-: 77:
#####: 78: _dbus_warn ("Byte-swapped data did not have same values as original data\n");
call 0 never executed
#####: 79: _dbus_assert_not_reached ("test failed");
call 0 never executed
-: 80: }
-: 81:
240: 82: _dbus_string_free (©);
call 0 returned 100%
-: 83:
240: 84: _dbus_string_set_length (&signature, 0);
call 0 returned 100%
240: 85: _dbus_string_set_length (&body, 0);
call 0 returned 100%
240: 86: ++sequence;
-: 87: }
-: 88:
2: 89: _dbus_string_free (&signature);
call 0 returned 100%
2: 90: _dbus_string_free (&body);
call 0 returned 100%
-: 91:
2: 92: printf (" %d blocks swapped from order '%c' to '%c'\n",
call 0 returned 100%
-: 93: sequence, byte_order, opposite_order);
2: 94:}
-: 95:
-: 96:dbus_bool_t
-: 97:_dbus_marshal_byteswap_test (void)
function _dbus_marshal_byteswap_test called 1 returned 100% blocks executed 100%
1: 98:{
1: 99: do_byteswap_test (DBUS_LITTLE_ENDIAN);
call 0 returned 100%
1: 100: do_byteswap_test (DBUS_BIG_ENDIAN);
call 0 returned 100%
-: 101:
1: 102: return TRUE;
-: 103:}
-: 104:
-: 105:#endif /* DBUS_BUILD_TESTS */