D-Bus  1.13.16
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 
32 DBUS_EMBEDDED_TESTS_EXPORT
33 void _dbus_test_fatal (const char *format,
34  ...) _DBUS_GNUC_NORETURN _DBUS_GNUC_PRINTF (1, 2);
35 
36 DBUS_EMBEDDED_TESTS_EXPORT
37 void _dbus_test_diag (const char *format,
38  ...) _DBUS_GNUC_PRINTF (1, 2);
39 
40 DBUS_EMBEDDED_TESTS_EXPORT
41 void _dbus_test_skip_all (const char *format,
42  ...) _DBUS_GNUC_NORETURN _DBUS_GNUC_PRINTF (1, 2);
43 
44 DBUS_EMBEDDED_TESTS_EXPORT
45 void _dbus_test_ok (const char *format,
46  ...) _DBUS_GNUC_PRINTF (1, 2);
47 DBUS_EMBEDDED_TESTS_EXPORT
48 void _dbus_test_not_ok (const char *format,
49  ...) _DBUS_GNUC_PRINTF (1, 2);
50 DBUS_EMBEDDED_TESTS_EXPORT
51 void _dbus_test_skip (const char *format,
52  ...) _DBUS_GNUC_PRINTF (1, 2);
53 
54 DBUS_EMBEDDED_TESTS_EXPORT
55 void _dbus_test_check_memleaks (const char *test_name);
56 
57 DBUS_EMBEDDED_TESTS_EXPORT
58 int _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