3 -- Grant of Unlimited Rights
5 -- The Ada Conformity Assessment Authority (ACAA) holds unlimited
6 -- rights in the software and documentation contained herein. Unlimited
7 -- rights are the same as those granted by the U.S. Government for older
8 -- parts of the Ada Conformity Assessment Test Suite, and are defined
9 -- in DFAR 252.227-7013(a)(19). By making this public release, the ACAA
10 -- intends to confer upon all recipients unlimited rights equal to those
11 -- held by the ACAA. These rights include rights to use, duplicate,
12 -- release or disclose the released technical data and computer software
13 -- in whole or in part, in any manner and for any purpose whatsoever, and
14 -- to have or permit others to do so.
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
27 -- Check that the default implementation of Read and Input raise End_Error
28 -- if the end of stream is reached before the reading of a value is
29 -- completed. (Defect Report 8652/0045,
30 -- Technical Corrigendum 13.13.2(35.1/1)).
33 -- 12 FEB 2001 PHL Initial version.
34 -- 29 JUN 2001 RLB Reformatted for ACATS.
42 type My_Stream
(Size
: Stream_Element_Count
) is new Root_Stream_Type
with
44 First
: Stream_Element_Offset
:= 1;
45 Last
: Stream_Element_Offset
:= 0;
46 Contents
: Stream_Element_Array
(1 .. Size
);
49 procedure Clear
(Stream
: in out My_Stream
);
51 procedure Read
(Stream
: in out My_Stream
;
52 Item
: out Stream_Element_Array
;
53 Last
: out Stream_Element_Offset
);
55 procedure Write
(Stream
: in out My_Stream
; Item
: in Stream_Element_Array
);
59 package body CDD2001_0
is
61 procedure Clear
(Stream
: in out My_Stream
) is
67 procedure Read
(Stream
: in out My_Stream
;
68 Item
: out Stream_Element_Array
;
69 Last
: out Stream_Element_Offset
) is
71 if Item
'Length >= Stream
.Last
- Stream
.First
+ 1 then
72 Item
(Item
'First .. Item
'First + Stream
.Last
- Stream
.First
) :=
73 Stream
.Contents
(Stream
.First
.. Stream
.Last
);
74 Last
:= Item
'First + Stream
.Last
- Stream
.First
;
75 Stream
.First
:= Stream
.Last
+ 1;
77 Item
:= Stream
.Contents
(Stream
.First
..
78 Stream
.First
+ Item
'Length - 1);
80 Stream
.First
:= Stream
.First
+ Item
'Length;
84 procedure Write
(Stream
: in out My_Stream
;
85 Item
: in Stream_Element_Array
) is
87 Stream
.Contents
(Stream
.Last
+ 1 .. Stream
.Last
+ Item
'Length) := Item
;
88 Stream
.Last
:= Stream
.Last
+ Item
'Length;
103 subtype Int
is Integer range -20 .. 20;
107 C1
: Character := Ident_Char
('a');
110 C2
: String (1 .. D
) := (others => Ident_Char
('b'));
112 C3
, C4
: Float := Float (-D
);
116 S
: aliased My_Stream
(200);
121 "Check that the default implementation of Read and Input " &
122 "raise End_Error if the end of stream is reached before the " &
123 "reading of a value is completed");
127 X
: R
(Ident_Int
(13));
131 -- A complete object.
132 R
'Write (S
'Access, X
);
133 X
.C1
:= Ident_Char
('A');
134 X
.C2
:= (others => Ident_Char
('B'));
135 R
'Read (S
'Access, X
);
136 if X
.C1
/= Ident_Char
('a') or X
.C2
/=
137 (1 .. 13 => Ident_Char
('b')) then
138 Failed
("Read did not produce the expected result");
144 Character'Write (S
'Access, 'a');
145 String'Write (S
'Access, "bbb");
148 R
'Read (S
'Access, X
);
150 ("No exception raised when the end of stream is reached " &
151 "before the reading of a value is completed - 1");
156 Failed
("Wrong Exception " & Exception_Name
(E
) &
157 " - " & Exception_Information
(E
) &
158 " - " & Exception_Message
(E
) & " - 1");
165 X
: R
(Ident_Int
(-11));
169 -- A complete object.
170 R
'Output (S
'Access, X
);
171 X
.C1
:= Ident_Char
('A');
174 X
:= R
'Input (S
'Access);
175 if X
.C1
/= Ident_Char
('a') or X
.C3
/= 11.0 or X
.C4
/= 11.0 then
176 Failed
("Input did not produce the expected result");
182 Integer'Output (S
'Access, Ident_Int
(-11)); -- The discriminant
183 Character'Output (S
'Access, 'a');
184 Float'Output (S
'Access, 11.0);
187 X
:= R
'Input (S
'Access);
189 ("No exception raised when the end of stream is reached " &
190 "before the reading of a value is completed - 2");
195 Failed
("Wrong exception " & Exception_Name
(E
) &
196 " - " & Exception_Message
(E
) & " - 2");