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/] [cxa/] [cxaa001.a] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
-- CXAA001.A
-- CXAA001.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 the Line_Length and Page_Length maximums for a Text_IO
--      Check that the Line_Length and Page_Length maximums for a Text_IO
--      file of mode Append_File are initially zero (unbounded) after a
--      file of mode Append_File are initially zero (unbounded) after a
--      Create, Open, or Reset, and that these values can be modified using
--      Create, Open, or Reset, and that these values can be modified using
--      the procedures Set_Line_Length and Set_Page_Length.
--      the procedures Set_Line_Length and Set_Page_Length.
--      Check that setting the Line_Length and Page_Length attributes to zero
--      Check that setting the Line_Length and Page_Length attributes to zero
--      results in an unbounded Text_IO file.
--      results in an unbounded Text_IO file.
--      Check that setting the line length when in Append_Mode doesn't
--      Check that setting the line length when in Append_Mode doesn't
--      change the length of lines previously written to the Text_IO file.
--      change the length of lines previously written to the Text_IO file.
--
--
-- TEST DESCRIPTION:
-- TEST DESCRIPTION:
--      This test attempts to simulate a possible text processing environment.
--      This test attempts to simulate a possible text processing environment.
--      String values, from a number of different string types, are written to
--      String values, from a number of different string types, are written to
--      a Text_IO file.  Prior to the writing of each, the line length is set
--      a Text_IO file.  Prior to the writing of each, the line length is set
--      to the particular length of the data being written.  In addition, the
--      to the particular length of the data being written.  In addition, the
--      default line and page lengths are checked, to determine whether they
--      default line and page lengths are checked, to determine whether they
--      are unbounded (length = 0) following a create, reset, or open of a
--      are unbounded (length = 0) following a create, reset, or open of a
--      Text_IO file with mode Append_File.
--      Text_IO file with mode Append_File.
--
--
-- APPLICABILITY CRITERIA:
-- APPLICABILITY CRITERIA:
--      This test is applicable only to implementations that support text
--      This test is applicable only to implementations that support text
--      files.
--      files.
--
--
--
--
-- CHANGE HISTORY:
-- CHANGE HISTORY:
--      06 Dec 94   SAIC    ACVC 2.0
--      06 Dec 94   SAIC    ACVC 2.0
--      27 Feb 97   PWB.CTA Allowed for non-support of some IO operations
--      27 Feb 97   PWB.CTA Allowed for non-support of some IO operations
--!
--!
with Ada.Text_IO;
with Ada.Text_IO;
with Report;
with Report;
procedure CXAA001 is
procedure CXAA001 is
   use Ada;
   use Ada;
   Data_File      : Text_IO.File_Type;
   Data_File      : Text_IO.File_Type;
   Data_Filename  : constant String :=
   Data_Filename  : constant String :=
                              Report.Legal_File_Name ( Nam => "CXAA001" );
                              Report.Legal_File_Name ( Nam => "CXAA001" );
   Incomplete : exception;
   Incomplete : exception;
begin
begin
   Report.Test ("CXAA001","Check that the Line_Length and Page_Length "      &
   Report.Test ("CXAA001","Check that the Line_Length and Page_Length "      &
                          "maximums for a Text_IO file of mode Append_File " &
                          "maximums for a Text_IO file of mode Append_File " &
                          "are initially zero (unbounded) after a Create, "  &
                          "are initially zero (unbounded) after a Create, "  &
                          "Open, or Reset, and that these values can be "    &
                          "Open, or Reset, and that these values can be "    &
                          "modified using the procedures Set_Line_Length "   &
                          "modified using the procedures Set_Line_Length "   &
                          "and Set_Page_Length");
                          "and Set_Page_Length");
   Test_for_Text_IO_Support:
   Test_for_Text_IO_Support:
   begin
   begin
      -- An implementation that does not support Text_IO in a particular
      -- An implementation that does not support Text_IO in a particular
      -- environment will raise Use_Error on calls to various
      -- environment will raise Use_Error on calls to various
      -- Text_IO operations.  This block statement encloses a call to
      -- Text_IO operations.  This block statement encloses a call to
      -- Create, which should raise an exception in a non-supportive
      -- Create, which should raise an exception in a non-supportive
      -- environment.  This exception will be handled to produce a
      -- environment.  This exception will be handled to produce a
      -- Not_Applicable result.
      -- Not_Applicable result.
      Text_IO.Create (File => Data_File,
      Text_IO.Create (File => Data_File,
                      Mode => Text_IO.Append_File,
                      Mode => Text_IO.Append_File,
                      Name => Data_Filename);
                      Name => Data_Filename);
   exception
   exception
       when Text_IO.Use_Error | Text_IO.Name_Error =>
       when Text_IO.Use_Error | Text_IO.Name_Error =>
          Report.Not_Applicable
          Report.Not_Applicable
             ( "Files not supported - Create as Append_File for Text_IO" );
             ( "Files not supported - Create as Append_File for Text_IO" );
          raise Incomplete;
          raise Incomplete;
   end Test_for_Text_IO_Support;
   end Test_for_Text_IO_Support;
   Operational_Test_Block:
   Operational_Test_Block:
   declare
   declare
      subtype Confidential_Data_Type is string (1 .. 10);
      subtype Confidential_Data_Type is string (1 .. 10);
      subtype Secret_Data_Type       is string (1 .. 20);
      subtype Secret_Data_Type       is string (1 .. 20);
      subtype Top_Secret_Data_Type   is string (1 .. 30);
      subtype Top_Secret_Data_Type   is string (1 .. 30);
      Zero                   : constant Text_IO.Count :=  0;
      Zero                   : constant Text_IO.Count :=  0;
      Confidential_Data_Size : constant Text_IO.Count := 10;
      Confidential_Data_Size : constant Text_IO.Count := 10;
      Secret_Data_Size       : constant Text_IO.Count := 20;
      Secret_Data_Size       : constant Text_IO.Count := 20;
      Top_Secret_Data_Size   : constant Text_IO.Count := 30;
      Top_Secret_Data_Size   : constant Text_IO.Count := 30;
      -- The following generic procedure is designed to simulate a text
      -- The following generic procedure is designed to simulate a text
      -- processing environment where line and page sizes are set and
      -- processing environment where line and page sizes are set and
      -- verified prior to the writing of data to a file.
      -- verified prior to the writing of data to a file.
      generic
      generic
         Data_Size : Text_IO.Count;
         Data_Size : Text_IO.Count;
      procedure Write_Data_To_File (Data_Item : in String);
      procedure Write_Data_To_File (Data_Item : in String);
      procedure Write_Data_To_File (Data_Item : in String) is
      procedure Write_Data_To_File (Data_Item : in String) is
         use Text_IO;  -- Used to provide visibility to the "/=" operator.
         use Text_IO;  -- Used to provide visibility to the "/=" operator.
      begin
      begin
         if (Text_IO.Line_Length (Data_File) /= Zero) then -- Check default
         if (Text_IO.Line_Length (Data_File) /= Zero) then -- Check default
            Report.Failed("Line not of unbounded length"); -- line length,
            Report.Failed("Line not of unbounded length"); -- line length,
         elsif (Text_IO.Page_Length (Data_File) /= Zero) then -- default
         elsif (Text_IO.Page_Length (Data_File) /= Zero) then -- default
            Report.Failed ("Page not of unbounded length"); -- page length.
            Report.Failed ("Page not of unbounded length"); -- page length.
         end if;
         end if;
         Text_IO.Set_Line_Length (File => Data_File,    -- Set the line
         Text_IO.Set_Line_Length (File => Data_File,    -- Set the line
                                  To   => Data_Size);   -- length.
                                  To   => Data_Size);   -- length.
         Text_IO.Set_Page_Length (File => Data_File,    -- Set the page
         Text_IO.Set_Page_Length (File => Data_File,    -- Set the page
                                  To   => Data_Size);   -- length.
                                  To   => Data_Size);   -- length.
         -- Verify the lengths set.
         -- Verify the lengths set.
         if (Integer(Text_IO.Line_Length (Data_File)) /=
         if (Integer(Text_IO.Line_Length (Data_File)) /=
             Report.Ident_Int(Integer(Data_Size))) then
             Report.Ident_Int(Integer(Data_Size))) then
            Report.Failed ("Line length not set to appropriate length");
            Report.Failed ("Line length not set to appropriate length");
         elsif (Integer(Text_IO.Page_Length (Data_File)) /=
         elsif (Integer(Text_IO.Page_Length (Data_File)) /=
                Report.Ident_Int(Integer(Data_Size))) then
                Report.Ident_Int(Integer(Data_Size))) then
            Report.Failed ("Page length not set to appropriate length");
            Report.Failed ("Page length not set to appropriate length");
         end if;
         end if;
         Text_IO.Put_Line (File => Data_File,           -- Write data to
         Text_IO.Put_Line (File => Data_File,           -- Write data to
                           Item => Data_Item);          -- file.
                           Item => Data_Item);          -- file.
      end Write_Data_To_File;
      end Write_Data_To_File;
      -- Instantiation for the three data types/sizes.
      -- Instantiation for the three data types/sizes.
      procedure Write_Confidential_Data is
      procedure Write_Confidential_Data is
        new Write_Data_To_File (Data_Size => Confidential_Data_Size);
        new Write_Data_To_File (Data_Size => Confidential_Data_Size);
      procedure Write_Secret_Data is
      procedure Write_Secret_Data is
        new Write_Data_To_File (Data_Size => Secret_Data_Size);
        new Write_Data_To_File (Data_Size => Secret_Data_Size);
      procedure Write_Top_Secret_Data is
      procedure Write_Top_Secret_Data is
        new Write_Data_To_File (Data_Size => Top_Secret_Data_Size);
        new Write_Data_To_File (Data_Size => Top_Secret_Data_Size);
      Confidential_Item : Confidential_Data_Type := "Confidenti";
      Confidential_Item : Confidential_Data_Type := "Confidenti";
      Secret_Item       : Secret_Data_Type       := "Secret Data Values  ";
      Secret_Item       : Secret_Data_Type       := "Secret Data Values  ";
      Top_Secret_Item   : Top_Secret_Data_Type   :=
      Top_Secret_Item   : Top_Secret_Data_Type   :=
        "Extremely Top Secret Data     ";
        "Extremely Top Secret Data     ";
   begin
   begin
      -- The following call simulates processing occurring after the create
      -- The following call simulates processing occurring after the create
      -- of a Text_IO file with mode Append_File.
      -- of a Text_IO file with mode Append_File.
      Write_Confidential_Data (Confidential_Item);
      Write_Confidential_Data (Confidential_Item);
      -- The following call simulates processing occurring after the reset
      -- The following call simulates processing occurring after the reset
      -- of a Text_IO file with mode Append_File.
      -- of a Text_IO file with mode Append_File.
      Reset1:
      Reset1:
      begin
      begin
         Text_IO.Reset (Data_File, Text_IO.Append_File); -- Reset to
         Text_IO.Reset (Data_File, Text_IO.Append_File); -- Reset to
                                                         -- Append_File mode.
                                                         -- Append_File mode.
      exception
      exception
         when Text_IO.Use_Error =>
         when Text_IO.Use_Error =>
            Report.Not_Applicable
            Report.Not_Applicable
               ( "Reset to Append_File not supported for Text_IO" );
               ( "Reset to Append_File not supported for Text_IO" );
            raise Incomplete;
            raise Incomplete;
      end Reset1;
      end Reset1;
      Write_Secret_Data (Data_Item    => Secret_Item);
      Write_Secret_Data (Data_Item    => Secret_Item);
      Text_IO.Close (Data_File);                      -- Close file.
      Text_IO.Close (Data_File);                      -- Close file.
      -- The following processing simulates processing occurring after the
      -- The following processing simulates processing occurring after the
      -- opening of an existing file with mode Append_File.
      -- opening of an existing file with mode Append_File.
      Text_IO.Open (Data_File,                        -- Open file in
      Text_IO.Open (Data_File,                        -- Open file in
                    Text_IO.Append_File,              -- Append_File mode.
                    Text_IO.Append_File,              -- Append_File mode.
                    Data_Filename);
                    Data_Filename);
      Write_Top_Secret_Data (Top_Secret_Item);
      Write_Top_Secret_Data (Top_Secret_Item);
      Test_Verification_Block:
      Test_Verification_Block:
      declare
      declare
         TC_String1,
         TC_String1,
         TC_String2,
         TC_String2,
         TC_String3  : String (1..80) := (others => ' ');
         TC_String3  : String (1..80) := (others => ' ');
         TC_Length1,
         TC_Length1,
         TC_Length2,
         TC_Length2,
         TC_Length3  : Natural := 0;
         TC_Length3  : Natural := 0;
      begin
      begin
         Reset2:
         Reset2:
         begin
         begin
            Text_IO.Reset (Data_File, Text_IO.In_File); -- Reset for reading.
            Text_IO.Reset (Data_File, Text_IO.In_File); -- Reset for reading.
         exception
         exception
            when Text_IO.Use_Error =>
            when Text_IO.Use_Error =>
               Report.Not_Applicable
               Report.Not_Applicable
                  ( "Reset to In_File not supported for Text_IO" );
                  ( "Reset to In_File not supported for Text_IO" );
               raise Incomplete;
               raise Incomplete;
         end Reset2;
         end Reset2;
         Text_IO.Get_Line (Data_File, TC_String1, TC_Length1);
         Text_IO.Get_Line (Data_File, TC_String1, TC_Length1);
         Text_IO.Get_Line (Data_File, TC_String2, TC_Length2);
         Text_IO.Get_Line (Data_File, TC_String2, TC_Length2);
         Text_IO.Get_Line (Data_File, TC_String3, TC_Length3);
         Text_IO.Get_Line (Data_File, TC_String3, TC_Length3);
         -- Verify that the line lengths of each line were accurate.
         -- Verify that the line lengths of each line were accurate.
         -- Note: Each data line was written to the file after the
         -- Note: Each data line was written to the file after the
         -- particular line length had been set (to the data length).
         -- particular line length had been set (to the data length).
         if not ((TC_Length1 = Natural(Confidential_Data_Size)) and
         if not ((TC_Length1 = Natural(Confidential_Data_Size)) and
                 (TC_Length2 = Natural(Secret_Data_Size))       and
                 (TC_Length2 = Natural(Secret_Data_Size))       and
                 (TC_Length3 = Natural(Top_Secret_Data_Size)))  then
                 (TC_Length3 = Natural(Top_Secret_Data_Size)))  then
            Report.Failed ("Inaccurate line lengths read from file");
            Report.Failed ("Inaccurate line lengths read from file");
         end if;
         end if;
         -- Verify that the data read from the file are accurate.
         -- Verify that the data read from the file are accurate.
         if (TC_String1(1..TC_Length1) /= Confidential_Item) or else
         if (TC_String1(1..TC_Length1) /= Confidential_Item) or else
            (TC_String2(1..TC_Length2) /= Secret_Item)       or else
            (TC_String2(1..TC_Length2) /= Secret_Item)       or else
            (TC_String3(1..TC_Length3) /= Top_Secret_Item)   then
            (TC_String3(1..TC_Length3) /= Top_Secret_Item)   then
            Report.Failed ("Corrupted data items read from file");
            Report.Failed ("Corrupted data items read from file");
         end if;
         end if;
      exception
      exception
         when Incomplete =>
         when Incomplete =>
            raise;
            raise;
         when others =>
         when others =>
               Report.Failed ("Error raised during data verification");
               Report.Failed ("Error raised during data verification");
      end Test_Verification_Block;
      end Test_Verification_Block;
   exception
   exception
         when Incomplete =>
         when Incomplete =>
            raise;
            raise;
         when others =>
         when others =>
            Report.Failed ("Exception raised during Text_IO processing");
            Report.Failed ("Exception raised during Text_IO processing");
      end Operational_Test_Block;
      end Operational_Test_Block;
      Deletion:
      Deletion:
      begin
      begin
         -- Check that the file is open prior to deleting it.
         -- Check that the file is open prior to deleting it.
         if Text_IO.Is_Open(Data_File) then
         if Text_IO.Is_Open(Data_File) then
            Text_IO.Delete(Data_File);
            Text_IO.Delete(Data_File);
         else
         else
            Text_IO.Open(Data_File, Text_IO.In_File, Data_Filename);
            Text_IO.Open(Data_File, Text_IO.In_File, Data_Filename);
            Text_IO.Delete(Data_File);
            Text_IO.Delete(Data_File);
         end if;
         end if;
   exception
   exception
      when others =>
      when others =>
         Report.Failed
         Report.Failed
            ( "Delete not properly implemented for Text_IO" );
            ( "Delete not properly implemented for Text_IO" );
   end Deletion;
   end Deletion;
   Report.Result;
   Report.Result;
exception
exception
   when Incomplete =>
   when Incomplete =>
      Report.Result;
      Report.Result;
   when others     =>
   when others     =>
      Report.Failed ( "Unexpected exception" );
      Report.Failed ( "Unexpected exception" );
      Report.Result;
      Report.Result;
end CXAA001;
end CXAA001;
 
 

powered by: WebSVN 2.1.0

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