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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [host/] [infra/] [testsuite/] [cyginfra/] [tassert4.c] - Blame information for rev 786

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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