OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [ca/] [ca110051.am] - Diff between revs 154 and 816

Only display areas with differences | Details | Blame | View Log

Rev 154 Rev 816
-- CA110051.AM
-- CA110051.AM
--
--
--                             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 entities and operations declared in a package can be used
--      Check that entities and operations declared in a package can be used
--      in the private part of a child of a child of the package.
--      in the private part of a child of a child of the package.
--
--
-- TEST DESCRIPTION:
-- TEST DESCRIPTION:
--      Declare a series of library unit packages -- parent, child, and
--      Declare a series of library unit packages -- parent, child, and
--      grandchild.  The grandchild package will have a private part.
--      grandchild.  The grandchild package will have a private part.
--      From within the private part of the grandchild, make use of
--      From within the private part of the grandchild, make use of
--      components declared in the parent and grandparent packages.
--      components declared in the parent and grandparent packages.
--
--
-- TEST FILES:
-- TEST FILES:
--      The test consists of the following files:
--      The test consists of the following files:
--
--
--         CA110050.A
--         CA110050.A
--      => CA110051.AM
--      => CA110051.AM
--
--
--
--
-- CHANGE HISTORY:
-- CHANGE HISTORY:
--      06 Dec 94   SAIC    ACVC 2.0
--      06 Dec 94   SAIC    ACVC 2.0
--
--
--!
--!
                                    -- Grandchild Package Message.Text.Encoded
                                    -- Grandchild Package Message.Text.Encoded
package CA110050_0.CA110050_1.CA110050_2 is
package CA110050_0.CA110050_1.CA110050_2 is
   type Coded_Message is new Text_Message_Type with private;
   type Coded_Message is new Text_Message_Type with private;
   procedure Send (Message : in     Coded_Message;
   procedure Send (Message : in     Coded_Message;
                   Confirm :    out Coded_Message;
                   Confirm :    out Coded_Message;
                   Status  :    out Boolean);
                   Status  :    out Boolean);
   function Encode (Message : Text_Message_Type) return Coded_Message;
   function Encode (Message : Text_Message_Type) return Coded_Message;
   function Decode (Message : Coded_Message)     return Boolean;
   function Decode (Message : Coded_Message)     return Boolean;
   function Test_Connection                      return Boolean;
   function Test_Connection                      return Boolean;
private
private
   Uncoded : Descriptor renames Null_Descriptor_Value; -- Grandparent object.
   Uncoded : Descriptor renames Null_Descriptor_Value; -- Grandparent object.
   type Coded_Message is new Text_Message_Type with    -- Parent type.
   type Coded_Message is new Text_Message_Type with    -- Parent type.
      record
      record
         Key       : Descriptor := Uncoded;
         Key       : Descriptor := Uncoded;
         Coded_Key : Descriptor := Next_Available_Message;
         Coded_Key : Descriptor := Next_Available_Message;
                                 -- Grandparent type, grandparent function.
                                 -- Grandparent type, grandparent function.
         Scrambled : Text_Type  := Null_Text;          -- Parent object.
         Scrambled : Text_Type  := Null_Text;          -- Parent object.
      end record;
      end record;
   Coded_Msg : Coded_Message;
   Coded_Msg : Coded_Message;
   type Blank_Message is new Message_Type with         -- Grandparent type.
   type Blank_Message is new Message_Type with         -- Grandparent type.
      record
      record
         ID        : Descriptor := Next_Available_Message;
         ID        : Descriptor := Next_Available_Message;
                                 -- Grandparent type, grandparent function.
                                 -- Grandparent type, grandparent function.
      end record;
      end record;
   Test_Message     : Blank_Message;
   Test_Message     : Blank_Message;
   Confirm_String   : constant String := "OK";
   Confirm_String   : constant String := "OK";
   Scrambled_String : constant String := "KO";
   Scrambled_String : constant String := "KO";
   Confirm_Text : Text_Type (Confirm_String'Length) :=
   Confirm_Text : Text_Type (Confirm_String'Length) :=
     (Max_Length => Confirm_String'Length,
     (Max_Length => Confirm_String'Length,
      Length     => Confirm_String'Length,
      Length     => Confirm_String'Length,
      Text_Field => Confirm_String);
      Text_Field => Confirm_String);
   Scrambled_Text : Text_Type (Scrambled_String'Length) :=
   Scrambled_Text : Text_Type (Scrambled_String'Length) :=
     (Max_Length => Scrambled_String'Length,
     (Max_Length => Scrambled_String'Length,
      Length     => Scrambled_String'Length,
      Length     => Scrambled_String'Length,
      Text_Field => Scrambled_String);
      Text_Field => Scrambled_String);
end CA110050_0.CA110050_1.CA110050_2; -- Grandchild Pkg Message.Text.Encoded
end CA110050_0.CA110050_1.CA110050_2; -- Grandchild Pkg Message.Text.Encoded
     --=================================================================--
     --=================================================================--
                               -- Grandchild Package body Message.Text.Encoded
                               -- Grandchild Package body Message.Text.Encoded
package body CA110050_0.CA110050_1.CA110050_2 is
package body CA110050_0.CA110050_1.CA110050_2 is
   procedure Send (Message : in     Coded_Message;
   procedure Send (Message : in     Coded_Message;
                   Confirm :    out Coded_Message;
                   Confirm :    out Coded_Message;
                   Status  :    out Boolean) is
                   Status  :    out Boolean) is
      Confirmation_Message : Coded_Message :=
      Confirmation_Message : Coded_Message :=
        (Number    => Message.Number,
        (Number    => Message.Number,
         Text      => Confirm_Text,
         Text      => Confirm_Text,
         Key       => Message.Number,
         Key       => Message.Number,
         Coded_Key => Message.Number,
         Coded_Key => Message.Number,
         Scrambled => Scrambled_Text);
         Scrambled => Scrambled_Text);
   begin                                          -- Dummy processing unit.
   begin                                          -- Dummy processing unit.
      Confirm := Confirmation_Message;
      Confirm := Confirmation_Message;
      if Confirm.Number /= Null_Message_Descriptor then
      if Confirm.Number /= Null_Message_Descriptor then
         Status := True;
         Status := True;
      else
      else
         Status := False;
         Status := False;
      end if;
      end if;
   end Send;
   end Send;
   -------------------------------------------------------------------------
   -------------------------------------------------------------------------
   function Encode (Message : Text_Message_Type)  return Coded_Message is
   function Encode (Message : Text_Message_Type)  return Coded_Message is
   begin
   begin
      Coded_Msg.Number       := Message.Number;
      Coded_Msg.Number       := Message.Number;
      if Message.Text.Length > 0 then
      if Message.Text.Length > 0 then
         Coded_Msg.Text      := Message.Text;     -- Record assignment.
         Coded_Msg.Text      := Message.Text;     -- Record assignment.
         Coded_Msg.Key       := Message.Number;   -- Same as msg number.
         Coded_Msg.Key       := Message.Number;   -- Same as msg number.
         Coded_Msg.Coded_Key := Message.Number;   -- Same as msg number.
         Coded_Msg.Coded_Key := Message.Number;   -- Same as msg number.
         Coded_Msg.Scrambled := Message.Text;     -- Dummy processing.
         Coded_Msg.Scrambled := Message.Text;     -- Dummy processing.
      end if;
      end if;
      return (Coded_Msg);
      return (Coded_Msg);
   end Encode;
   end Encode;
   -------------------------------------------------------------------------
   -------------------------------------------------------------------------
   function Decode (Message : Coded_Message) return Boolean is
   function Decode (Message : Coded_Message) return Boolean is
      Decoded : Boolean := False;
      Decoded : Boolean := False;
   begin
   begin
      if (Message.Text.Length = Confirm_String'Length)        and then
      if (Message.Text.Length = Confirm_String'Length)        and then
         (Message.Text.Text_Field = Confirm_String)           and then
         (Message.Text.Text_Field = Confirm_String)           and then
         (Message.Scrambled.Length = Scrambled_String'Length) and then
         (Message.Scrambled.Length = Scrambled_String'Length) and then
         (Message.Scrambled.Text_Field = Scrambled_String)    and then
         (Message.Scrambled.Text_Field = Scrambled_String)    and then
         (Message.Coded_Key = 15)
         (Message.Coded_Key = 15)
      then
      then
         Decoded := True;
         Decoded := True;
      end if;
      end if;
      return (Decoded);
      return (Decoded);
   end Decode;
   end Decode;
   -------------------------------------------------------------------------
   -------------------------------------------------------------------------
   function Test_Connection return Boolean is
   function Test_Connection return Boolean is
   begin
   begin
      return Test_Message.Id = 10;
      return Test_Message.Id = 10;
   end Test_Connection;
   end Test_Connection;
end CA110050_0.CA110050_1.CA110050_2;
end CA110050_0.CA110050_1.CA110050_2;
                               -- Grandchild Package body Message.Text.Encoded
                               -- Grandchild Package body Message.Text.Encoded
     --=================================================================--
     --=================================================================--
with CA110050_0.CA110050_1.CA110050_2;
with CA110050_0.CA110050_1.CA110050_2;
with Report;
with Report;
procedure CA110051 is
procedure CA110051 is
   package Message_Package renames CA110050_0.CA110050_1;
   package Message_Package renames CA110050_0.CA110050_1;
   package Code_Package    renames CA110050_0.CA110050_1.CA110050_2;
   package Code_Package    renames CA110050_0.CA110050_1.CA110050_2;
   Message_String : constant String := "One if by land, two if by sea";
   Message_String : constant String := "One if by land, two if by sea";
   Message_Text   : Message_Package.Text_Type (Message_String'Length) :=
   Message_Text   : Message_Package.Text_Type (Message_String'Length) :=
     (Max_Length => Message_String'Length,
     (Max_Length => Message_String'Length,
      Length     => Message_String'Length,
      Length     => Message_String'Length,
      Text_Field => Message_String);
      Text_Field => Message_String);
   Message : Message_Package.Text_Message_Type :=
   Message : Message_Package.Text_Message_Type :=
     (Number => CA110050_0.Next_Available_Message,
     (Number => CA110050_0.Next_Available_Message,
      Text   => Message_Text);
      Text   => Message_Text);
   Confirmation_Message : Code_Package.Coded_Message;
   Confirmation_Message : Code_Package.Coded_Message;
   Verification_OK      : Boolean := False;
   Verification_OK      : Boolean := False;
   Transmission_OK      : Boolean := False;
   Transmission_OK      : Boolean := False;
begin
begin
-- This test simulates the use of child library unit packages to implement
-- This test simulates the use of child library unit packages to implement
-- a message encoding and transmission scheme.  The full capability of the
-- a message encoding and transmission scheme.  The full capability of the
-- encoding and transmission mechanisms are not developed here, but the
-- encoding and transmission mechanisms are not developed here, but the
-- intent is to demonstrate that a grandchild library unit package with a
-- intent is to demonstrate that a grandchild library unit package with a
-- private part will provide the framework for this type of processing.
-- private part will provide the framework for this type of processing.
   Report.Test ("CA110051", "Check that entities and operations declared "  &
   Report.Test ("CA110051", "Check that entities and operations declared "  &
                            "in a package can be used in the private part " &
                            "in a package can be used in the private part " &
                            "of a child of a child of the package");
                            "of a child of a child of the package");
                            -- The following code demonstrates the use
                            -- The following code demonstrates the use
                            -- of functionality contained in a grandchild
                            -- of functionality contained in a grandchild
                            -- library unit.  The grandchild unit made use
                            -- library unit.  The grandchild unit made use
                            -- of components declared in the ancestor
                            -- of components declared in the ancestor
                            -- packages.
                            -- packages.
   Code_Package.Send                            -- Message object declared
   Code_Package.Send                            -- Message object declared
     (Message => Code_Package.Encode (Message), -- above in "encoded" by a
     (Message => Code_Package.Encode (Message), -- above in "encoded" by a
      Confirm => Confirmation_Message,          -- call to grandchild pkg
      Confirm => Confirmation_Message,          -- call to grandchild pkg
      Status  => Transmission_OK);              -- function call, reseting
      Status  => Transmission_OK);              -- function call, reseting
                                                -- fields and returning a
                                                -- fields and returning a
                                                -- coded message to the
                                                -- coded message to the
                                                -- parameter.  The confirm
                                                -- parameter.  The confirm
                                                -- parameter receives an
                                                -- parameter receives an
                                                -- encoded message value
                                                -- encoded message value
                                                -- from proc Send, which is
                                                -- from proc Send, which is
                                                -- "decoded"/verified below.
                                                -- "decoded"/verified below.
   if not Code_Package.Test_Connection then
   if not Code_Package.Test_Connection then
      Report.Failed ("Bad initialization");
      Report.Failed ("Bad initialization");
   end if;
   end if;
   Verification_OK := Code_Package.Decode (Confirmation_Message);
   Verification_OK := Code_Package.Decode (Confirmation_Message);
   if not (Transmission_OK and Verification_OK) then
   if not (Transmission_OK and Verification_OK) then
      Report.Failed ("Message transmission failure");
      Report.Failed ("Message transmission failure");
   end if;
   end if;
   Report.Result;
   Report.Result;
end CA110051;
end CA110051;
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.