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 : * @file Demo.c
21 : * @version 0.1
22 : * @brief This file contains implementation of the Demo
23 : * test module.
24 : */
25 :
26 : /* ------------------------------------------------------------------------- */
27 : /* INCLUDE FILES */
28 : #include <test_module_api.h>
29 : #include <min_logger.h>
30 : #include "Demo.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 357 : {
87 : /* Needed variables, please do not edit this section */
88 : int __test_case_index__;
89 : #define TEST_VAR_DECLARATIONS
90 : #include "DemoCases.c"
91 : #undef TEST_VAR_DECLARATIONS
92 357 : if (__action__ == RUN_CASE)
93 25 : __action__ = RUN_SETUP;
94 407 : min_unit_again:
95 407 : __test_case_index__ = 0;
96 : #define TEST_CASES
97 : #include "DemoCases.c"
98 : #undef TEST_CASES
99 407 : if (__action__ == RUN_SETUP) {
100 25 : __action__ = RUN_CASE;
101 25 : goto min_unit_again;
102 382 : } else if (__action__ == RUN_CASE) {
103 25 : __action__ = RUN_TEARDOWN;
104 25 : goto min_unit_again;
105 : }
106 :
107 357 : if (__action__ != GET_CASES)
108 25 : RESULT (__result__, TP_PASSED, "PASSED");
109 332 : return 0;
110 : }
111 :
112 : /* ------------------------------------------------------------------------- */
113 : /* ======================== FUNCTIONS ====================================== */
114 : /* ------------------------------------------------------------------------- */
115 : int tm_get_test_cases (const char *cfg_file, DLList ** cases)
116 332 : {
117 :
118 332 : min_unit_wrapper (GET_CASES, cfg_file, cases, 0, NULL);
119 :
120 332 : return 0;
121 : }
122 :
123 : /* ------------------------------------------------------------------------- */
124 : int tm_run_test_case (unsigned int id, const char *cfg_file,
125 : TestCaseResult * result)
126 25 : {
127 25 : int retval = 0;
128 :
129 25 : min_unit_wrapper (RUN_CASE, cfg_file, NULL, id, result);
130 :
131 25 : return retval;
132 : }
133 :
134 : /* ------------------------------------------------------------------------- */
135 : /* ================= OTHER EXPORTED FUNCTIONS ============================== */
136 : /* None */
137 :
138 : /* ------------------------------------------------------------------------- */
139 : /* End of file */
|