D-Bus: dbus-test-tap.h Source File

D-Bus 1.14.6

dbus-test-tap.h
1/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */
2/* dbus-test-tap — TAP helpers for "embedded tests"
3 *
4 * Copyright © 2017 Collabora Ltd.
5 *
6 * Permission is hereby granted, free of charge, to any person
7 * obtaining a copy of this software and associated documentation files
8 * (the "Software"), to deal in the Software without restriction,
9 * including without limitation the rights to use, copy, modify, merge,
10 * publish, distribute, sublicense, and/or sell copies of the Software,
11 * and to permit persons to whom the Software is furnished to do so,
12 * subject to the following conditions:
13 *
14 * The above copyright notice and this permission notice shall be
15 * included in all copies or substantial portions of the Software.
16 *
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
21 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
22 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
23 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24 * SOFTWARE.
25 */
26
27#ifndef DBUS_TEST_TAP_H
28#define DBUS_TEST_TAP_H
29
30#include <dbus/dbus-internals.h>
31
32DBUS_EMBEDDED_TESTS_EXPORT
33void _dbus_test_fatal (const char *format,
34 ...) _DBUS_GNUC_NORETURN _DBUS_GNUC_PRINTF (1, 2);
35
36DBUS_EMBEDDED_TESTS_EXPORT
37void _dbus_test_diag (const char *format,
38 ...) _DBUS_GNUC_PRINTF (1, 2);
39
40DBUS_EMBEDDED_TESTS_EXPORT
41void _dbus_test_skip_all (const char *format,
42 ...) _DBUS_GNUC_NORETURN _DBUS_GNUC_PRINTF (1, 2);
43
44DBUS_EMBEDDED_TESTS_EXPORT
45void _dbus_test_ok (const char *format,
46 ...) _DBUS_GNUC_PRINTF (1, 2);
47DBUS_EMBEDDED_TESTS_EXPORT
48void _dbus_test_not_ok (const char *format,
49 ...) _DBUS_GNUC_PRINTF (1, 2);
50DBUS_EMBEDDED_TESTS_EXPORT
51void _dbus_test_skip (const char *format,
52 ...) _DBUS_GNUC_PRINTF (1, 2);
53
54DBUS_EMBEDDED_TESTS_EXPORT
55void _dbus_test_check_memleaks (const char *test_name);
56
57DBUS_EMBEDDED_TESTS_EXPORT
58int _dbus_test_done_testing (void);
59
60#define _dbus_test_check(a) do { \
61 if (!(a)) \
62 _dbus_test_not_ok ("%s:%d - '%s' failed\n", __FILE__, __LINE__, #a); \
63 } while (0)
64
65#endif