xref: /aoo42x/main/idlc/test/parser/constant.tests (revision 57f04c0e)
1*57f04c0eSAndrew Rist#**************************************************************
2*57f04c0eSAndrew Rist#
3*57f04c0eSAndrew Rist#  Licensed to the Apache Software Foundation (ASF) under one
4*57f04c0eSAndrew Rist#  or more contributor license agreements.  See the NOTICE file
5*57f04c0eSAndrew Rist#  distributed with this work for additional information
6*57f04c0eSAndrew Rist#  regarding copyright ownership.  The ASF licenses this file
7*57f04c0eSAndrew Rist#  to you under the Apache License, Version 2.0 (the
8*57f04c0eSAndrew Rist#  "License"); you may not use this file except in compliance
9*57f04c0eSAndrew Rist#  with the License.  You may obtain a copy of the License at
10*57f04c0eSAndrew Rist#
11*57f04c0eSAndrew Rist#    http://www.apache.org/licenses/LICENSE-2.0
12*57f04c0eSAndrew Rist#
13*57f04c0eSAndrew Rist#  Unless required by applicable law or agreed to in writing,
14*57f04c0eSAndrew Rist#  software distributed under the License is distributed on an
15*57f04c0eSAndrew Rist#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*57f04c0eSAndrew Rist#  KIND, either express or implied.  See the License for the
17*57f04c0eSAndrew Rist#  specific language governing permissions and limitations
18*57f04c0eSAndrew Rist#  under the License.
19*57f04c0eSAndrew Rist#
20*57f04c0eSAndrew Rist#**************************************************************
21cdf0e10cSrcweir
22cdf0e10cSrcweirEXPECT SUCCESS "constant.tests 1":
23cdf0e10cSrcweirconstants C {
24cdf0e10cSrcweir    const boolean C1 = FALSE;
25cdf0e10cSrcweir    const byte C2 = 0;
26cdf0e10cSrcweir    const short C3 = 0;
27cdf0e10cSrcweir    const unsigned short C4 = 0;
28cdf0e10cSrcweir    const long C5 = 0;
29cdf0e10cSrcweir    const unsigned long C6 = 0;
30cdf0e10cSrcweir    const hyper C7 = 0;
31cdf0e10cSrcweir    const unsigned hyper C8 = 0;
32cdf0e10cSrcweir    const float C9 = 0.0;
33cdf0e10cSrcweir    const double C10 = 0.0;
34cdf0e10cSrcweir};
35cdf0e10cSrcweir
36cdf0e10cSrcweir
37cdf0e10cSrcweirEXPECT SUCCESS "constant.tests 2":
38cdf0e10cSrcweirmodule m {
39cdf0e10cSrcweir    const boolean C1 = FALSE;
40cdf0e10cSrcweir    const byte C2 = 0;
41cdf0e10cSrcweir    const short C3 = 0;
42cdf0e10cSrcweir    const unsigned short C4 = 0;
43cdf0e10cSrcweir    const long C5 = 0;
44cdf0e10cSrcweir    const unsigned long C6 = 0;
45cdf0e10cSrcweir    const hyper C7 = 0;
46cdf0e10cSrcweir    const unsigned hyper C8 = 0;
47cdf0e10cSrcweir    const float C9 = 0.0;
48cdf0e10cSrcweir    const double C10 = 0.0;
49cdf0e10cSrcweir};
50cdf0e10cSrcweir
51cdf0e10cSrcweir
52cdf0e10cSrcweirEXPECT FAILURE "constant.tests 3":
53cdf0e10cSrcweirconstants C {
54cdf0e10cSrcweir    const char C1 = 'A';
55cdf0e10cSrcweir};
56cdf0e10cSrcweir
57cdf0e10cSrcweir
58cdf0e10cSrcweirEXPECT FAILURE "constant.tests 4":
59cdf0e10cSrcweirmodule m {
60cdf0e10cSrcweir    const char C1 = 'A';
61cdf0e10cSrcweir};
62cdf0e10cSrcweir
63cdf0e10cSrcweir
64cdf0e10cSrcweirEXPECT FAILURE "constant.tests 5":
65cdf0e10cSrcweirconstants C {
66cdf0e10cSrcweir    const string C1 = "";
67cdf0e10cSrcweir};
68cdf0e10cSrcweir
69cdf0e10cSrcweir
70cdf0e10cSrcweirEXPECT FAILURE "constant.tests 6":
71cdf0e10cSrcweirmodule m {
72cdf0e10cSrcweir    const string C1 = "";
73cdf0e10cSrcweir};
74cdf0e10cSrcweir
75cdf0e10cSrcweir
76cdf0e10cSrcweirEXPECT SUCCESS "constant.tests 7":
77cdf0e10cSrcweirconstants C {};
78cdf0e10cSrcweir
79cdf0e10cSrcweir
80cdf0e10cSrcweirEXPECT SUCCESS "constant.tests 8":
81cdf0e10cSrcweirmodule m {
82cdf0e10cSrcweir    const byte C1 = -128;
83cdf0e10cSrcweir    const byte C2 = -0200;
84cdf0e10cSrcweir    const byte C3 = -0x80;
85cdf0e10cSrcweir    const byte C4 = 255;
86cdf0e10cSrcweir    const byte C5 = 0377;
87cdf0e10cSrcweir    const byte C6 = 0xFF;
88cdf0e10cSrcweir    const short C7 = -32768;
89cdf0e10cSrcweir    const short C8 = -0100000;
90cdf0e10cSrcweir    const short C9 = -0x8000;
91cdf0e10cSrcweir    const short C10 = 32767;
92cdf0e10cSrcweir    const short C11 = 077777;
93cdf0e10cSrcweir    const short C12 = 0x7FFF;
94cdf0e10cSrcweir    const unsigned short C13 = 0;
95cdf0e10cSrcweir    const unsigned short C14 = 0x0;
96cdf0e10cSrcweir    const unsigned short C15 = 65535;
97cdf0e10cSrcweir    const unsigned short C16 = 0177777;
98cdf0e10cSrcweir    const unsigned short C17 = 0xFFFF;
99cdf0e10cSrcweir    const long C18 = -2147483648;
100cdf0e10cSrcweir    const long C19 = -020000000000;
101cdf0e10cSrcweir    const long C20 = -0x80000000;
102cdf0e10cSrcweir    const long C21 = 2147483647;
103cdf0e10cSrcweir    const long C22 = 017777777777;
104cdf0e10cSrcweir    const long C23 = 0x7FFFFFFF;
105cdf0e10cSrcweir    const unsigned long C24 = 0;
106cdf0e10cSrcweir    const unsigned long C25 = 0x0;
107cdf0e10cSrcweir    const unsigned long C26 = 4294967295;
108cdf0e10cSrcweir    const unsigned long C27 = 037777777777;
109cdf0e10cSrcweir	const unsigned long C28 = 0xFFFFFFFF;
110cdf0e10cSrcweir	const hyper C29 = -9223372036854775808;
111cdf0e10cSrcweir    const hyper C30 = -01000000000000000000000;
112cdf0e10cSrcweir    const hyper C31 = -0x8000000000000000;
113cdf0e10cSrcweir	const hyper C32 = 9223372036854775807;
114cdf0e10cSrcweir    const hyper C33 = 0777777777777777777777;
115cdf0e10cSrcweir    const hyper C34 = 0x7FFFFFFFFFFFFFFF;
116cdf0e10cSrcweir    const unsigned hyper C35 = 0;
117cdf0e10cSrcweir    const unsigned hyper C36 = 0x0;
118cdf0e10cSrcweir    const unsigned hyper C37 = 18446744073709551615;
119cdf0e10cSrcweir    const unsigned hyper C38 = 01777777777777777777777;
120cdf0e10cSrcweir    const unsigned hyper C39 = 0xFFFFFFFFFFFFFFFF;
121cdf0e10cSrcweir};
122cdf0e10cSrcweir
123cdf0e10cSrcweir
124cdf0e10cSrcweirEXPECT FAILURE "constant.tests 9":
125cdf0e10cSrcweirmodule m { const byte C = -129; };
126cdf0e10cSrcweir
127cdf0e10cSrcweir
128cdf0e10cSrcweirEXPECT FAILURE "constant.tests 10":
129cdf0e10cSrcweirmodule m { const byte C = -0201; };
130cdf0e10cSrcweir
131cdf0e10cSrcweir
132cdf0e10cSrcweirEXPECT FAILURE "constant.tests 11":
133cdf0e10cSrcweirmodule m { const byte C = -0x81; };
134cdf0e10cSrcweir
135cdf0e10cSrcweir
136cdf0e10cSrcweirEXPECT FAILURE "constant.tests 12":
137cdf0e10cSrcweirmodule m { const byte C = 256; };
138cdf0e10cSrcweir
139cdf0e10cSrcweir
140cdf0e10cSrcweirEXPECT FAILURE "constant.tests 13":
141cdf0e10cSrcweirmodule m { const byte C = 0400; };
142cdf0e10cSrcweir
143cdf0e10cSrcweir
144cdf0e10cSrcweirEXPECT FAILURE "constant.tests 14":
145cdf0e10cSrcweirmodule m { const byte C = 0x100; };
146cdf0e10cSrcweir
147cdf0e10cSrcweir
148cdf0e10cSrcweirEXPECT FAILURE "constant.tests 15":
149cdf0e10cSrcweirmodule m { const short C = -32769; };
150cdf0e10cSrcweir
151cdf0e10cSrcweir
152cdf0e10cSrcweirEXPECT FAILURE "constant.tests 16":
153cdf0e10cSrcweirmodule m { const short C = -0100001; };
154cdf0e10cSrcweir
155cdf0e10cSrcweir
156cdf0e10cSrcweirEXPECT FAILURE "constant.tests 17":
157cdf0e10cSrcweirmodule m { const short C = -0x8001; };
158cdf0e10cSrcweir
159cdf0e10cSrcweir
160cdf0e10cSrcweirEXPECT FAILURE "constant.tests 18":
161cdf0e10cSrcweirmodule m { const short C = 32768; };
162cdf0e10cSrcweir
163cdf0e10cSrcweir
164cdf0e10cSrcweirEXPECT FAILURE "constant.tests 19":
165cdf0e10cSrcweirmodule m { const short C = 0100000; };
166cdf0e10cSrcweir
167cdf0e10cSrcweir
168cdf0e10cSrcweirEXPECT FAILURE "constant.tests 20":
169cdf0e10cSrcweirmodule m { const short C = 0x8000; };
170cdf0e10cSrcweir
171cdf0e10cSrcweir
172cdf0e10cSrcweirEXPECT FAILURE "constant.tests 21":
173cdf0e10cSrcweirmodule m { const unsigned short C = -1; };
174cdf0e10cSrcweir
175cdf0e10cSrcweir
176cdf0e10cSrcweirEXPECT FAILURE "constant.tests 22":
177cdf0e10cSrcweirmodule m { const unsigned short C = -01; };
178cdf0e10cSrcweir
179cdf0e10cSrcweir
180cdf0e10cSrcweirEXPECT FAILURE "constant.tests 23":
181cdf0e10cSrcweirmodule m { const unsigned short C = -0x1; };
182cdf0e10cSrcweir
183cdf0e10cSrcweir
184cdf0e10cSrcweirEXPECT FAILURE "constant.tests 24":
185cdf0e10cSrcweirmodule m { const unsigned short C = 65536; };
186cdf0e10cSrcweir
187cdf0e10cSrcweir
188cdf0e10cSrcweirEXPECT FAILURE "constant.tests 25":
189cdf0e10cSrcweirmodule m { const unsigned short C = 0200000; };
190cdf0e10cSrcweir
191cdf0e10cSrcweir
192cdf0e10cSrcweirEXPECT FAILURE "constant.tests 26":
193cdf0e10cSrcweirmodule m { const unsigned short C = 0x10000; };
194cdf0e10cSrcweir
195cdf0e10cSrcweir
196cdf0e10cSrcweirEXPECT FAILURE "constant.tests 27":
197cdf0e10cSrcweirmodule m { const long C = -2147483649; };
198cdf0e10cSrcweir
199cdf0e10cSrcweir
200cdf0e10cSrcweirEXPECT FAILURE "constant.tests 28":
201cdf0e10cSrcweirmodule m { const long C = -020000000001; };
202cdf0e10cSrcweir
203cdf0e10cSrcweir
204cdf0e10cSrcweirEXPECT FAILURE "constant.tests 29":
205cdf0e10cSrcweirmodule m { const long C = -0x80000001; };
206cdf0e10cSrcweir
207cdf0e10cSrcweir
208cdf0e10cSrcweirEXPECT FAILURE "constant.tests 30":
209cdf0e10cSrcweirmodule m { const long C = 2147483648; };
210cdf0e10cSrcweir
211cdf0e10cSrcweir
212cdf0e10cSrcweirEXPECT FAILURE "constant.tests 31":
213cdf0e10cSrcweirmodule m { const long C = 020000000000; };
214cdf0e10cSrcweir
215cdf0e10cSrcweir
216cdf0e10cSrcweirEXPECT FAILURE "constant.tests 32":
217cdf0e10cSrcweirmodule m { const long C = 0x80000000; };
218cdf0e10cSrcweir
219cdf0e10cSrcweir
220cdf0e10cSrcweirEXPECT FAILURE "constant.tests 33":
221cdf0e10cSrcweirmodule m { const unsigned long C = -1; };
222cdf0e10cSrcweir
223cdf0e10cSrcweir
224cdf0e10cSrcweirEXPECT FAILURE "constant.tests 34":
225cdf0e10cSrcweirmodule m { const unsigned long C = -01; };
226cdf0e10cSrcweir
227cdf0e10cSrcweir
228cdf0e10cSrcweirEXPECT FAILURE "constant.tests 35":
229cdf0e10cSrcweirmodule m { const unsigned long C = -0x1; };
230cdf0e10cSrcweir
231cdf0e10cSrcweir
232cdf0e10cSrcweirEXPECT FAILURE "constant.tests 36":
233cdf0e10cSrcweirmodule m { const unsigned long C = 4294967296; };
234cdf0e10cSrcweir
235cdf0e10cSrcweir
236cdf0e10cSrcweirEXPECT FAILURE "constant.tests 37":
237cdf0e10cSrcweirmodule m { const unsigned long C = 040000000000; };
238cdf0e10cSrcweir
239cdf0e10cSrcweir
240cdf0e10cSrcweirEXPECT FAILURE "constant.tests 38":
241cdf0e10cSrcweirmodule m { const unsigned long C = 0x100000000; };
242cdf0e10cSrcweir
243cdf0e10cSrcweir
244cdf0e10cSrcweirEXPECT FAILURE "constant.tests 39":
245cdf0e10cSrcweirmodule m { const hyper C = -9223372036854775809; };
246cdf0e10cSrcweir
247cdf0e10cSrcweir
248cdf0e10cSrcweirEXPECT FAILURE "constant.tests 40":
249cdf0e10cSrcweirmodule m { const hyper C = -01000000000000000000001; };
250cdf0e10cSrcweir
251cdf0e10cSrcweir
252cdf0e10cSrcweirEXPECT FAILURE "constant.tests 41":
253cdf0e10cSrcweirmodule m { const hyper C = -0x8000000000000001; };
254cdf0e10cSrcweir
255cdf0e10cSrcweir
256cdf0e10cSrcweirEXPECT FAILURE "constant.tests 42":
257cdf0e10cSrcweirmodule m { const hyper C = 9223372036854775808; };
258cdf0e10cSrcweir
259cdf0e10cSrcweir
260cdf0e10cSrcweirEXPECT FAILURE "constant.tests 43":
261cdf0e10cSrcweirmodule m { const hyper C = 01000000000000000000000; };
262cdf0e10cSrcweir
263cdf0e10cSrcweir
264cdf0e10cSrcweirEXPECT FAILURE "constant.tests 44":
265cdf0e10cSrcweirmodule m { const hyper C = 0x8000000000000000; };
266cdf0e10cSrcweir
267cdf0e10cSrcweir
268cdf0e10cSrcweirEXPECT FAILURE "constant.tests 45":
269cdf0e10cSrcweirmodule m { const unsigned hyper C = -1; };
270cdf0e10cSrcweir
271cdf0e10cSrcweir
272cdf0e10cSrcweirEXPECT FAILURE "constant.tests 46":
273cdf0e10cSrcweirmodule m { const unsigned hyper C = -01; };
274cdf0e10cSrcweir
275cdf0e10cSrcweir
276cdf0e10cSrcweirEXPECT FAILURE "constant.tests 47":
277cdf0e10cSrcweirmodule m { const unsigned hyper C = -0x1; };
278cdf0e10cSrcweir
279cdf0e10cSrcweir
280cdf0e10cSrcweirEXPECT FAILURE "constant.tests 48":
281cdf0e10cSrcweirmodule m { const unsigned hyper C = 18446744073709551616; };
282cdf0e10cSrcweir
283cdf0e10cSrcweir
284cdf0e10cSrcweirEXPECT FAILURE "constant.tests 49":
285cdf0e10cSrcweirmodule m { const unsigned hyper C = 02000000000000000000000; };
286cdf0e10cSrcweir
287cdf0e10cSrcweir
288cdf0e10cSrcweirEXPECT FAILURE "constant.tests 50":
289cdf0e10cSrcweirmodule m { const unsigned hyper C = 0x10000000000000000; };
290