File: test_numeric_limits.pro

package info (click to toggle)
gnudatalanguage 1.1.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 80,368 kB
  • sloc: cpp: 189,797; ansic: 46,721; sh: 677; python: 474; makefile: 146; xml: 69; f90: 28
file content (164 lines) | stat: -rw-r--r-- 8,818 bytes parent folder | download | duplicates (2)
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
164
pro test_numeric_limits, no_exit=no_exit, test=test
  errnum=0
  dotest=keyword_set(test)
  z=!NULL
; byte
  z=!NULL & a=execute("z='12'xb")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 18 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='123'xb") ;error
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=-127b") ;no error
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 129 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=-1270b") ;error
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute('z="077b') ;ok
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute('z="0777b') ;ok
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
; short
  z=!NULL & a=execute("z='7FFF'xs")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 32767 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='8000'xs")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne -32768 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=-32767s")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne -32767 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=-32768s")
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='80000'xs")
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=123456789s")
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
; unsigned short
  z=!NULL & a=execute("z='7FFF'xus")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 32767 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='8000'xus")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 32768 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=-32767us")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 32769 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=-65535us")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 1 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=-65536us")
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='80000'xus")
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=123456789us")
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
; long
  z=!NULL & a=execute("z='7FFFFFFF'xl")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 2147483647 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='80000000'xl")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne -2147483648 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=-2147483647l")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne -2147483647 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=-2147483648l")
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='8000000000'xl")
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=12345678999999999l")
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
; unsigned long
  z=!NULL & a=execute("z='7FFFFFFF'xul")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 2147483647 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='80000000'xul")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 2147483648 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=-4294967295ul")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 1 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=-4294967296ul")
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='8000000000'xul")
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=123456789976754ul")
  if a ne 0 then begin & errnum++ & if dotest then stop & end
  if z ne !NULL then begin & errnum++ & if dotest then stop & end
; long64
  z=!NULL & a=execute("z='7FFFFFFFFFFFFFFF'xll")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 9223372036854775807 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='8000000000000000'xll")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne -9223372036854775808 then begin & errnum++ & if dotest then stop & endif ; !!!!!
  z=!NULL & a=execute("z=-9223372036854775808ll")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne -9223372036854775808 then begin & errnum++ & if dotest then stop & endif ; !!!!!
  z=!NULL & a=execute("z=-9223372036854775808"); promotion
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if ~(isa(z,"Long64")) then begin & errnum++ & if dotest then stop & end
  if z ne -9223372036854775808 then begin & errnum++ & if dotest then stop & endif ; !!!!!
  z=!NULL & a=execute("z=-92233720368547758089"); promotion
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if ~(isa(z,"Long64")) then begin & errnum++ & if dotest then stop & end
  if z ne 1 then begin & errnum++ & if dotest then stop & endif ; !!!!!
  z=!NULL & a=execute("z=92233720368547758089"); promotion
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if ~(isa(z,"Long64")) then begin & errnum++ & if dotest then stop & end
  if z ne -1 then begin & errnum++ & if dotest then stop & endif ; !!!!!
  z=!NULL & a=execute("z='8000000000000000'x") ; promotion
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if ~(isa(z,"Long64")) then begin & errnum++ & if dotest then stop & end
  if z ne -9223372036854775808ull then begin & errnum++ & if dotest then stop & endif ; !!!!
  z=!NULL & a=execute("z='80000000000000001'xll")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne -1 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='80000000000000001'x") ; promotion
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if ~(isa(z,"Long64")) then begin & errnum++ & if dotest then stop & end
  if z ne -1 then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='7FFFFFFFFFFFFFFFFF'xll")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne -1 then begin & errnum++ & if dotest then stop & end
  
; ulong64
  z=!NULL & a=execute("z='8000000000000000'xull")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 9223372036854775808ull then begin & errnum++ & if dotest then stop & endif ; !!!
  z=!NULL & a=execute("z='7FFFFFFFFFFFFFFF'xull")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 9223372036854775807ull then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='FFFFFFFFFFFFFFFF'xull")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 18446744073709551615ull then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z='80000000000000000'xull")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 18446744073709551615ull then begin & errnum++ & if dotest then stop & end
  z=!NULL & a=execute("z=92233720368547758099999ull")
  if a ne 1 then begin & errnum++ & if dotest then stop & end
  if z ne 18446744073709551615ull then begin & errnum++ & if dotest then stop & end
;
; ----------------- final message ----------
;
BANNER_FOR_TESTSUITE, 'TEST_NUMERIC_LIMITS', errnum
;
if (errnum GT 0) AND ~KEYWORD_SET(no_exit) then EXIT, status=1
;
if KEYWORD_SET(test) then STOP
;
end