~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/packages/fcl-base/tests/fstream.pp

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Program TestStream;
 
2
 
 
3
uses classes;
 
4
 
 
5
Var Stream : TFileStream;
 
6
    S,T : String;
 
7
 
 
8
begin
 
9
  S:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
 
10
  T:=S;
 
11
  Writeln ('Creating stream.');
 
12
  Stream:=TFileStream.Create('Test2.dat',fmcreate);
 
13
  Writeln ('Initial Size : ',Stream.Size);
 
14
  Writeln ('Initial Position : ',Stream.Position);
 
15
  Stream.WriteByte  (1);
 
16
  Stream.WriteWord  (2);
 
17
  Stream.WriteDWord (3);
 
18
  Stream.WriteBuffer (S[1],Length(S));
 
19
  Writeln ('Stream Size is : ',Stream.Size);
 
20
  Stream.Seek(0,soFromBeginning);
 
21
  If Stream.ReadByte<>1 then  Writeln ('First byte not 1');
 
22
  If Stream.ReadWord<>2 then  Writeln ('First word not 2');
 
23
  If Stream.ReadDWord<>3 then Writeln ('First DWord not 3');
 
24
  If Stream.Read(T[1],Length(S))<>Length(S) then
 
25
    Writeln ('Couldn''t read string.');
 
26
  Writeln ('Second pass.');
 
27
  Stream.WriteByte  (1);
 
28
  Stream.WriteWord  (2);
 
29
  Stream.WriteDWord (3);
 
30
  Stream.WriteBuffer (S[1],Length(S));
 
31
  Writeln ('Stream Size is : ',Stream.Size);
 
32
  Writeln ('Stream Position is : ',Stream.Position);
 
33
  Writeln ('Freeing stream.');
 
34
  Stream.Free;
 
35
  Writeln ('Creating stream Read-Only');
 
36
  Stream:=TFileStream.Create('Test2.dat',fmOpenRead);
 
37
  Writeln ('Stream Size is : ',Stream.Size);
 
38
  Stream.Seek(0,soFromBeginning);
 
39
  If Stream.ReadByte<>1 then  Writeln ('First byte not 1');
 
40
  If Stream.ReadWord<>2 then  Writeln ('First word not 2');
 
41
  If Stream.ReadDWord<>3 then Writeln ('First DWord not 3');
 
42
  If Stream.Read(T[1],Length(S))<>Length(S) then
 
43
    Writeln ('Couldn''t read string.');
 
44
  If Stream.ReadByte<>1 then  Writeln ('Second byte not 1');
 
45
  If Stream.ReadWord<>2 then  Writeln ('Second word not 2');
 
46
  If Stream.ReadDWord<>3 then Writeln ('Second DWord not 3');
 
47
  If Stream.Read(T[1],Length(S))<>Length(S) then
 
48
    Writeln ('Couldn''t read string.');
 
49
  Writeln ('Stream Size is : ',Stream.Size);
 
50
  Writeln ('Stream Position is : ',Stream.Position);
 
51
  Stream.Free;
 
52
end.