1 : /*
2 : * This file is part of MIN Test Framework. Copyright © 2008 Nokia Corporation
3 : * and/or its subsidiary(-ies).
4 : * Contact: Sampo Saaristo
5 : * Contact e-mail: DG.MIN-Support@nokia.com
6 : *
7 : * This program is free software: you can redistribute it and/or modify it
8 : * under the terms of the GNU General Public License as published by the Free
9 : * Software Foundation, version 2 of the License.
10 : *
11 : * This program is distributed in the hope that it will be useful, but WITHOUT
12 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 : * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 : * more details. You should have received a copy of the GNU General Public
15 : * License along with this program. If not, see
16 : * <http://www.gnu.org/licenses/>.
17 : */
18 :
19 :
20 : /**
21 : * @file min_unit_selftest.c
22 : * @version 0.1
23 : * @brief This file contains implementation of the UNIT SELFTEST
24 : * Test Library.
25 : */
26 :
27 : /* ------------------------------------------------------------------------- */
28 : /* INCLUDE FILES */
29 : #include "../tmc/test_module_api/test_module_api.h"
30 : #include "min_unit_macros.h"
31 :
32 : /* ------------------------------------------------------------------------- */
33 : /* EXTERNAL DATA STRUCTURES */
34 : /* None */
35 :
36 : /* ------------------------------------------------------------------------- */
37 : /* EXTERNAL GLOBAL VARIABLES */
38 : /* None */
39 :
40 : /* ------------------------------------------------------------------------- */
41 : /* EXTERNAL FUNCTION PROTOTYPES */
42 : /* None */
43 :
44 : /* ------------------------------------------------------------------------- */
45 : /* GLOBAL VARIABLES */
46 : /* None */
47 :
48 : /* ------------------------------------------------------------------------- */
49 : /* CONSTANTS */
50 : /* None */
51 :
52 : /* ------------------------------------------------------------------------- */
53 : /* MACROS */
54 : #define GET_CASES 0
55 : #define RUN_SETUP 1
56 : #define RUN_CASE 2
57 : #define RUN_TEARDOWN 3
58 :
59 : /* ------------------------------------------------------------------------- */
60 : /* LOCAL GLOBAL VARIABLES */
61 : /* None */
62 :
63 : /* ------------------------------------------------------------------------- */
64 : /* LOCAL CONSTANTS AND MACROS */
65 : /* None */
66 :
67 : /* ------------------------------------------------------------------------- */
68 : /* MODULE DATA STRUCTURES */
69 : /* None */
70 :
71 : /* ------------------------------------------------------------------------- */
72 : /* LOCAL FUNCTION PROTOTYPES */
73 : LOCAL int min_unit_wrapper (int __action__, const char *__cfg_file__,
74 : DLList ** __cases__, unsigned int __id__,
75 : TestCaseResult * __result__);
76 :
77 : /* ------------------------------------------------------------------------- */
78 : /* FORWARD DECLARATIONS */
79 : /* None */
80 :
81 : /* ==================== LOCAL FUNCTIONS ==================================== */
82 : /* ------------------------------------------------------------------------- */
83 : LOCAL int min_unit_wrapper (int __action__, const char *__cfg_file__,
84 : DLList ** __cases__, unsigned int __id__,
85 : TestCaseResult * __result__)
86 17 : {
87 : /* Needed variables, please do not edit this section */
88 : int __test_case_index__;
89 : #define TEST_VAR_DECLARATIONS
90 : #include "min_unit_selftest_cases.c"
91 : #undef TEST_VAR_DECLARATIONS
92 17 : MIN_DEBUG ("%s id = %d\n", __FUNCTION__, __id__);
93 17 : if (__action__ == RUN_CASE)
94 16 : __action__ = RUN_SETUP;
95 41 : min_unit_again:
96 41 : __test_case_index__ = 0;
97 : #define TEST_CASES
98 : #include "min_unit_selftest_cases.c"
99 : #undef TEST_CASES
100 33 : if (__action__ == RUN_SETUP) {
101 16 : __action__ = RUN_CASE;
102 16 : goto min_unit_again;
103 17 : } else if (__action__ == RUN_CASE) {
104 8 : __action__ = RUN_TEARDOWN;
105 8 : goto min_unit_again;
106 : }
107 :
108 9 : if (__action__ != GET_CASES)
109 8 : RESULT (__result__, TP_PASSED, "PASSED");
110 :
111 1 : return 0;
112 : }
113 :
114 : /* ------------------------------------------------------------------------- */
115 : /* ======================== FUNCTIONS ====================================== */
116 : /* ------------------------------------------------------------------------- */
117 : int tm_get_test_cases (const char *cfg_file, DLList ** cases)
118 1 : {
119 :
120 1 : min_unit_wrapper (GET_CASES, cfg_file, cases, 0, NULL);
121 :
122 1 : return 0;
123 : }
124 :
125 : /* ------------------------------------------------------------------------- */
126 : int tm_run_test_case (unsigned int id, const char *cfg_file,
127 : TestCaseResult * result)
128 16 : {
129 16 : int retval = 0;
130 :
131 16 : min_unit_wrapper (RUN_CASE, cfg_file, NULL, id, result);
132 :
133 16 : return retval;
134 : }
135 :
136 : /* ------------------------------------------------------------------------- */
137 : /* ================= OTHER EXPORTED FUNCTIONS ============================== */
138 : /* None */
139 :
140 : /* ------------------------------------------------------------------------- */
141 : /* End of file */
|