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/] [cxaa002.a] - Diff between revs 154 and 816

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

Rev 154 Rev 816
-- CXAA002.A
-- CXAA002.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 procedures New_Page, Set_Line, Set_Col, and New_Line
--      Check that the procedures New_Page, Set_Line, Set_Col, and New_Line
--      subprograms perform properly on a text file created with mode
--      subprograms perform properly on a text file created with mode
--      Append_File.
--      Append_File.
--      Check that the attributes Page, Line, and Column are all set to 1
--      Check that the attributes Page, Line, and Column are all set to 1
--      following the creation of a text file with mode Append_File.
--      following the creation of a text file with mode Append_File.
--      Check that the functions Page, Line, and Col perform properly on a
--      Check that the functions Page, Line, and Col perform properly on a
--      text file created with mode Append_File.
--      text file created with mode Append_File.
--      Check that the procedures Put and Put_Line perform properly on text
--      Check that the procedures Put and Put_Line perform properly on text
--      files created with mode Append_File.
--      files created with mode Append_File.
--      Check that the procedure Set_Line sets the current line number to
--      Check that the procedure Set_Line sets the current line number to
--      the value specified by the parameter "To" for text files created with
--      the value specified by the parameter "To" for text files created with
--      mode Append_File.
--      mode Append_File.
--      Check that the procedure Set_Col sets the current column number to
--      Check that the procedure Set_Col sets the current column number to
--      the value specified by the parameter "To" for text files created with
--      the value specified by the parameter "To" for text files created with
--      mode Append_File.
--      mode Append_File.
--
--
-- TEST DESCRIPTION:
-- TEST DESCRIPTION:
--      This test is designed to simulate the text processing that could
--      This test is designed to simulate the text processing that could
--      occur with files that have been created in Append_File mode. Various
--      occur with files that have been created in Append_File mode. Various
--      calls to Text_IO formatting subprograms are called to properly
--      calls to Text_IO formatting subprograms are called to properly
--      position text appended to a document.  The text content and position
--      position text appended to a document.  The text content and position
--      are subsequently verified for accuracy.
--      are subsequently verified for accuracy.
--
--
-- 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 CXAA002 is
procedure CXAA002 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 => "CXAA002" );
                             Report.Legal_File_Name ( Nam => "CXAA002" );
   Incomplete : exception;
   Incomplete : exception;
begin
begin
   Report.Test ("CXAA002", "Check that page, line, and column formatting " &
   Report.Test ("CXAA002", "Check that page, line, and column formatting " &
                           "subprograms perform properly on text files "   &
                           "subprograms perform properly on text files "   &
                           "created with mode Append_File");
                           "created with mode Append_File");
   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 the exception in a non-supportive
      -- Create, which should raise the 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
      Default_Position : constant Text_IO.Positive_Count := 1;
      Default_Position : constant Text_IO.Positive_Count := 1;
      Section_Header   : constant String := "VII.  ";
      Section_Header   : constant String := "VII.  ";
      Appendix_Title   : constant String := "Appendix A";
      Appendix_Title   : constant String := "Appendix A";
      Appendix_Content : constant String := "TBD";
      Appendix_Content : constant String := "TBD";
      -- The following procedure simulates the addition of an Appendix page
      -- The following procedure simulates the addition of an Appendix page
      -- to an existing text file.
      -- to an existing text file.
      procedure Position_Appendix_Text is
      procedure Position_Appendix_Text is
         use Text_IO;   -- To provide visibility to the "/=" operator.
         use Text_IO;   -- To provide visibility to the "/=" operator.
      begin
      begin
         -- Test control code.
         -- Test control code.
         -- Verify initial page, line, column number.
         -- Verify initial page, line, column number.
         if "/="(Text_IO.Page (Data_File), Default_Position) then
         if "/="(Text_IO.Page (Data_File), Default_Position) then
            Report.Failed ("Incorrect default page number");
            Report.Failed ("Incorrect default page number");
         end if;
         end if;
         if Text_IO.Line (Data_File) /= Default_Position then
         if Text_IO.Line (Data_File) /= Default_Position then
            Report.Failed ("Incorrect default line number");
            Report.Failed ("Incorrect default line number");
         end if;
         end if;
         if "/="(Text_IO.Col (Data_File), Default_Position) then
         if "/="(Text_IO.Col (Data_File), Default_Position) then
            Report.Failed ("Incorrect default column number");
            Report.Failed ("Incorrect default column number");
         end if;
         end if;
         -- Simulated usage code.
         -- Simulated usage code.
         -- Set new page/line positions.
         -- Set new page/line positions.
         Text_IO.Put_Line
         Text_IO.Put_Line
           (Data_File, "Add some optional data to the file here");
           (Data_File, "Add some optional data to the file here");
         Text_IO.New_Page (Data_File);
         Text_IO.New_Page (Data_File);
         Text_IO.New_Line (File => Data_File, Spacing => 2);
         Text_IO.New_Line (File => Data_File, Spacing => 2);
         -- Test control code.
         -- Test control code.
         if Integer(Text_IO.Page (Data_File)) /= Report.Ident_Int(2) or else
         if Integer(Text_IO.Page (Data_File)) /= Report.Ident_Int(2) or else
            Integer(Text_IO.Line (Data_File)) /= Report.Ident_Int(3) then
            Integer(Text_IO.Line (Data_File)) /= Report.Ident_Int(3) then
            Report.Failed ("Incorrect results from page/line positioning");
            Report.Failed ("Incorrect results from page/line positioning");
         end if;
         end if;
         -- Simulated usage code.
         -- Simulated usage code.
         Text_IO.Put      (Data_File, Section_Header);     -- Position title
         Text_IO.Put      (Data_File, Section_Header);     -- Position title
         Text_IO.Put_Line (Data_File, Appendix_Title);     -- of Appendix.
         Text_IO.Put_Line (Data_File, Appendix_Title);     -- of Appendix.
         Text_IO.Set_Line (File => Data_File, To => 5);    -- Set new
         Text_IO.Set_Line (File => Data_File, To => 5);    -- Set new
         Text_IO.Set_Col  (File => Data_File, To => 8);    -- position.
         Text_IO.Set_Col  (File => Data_File, To => 8);    -- position.
         -- Test control code.
         -- Test control code.
         if (Integer(Text_IO.Line (Data_File)) /= Report.Ident_Int(5)) or
         if (Integer(Text_IO.Line (Data_File)) /= Report.Ident_Int(5)) or
            (Integer(Text_IO.Col  (Data_File)) /= Report.Ident_Int(8)) then
            (Integer(Text_IO.Col  (Data_File)) /= Report.Ident_Int(8)) then
            Report.Failed ("Incorrect results from line/column positioning");
            Report.Failed ("Incorrect results from line/column positioning");
         end if;
         end if;
         -- Simulated usage code.                          -- Position
         -- Simulated usage code.                          -- Position
         Text_IO.Put_Line (Data_File, Appendix_Content);   -- content of
         Text_IO.Put_Line (Data_File, Appendix_Content);   -- content of
                                                           -- Appendix.
                                                           -- Appendix.
      end Position_Appendix_Text;
      end Position_Appendix_Text;
   begin
   begin
      -- This code section simulates a scenario that could occur in a
      -- This code section simulates a scenario that could occur in a
      -- text processing environment:
      -- text processing environment:
      --    A document is created/modified/edited Then...
      --    A document is created/modified/edited Then...
      --    Text is to be appended to the document.
      --    Text is to be appended to the document.
      --    A procedure is called to perform that operation.
      --    A procedure is called to perform that operation.
      --    The position on the appended page is set, verified, and text is
      --    The position on the appended page is set, verified, and text is
      --    appended to the existing file.
      --    appended to the existing file.
      --
      --
      -- Note: The text file has been originally created in Append_File
      -- Note: The text file has been originally created in Append_File
      -- mode, and has not been closed prior to this processing.
      -- mode, and has not been closed prior to this processing.
      Position_Appendix_Text;
      Position_Appendix_Text;
      Test_Verification_Block:
      Test_Verification_Block:
      declare
      declare
         TC_Page,
         TC_Page,
         TC_Line,
         TC_Line,
         TC_Column   : Text_IO.Positive_Count;
         TC_Column   : Text_IO.Positive_Count;
         TC_Position : Natural := 0;
         TC_Position : Natural := 0;
         Blanks      : constant String  := "                 ";
         Blanks      : constant String  := "                 ";
         TC_String   : String (1 .. 17) := Blanks;
         TC_String   : String (1 .. 17) := Blanks;
      begin
      begin
         Reset1:
         Reset1:
         begin
         begin
            Text_IO.Reset     (Data_File, Text_IO.In_File);
            Text_IO.Reset     (Data_File, Text_IO.In_File);
         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 Reset1;
         end Reset1;
         Text_IO.Skip_Page (Data_File);
         Text_IO.Skip_Page (Data_File);
                                                 -- Loop to the third line
                                                 -- Loop to the third line
         for I in 1 .. 3 loop                    -- and read the contents.
         for I in 1 .. 3 loop                    -- and read the contents.
            Text_IO.Get_Line (Data_File, TC_String, TC_Position);
            Text_IO.Get_Line (Data_File, TC_String, TC_Position);
         end loop;
         end loop;
         if (TC_Position /= 16) or else          -- Verify the title line.
         if (TC_Position /= 16) or else          -- Verify the title line.
            (TC_String (1..4)  /= "VII.") or else
            (TC_String (1..4)  /= "VII.") or else
            (TC_String (3..16) /= ("I.  " & Appendix_Title)) then
            (TC_String (3..16) /= ("I.  " & Appendix_Title)) then
            Report.Failed ("Incorrect positioning of title line");
            Report.Failed ("Incorrect positioning of title line");
         end if;
         end if;
         TC_String := Blanks;                    -- Clear string.
         TC_String := Blanks;                    -- Clear string.
                                                 -- Loop to the fifth line
                                                 -- Loop to the fifth line
         for I in 4 .. 5 loop                    -- and read the contents.
         for I in 4 .. 5 loop                    -- and read the contents.
            Text_IO.Get_Line (Data_File, TC_String, TC_Position);
            Text_IO.Get_Line (Data_File, TC_String, TC_Position);
         end loop;
         end loop;
         if (TC_Position /= 10) or               -- Verify the contents.
         if (TC_Position /= 10) or               -- Verify the contents.
            (TC_String (8..10) /= Appendix_Content) then
            (TC_String (8..10) /= Appendix_Content) then
            Report.Failed ("Incorrect positioning of contents line");
            Report.Failed ("Incorrect positioning of contents line");
         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
      -- Delete the external file.
      -- Delete the external file.
      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 CXAA002;
end CXAA002;
 
 

powered by: WebSVN 2.1.0

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