test_helpers.h revision 10915
1/*
2 * Copyright (c) 2013 Andreas Sandberg
3 * All rights reserved
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 *     http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * Authors: Andreas Sandberg
18 */
19
20#ifndef _TEST_HELPERS
21#define _TEST_HELPERS 1
22
23#include <stdio.h>
24
25#ifdef __cplusplus
26#extern "C" {
27#endif
28
29extern unsigned test_current;
30extern unsigned test_count;
31extern unsigned test_fail_count;
32
33void test_init(unsigned no_tests);
34void test_exit()
35    __attribute__((noreturn));
36
37void test_bail(const char *fmt, ...)
38    __attribute__((format (printf, 1, 2), noreturn));
39
40void test_diag(const char *fmt, ...)
41    __attribute__((format (printf, 1, 2)));
42
43void test_ok(const char *test);
44
45void test_fail(const char *test);
46
47void test_skip(const char *test, const char *fmt_why, ...)
48    __attribute__((format (printf, 2, 3)));
49
50void test_todo(const char *test, const char *fmt_why, ...)
51    __attribute__((format (printf, 2, 3)));
52
53#ifdef __cplusplus
54}
55#endif
56
57#endif
58