aboutsummaryrefslogtreecommitdiff
path: root/components/service/test_runner/common/test_runner.h
blob: c891918cb5abe3db218e449c37df746cf55f567f (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) 2020-2021, Arm Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#ifndef CPPUTEST_TEST_RUNNER_H
#define CPPUTEST_TEST_RUNNER_H

#include <protocols/service/test_runner/packed-c/test_result.h>

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Constants
 */
#define TEST_NAME_MAX_LEN		(30)
#define TEST_GROUP_MAX_LEN		(30)

/**
 * Specifies a set of tests for running or listing.
 */
struct test_spec
{
	char name[TEST_NAME_MAX_LEN];
	char group[TEST_GROUP_MAX_LEN];
};

/**
 * A summary of a set of tests qualified by a test_spec.
 */
struct test_summary
{
	int num_tests;		/* Number of qualifying tests */
	int num_results;	/* Number of available test result objects */
	int num_passed;		/* Number that ran and passed */
	int num_failed;		/* Number that ran and failed */
};

/**
 * The run state of a test case
 */
enum test_run_state
{
	TEST_RUN_STATE_NOT_RUN = TS_TEST_RUNNER_TEST_RESULT_RUN_STATE_NOT_RUN,
	TEST_RUN_STATE_PASSED = TS_TEST_RUNNER_TEST_RESULT_RUN_STATE_PASSED,
	TEST_RUN_STATE_FAILED = TS_TEST_RUNNER_TEST_RESULT_RUN_STATE_FAILED
};

/**
 * The result for a particular test case.
 */
struct test_result
{
	char name[TEST_NAME_MAX_LEN];
	char group[TEST_GROUP_MAX_LEN];
	enum test_run_state run_state;
	unsigned int fail_line;
};

#ifdef __cplusplus
} /* extern "C" */
#endif

#endif /* CPPUTEST_TEST_RUNNER_H */