summaryrefslogtreecommitdiff
path: root/fpcsrc/tests/webtbs/tw4080.pp
blob: 05b8c3fad5f045a51e074fec223c5a42eceb42a0 (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
program tw4080;
{$i+}

{$ifdef unix}
uses
  cwstring;
{$endif unix}

var
  S, S2 : array [1..15] of char;
  f: text;
  f2: file;
  l: longint;
  str: shortstring;
  astr: ansistring;
  wstr: widestring;
begin
  S := 'string1'#0'string2';
  assign(f,'tw4080.out');
  rewrite(f);
  write (f,S);
  close(f);
  assign(f2,'tw4080.out');
  reset(f2,1);
  if (filesize(f2) <> 15) then
    halt(1);
  blockread(f2,s2,sizeof(s2));
  close(f2);
  erase(f2);
  for l := low(s) to high(s) do
    if s[l] <> s2[l] then
      halt(1);

  str := s;
  for l := low(s) to high(s) do
    if s[l] <> str[l] then
      halt(1);

  astr := s;
  for l := low(s) to high(s) do
    if s[l] <> astr[l] then
      halt(1);
  wstr := s;
  for l := low(s) to high(s) do
    if s[l] <> wstr[l] then
      halt(1);
end.