OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [tools/] [src/] [infra/] [testsuite/] [cyginfra/] [tassert4.c] - Blame information for rev 596

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 26 unneback
/* ==========================================================================
2
 *
3
 *      tassert4.c
4
 *
5
 *      Assertion test case
6
 *
7
 *==========================================================================
8
 *####COPYRIGHTBEGIN####
9
 *
10
 * ----------------------------------------------------------------------------
11
 * Copyright (C) 1998, 1999, 2000 Red Hat, Inc.
12
 *
13
 * This file is part of the eCos host tools.
14
 *
15
 * This program is free software; you can redistribute it and/or modify it
16
 * under the terms of the GNU General Public License as published by the Free
17
 * Software Foundation; either version 2 of the License, or (at your option)
18
 * any later version.
19
 *
20
 * This program is distributed in the hope that it will be useful, but WITHOUT
21
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
22
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
23
 * more details.
24
 *
25
 * You should have received a copy of the GNU General Public License along with
26
 * this program; if not, write to the Free Software Foundation, Inc.,
27
 * 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
28
 *
29
 * ----------------------------------------------------------------------------
30
 *
31
 *####COPYRIGHTEND####
32
 *==========================================================================
33
 *#####DESCRIPTIONBEGIN####
34
 *
35
 * Author(s):           bartv
36
 * Contributors:        bartv
37
 * Date:                1998-11-27
38
 * Purpose:
39
 * Description:         A C equivalent of tassert1.cxx
40
 *
41
 *####DESCRIPTIONEND####
42
 *==========================================================================
43
 */
44
 
45
#include <cyg/infra/testcase.h>
46
#include <cyg/infra/cyg_ass.h>
47
#include <stdlib.h>
48
 
49
#ifdef CYGDBG_USE_ASSERTS
50
# error Assertions should not be enabled by default.
51
#endif
52
 
53
static const char message[] = "This should never be seen.";
54
 
55
int main(int argc, char** argv)
56
{
57
    CYG_ASSERT( true, message);
58
    CYG_ASSERT( false, message);
59
    CYG_ASSERTC(true);
60
    CYG_ASSERTC(false);
61
 
62
    CYG_FAIL(message);
63
 
64
    CYG_CHECK_DATA_PTR( &argc, message);
65
    CYG_CHECK_DATA_PTR( 0,     message);
66
    CYG_CHECK_FUNC_PTR( &main, message);
67
    CYG_CHECK_FUNC_PTR( 0,     message);
68
    CYG_CHECK_DATA_PTRC(&argc);
69
    CYG_CHECK_DATA_PTRC(0);
70
    CYG_CHECK_FUNC_PTRC(&main);
71
    CYG_CHECK_FUNC_PTRC(0);
72
 
73
    CYG_PRECONDITION(true, message);
74
    CYG_PRECONDITION(false, message);
75
    CYG_PRECONDITIONC(true);
76
    CYG_PRECONDITIONC(false);
77
 
78
    CYG_POSTCONDITION(true, message);
79
    CYG_POSTCONDITION(false, message);
80
    CYG_POSTCONDITIONC(true);
81
    CYG_POSTCONDITIONC(false);
82
 
83
    CYG_LOOP_INVARIANT(true, message);
84
    CYG_LOOP_INVARIANT(false, message);
85
    CYG_LOOP_INVARIANTC(true);
86
    CYG_LOOP_INVARIANTC(false);
87
 
88
    CYG_INVARIANT(true, message);
89
    CYG_INVARIANT(false, message);
90
    CYG_INVARIANTC(true);
91
    CYG_INVARIANTC(false);
92
 
93
    CYG_TEST_PASS_FINISH("disabled assertions in C code do nothing");
94
    return 0;
95
}
96
 
97
#ifdef CYG_ASSERT_CLASS
98
# error CYG_ASSERT_CLASS macro should not be defined in C code
99
#endif
100
#ifdef CYG_ASSERT_CLASSC
101
# error CYG_ASSERT_CLASSC macro should not be defined in C code
102
#endif
103
#ifdef CYG_ASSERT_CLASSO
104
# error CYG_ASSERT_CLASSO macro should not be defined in C code
105
#endif
106
#ifdef CYG_ASSERT_CLASSOC
107
# error CYG_ASSERT_CLASSOC macro should not be defined in C code
108
#endif
109
#ifdef CYG_ASSERT_ZERO_OR_CLASS
110
# error CYG_ASSERT_ZERO_OR_CLASS macro should not be defined in C code
111
#endif
112
#ifdef CYG_ASSERT_ZERO_OR_CLASSC
113
# error CYG_ASSERT_ZERO_OR_CLASSC macro should not be defined in C code
114
#endif
115
#ifdef CYG_ASSERT_THIS
116
# error CYG_ASSERT_THIS macro should not be defined in C code
117
#endif
118
#ifdef CYG_ASSERT_THISC
119
# error CYG_ASSERT_THISC macro should not be defined in C code
120
#endif
121
#ifdef CYGDBG_DEFINE_CHECK_THIS
122
# error CYGDBG_DEFINE_CHECK_THIS macro should not be defined in C code
123
#endif
124
 
125
#ifdef CYG_PRECONDITION_CLASS
126
# error CYG_PRECONDITION_CLASS macro should not be defined in C code
127
#endif
128
#ifdef CYG_PRECONDITION_CLASSC
129
# error CYG_PRECONDITION_CLASSC macro should not be defined in C code
130
#endif
131
#ifdef CYG_PRECONDITION_CLASSO
132
# error CYG_PRECONDITION_CLASSO macro should not be defined in C code
133
#endif
134
#ifdef CYG_PRECONDITION_CLASSOC
135
# error CYG_PRECONDITION_CLASSOC macro should not be defined in C code
136
#endif
137
#ifdef CYG_PRECONDITION_ZERO_OR_CLASS
138
# error CYG_PRECONDITION_ZERO_OR_CLASS macro should not be defined in C code
139
#endif
140
#ifdef CYG_PRECONDITION_ZERO_OR_CLASSC
141
# error CYG_PRECONDITION_ZERO_OR_CLASSC macro should not be defined in C code
142
#endif
143
#ifdef CYG_PRECONDITION_THIS
144
# error CYG_PRECONDITION_THIS macro should not be defined in C code
145
#endif
146
#ifdef CYG_PRECONDITION_THISC
147
# error CYG_PRECONDITION_THISC macro should not be defined in C code
148
#endif
149
 
150
#ifdef CYG_POSTCONDITION_CLASS
151
# error CYG_POSTCONDITION_CLASS macro should not be defined in C code
152
#endif
153
#ifdef CYG_POSTCONDITION_CLASSC
154
# error CYG_POSTCONDITION_CLASSC macro should not be defined in C code
155
#endif
156
#ifdef CYG_POSTCONDITION_CLASSO
157
# error CYG_POSTCONDITION_CLASSO macro should not be defined in C code
158
#endif
159
#ifdef CYG_POSTCONDITION_CLASSOC
160
# error CYG_POSTCONDITION_CLASSOC macro should not be defined in C code
161
#endif
162
#ifdef CYG_POSTCONDITION_ZERO_OR_CLASS
163
# error CYG_POSTCONDITION_ZERO_OR_CLASS macro should not be defined in C code
164
#endif
165
#ifdef CYG_POSTCONDITION_ZERO_OR_CLASSC
166
# error CYG_POSTCONDITION_ZERO_OR_CLASSC macro should not be defined in C code
167
#endif
168
#ifdef CYG_POSTCONDITION_THIS
169
# error CYG_POSTCONDITION_THIS macro should not be defined in C code
170
#endif
171
#ifdef CYG_POSTCONDITION_THISC
172
# error CYG_POSTCONDITION_THISC macro should not be defined in C code
173
#endif
174
 
175
#ifdef CYG_LOOP_INVARIANT_CLASS
176
# error CYG_LOOP_INVARIANT_CLASS macro should not be defined in C code
177
#endif
178
#ifdef CYG_LOOP_INVARIANT_CLASSC
179
# error CYG_LOOP_INVARIANT_CLASSC macro should not be defined in C code
180
#endif
181
#ifdef CYG_LOOP_INVARIANT_CLASSO
182
# error CYG_LOOP_INVARIANT_CLASSO macro should not be defined in C code
183
#endif
184
#ifdef CYG_LOOP_INVARIANT_CLASSOC
185
# error CYG_LOOP_INVARIANT_CLASSOC macro should not be defined in C code
186
#endif
187
#ifdef CYG_LOOP_INVARIANT_ZERO_OR_CLASS
188
# error CYG_LOOP_INVARIANT_ZERO_OR_CLASS macro should not be defined in C code
189
#endif
190
#ifdef CYG_LOOP_INVARIANT_ZERO_OR_CLASSC
191
# error CYG_LOOP_INVARIANT_ZERO_OR_CLASSC macro should not be defined in C code
192
#endif
193
#ifdef CYG_LOOP_INVARIANT_THIS
194
# error CYG_LOOP_INVARIANT_THIS macro should not be defined in C code
195
#endif
196
#ifdef CYG_LOOP_INVARIANT_THISC
197
# error CYG_LOOP_INVARIANT_THISC macro should not be defined in C code
198
#endif
199
 
200
#ifdef CYG_INVARIANT_CLASS
201
# error CYG_INVARIANT_CLASS macro should not be defined in C code
202
#endif
203
#ifdef CYG_INVARIANT_CLASSC
204
# error CYG_INVARIANT_CLASSC macro should not be defined in C code
205
#endif
206
#ifdef CYG_INVARIANT_CLASSO
207
# error CYG_INVARIANT_CLASSO macro should not be defined in C code
208
#endif
209
#ifdef CYG_INVARIANT_CLASSOC
210
# error CYG_INVARIANT_CLASSOC macro should not be defined in C code
211
#endif
212
#ifdef CYG_INVARIANT_THIS
213
# error CYG_INVARIANT_THIS macro should not be defined in C code
214
#endif
215
#ifdef CYG_INVARIANT_THISC
216
# error CYG_INVARIANT_THISC macro should not be defined in C code
217
#endif
218
 
219
 
220
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.