blob: 6f6ef8ff79d38adfeedc126ef8219a0de7fb9f30 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
|
// %CopyrightBegin%
//
// Copyright Ericsson AB 1997-2010. All Rights Reserved.
//
// The contents of this file are subject to the Erlang Public License,
// Version 1.1, (the "License"); you may not use this file except in
// compliance with the License. You should have received a copy of the
// Erlang Public License along with this software. If not, it can be
// retrieved online at http://www.erlang.org/.
//
// Software distributed under the License is distributed on an "AS IS"
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
// the License for the specific language governing rights and limitations
// under the License.
//
// %CopyrightEnd%
//
// Check normal values and expressions for constants
//
// Integer types
const long co1 = 077;
const long ch1 = 0xf1;
const long ch2 = 0XAB;
const long c1 = 1;
const short c2 = 3;
const unsigned long c3 = 1;
const unsigned short c4 = 3;
// Unary ops
const long c1hb = -0x1;
const long c1b = -1;
const short c2b = -3;
const long c1c = +1;
const short c2c = +3;
// ~ not supported
// Check binary ops
const long c1d = 9+1-3;
const long c1hd = 9+1-0xf3;
const short c2d = 7+3;
const short c2e = 7*3;
const long c1e = 1 | 7;
const long c1f = 7 & 9;
const long c1g = (1 | 7) & 9;
const long c1h = 1^7;
//floats
const float c5 = 1.9;
const double c6 = 1.9;
const float c5b = -1.9;
const double c6b = -1.9;
// Check type operand casting
const float c5c = 1/(9+2) * 2;
const double c6c = 1.9-1;
//const double c6d = 1; // Does not work yet
// Booleans and expressions
const boolean c7 = TRUE;
const boolean c7b = FALSE;
const boolean c7c = TRUE | FALSE;
const boolean c7d = TRUE & FALSE;
const boolean c7e = TRUE&TRUE | FALSE&TRUE;
const boolean c7f = TRUE&TRUE ^ FALSE&TRUE;
// Character and string
const char c8 = 'c';
const char c8b = '\n';
const string c9 = "hej";
const string<9> c9b = "hejdu";
//
// Check that value references work
//
const long rc1 = c1g;
const long rc1h = c1h + 9;
const short rc2 = c2;
const unsigned long rc3 = c3;
const unsigned short rc4 = c4;
const float rc5c = c5c;
const double rc6c = c6c;
const double rc6d = c6c+1.3;
const boolean rc7 = c7;
const boolean rc7c = c7c | TRUE;
const char rc8 = c8;
const char rc8b = c8b;
const string rc9 = c9;
const string<9> rc9b = c9b;
//
// Now check that all typerefs work
//
typedef long longT;
typedef short shortT;
typedef unsigned long ulongT;
typedef unsigned short ushortT;
typedef float floatT;
typedef double doubleT;
typedef char charT;
typedef string stringT;
typedef boolean booleanT;
const longT cc1 = 1;
const shortT cc2 = 3;
const ::longT cc1b = -1;
const ::shortT cc2b = -3;
const floatT cc5 = 1.9;
const doubleT cc6 = 1.9;
const floatT cc5b = -1.9;
const doubleT cc6b = -1.9;
const floatT cc5c = 1/(9+2) * 2;
const doubleT cc6c = 1.9-1;
const booleanT cc7 = TRUE;
const booleanT cc7b = TRUE;
const booleanT cc7c = TRUE | FALSE;
const booleanT cc7d = TRUE & FALSE;
const booleanT cc7e = TRUE&TRUE | FALSE&TRUE;
const charT cc8 = 'c';
const charT cc8b = '\n';
const stringT cc9 = "hej";
const stringT cc9b = "hejdu";
//
// Check value casting
//
const long longC = -9;
const short shortC = -9;
const unsigned long ulongC = 1;
const unsigned short ushortC = 0;
const float floatC = 5.1;
const double doubleC = -2.111;
const long c20 = shortC;
const long c21 = ulongC;
const long c22 = ushortC;
const short c23 = ushortC;
const double c34 = floatC;
|