3 -- Grant of Unlimited Rights
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7 -- unlimited rights in the software and documentation contained herein.
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
9 -- this public release, the Government intends to confer upon all
10 -- recipients unlimited rights equal to those held by the Government.
11 -- These rights include rights to use, duplicate, release or disclose the
12 -- released technical data and computer software in whole or in part, in
13 -- any manner and for any purpose whatsoever, and to have or permit others
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 capabilities of Text_IO.Integer_IO perform correctly
28 -- on files of Append_File mode, for instantiations with integer and
29 -- user-defined subtypes.
30 -- Check that the formatting parameters available in the package can
31 -- be used and modified successfully in the storage and retrieval of
35 -- This test simulates a receiving department inventory system. Data on
36 -- items received is entered into an inventory database. This information
37 -- consists of integer entry number, item number, and bar code.
38 -- One item is placed into the inventory file immediately following file
39 -- creation, subsequent items are entered following file opening in
40 -- Append_File mode. Data items are validated by reading all data from
41 -- the file and comparing against known values (those used to enter the
44 -- This test verifies issues of create in Append_File mode, appending to
45 -- a file previously appended to, opening in Append_File mode, resetting
46 -- from Append_File mode to In_File mode, as well as a variety of Text_IO
47 -- and Integer_IO predefined subprograms.
49 -- APPLICABILITY CRITERIA:
50 -- This test is applicable only to implementations that support text
55 -- 06 Dec 94 SAIC ACVC 2.0
56 -- 25 Feb 97 PWB.CTA Allowed for non-support of some IO operations
65 Inventory_File
: Text_IO
.File_Type
;
66 Inventory_Filename
: constant String :=
67 Report
.Legal_File_Name
( Nam
=> "CXAA007" );
68 Incomplete
: exception;
72 Report
.Test
("CXAA007", "Check that the capabilities of " &
73 "Text_IO.Integer_IO operate correctly for files " &
74 "with mode Append_File");
76 Test_for_Text_IO_Support
:
79 -- An implementation that does not support Text_IO in a particular
80 -- environment will raise Use_Error on calls to various
81 -- Text_IO operations. This block statement encloses a call to
82 -- Create, which should raise the exception in a non-supportive
83 -- environment. This exception will be handled to produce a
84 -- Not_Applicable result.
86 Text_IO
.Create
(File
=> Inventory_File
,
87 Mode
=> Text_IO
.Append_File
,
88 Name
=> Inventory_Filename
);
90 when Text_IO
.Use_Error | Text_IO
.Name_Error
=>
92 ( "Files not supported - Create with Append_File for Text_IO" );
94 end Test_for_Text_IO_Support
;
96 Operational_Test_Block
:
99 Max_Entries_Per_Order
: constant Natural := 4;
101 type Bar_Code_Type
is range 0 .. 127; -- Values to be stored as base
102 -- two numbers in file.
103 type Item_Type
is record
104 Entry_Number
: Natural := 0;
105 Item_Number
: Integer := 0;
106 Bar_Code
: Bar_Code_Type
:= 0;
109 type Inventory_Type
is
110 array (1 .. Max_Entries_Per_Order
) of Item_Type
;
112 Inventory_List
: Inventory_Type
:= ((1, 119, 87), -- Items received
113 (2, 206, 44), -- this order.
117 Daily_Order
: constant := 1;
118 Entry_Field_Width
: constant Natural := 1;
119 Item_Base
: constant Natural := 16;
120 Items_Inventoried
: Natural := 1;
121 Items_To_Inventory
: Natural := 4;
123 package Entry_IO
is new Text_IO
.Integer_IO
(Natural);
124 package Item_IO
is new Text_IO
.Integer_IO
(Integer);
125 package Bar_Code_IO
is new Text_IO
.Integer_IO
(Bar_Code_Type
);
128 -- The following procedure simulates the addition of inventory item
129 -- information into a data file.
131 procedure Update_Inventory
(The_Item
: in Item_Type
) is
132 Spacer
: constant String := " ";
134 -- Enter all the incoming data into the inventory file.
135 Entry_IO
.Put
(Inventory_File
, The_Item
.Entry_Number
);
136 Text_IO
.Put
(Inventory_File
, Spacer
);
137 Item_IO
.Put
(Inventory_File
, The_Item
.Item_Number
);
138 Text_IO
.Put
(Inventory_File
, Spacer
);
139 Bar_Code_IO
.Put
(File
=> Inventory_File
,
140 Item
=> The_Item
.Bar_Code
,
143 Text_IO
.New_Line
(Inventory_File
);
144 end Update_Inventory
;
149 -- This code section simulates a receiving department maintaining a
150 -- data file containing information on items that have been ordered
153 -- As new orders are received, the file is opened in Append_File
155 -- Data is taken from the inventory list and entered into the file,
156 -- in specific format.
157 -- Enter the order into the inventory file. This is item 1 in
158 -- the inventory list.
159 -- The data entry process can be repeated numerous times as required.
161 Entry_IO
.Put
(Inventory_File
,
162 Inventory_List
(Daily_Order
).Entry_Number
);
163 Item_IO
.Put
(Inventory_File
,
164 Inventory_List
(Daily_Order
).Item_Number
);
165 Bar_Code_IO
.Put
(File
=> Inventory_File
,
166 Item
=> Inventory_List
(Daily_Order
).Bar_Code
);
167 Text_IO
.New_Line
(Inventory_File
);
169 Text_IO
.Close
(Inventory_File
);
172 Entry_IO
.Default_Width
:= Entry_Field_Width
; -- Modify the default
173 -- width of Entry_IO.
174 Item_IO
.Default_Base
:= Item_Base
; -- Modify the default
177 Text_IO
.Open
(Inventory_File
,
178 Text_IO
.Append_File
, -- Open in Append mode.
181 while (Items_Inventoried
< Items_To_Inventory
) loop -- 2-4 into the
182 Items_Inventoried
:= Items_Inventoried
+ 1; -- inventory file.
183 Update_Inventory
(The_Item
=> Inventory_List
(Items_Inventoried
));
186 Test_Verification_Block
: -- Read and check
187 declare -- all the data
188 TC_Entry
: Natural; -- values that
189 TC_Item
: Integer; -- have been
190 TC_Bar_Code
: Bar_Code_Type
; -- entered in the
191 TC_Item_Count
: Natural := 0; -- data file.
196 Text_IO
.Reset
(Inventory_File
, Text_IO
.In_File
); -- Reset for
199 when Text_IO
.Use_Error
=>
200 Report
.Not_Applicable
201 ( "Reset to mode In_File not supported for Text_IO" );
205 while not Text_IO
.End_Of_File
(Inventory_File
) loop
206 Entry_IO
.Get
(Inventory_File
, TC_Entry
);
207 Item_IO
.Get
(Inventory_File
, TC_Item
);
208 Bar_Code_IO
.Get
(Inventory_File
, TC_Bar_Code
);
209 Text_IO
.Skip_Line
(Inventory_File
);
210 TC_Item_Count
:= TC_Item_Count
+ 1;
212 if (TC_Item
/= Inventory_List
(TC_Entry
).Item_Number
) or
213 (TC_Bar_Code
/= Inventory_List
(TC_Entry
).Bar_Code
) then
214 Report
.Failed
("Error in integer data read from file");
218 if (TC_Item_Count
/= Max_Entries_Per_Order
) then
219 Report
.Failed
("Incorrect number of records read from file");
226 Report
.Failed
("Error raised during data verification");
227 end Test_Verification_Block
;
233 Report
.Failed
("Exception in Text_IO.Integer_IO processing");
234 end Operational_Test_Block
;
238 -- Delete the external file.
239 if Text_IO
.Is_Open
(Inventory_File
) then
240 Text_IO
.Delete
(Inventory_File
);
242 Text_IO
.Open
(Inventory_File
, Text_IO
.In_File
, Inventory_Filename
);
243 Text_IO
.Delete
(Inventory_File
);
249 Report
.Failed
( "Delete not properly implemented for Text_IO" );
260 Report
.Failed
( "Unexpected exception" );