File: cuttest-assertions.h

package info (click to toggle)
cutter-testing-framework 1.1.7-1.2
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 18,556 kB
  • sloc: ansic: 79,864; xml: 38,680; sh: 10,266; makefile: 2,324; ruby: 845; cpp: 697
file content (116 lines) | stat: -rw-r--r-- 6,124 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/* -*- Mode: C; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 *  Copyright (C) 2008-2009  Kouhei Sutou <kou@clear-code.com>
 *
 *  This library is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU Lesser General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU Lesser General Public License for more details.
 *
 *  You should have received a copy of the GNU Lesser General Public License
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *
 */

#ifndef __CUTTEST_ASSERTIONS_H__
#define __CUTTEST_ASSERTIONS_H__

#include <gcutter.h>
#include <cutter/cut-assertions.h>
#include <cutter/cut-run-context.h>
#include <cutter/cut-test-result.h>
#include "cuttest-utils.h"

G_BEGIN_DECLS

#define cut_take_result_summary_list(list)      \
    gcut_take_list(list, NULL)

#define cut_take_result_string_list(list)       \
    gcut_take_list(list, g_free)

#define cut_assert_test_result_summary(run_context, n_tests,            \
                                       n_assertions, n_successes,       \
                                       n_failures, n_errors,            \
                                       n_pendings, n_notifications,     \
                                       n_omissions)                     \
    cut_trace_with_info_expression(                                     \
        cut_assert_test_result_summary_helper(run_context, n_tests,     \
                                              n_assertions,             \
                                              n_successes,              \
                                              n_failures, n_errors,     \
                                              n_pendings,               \
                                              n_notifications,          \
                                              n_omissions),             \
        cut_assert_test_result_summary(run_context, n_tests,            \
                                       n_assertions, n_successes,       \
                                       n_failures, n_errors,            \
                                       n_pendings, n_notifications,     \
                                       n_omissions))

#define cut_assert_test_result_with_message(run_context, i, status,     \
                                            test_name, user_message,    \
                                            system_message, message,    \
                                            expected, actual,           \
                                            backtrace, ...)             \
    cut_trace_with_info_expression(                                     \
        cut_assert_test_result_helper(run_context, i, status,           \
                                      test_name, user_message,          \
                                      system_message, message,          \
                                      expected, actual,                 \
                                      backtrace, __VA_ARGS__),          \
        cut_assert_test_result_with_message(run_context, i, status,     \
                                            test_name, user_message,    \
                                            system_message, message,    \
                                            expected, actual,           \
                                            backtrace, __VA_ARGS__))

#define cut_assert_test_result(run_context, i, status, test_name,       \
                               user_message, system_message,            \
                               expected, actual,                        \
                               backtrace, ...)                          \
    cut_trace_with_info_expression(                                     \
        cut_assert_test_result_helper(run_context, i, status,           \
                                      test_name, user_message,          \
                                      system_message, NULL,             \
                                      expected, actual,                 \
                                      backtrace, __VA_ARGS__),          \
        cut_assert_test_result(run_context, i, status, test_name,       \
                               user_message, system_message,            \
                               expected, actual,                        \
                               backtrace, __VA_ARGS__))


void cut_assert_test_result_summary_helper (CutRunContext *run_context,
                                            guint n_tests,
                                            guint n_assertions,
                                            guint n_successes,
                                            guint n_failures,
                                            guint n_errors,
                                            guint n_pendings,
                                            guint n_notifications,
                                            guint n_omissions);
void cut_assert_test_result_helper         (CutRunContext *run_context,
                                            guint i,
                                            CutTestResultStatus status,
                                            const gchar *test_name,
                                            const gchar *user_message,
                                            const gchar *system_message,
                                            const gchar *message,
                                            const gchar *expected,
                                            const gchar *actual,
                                            const gchar *backtrace,
                                            ...);

G_END_DECLS

#endif /* __CUTTEST_ASSERTIONS_H__ */

/*
vi:ts=4:nowrap:ai:expandtab:sw=4
*/