OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc1/] [gcc/] [testsuite/] [ada/] [acats/] [tests/] [cxa/] [cxa3002.a] - Diff between revs 294 and 338

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

Rev 294 Rev 338
-- CXA3002.A
-- CXA3002.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 conversion functions for Characters and Strings
--      Check that the conversion functions for Characters and Strings
--      defined in package Ada.Characters.Handling provide correct results
--      defined in package Ada.Characters.Handling provide correct results
--      when given character/string input parameters.
--      when given character/string input parameters.
--
--
-- TEST DESCRIPTION:
-- TEST DESCRIPTION:
--      This test checks the output of the To_Lower, To_Upper, and
--      This test checks the output of the To_Lower, To_Upper, and
--      To_Basic functions for both Characters and Strings.  Each function
--      To_Basic functions for both Characters and Strings.  Each function
--      is called with input parameters that are within the appropriate
--      is called with input parameters that are within the appropriate
--      range of values, and also with values outside the specified
--      range of values, and also with values outside the specified
--      range (i.e., lower case 'a' to To_Lower).  The functions are also
--      range (i.e., lower case 'a' to To_Lower).  The functions are also
--      used in combination with one another, with the result of one function
--      used in combination with one another, with the result of one function
--      providing the actual input parameter value to another.
--      providing the actual input parameter value to another.
--
--
--
--
-- CHANGE HISTORY:
-- CHANGE HISTORY:
--      06 Dec 94   SAIC    ACVC 2.0
--      06 Dec 94   SAIC    ACVC 2.0
--      22 Dec 94   SAIC    Corrected evaluations of Functions In Combination.
--      22 Dec 94   SAIC    Corrected evaluations of Functions In Combination.
--
--
--!
--!
with Ada.Characters.Latin_1;
with Ada.Characters.Latin_1;
with Ada.Characters.Handling;
with Ada.Characters.Handling;
with Report;
with Report;
procedure CXA3002 is
procedure CXA3002 is
   package AC  renames Ada.Characters;
   package AC  renames Ada.Characters;
   package ACH renames Ada.Characters.Handling;
   package ACH renames Ada.Characters.Handling;
begin
begin
   Report.Test ("CXA3002", "Check that the conversion functions for "   &
   Report.Test ("CXA3002", "Check that the conversion functions for "   &
                           "Characters and Strings defined in package " &
                           "Characters and Strings defined in package " &
                           "Ada.Characters.Handling provide correct "   &
                           "Ada.Characters.Handling provide correct "   &
                           "results when given character/string input " &
                           "results when given character/string input " &
                           "parameters");
                           "parameters");
   Character_Block:
   Character_Block:
   declare
   declare
      Offset : constant Integer := Character'Pos('a') - Character'Pos('A');
      Offset : constant Integer := Character'Pos('a') - Character'Pos('A');
   begin
   begin
      -- Function To_Lower for Characters
      -- Function To_Lower for Characters
      if ACH.To_Lower('A') /= 'a' or  ACH.To_Lower('Z') /= 'z' then
      if ACH.To_Lower('A') /= 'a' or  ACH.To_Lower('Z') /= 'z' then
         Report.Failed ("Incorrect operation of function To_Lower - 1");
         Report.Failed ("Incorrect operation of function To_Lower - 1");
      end if;
      end if;
      for i in Character'Pos('A') .. Character'Pos('Z') loop
      for i in Character'Pos('A') .. Character'Pos('Z') loop
         if ACH.To_Lower(Character'Val(i)) /= Character'Val(i + Offset) then
         if ACH.To_Lower(Character'Val(i)) /= Character'Val(i + Offset) then
            Report.Failed ("Incorrect operation of function To_Lower - 2");
            Report.Failed ("Incorrect operation of function To_Lower - 2");
         end if;
         end if;
      end loop;
      end loop;
      if (ACH.To_Lower(AC.Latin_1.UC_A_Grave)         /=
      if (ACH.To_Lower(AC.Latin_1.UC_A_Grave)         /=
          AC.Latin_1.LC_A_Grave)                     or
          AC.Latin_1.LC_A_Grave)                     or
         (ACH.To_Lower(AC.Latin_1.UC_Icelandic_Thorn) /=
         (ACH.To_Lower(AC.Latin_1.UC_Icelandic_Thorn) /=
          AC.Latin_1.LC_Icelandic_Thorn)
          AC.Latin_1.LC_Icelandic_Thorn)
      then
      then
         Report.Failed ("Incorrect operation of function To_Lower - 3");
         Report.Failed ("Incorrect operation of function To_Lower - 3");
      end if;
      end if;
      if ACH.To_Lower('c')                 /= 'c'                 or
      if ACH.To_Lower('c')                 /= 'c'                 or
         ACH.To_Lower('w')                 /= 'w'                 or
         ACH.To_Lower('w')                 /= 'w'                 or
         ACH.To_Lower(AC.Latin_1.CR)       /= AC.Latin_1.CR       or
         ACH.To_Lower(AC.Latin_1.CR)       /= AC.Latin_1.CR       or
         ACH.To_Lower(AC.Latin_1.LF)       /= AC.Latin_1.LF       or
         ACH.To_Lower(AC.Latin_1.LF)       /= AC.Latin_1.LF       or
         ACH.To_Lower(AC.Latin_1.Comma)    /= AC.Latin_1.Comma    or
         ACH.To_Lower(AC.Latin_1.Comma)    /= AC.Latin_1.Comma    or
         ACH.To_Lower(AC.Latin_1.Question) /= AC.Latin_1.Question or
         ACH.To_Lower(AC.Latin_1.Question) /= AC.Latin_1.Question or
         ACH.To_Lower('0')                 /= '0'                 or
         ACH.To_Lower('0')                 /= '0'                 or
         ACH.To_Lower('9')                 /= '9'
         ACH.To_Lower('9')                 /= '9'
      then
      then
         Report.Failed ("Incorrect operation of function To_Lower - 4");
         Report.Failed ("Incorrect operation of function To_Lower - 4");
      end if;
      end if;
      --- Function To_Upper for Characters
      --- Function To_Upper for Characters
      if not (ACH.To_Upper('b') = 'B') and (ACH.To_Upper('y') = 'Y') then
      if not (ACH.To_Upper('b') = 'B') and (ACH.To_Upper('y') = 'Y') then
         Report.Failed ("Incorrect operation of function To_Upper - 1");
         Report.Failed ("Incorrect operation of function To_Upper - 1");
      end if;
      end if;
      for i in Character'Pos(AC.Latin_1.LC_A) ..
      for i in Character'Pos(AC.Latin_1.LC_A) ..
               Character'Pos(AC.Latin_1.LC_Z) loop
               Character'Pos(AC.Latin_1.LC_Z) loop
         if ACH.To_Upper(Character'Val(i)) /= Character'Val(i - Offset) then
         if ACH.To_Upper(Character'Val(i)) /= Character'Val(i - Offset) then
            Report.Failed ("Incorrect operation of function To_Upper - 2");
            Report.Failed ("Incorrect operation of function To_Upper - 2");
         end if;
         end if;
      end loop;
      end loop;
      if (ACH.To_Upper(AC.Latin_1.LC_U_Diaeresis) /=
      if (ACH.To_Upper(AC.Latin_1.LC_U_Diaeresis) /=
          AC.Latin_1.UC_U_Diaeresis)                 or
          AC.Latin_1.UC_U_Diaeresis)                 or
         (ACH.To_Upper(AC.Latin_1.LC_A_Ring)      /=
         (ACH.To_Upper(AC.Latin_1.LC_A_Ring)      /=
          AC.Latin_1.UC_A_Ring)
          AC.Latin_1.UC_A_Ring)
      then
      then
         Report.Failed ("Incorrect operation of function To_Upper - 3");
         Report.Failed ("Incorrect operation of function To_Upper - 3");
      end if;
      end if;
      if not (ACH.To_Upper('F') = 'F'                       and
      if not (ACH.To_Upper('F') = 'F'                       and
              ACH.To_Upper('U') = 'U'                       and
              ACH.To_Upper('U') = 'U'                       and
              ACH.To_Upper(AC.Latin_1.LC_German_Sharp_S) =
              ACH.To_Upper(AC.Latin_1.LC_German_Sharp_S) =
                AC.Latin_1.LC_German_Sharp_S                and
                AC.Latin_1.LC_German_Sharp_S                and
              ACH.To_Upper(AC.Latin_1.LC_Y_Diaeresis) =
              ACH.To_Upper(AC.Latin_1.LC_Y_Diaeresis) =
                AC.Latin_1.LC_Y_Diaeresis)
                AC.Latin_1.LC_Y_Diaeresis)
      then
      then
         Report.Failed ("Incorrect operation of function To_Upper - 4");
         Report.Failed ("Incorrect operation of function To_Upper - 4");
      end if;
      end if;
      --- Function To_Basic for Characters
      --- Function To_Basic for Characters
      if ACH.To_Basic(AC.Latin_1.LC_A_Circumflex) /=
      if ACH.To_Basic(AC.Latin_1.LC_A_Circumflex) /=
         ACH.To_Basic(AC.Latin_1.LC_A_Tilde)         or
         ACH.To_Basic(AC.Latin_1.LC_A_Tilde)         or
         ACH.To_Basic(AC.Latin_1.LC_E_Grave)      /=
         ACH.To_Basic(AC.Latin_1.LC_E_Grave)      /=
         ACH.To_Basic(AC.Latin_1.LC_E_Acute)         or
         ACH.To_Basic(AC.Latin_1.LC_E_Acute)         or
         ACH.To_Basic(AC.Latin_1.LC_I_Circumflex) /=
         ACH.To_Basic(AC.Latin_1.LC_I_Circumflex) /=
         ACH.To_Basic(AC.Latin_1.LC_I_Diaeresis)     or
         ACH.To_Basic(AC.Latin_1.LC_I_Diaeresis)     or
         ACH.To_Basic(AC.Latin_1.UC_O_Tilde)      /=
         ACH.To_Basic(AC.Latin_1.UC_O_Tilde)      /=
         ACH.To_Basic(AC.Latin_1.UC_O_Acute)         or
         ACH.To_Basic(AC.Latin_1.UC_O_Acute)         or
         ACH.To_Basic(AC.Latin_1.UC_U_Grave)      /=
         ACH.To_Basic(AC.Latin_1.UC_U_Grave)      /=
         ACH.To_Basic(AC.Latin_1.UC_U_Acute)         or
         ACH.To_Basic(AC.Latin_1.UC_U_Acute)         or
         ACH.To_Basic(AC.Latin_1.LC_Y_Acute)      /=
         ACH.To_Basic(AC.Latin_1.LC_Y_Acute)      /=
         ACH.To_Basic(AC.Latin_1.LC_Y_Diaeresis)
         ACH.To_Basic(AC.Latin_1.LC_Y_Diaeresis)
      then
      then
         Report.Failed ("Incorrect operation of function To_Basic - 1");
         Report.Failed ("Incorrect operation of function To_Basic - 1");
      end if;
      end if;
      if ACH.To_Basic('Y') /= 'Y'                   or
      if ACH.To_Basic('Y') /= 'Y'                   or
         ACH.To_Basic(AC.Latin_1.LC_E_Acute) /= 'e' or
         ACH.To_Basic(AC.Latin_1.LC_E_Acute) /= 'e' or
         ACH.To_Basic('6') /= '6'                   or
         ACH.To_Basic('6') /= '6'                   or
         ACH.To_Basic(AC.Latin_1.LC_R) /= 'r'
         ACH.To_Basic(AC.Latin_1.LC_R) /= 'r'
      then
      then
         Report.Failed ("Incorrect operation of function To_Basic - 2");
         Report.Failed ("Incorrect operation of function To_Basic - 2");
      end if;
      end if;
      -- Using Functions (for Characters) in Combination
      -- Using Functions (for Characters) in Combination
      if (ACH.To_Upper(ACH.To_Lower('A')) /= 'A' ) or
      if (ACH.To_Upper(ACH.To_Lower('A')) /= 'A' ) or
         (ACH.To_Upper(ACH.To_Lower(AC.Latin_1.UC_A_Acute)) /=
         (ACH.To_Upper(ACH.To_Lower(AC.Latin_1.UC_A_Acute)) /=
          AC.Latin_1.UC_A_Acute )
          AC.Latin_1.UC_A_Acute )
      then
      then
         Report.Failed("Incorrect operation of functions in combination - 1");
         Report.Failed("Incorrect operation of functions in combination - 1");
      end if;
      end if;
      if ACH.To_Basic(ACH.To_Lower(ACH.To_Upper(AC.Latin_1.LC_U_Grave))) /=
      if ACH.To_Basic(ACH.To_Lower(ACH.To_Upper(AC.Latin_1.LC_U_Grave))) /=
         'u'
         'u'
      then
      then
         Report.Failed("Incorrect operation of functions in combination - 2");
         Report.Failed("Incorrect operation of functions in combination - 2");
      end if;
      end if;
      if ACH.To_Lower (ACH.To_Basic
      if ACH.To_Lower (ACH.To_Basic
                         (ACH.To_Upper(AC.Latin_1.LC_O_Diaeresis))) /= 'o'
                         (ACH.To_Upper(AC.Latin_1.LC_O_Diaeresis))) /= 'o'
      then
      then
         Report.Failed("Incorrect operation of functions in combination - 3");
         Report.Failed("Incorrect operation of functions in combination - 3");
      end if;
      end if;
   exception
   exception
      when others => Report.Failed ("Exception raised in Character_Block");
      when others => Report.Failed ("Exception raised in Character_Block");
   end Character_Block;
   end Character_Block;
   String_Block:
   String_Block:
   declare
   declare
      LC_String : constant String := "az" &
      LC_String : constant String := "az" &
                                      AC.Latin_1.LC_A_Grave &
                                      AC.Latin_1.LC_A_Grave &
                                      AC.Latin_1.LC_C_Cedilla;
                                      AC.Latin_1.LC_C_Cedilla;
      UC_String : constant String := "AZ" &
      UC_String : constant String := "AZ" &
                                      AC.Latin_1.UC_A_Grave &
                                      AC.Latin_1.UC_A_Grave &
                                      AC.Latin_1.UC_C_Cedilla;
                                      AC.Latin_1.UC_C_Cedilla;
      LC_Basic_String    : constant String := "aei" & 'o' & 'u';
      LC_Basic_String    : constant String := "aei" & 'o' & 'u';
      LC_NonBasic_String : constant String := AC.Latin_1.LC_A_Diaeresis  &
      LC_NonBasic_String : constant String := AC.Latin_1.LC_A_Diaeresis  &
                                              AC.Latin_1.LC_E_Circumflex &
                                              AC.Latin_1.LC_E_Circumflex &
                                              AC.Latin_1.LC_I_Acute      &
                                              AC.Latin_1.LC_I_Acute      &
                                              AC.Latin_1.LC_O_Tilde      &
                                              AC.Latin_1.LC_O_Tilde      &
                                              AC.Latin_1.LC_U_Grave;
                                              AC.Latin_1.LC_U_Grave;
      UC_Basic_String    : constant String := "AEIOU";
      UC_Basic_String    : constant String := "AEIOU";
      UC_NonBasic_String : constant String := AC.Latin_1.UC_A_Tilde      &
      UC_NonBasic_String : constant String := AC.Latin_1.UC_A_Tilde      &
                                              AC.Latin_1.UC_E_Acute      &
                                              AC.Latin_1.UC_E_Acute      &
                                              AC.Latin_1.UC_I_Grave      &
                                              AC.Latin_1.UC_I_Grave      &
                                              AC.Latin_1.UC_O_Diaeresis  &
                                              AC.Latin_1.UC_O_Diaeresis  &
                                              AC.Latin_1.UC_U_Circumflex;
                                              AC.Latin_1.UC_U_Circumflex;
      LC_Special_String  : constant String := "ab"                         &
      LC_Special_String  : constant String := "ab"                         &
                                              AC.Latin_1.LC_German_Sharp_S &
                                              AC.Latin_1.LC_German_Sharp_S &
                                              AC.Latin_1.LC_Y_Diaeresis;
                                              AC.Latin_1.LC_Y_Diaeresis;
      UC_Special_String  : constant String := "AB"                         &
      UC_Special_String  : constant String := "AB"                         &
                                              AC.Latin_1.LC_German_Sharp_S &
                                              AC.Latin_1.LC_German_Sharp_S &
                                              AC.Latin_1.LC_Y_Diaeresis;
                                              AC.Latin_1.LC_Y_Diaeresis;
   begin
   begin
      -- Function To_Lower for Strings
      -- Function To_Lower for Strings
      if ACH.To_Lower (UC_String) /= LC_String  or
      if ACH.To_Lower (UC_String) /= LC_String  or
         ACH.To_Lower (LC_String) /= LC_String
         ACH.To_Lower (LC_String) /= LC_String
      then
      then
         Report.Failed ("Incorrect result from To_Lower for strings - 1");
         Report.Failed ("Incorrect result from To_Lower for strings - 1");
      end if;
      end if;
      if ACH.To_Lower (UC_Basic_String) /= LC_Basic_String then
      if ACH.To_Lower (UC_Basic_String) /= LC_Basic_String then
         Report.Failed ("Incorrect result from To_Lower for strings - 2");
         Report.Failed ("Incorrect result from To_Lower for strings - 2");
      end if;
      end if;
      -- Function To_Upper for Strings
      -- Function To_Upper for Strings
      if not (ACH.To_Upper (LC_String) = UC_String) then
      if not (ACH.To_Upper (LC_String) = UC_String) then
         Report.Failed ("Incorrect result from To_Upper for strings - 1");
         Report.Failed ("Incorrect result from To_Upper for strings - 1");
      end if;
      end if;
      if ACH.To_Upper (LC_Basic_String) /= UC_Basic_String or
      if ACH.To_Upper (LC_Basic_String) /= UC_Basic_String or
         ACH.To_Upper (UC_String)       /= UC_String
         ACH.To_Upper (UC_String)       /= UC_String
      then
      then
         Report.Failed ("Incorrect result from To_Upper for strings - 2");
         Report.Failed ("Incorrect result from To_Upper for strings - 2");
      end if;
      end if;
      if ACH.To_Upper (LC_Special_String) /= UC_Special_String then
      if ACH.To_Upper (LC_Special_String) /= UC_Special_String then
         Report.Failed ("Incorrect result from To_Upper for strings - 3");
         Report.Failed ("Incorrect result from To_Upper for strings - 3");
      end if;
      end if;
      -- Function To_Basic for Strings
      -- Function To_Basic for Strings
      if (ACH.To_Basic (LC_String) /= "azac") or
      if (ACH.To_Basic (LC_String) /= "azac") or
         (ACH.To_Basic (UC_String) /= "AZAC")
         (ACH.To_Basic (UC_String) /= "AZAC")
      then
      then
         Report.Failed ("Incorrect result from To_Basic for Strings - 1");
         Report.Failed ("Incorrect result from To_Basic for Strings - 1");
      end if;
      end if;
      if ACH.To_Basic (LC_NonBasic_String) /= LC_Basic_String then
      if ACH.To_Basic (LC_NonBasic_String) /= LC_Basic_String then
         Report.Failed ("Incorrect result from To_Basic for Strings - 2");
         Report.Failed ("Incorrect result from To_Basic for Strings - 2");
      end if;
      end if;
      if ACH.To_Basic (UC_NonBasic_String) /= UC_Basic_String then
      if ACH.To_Basic (UC_NonBasic_String) /= UC_Basic_String then
         Report.Failed ("Incorrect result from To_Basic for Strings - 3");
         Report.Failed ("Incorrect result from To_Basic for Strings - 3");
      end if;
      end if;
      -- Using Functions (for Strings) in Combination
      -- Using Functions (for Strings) in Combination
      if ACH.To_Upper(ACH.To_Lower(UC_Basic_String)) /= UC_Basic_String or
      if ACH.To_Upper(ACH.To_Lower(UC_Basic_String)) /= UC_Basic_String or
         ACH.To_Lower(ACH.To_Upper(LC_Basic_String)) /= LC_Basic_String
         ACH.To_Lower(ACH.To_Upper(LC_Basic_String)) /= LC_Basic_String
      then
      then
         Report.Failed ("Incorrect operation of functions in combination - 4");
         Report.Failed ("Incorrect operation of functions in combination - 4");
      end if;
      end if;
      if (ACH.To_Basic(ACH.To_Lower(UC_NonBasic_String)) /= LC_Basic_String) or
      if (ACH.To_Basic(ACH.To_Lower(UC_NonBasic_String)) /= LC_Basic_String) or
         (ACH.To_Basic(ACH.To_Upper(LC_NonBasic_String)) /= UC_Basic_String)
         (ACH.To_Basic(ACH.To_Upper(LC_NonBasic_String)) /= UC_Basic_String)
      then
      then
         Report.Failed ("Incorrect operation of functions in combination - 5");
         Report.Failed ("Incorrect operation of functions in combination - 5");
      end if;
      end if;
   exception
   exception
      when others => Report.Failed ("Exception raised in String_Block");
      when others => Report.Failed ("Exception raised in String_Block");
   end String_Block;
   end String_Block;
   Report.Result;
   Report.Result;
end CXA3002;
end CXA3002;
 
 

powered by: WebSVN 2.1.0

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