summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/tbs/tb0336.pp
blob: 7cacb0260f52b8d81c63cf87977e0aa9a18e3017 (plain)
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
var
   l : longint;
   d : dword;
   s : string;
   code : integer;

procedure do_error(l : longint);

  begin
     writeln('Error near number ',l);
     halt(1);
  end;

begin
   s:='4294967295';
   val(s,d,code);
   if code<>0 then
     do_error(1);
   s:='4294967296';
   val(s,d,code);
{$ifdef CPU64}
   if code<>0 then
{$else CPU64}
   if code=0 then
{$endif CPU64}
     do_error(1);

   s:='2147483647';
   val(s,l,code);
   if code<>0 then
     do_error(3);
   s:='2147483648';
   val(s,l,code);
{$ifdef CPU64}
   if code<>0 then
{$else CPU64}
   if code=0 then
{$endif CPU64}
     do_error(4);
   s:='-2147483648';
   val(s,l,code);
   if code<>0 then
     do_error(5);
   s:='-2147483649';
   val(s,l,code);
{$ifdef CPU64}
   if code<>0 then
{$else CPU64}
   if code=0 then
{$endif CPU64}
     do_error(6);
end.