summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/test/units/system/tintstr.pp
blob: e9b0f29ad29c441ee049fed525e8d8c3803dc7d2 (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
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
var
  l: longint;
  c: cardinal;
  i: int64;
  q: qword;

procedure ts1(const res1, res2, res3, res4: string);
var
  r: packed record
    s: string[1];
    b1,b2,b3,b4: byte;
  end;
begin
  with r do
    begin
      b1:=0;
      b2:=0;
      b3:=0;
      b4:=0;
      str(l,s);
      if (res1<>s) or
         (b1<>0) or
         (b2<>0) or
         (b3<>0) or
         (b4<>0) then
        halt(1);

      str(c,s);
      if (res2<>s) or
         (b1<>0) or
         (b2<>0) or
         (b3<>0) or
         (b4<>0) then
        halt(2);

      str(i,s);
      if (res3<>s) or
         (b1<>0) or
         (b2<>0) or
         (b3<>0) or
         (b4<>0) then
        halt(3);

      str(q,s);
      if (res4<>s) or
         (b1<>0) or
         (b2<>0) or
         (b3<>0) or
         (b4<>0) then
        halt(4);
    end;
end;



procedure ts3(const res1, res2, res3, res4: string);
var
  r: packed record
    s: string[3];
    b1,b2,b3,b4: byte;
  end;
begin
  with r do
    begin
      b1:=0;
      b2:=0;
      b3:=0;
      b4:=0;
      str(l,s);
      if (res1<>s) or
         (b1<>0) or
         (b2<>0) or
         (b3<>0) or
         (b4<>0) then
        halt(1);

      str(c,s);
      if (res2<>s) or
         (b1<>0) or
         (b2<>0) or
         (b3<>0) or
         (b4<>0) then
        halt(2);

      str(i,s);
      if (res3<>s) or
         (b1<>0) or
         (b2<>0) or
         (b3<>0) or
         (b4<>0) then
        halt(3);

      str(q,s);
      if (res4<>s) or
         (b1<>0) or
         (b2<>0) or
         (b3<>0) or
         (b4<>0) then
        halt(4);
    end;
end;


begin
  l:=high(longint);
  c:=high(cardinal);
  i:=high(int64);
  q:=high(qword);
  ts1('2','4','9','1');
  ts3('214','429','922','184');
  l:=low(longint)+1;
  c:=high(cardinal)-1;
  i:=low(int64)+1;
  q:=high(qword)-1;
  ts1('-','4','-','1');
  ts3('-21','429','-92','184');
end.