gnatcoll_gmp_24.0.0_e90c5b4d/testsuite/tests/coders/test_streams.ads

 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
with Ada.Streams;               use Ada.Streams;
with Ada.Numerics.Float_Random; use Ada.Numerics.Float_Random;
with GNATCOLL.Strings;          use GNATCOLL.Strings;

package Test_Streams is

   type Stream_Type is new Root_Stream_Type with private;
   --  Stream checking that all data taken from Read have to be the same
   --  accepted by Write.

   overriding procedure Read
     (Stream : in out Stream_Type;
      Item   :    out Stream_Element_Array;
      Last   :    out Stream_Element_Offset);

   overriding procedure Write
     (Stream : in out Stream_Type;
      Item   :        Stream_Element_Array);

   procedure Set_Limit
     (Stream : in out Stream_Type; Limit : Stream_Element_Count);
   --  Set the data limit to get from Read routine.

private

   type Stream_Type is new Root_Stream_Type with record
      Read_Started    : Boolean := False;
      Write_Started   : Boolean := False;
      Limit           : Stream_Element_Count := Stream_Element_Count'Last;
      Read_Generator  : Generator;
      Write_Generator : Generator;
      Init_State      : State;
      Read_Remain     : XString;
      Write_Remain    : XString;
   end record;


end Test_Streams;