mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-07 09:50:38 +02:00
Implemented stream tests
This commit is contained in:
parent
8068589c3c
commit
aaae629e69
BIN
fcl/tests/fstream.pp
Normal file
BIN
fcl/tests/fstream.pp
Normal file
Binary file not shown.
35
fcl/tests/mstream.pp
Normal file
35
fcl/tests/mstream.pp
Normal file
@ -0,0 +1,35 @@
|
||||
Program TestStream;
|
||||
|
||||
uses objpas, classes;
|
||||
|
||||
Var Stream : TMemoryStream;
|
||||
S,T : String;
|
||||
|
||||
begin
|
||||
S:='ABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
T:=S;
|
||||
Writeln ('Creating stream.');
|
||||
Stream:=TMemoryStream.Create;
|
||||
Writeln ('Initial Size : ',Stream.Size);
|
||||
Writeln ('Initial Capacity : ',Stream.Capacity);
|
||||
Writeln ('Initial Position : ',Stream.Position);
|
||||
Stream.WriteByte (1);
|
||||
Stream.WriteWord (2);
|
||||
Stream.WriteDWord (3);
|
||||
Stream.WriteBuffer (S[1],Length(S));
|
||||
Writeln ('Stream Size is : ',Stream.Size);
|
||||
Writeln ('Streem Capacity is : ',STream.Capacity);
|
||||
Stream.Seek(0,soFromBeginning);
|
||||
If Stream.ReadByte<>1 then Writeln ('First byte not 1');
|
||||
If Stream.ReadWord<>2 then Writeln ('First word not 2');
|
||||
If Stream.ReadDWord<>3 then Writeln ('First Word not 3');
|
||||
If Stream.Read(T[1],Length(S))<>Length(S) then Writeln ('Couldn''t read string.');
|
||||
Stream.WriteByte (1);
|
||||
Stream.WriteWord (2);
|
||||
Stream.WriteDWord (3);
|
||||
Stream.WriteBuffer (S[1],Length(S));
|
||||
Writeln ('Stream Size is : ',Stream.Size);
|
||||
Writeln ('Streem Capacity is : ',STream.Capacity);
|
||||
Stream.SaveToFile('Test2.dat');
|
||||
Stream.Free;
|
||||
end.
|
Loading…
Reference in New Issue
Block a user