2 # This file is part of the LibreOffice project.
4 # This Source Code Form is subject to the terms of the Mozilla Public
5 # License, v. 2.0. If a copy of the MPL was not distributed with this
6 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 EXPECT SUCCESS "conversion.tests 1":
11 const byte C1 = -128.0;
12 const byte C2 = -127.9;
13 const byte C3 = 254.9;
14 const byte C4 = 255.0;
15 const short C5 = -32768.0;
16 const short C6 = -32767.9;
17 const short C7 = 32766.9;
18 const short C8 = 32767.0;
19 const unsigned short C9 = 0.0;
20 const unsigned short C10 = 0.1;
21 const unsigned short C11 = 65534.9;
22 const unsigned short C12 = 65535.0;
23 const long C13 = -2147483648.0;
24 const long C14 = -2147483647.9;
25 const long C15 = 2147483646.9;
26 const long C16 = 2147483647.0;
27 const unsigned long C17 = 0.0;
28 const unsigned long C18 = 0.1;
29 const unsigned long C19 = 4294967294.9;
30 const unsigned long C20 = 4294967295.0;
31 const hyper C21 = -9223372036854774784.0; // -0x7FFFFFFFFFFFFC00 = -0x1.FFFFFFFFFFFFFp62
32 const hyper C22 = 9223372036854774784.0; // 0x7FFFFFFFFFFFFC00 = 0x1.FFFFFFFFFFFFFp62
33 const unsigned hyper C23 = 0.0;
34 const unsigned hyper C24 = 0.1;
35 const unsigned hyper C25 = 18446744073709549568.0; // 0xFFFFFFFFFFFFF800 = 0x1.FFFFFFFFFFFFFp63
38 EXPECT FAILURE "conversion.tests 2":
39 constants C { const byte C1 = -128.1; };
41 EXPECT FAILURE "conversion.tests 3":
42 constants C { const byte C1 = 255.1; };
44 EXPECT FAILURE "conversion.tests 4":
45 constants C { const short C1 = -32768.1; };
47 EXPECT FAILURE "conversion.tests 5":
48 constants C { const short C1 = 32767.1; };
50 EXPECT FAILURE "conversion.tests 6":
51 constants C { const unsigned short C1 = -0.1; };
53 EXPECT FAILURE "conversion.tests 7":
54 constants C { const unsigned short C1 = 65535.1; };
56 EXPECT FAILURE "conversion.tests 8":
57 constants C { const long C1 = -2147483648.1; };
59 EXPECT FAILURE "conversion.tests 9":
60 constants C { const long C1 = 2147483647.1; };
62 EXPECT FAILURE "conversion.tests 10":
63 constants C { const unsigned long C1 = -0.1; };
65 EXPECT FAILURE "conversion.tests 11":
66 constants C { const unsigned long C1 = 4294967295.1; };
68 EXPECT FAILURE "conversion.tests 12":
69 constants C { const hyper C1 = -9223372036854775808.0; }; // -0x8000000000000000 = -0x1p63
71 EXPECT FAILURE "conversion.tests 13":
72 constants C { const hyper C1 = 9223372036854775807.0; }; // 0x7FFFFFFFFFFFFFFF rounds up to 0x1p63
74 EXPECT FAILURE "conversion.tests 14":
75 constants C { const unsigned hyper C1 = -0.1; };
77 EXPECT FAILURE "conversion.tests 15":
78 constants C { const unsigned hyper C1 = 18446744073709551615.0; };
79 // 0xFFFFFFFFFFFFFFFF rounds up to 0x1p64