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 : * GLOBAL VARIABLES SECTION
21 : */
22 : #ifdef TEST_VAR_DECLARATIONS
23 33 : int uno = 0, one = 0, two = 0, dos = 0;
24 : void *null_ptr, *ptr, *ptrsame, *ptrnotsame;
25 : #endif /* TEST_VAR_DECLARATIONS */
26 : /**
27 : * END OF GLOBAL VARIABLES SECTION
28 : */
29 :
30 : /**
31 : * TEST CASES SECTION
32 : */
33 : #ifdef TEST_CASES
34 : /**
35 : * MIN_SETUP defines activities needed before every test case.
36 : */
37 57 : MIN_SETUP {
38 16 : uno = one = 1;
39 16 : dos = two = 2;
40 16 : null_ptr = NULL;
41 16 : ptr = &one;
42 16 : ptrsame = &one;
43 16 : ptrnotsame = &two;
44 : }
45 :
46 : /**
47 : * MIN_TEARDOWN defines activities needed after every test case
48 : */
49 : MIN_TEARDOWN {
50 : ;
51 : }
52 :
53 : /**
54 : * MIN_TESTDEFINE defines a test case
55 : *
56 : */
57 57 : MIN_TESTDEFINE (assertequals_fail)
58 : {
59 :
60 1 : MIN_ASSERT_EQUALS (uno, dos);
61 : }
62 :
63 56 : MIN_TESTDEFINE (assertequals_ok)
64 : {
65 :
66 1 : MIN_ASSERT_EQUALS (uno, one);
67 : }
68 :
69 56 : MIN_TESTDEFINE (assertnotequals_fail)
70 : {
71 :
72 1 : MIN_ASSERT_NOT_EQUALS (two, dos);
73 : }
74 :
75 55 : MIN_TESTDEFINE (assertnotequals_ok)
76 : {
77 :
78 1 : MIN_ASSERT_NOT_EQUALS (uno, two);
79 : }
80 :
81 55 : MIN_TESTDEFINE (assertnull_fails)
82 : {
83 :
84 1 : MIN_ASSERT_NULL (ptr);
85 : }
86 :
87 54 : MIN_TESTDEFINE (assertnull_ok)
88 : {
89 :
90 1 : MIN_ASSERT_NULL (null_ptr);
91 : }
92 :
93 54 : MIN_TESTDEFINE (assertnotnull_fails)
94 : {
95 :
96 1 : MIN_ASSERT_NOT_NULL (null_ptr);
97 : }
98 :
99 53 : MIN_TESTDEFINE (assertnotnull_ok)
100 : {
101 :
102 1 : MIN_ASSERT_NOT_NULL (ptr);
103 : }
104 :
105 53 : MIN_TESTDEFINE (assertsame_fails)
106 : {
107 :
108 1 : MIN_ASSERT_SAME (ptr, ptrnotsame);
109 : }
110 :
111 52 : MIN_TESTDEFINE (assertsame_ok)
112 : {
113 :
114 1 : MIN_ASSERT_SAME (ptr, ptrsame);
115 : }
116 :
117 52 : MIN_TESTDEFINE (assertnotsame_fails)
118 : {
119 :
120 1 : MIN_ASSERT_NOT_SAME (ptr, ptrsame);
121 : }
122 :
123 51 : MIN_TESTDEFINE (assertnotsame_ok)
124 : {
125 :
126 1 : MIN_ASSERT_NOT_SAME (ptr, ptrnotsame);
127 : }
128 :
129 51 : MIN_TESTDEFINE (asserttrue_fails)
130 : {
131 1 : MIN_ASSERT_TRUE (one == 2);
132 : }
133 :
134 50 : MIN_TESTDEFINE (asserttrue_ok)
135 : {
136 1 : MIN_ASSERT_TRUE (one == 1);
137 : }
138 :
139 50 : MIN_TESTDEFINE (assertfals_fails)
140 : {
141 1 : MIN_ASSERT_FALSE (one == 1);
142 : }
143 :
144 49 : MIN_TESTDEFINE (assertfalse_ok)
145 : {
146 1 : MIN_ASSERT_FALSE (one == 2);
147 : }
148 :
149 : #endif
150 : /**
151 : * END OF TEST CASES SECTION
152 : */
|