xref: /aoo42x/main/idlc/test/parser/constant.tests (revision cdf0e10c)
1*cdf0e10cSrcweir#*************************************************************************
2*cdf0e10cSrcweir#
3*cdf0e10cSrcweir# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4*cdf0e10cSrcweir#
5*cdf0e10cSrcweir# Copyright 2000, 2010 Oracle and/or its affiliates.
6*cdf0e10cSrcweir#
7*cdf0e10cSrcweir# OpenOffice.org - a multi-platform office productivity suite
8*cdf0e10cSrcweir#
9*cdf0e10cSrcweir# This file is part of OpenOffice.org.
10*cdf0e10cSrcweir#
11*cdf0e10cSrcweir# OpenOffice.org is free software: you can redistribute it and/or modify
12*cdf0e10cSrcweir# it under the terms of the GNU Lesser General Public License version 3
13*cdf0e10cSrcweir# only, as published by the Free Software Foundation.
14*cdf0e10cSrcweir#
15*cdf0e10cSrcweir# OpenOffice.org is distributed in the hope that it will be useful,
16*cdf0e10cSrcweir# but WITHOUT ANY WARRANTY; without even the implied warranty of
17*cdf0e10cSrcweir# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18*cdf0e10cSrcweir# GNU Lesser General Public License version 3 for more details
19*cdf0e10cSrcweir# (a copy is included in the LICENSE file that accompanied this code).
20*cdf0e10cSrcweir#
21*cdf0e10cSrcweir# You should have received a copy of the GNU Lesser General Public License
22*cdf0e10cSrcweir# version 3 along with OpenOffice.org.  If not, see
23*cdf0e10cSrcweir# <http://www.openoffice.org/license.html>
24*cdf0e10cSrcweir# for a copy of the LGPLv3 License.
25*cdf0e10cSrcweir#
26*cdf0e10cSrcweir#*************************************************************************
27*cdf0e10cSrcweir
28*cdf0e10cSrcweirEXPECT SUCCESS "constant.tests 1":
29*cdf0e10cSrcweirconstants C {
30*cdf0e10cSrcweir    const boolean C1 = FALSE;
31*cdf0e10cSrcweir    const byte C2 = 0;
32*cdf0e10cSrcweir    const short C3 = 0;
33*cdf0e10cSrcweir    const unsigned short C4 = 0;
34*cdf0e10cSrcweir    const long C5 = 0;
35*cdf0e10cSrcweir    const unsigned long C6 = 0;
36*cdf0e10cSrcweir    const hyper C7 = 0;
37*cdf0e10cSrcweir    const unsigned hyper C8 = 0;
38*cdf0e10cSrcweir    const float C9 = 0.0;
39*cdf0e10cSrcweir    const double C10 = 0.0;
40*cdf0e10cSrcweir};
41*cdf0e10cSrcweir
42*cdf0e10cSrcweir
43*cdf0e10cSrcweirEXPECT SUCCESS "constant.tests 2":
44*cdf0e10cSrcweirmodule m {
45*cdf0e10cSrcweir    const boolean C1 = FALSE;
46*cdf0e10cSrcweir    const byte C2 = 0;
47*cdf0e10cSrcweir    const short C3 = 0;
48*cdf0e10cSrcweir    const unsigned short C4 = 0;
49*cdf0e10cSrcweir    const long C5 = 0;
50*cdf0e10cSrcweir    const unsigned long C6 = 0;
51*cdf0e10cSrcweir    const hyper C7 = 0;
52*cdf0e10cSrcweir    const unsigned hyper C8 = 0;
53*cdf0e10cSrcweir    const float C9 = 0.0;
54*cdf0e10cSrcweir    const double C10 = 0.0;
55*cdf0e10cSrcweir};
56*cdf0e10cSrcweir
57*cdf0e10cSrcweir
58*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 3":
59*cdf0e10cSrcweirconstants C {
60*cdf0e10cSrcweir    const char C1 = 'A';
61*cdf0e10cSrcweir};
62*cdf0e10cSrcweir
63*cdf0e10cSrcweir
64*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 4":
65*cdf0e10cSrcweirmodule m {
66*cdf0e10cSrcweir    const char C1 = 'A';
67*cdf0e10cSrcweir};
68*cdf0e10cSrcweir
69*cdf0e10cSrcweir
70*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 5":
71*cdf0e10cSrcweirconstants C {
72*cdf0e10cSrcweir    const string C1 = "";
73*cdf0e10cSrcweir};
74*cdf0e10cSrcweir
75*cdf0e10cSrcweir
76*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 6":
77*cdf0e10cSrcweirmodule m {
78*cdf0e10cSrcweir    const string C1 = "";
79*cdf0e10cSrcweir};
80*cdf0e10cSrcweir
81*cdf0e10cSrcweir
82*cdf0e10cSrcweirEXPECT SUCCESS "constant.tests 7":
83*cdf0e10cSrcweirconstants C {};
84*cdf0e10cSrcweir
85*cdf0e10cSrcweir
86*cdf0e10cSrcweirEXPECT SUCCESS "constant.tests 8":
87*cdf0e10cSrcweirmodule m {
88*cdf0e10cSrcweir    const byte C1 = -128;
89*cdf0e10cSrcweir    const byte C2 = -0200;
90*cdf0e10cSrcweir    const byte C3 = -0x80;
91*cdf0e10cSrcweir    const byte C4 = 255;
92*cdf0e10cSrcweir    const byte C5 = 0377;
93*cdf0e10cSrcweir    const byte C6 = 0xFF;
94*cdf0e10cSrcweir    const short C7 = -32768;
95*cdf0e10cSrcweir    const short C8 = -0100000;
96*cdf0e10cSrcweir    const short C9 = -0x8000;
97*cdf0e10cSrcweir    const short C10 = 32767;
98*cdf0e10cSrcweir    const short C11 = 077777;
99*cdf0e10cSrcweir    const short C12 = 0x7FFF;
100*cdf0e10cSrcweir    const unsigned short C13 = 0;
101*cdf0e10cSrcweir    const unsigned short C14 = 0x0;
102*cdf0e10cSrcweir    const unsigned short C15 = 65535;
103*cdf0e10cSrcweir    const unsigned short C16 = 0177777;
104*cdf0e10cSrcweir    const unsigned short C17 = 0xFFFF;
105*cdf0e10cSrcweir    const long C18 = -2147483648;
106*cdf0e10cSrcweir    const long C19 = -020000000000;
107*cdf0e10cSrcweir    const long C20 = -0x80000000;
108*cdf0e10cSrcweir    const long C21 = 2147483647;
109*cdf0e10cSrcweir    const long C22 = 017777777777;
110*cdf0e10cSrcweir    const long C23 = 0x7FFFFFFF;
111*cdf0e10cSrcweir    const unsigned long C24 = 0;
112*cdf0e10cSrcweir    const unsigned long C25 = 0x0;
113*cdf0e10cSrcweir    const unsigned long C26 = 4294967295;
114*cdf0e10cSrcweir    const unsigned long C27 = 037777777777;
115*cdf0e10cSrcweir	const unsigned long C28 = 0xFFFFFFFF;
116*cdf0e10cSrcweir	const hyper C29 = -9223372036854775808;
117*cdf0e10cSrcweir    const hyper C30 = -01000000000000000000000;
118*cdf0e10cSrcweir    const hyper C31 = -0x8000000000000000;
119*cdf0e10cSrcweir	const hyper C32 = 9223372036854775807;
120*cdf0e10cSrcweir    const hyper C33 = 0777777777777777777777;
121*cdf0e10cSrcweir    const hyper C34 = 0x7FFFFFFFFFFFFFFF;
122*cdf0e10cSrcweir    const unsigned hyper C35 = 0;
123*cdf0e10cSrcweir    const unsigned hyper C36 = 0x0;
124*cdf0e10cSrcweir    const unsigned hyper C37 = 18446744073709551615;
125*cdf0e10cSrcweir    const unsigned hyper C38 = 01777777777777777777777;
126*cdf0e10cSrcweir    const unsigned hyper C39 = 0xFFFFFFFFFFFFFFFF;
127*cdf0e10cSrcweir};
128*cdf0e10cSrcweir
129*cdf0e10cSrcweir
130*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 9":
131*cdf0e10cSrcweirmodule m { const byte C = -129; };
132*cdf0e10cSrcweir
133*cdf0e10cSrcweir
134*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 10":
135*cdf0e10cSrcweirmodule m { const byte C = -0201; };
136*cdf0e10cSrcweir
137*cdf0e10cSrcweir
138*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 11":
139*cdf0e10cSrcweirmodule m { const byte C = -0x81; };
140*cdf0e10cSrcweir
141*cdf0e10cSrcweir
142*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 12":
143*cdf0e10cSrcweirmodule m { const byte C = 256; };
144*cdf0e10cSrcweir
145*cdf0e10cSrcweir
146*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 13":
147*cdf0e10cSrcweirmodule m { const byte C = 0400; };
148*cdf0e10cSrcweir
149*cdf0e10cSrcweir
150*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 14":
151*cdf0e10cSrcweirmodule m { const byte C = 0x100; };
152*cdf0e10cSrcweir
153*cdf0e10cSrcweir
154*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 15":
155*cdf0e10cSrcweirmodule m { const short C = -32769; };
156*cdf0e10cSrcweir
157*cdf0e10cSrcweir
158*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 16":
159*cdf0e10cSrcweirmodule m { const short C = -0100001; };
160*cdf0e10cSrcweir
161*cdf0e10cSrcweir
162*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 17":
163*cdf0e10cSrcweirmodule m { const short C = -0x8001; };
164*cdf0e10cSrcweir
165*cdf0e10cSrcweir
166*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 18":
167*cdf0e10cSrcweirmodule m { const short C = 32768; };
168*cdf0e10cSrcweir
169*cdf0e10cSrcweir
170*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 19":
171*cdf0e10cSrcweirmodule m { const short C = 0100000; };
172*cdf0e10cSrcweir
173*cdf0e10cSrcweir
174*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 20":
175*cdf0e10cSrcweirmodule m { const short C = 0x8000; };
176*cdf0e10cSrcweir
177*cdf0e10cSrcweir
178*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 21":
179*cdf0e10cSrcweirmodule m { const unsigned short C = -1; };
180*cdf0e10cSrcweir
181*cdf0e10cSrcweir
182*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 22":
183*cdf0e10cSrcweirmodule m { const unsigned short C = -01; };
184*cdf0e10cSrcweir
185*cdf0e10cSrcweir
186*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 23":
187*cdf0e10cSrcweirmodule m { const unsigned short C = -0x1; };
188*cdf0e10cSrcweir
189*cdf0e10cSrcweir
190*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 24":
191*cdf0e10cSrcweirmodule m { const unsigned short C = 65536; };
192*cdf0e10cSrcweir
193*cdf0e10cSrcweir
194*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 25":
195*cdf0e10cSrcweirmodule m { const unsigned short C = 0200000; };
196*cdf0e10cSrcweir
197*cdf0e10cSrcweir
198*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 26":
199*cdf0e10cSrcweirmodule m { const unsigned short C = 0x10000; };
200*cdf0e10cSrcweir
201*cdf0e10cSrcweir
202*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 27":
203*cdf0e10cSrcweirmodule m { const long C = -2147483649; };
204*cdf0e10cSrcweir
205*cdf0e10cSrcweir
206*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 28":
207*cdf0e10cSrcweirmodule m { const long C = -020000000001; };
208*cdf0e10cSrcweir
209*cdf0e10cSrcweir
210*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 29":
211*cdf0e10cSrcweirmodule m { const long C = -0x80000001; };
212*cdf0e10cSrcweir
213*cdf0e10cSrcweir
214*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 30":
215*cdf0e10cSrcweirmodule m { const long C = 2147483648; };
216*cdf0e10cSrcweir
217*cdf0e10cSrcweir
218*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 31":
219*cdf0e10cSrcweirmodule m { const long C = 020000000000; };
220*cdf0e10cSrcweir
221*cdf0e10cSrcweir
222*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 32":
223*cdf0e10cSrcweirmodule m { const long C = 0x80000000; };
224*cdf0e10cSrcweir
225*cdf0e10cSrcweir
226*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 33":
227*cdf0e10cSrcweirmodule m { const unsigned long C = -1; };
228*cdf0e10cSrcweir
229*cdf0e10cSrcweir
230*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 34":
231*cdf0e10cSrcweirmodule m { const unsigned long C = -01; };
232*cdf0e10cSrcweir
233*cdf0e10cSrcweir
234*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 35":
235*cdf0e10cSrcweirmodule m { const unsigned long C = -0x1; };
236*cdf0e10cSrcweir
237*cdf0e10cSrcweir
238*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 36":
239*cdf0e10cSrcweirmodule m { const unsigned long C = 4294967296; };
240*cdf0e10cSrcweir
241*cdf0e10cSrcweir
242*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 37":
243*cdf0e10cSrcweirmodule m { const unsigned long C = 040000000000; };
244*cdf0e10cSrcweir
245*cdf0e10cSrcweir
246*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 38":
247*cdf0e10cSrcweirmodule m { const unsigned long C = 0x100000000; };
248*cdf0e10cSrcweir
249*cdf0e10cSrcweir
250*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 39":
251*cdf0e10cSrcweirmodule m { const hyper C = -9223372036854775809; };
252*cdf0e10cSrcweir
253*cdf0e10cSrcweir
254*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 40":
255*cdf0e10cSrcweirmodule m { const hyper C = -01000000000000000000001; };
256*cdf0e10cSrcweir
257*cdf0e10cSrcweir
258*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 41":
259*cdf0e10cSrcweirmodule m { const hyper C = -0x8000000000000001; };
260*cdf0e10cSrcweir
261*cdf0e10cSrcweir
262*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 42":
263*cdf0e10cSrcweirmodule m { const hyper C = 9223372036854775808; };
264*cdf0e10cSrcweir
265*cdf0e10cSrcweir
266*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 43":
267*cdf0e10cSrcweirmodule m { const hyper C = 01000000000000000000000; };
268*cdf0e10cSrcweir
269*cdf0e10cSrcweir
270*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 44":
271*cdf0e10cSrcweirmodule m { const hyper C = 0x8000000000000000; };
272*cdf0e10cSrcweir
273*cdf0e10cSrcweir
274*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 45":
275*cdf0e10cSrcweirmodule m { const unsigned hyper C = -1; };
276*cdf0e10cSrcweir
277*cdf0e10cSrcweir
278*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 46":
279*cdf0e10cSrcweirmodule m { const unsigned hyper C = -01; };
280*cdf0e10cSrcweir
281*cdf0e10cSrcweir
282*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 47":
283*cdf0e10cSrcweirmodule m { const unsigned hyper C = -0x1; };
284*cdf0e10cSrcweir
285*cdf0e10cSrcweir
286*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 48":
287*cdf0e10cSrcweirmodule m { const unsigned hyper C = 18446744073709551616; };
288*cdf0e10cSrcweir
289*cdf0e10cSrcweir
290*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 49":
291*cdf0e10cSrcweirmodule m { const unsigned hyper C = 02000000000000000000000; };
292*cdf0e10cSrcweir
293*cdf0e10cSrcweir
294*cdf0e10cSrcweirEXPECT FAILURE "constant.tests 50":
295*cdf0e10cSrcweirmodule m { const unsigned hyper C = 0x10000000000000000; };
296