-- CXACA02.A
|
-- CXACA02.A
|
--
|
--
|
-- Grant of Unlimited Rights
|
-- Grant of Unlimited Rights
|
--
|
--
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
|
-- unlimited rights in the software and documentation contained herein.
|
-- unlimited rights in the software and documentation contained herein.
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
|
-- this public release, the Government intends to confer upon all
|
-- this public release, the Government intends to confer upon all
|
-- recipients unlimited rights equal to those held by the Government.
|
-- recipients unlimited rights equal to those held by the Government.
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- These rights include rights to use, duplicate, release or disclose the
|
-- released technical data and computer software in whole or in part, in
|
-- released technical data and computer software in whole or in part, in
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- any manner and for any purpose whatsoever, and to have or permit others
|
-- to do so.
|
-- to do so.
|
--
|
--
|
-- DISCLAIMER
|
-- DISCLAIMER
|
--
|
--
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
-- PARTICULAR PURPOSE OF SAID MATERIAL.
|
--*
|
--*
|
--
|
--
|
-- OBJECTIVE:
|
-- OBJECTIVE:
|
-- Check that user defined subprograms can override the default
|
-- Check that user defined subprograms can override the default
|
-- attributes 'Read and 'Write using attribute definition clauses.
|
-- attributes 'Read and 'Write using attribute definition clauses.
|
-- Use objects of record types.
|
-- Use objects of record types.
|
--
|
--
|
-- TEST DESCRIPTION:
|
-- TEST DESCRIPTION:
|
-- This test demonstrates that the default implementations of the
|
-- This test demonstrates that the default implementations of the
|
-- 'Read and 'Write attributes can be overridden by user specified
|
-- 'Read and 'Write attributes can be overridden by user specified
|
-- subprograms in conjunction with attribute definition clauses.
|
-- subprograms in conjunction with attribute definition clauses.
|
-- These attributes have been overridden below, and in the user defined
|
-- These attributes have been overridden below, and in the user defined
|
-- substitutes, values are added or subtracted to global variables.
|
-- substitutes, values are added or subtracted to global variables.
|
-- The global variables are evaluated to ensure that the user defined
|
-- The global variables are evaluated to ensure that the user defined
|
-- subprograms were used in overriding the type-related default
|
-- subprograms were used in overriding the type-related default
|
-- attributes.
|
-- attributes.
|
--
|
--
|
-- APPLICABILITY CRITERIA:
|
-- APPLICABILITY CRITERIA:
|
-- Applicable to all implementations that support external
|
-- Applicable to all implementations that support external
|
-- Stream_IO files.
|
-- Stream_IO files.
|
--
|
--
|
--
|
--
|
-- CHANGE HISTORY:
|
-- CHANGE HISTORY:
|
-- 06 Dec 94 SAIC ACVC 2.0
|
-- 06 Dec 94 SAIC ACVC 2.0
|
-- 21 Nov 95 SAIC Corrected recursive attribute definitions
|
-- 21 Nov 95 SAIC Corrected recursive attribute definitions
|
-- for ACVC 2.0.1.
|
-- for ACVC 2.0.1.
|
-- 24 Aug 96 SAIC Corrected typo in test verification criteria.
|
-- 24 Aug 96 SAIC Corrected typo in test verification criteria.
|
--
|
--
|
--!
|
--!
|
|
|
with Report;
|
with Report;
|
with Ada.Streams.Stream_IO;
|
with Ada.Streams.Stream_IO;
|
|
|
procedure CXACA02 is
|
procedure CXACA02 is
|
begin
|
begin
|
|
|
Report.Test ("CXACA02", "Check that user defined subprograms can " &
|
Report.Test ("CXACA02", "Check that user defined subprograms can " &
|
"override the default attributes 'Read and " &
|
"override the default attributes 'Read and " &
|
"'Write using attribute definition clauses");
|
"'Write using attribute definition clauses");
|
|
|
Test_for_Stream_IO_Support:
|
Test_for_Stream_IO_Support:
|
declare
|
declare
|
|
|
Data_File : Ada.Streams.Stream_IO.File_Type;
|
Data_File : Ada.Streams.Stream_IO.File_Type;
|
Data_Stream : Ada.Streams.Stream_IO.Stream_Access;
|
Data_Stream : Ada.Streams.Stream_IO.Stream_Access;
|
The_Filename : constant String := Report.Legal_File_Name;
|
The_Filename : constant String := Report.Legal_File_Name;
|
|
|
begin
|
begin
|
|
|
-- If an implementation does not support Stream_IO in a particular
|
-- If an implementation does not support Stream_IO in a particular
|
-- environment, the exception Use_Error or Name_Error will be raised on
|
-- environment, the exception Use_Error or Name_Error will be raised on
|
-- calls to various Stream_IO operations. This block statement
|
-- calls to various Stream_IO operations. This block statement
|
-- encloses a call to Create, which should produce an exception in a
|
-- encloses a call to Create, which should produce an exception in a
|
-- non-supportive environment. These exceptions will be handled to
|
-- non-supportive environment. These exceptions will be handled to
|
-- produce a Not_Applicable result.
|
-- produce a Not_Applicable result.
|
|
|
Ada.Streams.Stream_IO.Create (Data_File,
|
Ada.Streams.Stream_IO.Create (Data_File,
|
Ada.Streams.Stream_IO.Out_File,
|
Ada.Streams.Stream_IO.Out_File,
|
The_Filename);
|
The_Filename);
|
|
|
Operational_Test_Block:
|
Operational_Test_Block:
|
declare
|
declare
|
|
|
type Origin_Type is (Foreign, Domestic);
|
type Origin_Type is (Foreign, Domestic);
|
subtype String_Data_Type is String(1..8);
|
subtype String_Data_Type is String(1..8);
|
|
|
type Product_Type is
|
type Product_Type is
|
record
|
record
|
Item : String_Data_Type;
|
Item : String_Data_Type;
|
ID : Natural range 1..100;
|
ID : Natural range 1..100;
|
Manufacture : Origin_Type := Domestic;
|
Manufacture : Origin_Type := Domestic;
|
Distributor : String_Data_Type;
|
Distributor : String_Data_Type;
|
Importer : String_Data_Type;
|
Importer : String_Data_Type;
|
end record;
|
end record;
|
|
|
type Sales_Record_Type is
|
type Sales_Record_Type is
|
record
|
record
|
Name : String_Data_Type;
|
Name : String_Data_Type;
|
Sale_Item : Boolean := False;
|
Sale_Item : Boolean := False;
|
Buyer : Origin_Type;
|
Buyer : Origin_Type;
|
Quantity_Discount : Boolean;
|
Quantity_Discount : Boolean;
|
Cash_Discount : Boolean;
|
Cash_Discount : Boolean;
|
end record;
|
end record;
|
|
|
|
|
-- Mode conformant, user defined subprograms that will override
|
-- Mode conformant, user defined subprograms that will override
|
-- the type-related attributes.
|
-- the type-related attributes.
|
-- In this test, the user defines these subprograms to add/subtract
|
-- In this test, the user defines these subprograms to add/subtract
|
-- specific values from global variables.
|
-- specific values from global variables.
|
|
|
procedure Product_Read
|
procedure Product_Read
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
The_Item : out Product_Type );
|
The_Item : out Product_Type );
|
|
|
procedure Product_Write
|
procedure Product_Write
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
The_Item : Product_Type );
|
The_Item : Product_Type );
|
|
|
procedure Sales_Read
|
procedure Sales_Read
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
The_Item : out Sales_Record_Type );
|
The_Item : out Sales_Record_Type );
|
|
|
procedure Sales_Write
|
procedure Sales_Write
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
The_Item : Sales_Record_Type );
|
The_Item : Sales_Record_Type );
|
|
|
-- Attribute definition clauses.
|
-- Attribute definition clauses.
|
|
|
for Product_Type'Read use Product_Read;
|
for Product_Type'Read use Product_Read;
|
for Product_Type'Write use Product_Write;
|
for Product_Type'Write use Product_Write;
|
|
|
for Sales_Record_Type'Read use Sales_Read;
|
for Sales_Record_Type'Read use Sales_Read;
|
for Sales_Record_Type'Write use Sales_Write;
|
for Sales_Record_Type'Write use Sales_Write;
|
|
|
|
|
-- Object Declarations
|
-- Object Declarations
|
|
|
Product_01 : Product_Type :=
|
Product_01 : Product_Type :=
|
("Product1", 1, Domestic, "Distrib1", "Import 1");
|
("Product1", 1, Domestic, "Distrib1", "Import 1");
|
Product_02 : Product_Type :=
|
Product_02 : Product_Type :=
|
("Product2", 2, Foreign, "Distrib2", "Import 2");
|
("Product2", 2, Foreign, "Distrib2", "Import 2");
|
|
|
Sale_Rec_01 : Sales_Record_Type :=
|
Sale_Rec_01 : Sales_Record_Type :=
|
("Buyer 01", False, Domestic, True, True);
|
("Buyer 01", False, Domestic, True, True);
|
Sale_Rec_02 : Sales_Record_Type :=
|
Sale_Rec_02 : Sales_Record_Type :=
|
("Buyer 02", True, Domestic, True, False);
|
("Buyer 02", True, Domestic, True, False);
|
Sale_Rec_03 : Sales_Record_Type := (Name => "Buyer 03",
|
Sale_Rec_03 : Sales_Record_Type := (Name => "Buyer 03",
|
Sale_Item => True,
|
Sale_Item => True,
|
Buyer => Foreign,
|
Buyer => Foreign,
|
Quantity_Discount => False,
|
Quantity_Discount => False,
|
Cash_Discount => True);
|
Cash_Discount => True);
|
Sale_Rec_04 : Sales_Record_Type :=
|
Sale_Rec_04 : Sales_Record_Type :=
|
("Buyer 04", True, Foreign, False, False);
|
("Buyer 04", True, Foreign, False, False);
|
Sale_Rec_05 : Sales_Record_Type :=
|
Sale_Rec_05 : Sales_Record_Type :=
|
("Buyer 05", False, Foreign, False, False);
|
("Buyer 05", False, Foreign, False, False);
|
|
|
TC_Read_Total : Integer := 100;
|
TC_Read_Total : Integer := 100;
|
TC_Write_Total : Integer := 0;
|
TC_Write_Total : Integer := 0;
|
|
|
|
|
-- Subprogram bodies.
|
-- Subprogram bodies.
|
-- These subprograms are designed to override the default attributes
|
-- These subprograms are designed to override the default attributes
|
-- 'Read and 'Write for the specified types. Each adds/subtracts
|
-- 'Read and 'Write for the specified types. Each adds/subtracts
|
-- a quantity to/from a program control variable, indicating its
|
-- a quantity to/from a program control variable, indicating its
|
-- activity. In addition, each component of the record is
|
-- activity. In addition, each component of the record is
|
-- individually read from or written to the stream, using the
|
-- individually read from or written to the stream, using the
|
-- appropriate 'Read or 'Write attribute for the component type.
|
-- appropriate 'Read or 'Write attribute for the component type.
|
-- The string components are moved to/from the stream using the
|
-- The string components are moved to/from the stream using the
|
-- 'Input and 'Output attributes for the string subtype, so that
|
-- 'Input and 'Output attributes for the string subtype, so that
|
-- the bounds of the strings are also written/read.
|
-- the bounds of the strings are also written/read.
|
|
|
procedure Product_Read
|
procedure Product_Read
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
The_Item : out Product_Type ) is
|
The_Item : out Product_Type ) is
|
begin
|
begin
|
TC_Read_Total := TC_Read_Total - 10;
|
TC_Read_Total := TC_Read_Total - 10;
|
|
|
The_Item.Item := String_Data_Type'Input(Data_Stream); -- Field 1.
|
The_Item.Item := String_Data_Type'Input(Data_Stream); -- Field 1.
|
Natural'Read(Data_Stream, The_Item.ID); -- Field 2.
|
Natural'Read(Data_Stream, The_Item.ID); -- Field 2.
|
Origin_Type'Read(Data_Stream, -- Field 3.
|
Origin_Type'Read(Data_Stream, -- Field 3.
|
The_Item.Manufacture);
|
The_Item.Manufacture);
|
The_Item.Distributor := -- Field 4.
|
The_Item.Distributor := -- Field 4.
|
String_Data_Type'Input(Data_Stream);
|
String_Data_Type'Input(Data_Stream);
|
The_Item.Importer := -- Field 5.
|
The_Item.Importer := -- Field 5.
|
String_Data_Type'Input(Data_Stream);
|
String_Data_Type'Input(Data_Stream);
|
end Product_Read;
|
end Product_Read;
|
|
|
|
|
procedure Product_Write
|
procedure Product_Write
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
The_Item : Product_Type ) is
|
The_Item : Product_Type ) is
|
begin
|
begin
|
TC_Write_Total := TC_Write_Total + 5;
|
TC_Write_Total := TC_Write_Total + 5;
|
|
|
String_Data_Type'Output(Data_Stream, The_Item.Item); -- Field 1.
|
String_Data_Type'Output(Data_Stream, The_Item.Item); -- Field 1.
|
Natural'Write(Data_Stream, The_Item.ID); -- Field 2.
|
Natural'Write(Data_Stream, The_Item.ID); -- Field 2.
|
Origin_Type'Write(Data_Stream, -- Field 3.
|
Origin_Type'Write(Data_Stream, -- Field 3.
|
The_Item.Manufacture);
|
The_Item.Manufacture);
|
String_Data_Type'Output(Data_Stream, -- Field 4.
|
String_Data_Type'Output(Data_Stream, -- Field 4.
|
The_Item.Distributor);
|
The_Item.Distributor);
|
String_Data_Type'Output(Data_Stream, -- Field 5.
|
String_Data_Type'Output(Data_Stream, -- Field 5.
|
The_Item.Importer);
|
The_Item.Importer);
|
end Product_Write;
|
end Product_Write;
|
|
|
|
|
procedure Sales_Read
|
procedure Sales_Read
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
The_Item : out Sales_Record_Type ) is
|
The_Item : out Sales_Record_Type ) is
|
begin
|
begin
|
TC_Read_Total := TC_Read_Total - 20;
|
TC_Read_Total := TC_Read_Total - 20;
|
|
|
The_Item.Name := String_Data_Type'Input(Data_Stream); -- Field 1.
|
The_Item.Name := String_Data_Type'Input(Data_Stream); -- Field 1.
|
Boolean'Read(Data_Stream, The_Item.Sale_Item); -- Field 2.
|
Boolean'Read(Data_Stream, The_Item.Sale_Item); -- Field 2.
|
Origin_Type'Read(Data_Stream, The_Item.Buyer); -- Field 3.
|
Origin_Type'Read(Data_Stream, The_Item.Buyer); -- Field 3.
|
Boolean'Read(Data_Stream, The_Item.Quantity_Discount); -- Field 4.
|
Boolean'Read(Data_Stream, The_Item.Quantity_Discount); -- Field 4.
|
Boolean'Read(Data_Stream, The_Item.Cash_Discount); -- Field 5.
|
Boolean'Read(Data_Stream, The_Item.Cash_Discount); -- Field 5.
|
end Sales_Read;
|
end Sales_Read;
|
|
|
|
|
procedure Sales_Write
|
procedure Sales_Write
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
( Stream : access Ada.Streams.Root_Stream_Type'Class;
|
The_Item : Sales_Record_Type ) is
|
The_Item : Sales_Record_Type ) is
|
begin
|
begin
|
TC_Write_Total := TC_Write_Total + 10;
|
TC_Write_Total := TC_Write_Total + 10;
|
|
|
String_Data_Type'Output(Data_Stream, The_Item.Name); -- Field 1.
|
String_Data_Type'Output(Data_Stream, The_Item.Name); -- Field 1.
|
Boolean'Write(Data_Stream, The_Item.Sale_Item); -- Field 2.
|
Boolean'Write(Data_Stream, The_Item.Sale_Item); -- Field 2.
|
Origin_Type'Write(Data_Stream, The_Item.Buyer); -- Field 3.
|
Origin_Type'Write(Data_Stream, The_Item.Buyer); -- Field 3.
|
Boolean'Write(Data_Stream, The_Item.Quantity_Discount); -- Field 4.
|
Boolean'Write(Data_Stream, The_Item.Quantity_Discount); -- Field 4.
|
Boolean'Write(Data_Stream, The_Item.Cash_Discount); -- Field 5.
|
Boolean'Write(Data_Stream, The_Item.Cash_Discount); -- Field 5.
|
end Sales_Write;
|
end Sales_Write;
|
|
|
|
|
|
|
begin
|
begin
|
|
|
Data_Stream := Ada.Streams.Stream_IO.Stream (Data_File);
|
Data_Stream := Ada.Streams.Stream_IO.Stream (Data_File);
|
|
|
-- Write product and sales data to the stream.
|
-- Write product and sales data to the stream.
|
|
|
Product_Type'Write (Data_Stream, Product_01);
|
Product_Type'Write (Data_Stream, Product_01);
|
Sales_Record_Type'Write (Data_Stream, Sale_Rec_01);
|
Sales_Record_Type'Write (Data_Stream, Sale_Rec_01);
|
Sales_Record_Type'Write (Data_Stream, Sale_Rec_02);
|
Sales_Record_Type'Write (Data_Stream, Sale_Rec_02);
|
|
|
Product_Type'Write (Data_Stream, Product_02);
|
Product_Type'Write (Data_Stream, Product_02);
|
Sales_Record_Type'Write (Data_Stream, Sale_Rec_03);
|
Sales_Record_Type'Write (Data_Stream, Sale_Rec_03);
|
Sales_Record_Type'Write (Data_Stream, Sale_Rec_04);
|
Sales_Record_Type'Write (Data_Stream, Sale_Rec_04);
|
Sales_Record_Type'Write (Data_Stream, Sale_Rec_05);
|
Sales_Record_Type'Write (Data_Stream, Sale_Rec_05);
|
|
|
-- Read data from the stream, and verify the use of the user specified
|
-- Read data from the stream, and verify the use of the user specified
|
-- attributes.
|
-- attributes.
|
|
|
Verify_Data_Block:
|
Verify_Data_Block:
|
declare
|
declare
|
|
|
TC_Product1,
|
TC_Product1,
|
TC_Product2 : Product_Type;
|
TC_Product2 : Product_Type;
|
|
|
TC_Sale1,
|
TC_Sale1,
|
TC_Sale2,
|
TC_Sale2,
|
TC_Sale3,
|
TC_Sale3,
|
TC_Sale4,
|
TC_Sale4,
|
TC_Sale5 : Sales_Record_Type;
|
TC_Sale5 : Sales_Record_Type;
|
|
|
begin
|
begin
|
|
|
-- Reset the mode of the stream file so that Read/Input
|
-- Reset the mode of the stream file so that Read/Input
|
-- operations may be performed.
|
-- operations may be performed.
|
|
|
Ada.Streams.Stream_IO.Reset (Data_File,
|
Ada.Streams.Stream_IO.Reset (Data_File,
|
Ada.Streams.Stream_IO.In_File);
|
Ada.Streams.Stream_IO.In_File);
|
|
|
-- Data is read/reconstructed from the stream, in the order that
|
-- Data is read/reconstructed from the stream, in the order that
|
-- the data was placed into the stream.
|
-- the data was placed into the stream.
|
|
|
Product_Type'Read (Data_Stream, TC_Product1);
|
Product_Type'Read (Data_Stream, TC_Product1);
|
Sales_Record_Type'Read (Data_Stream, TC_Sale1);
|
Sales_Record_Type'Read (Data_Stream, TC_Sale1);
|
Sales_Record_Type'Read (Data_Stream, TC_Sale2);
|
Sales_Record_Type'Read (Data_Stream, TC_Sale2);
|
|
|
Product_Type'Read (Data_Stream, TC_Product2);
|
Product_Type'Read (Data_Stream, TC_Product2);
|
Sales_Record_Type'Read (Data_Stream, TC_Sale3);
|
Sales_Record_Type'Read (Data_Stream, TC_Sale3);
|
Sales_Record_Type'Read (Data_Stream, TC_Sale4);
|
Sales_Record_Type'Read (Data_Stream, TC_Sale4);
|
Sales_Record_Type'Read (Data_Stream, TC_Sale5);
|
Sales_Record_Type'Read (Data_Stream, TC_Sale5);
|
|
|
-- Verify product data was correctly written to/read from stream.
|
-- Verify product data was correctly written to/read from stream.
|
|
|
if TC_Product1 /= Product_01 then
|
if TC_Product1 /= Product_01 then
|
Report.Failed ("Data verification error, Product 1");
|
Report.Failed ("Data verification error, Product 1");
|
end if;
|
end if;
|
if TC_Product2 /= Product_02 then
|
if TC_Product2 /= Product_02 then
|
Report.Failed ("Data verification error, Product 2");
|
Report.Failed ("Data verification error, Product 2");
|
end if;
|
end if;
|
|
|
if TC_Sale1 /= Sale_Rec_01 then
|
if TC_Sale1 /= Sale_Rec_01 then
|
Report.Failed ("Data verification error, Sale_Rec_01");
|
Report.Failed ("Data verification error, Sale_Rec_01");
|
end if;
|
end if;
|
if TC_Sale2 /= Sale_Rec_02 then
|
if TC_Sale2 /= Sale_Rec_02 then
|
Report.Failed ("Data verification error, Sale_Rec_02");
|
Report.Failed ("Data verification error, Sale_Rec_02");
|
end if;
|
end if;
|
if TC_Sale3 /= Sale_Rec_03 then
|
if TC_Sale3 /= Sale_Rec_03 then
|
Report.Failed ("Data verification error, Sale_Rec_03");
|
Report.Failed ("Data verification error, Sale_Rec_03");
|
end if;
|
end if;
|
if TC_Sale4 /= Sale_Rec_04 then
|
if TC_Sale4 /= Sale_Rec_04 then
|
Report.Failed ("Data verification error, Sale_Rec_04");
|
Report.Failed ("Data verification error, Sale_Rec_04");
|
end if;
|
end if;
|
if TC_Sale5 /= Sale_Rec_05 then
|
if TC_Sale5 /= Sale_Rec_05 then
|
Report.Failed ("Data verification error, Sale_Rec_05");
|
Report.Failed ("Data verification error, Sale_Rec_05");
|
end if;
|
end if;
|
|
|
-- Verify that the user defined subprograms were used to
|
-- Verify that the user defined subprograms were used to
|
-- override the default 'Read and 'Write attributes.
|
-- override the default 'Read and 'Write attributes.
|
-- There were two "product" reads and two writes; there
|
-- There were two "product" reads and two writes; there
|
-- were five "sale record" reads and five writes.
|
-- were five "sale record" reads and five writes.
|
|
|
if (TC_Read_Total /= -20) or (TC_Write_Total /= 60) then
|
if (TC_Read_Total /= -20) or (TC_Write_Total /= 60) then
|
Report.Failed ("Incorrect use of user defined attributes");
|
Report.Failed ("Incorrect use of user defined attributes");
|
end if;
|
end if;
|
|
|
end Verify_Data_Block;
|
end Verify_Data_Block;
|
|
|
exception
|
exception
|
|
|
when others =>
|
when others =>
|
Report.Failed ("Exception raised in Operational Test Block");
|
Report.Failed ("Exception raised in Operational Test Block");
|
|
|
end Operational_Test_Block;
|
end Operational_Test_Block;
|
|
|
if Ada.Streams.Stream_IO.Is_Open (Data_File) then
|
if Ada.Streams.Stream_IO.Is_Open (Data_File) then
|
Ada.Streams.Stream_IO.Delete (Data_File);
|
Ada.Streams.Stream_IO.Delete (Data_File);
|
else
|
else
|
Ada.Streams.Stream_IO.Open (Data_File,
|
Ada.Streams.Stream_IO.Open (Data_File,
|
Ada.Streams.Stream_IO.Out_File,
|
Ada.Streams.Stream_IO.Out_File,
|
The_Filename);
|
The_Filename);
|
Ada.Streams.Stream_IO.Delete (Data_File);
|
Ada.Streams.Stream_IO.Delete (Data_File);
|
end if;
|
end if;
|
|
|
|
|
exception
|
exception
|
|
|
-- Since Use_Error or Name_Error can be raised if, for the specified
|
-- Since Use_Error or Name_Error can be raised if, for the specified
|
-- mode, the environment does not support Stream_IO operations,
|
-- mode, the environment does not support Stream_IO operations,
|
-- the following handlers are included:
|
-- the following handlers are included:
|
|
|
when Ada.Streams.Stream_IO.Name_Error =>
|
when Ada.Streams.Stream_IO.Name_Error =>
|
Report.Not_Applicable ("Name_Error raised on Stream IO Create");
|
Report.Not_Applicable ("Name_Error raised on Stream IO Create");
|
|
|
when Ada.Streams.Stream_IO.Use_Error =>
|
when Ada.Streams.Stream_IO.Use_Error =>
|
Report.Not_Applicable ("Use_Error raised on Stream IO Create");
|
Report.Not_Applicable ("Use_Error raised on Stream IO Create");
|
|
|
when others =>
|
when others =>
|
Report.Failed ("Unexpected exception raised");
|
Report.Failed ("Unexpected exception raised");
|
|
|
end Test_for_Stream_IO_Support;
|
end Test_for_Stream_IO_Support;
|
|
|
Report.Result;
|
Report.Result;
|
|
|
end CXACA02;
|
end CXACA02;
|
|
|