blob: 129254775e1ec06313e26a4c756b27cf66a555b2 (
plain)
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
|
/*
* Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#ifndef SIMPLE_C_TEST_RUNNER_H
#define SIMPLE_C_TEST_RUNNER_H
#include <service/test_runner/common/test_runner.h>
#include <stdbool.h>
#include <stddef.h>
/**
* A simple C code test runner. Allows tests to be run in environments
* where C++ and hence use of cpputest is not supported.
*/
#ifdef __cplusplus
extern "C" {
#endif
struct test_runner_provider;
/**
* Describes a test case. Each test cases is a member of a test group.
*/
struct simple_c_test_case
{
/* The test name string */
const char *name;
/* The test function that results true for a pass, false for a fail. */
bool (*test_func)(struct test_failure *test_failure);
};
/**
* Describes a test group consisting of [0..*] test cases.
*/
struct simple_c_test_group
{
/* The test group string */
const char *group;
/* Number of test cases in the group */
size_t num_test_cases;
/* Pointer to an array of test cases */
const struct simple_c_test_case *test_cases;
};
/**
* Initialise the test runner and register it as a backend to the
* test_runner_provider. The simple_c test runner is a singleton.
*/
void simple_c_test_runner_init(struct test_runner_provider *frontend);
/**
* Registers a test group with the test runner.
*/
void simple_c_test_runner_register_group(const struct simple_c_test_group *test_group);
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /* SIMPLE_C_TEST_RUNNER_H */
|