blob: 04b094f1ff3692d2305c82177c9fe6bc3852a6a5 [file] [log] [blame]
--
-- C352001.A
--
-- Grant of Unlimited Rights
--
-- 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
-- unlimited rights in the software and documentation contained herein.
-- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
-- this public release, the Government intends to confer upon all
-- recipients unlimited rights equal to those held by the Government.
-- These rights include rights to use, duplicate, release or disclose the
-- 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
-- to do so.
--
-- DISCLAIMER
--
-- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
-- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
-- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
-- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
-- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
-- PARTICULAR PURPOSE OF SAID MATERIAL.
--*
--
-- OBJECTIVE:
-- Check that the predefined Character type comprises 256 positions.
-- Check that the names of the non-graphic characters are usable with
-- the attributes (Wide_)Image and (Wide_)Value, and that these
-- attributes produce the correct result.
--
-- TEST DESCRIPTION:
-- Build two tables of nongraphic characters from positions of Row 00
-- (0000-001F and 007F-009F) of the ISO 10646 Basic Multilingual Plane.
-- Fill the first table with compiler created strings. Fill the second
-- table with strings defined by the language. Compare the two tables.
-- Check 256 positions of the predefined character type. Use attributes
-- (Wide_)Image and (Wide_)Value to check the values of the non-graphic
-- characters and the last 2 characters.
--
--
-- CHANGE HISTORY:
-- 20 Jun 95 SAIC Initial prerelease version.
-- 27 Jan 96 SAIC Revised for 2.1. Hid values, added "del" case.
--
--!
with Ada.Characters.Handling;
with Report;
procedure C352001 is
Lower_Bound : Integer := 0;
Middle_Bound : Integer := 31;
Upper_Bound : Integer := 159;
Half_Bound : Integer := 127;
Max_Bound : Integer := 255;
type Dyn_String is access String;
type Value_Result is array (Character) of Dyn_String;
Table_Of_Character : Value_Result;
TC_Table : Value_Result;
function CVII(K : Natural) return Character is
begin
return Character'Val( Report.Ident_Int(K) );
end CVII;
function "=" (L, R : String) return Boolean is
UCL : String (L'First .. L'Last);
UCR : String (R'First .. R'last);
begin
UCL := Ada.Characters.Handling.To_Upper (L);
UCR := Ada.Characters.Handling.To_Upper (R);
if UCL'Last /= UCR'Last then
return False;
else
for I in UCL'First .. UCR'Last loop
if UCL (I) /= UCR (I) then
return False;
end if;
end loop;
return True;
end if;
end "=";
begin
Report.Test ("C352001", "Check that, the predefined Character type " &
"comprises 256 positions. Check that the names of the " &
"non-graphic characters are usable with the attributes " &
"(Wide_)Image and (Wide_)Value, and that these attributes " &
"produce the correct result");
-- Fill table with strings (positions of Row 00 (0000-001F) of the ISO
-- 10646 Basic Multilingual Plane created by the compiler.
for I in CVII(Lower_Bound) .. CVII(Middle_Bound) loop
Table_Of_Character (I) := new String'(Character'Image(I));
end loop;
-- Fill table with strings (positions of Row 00 (007F-009F) of the ISO
-- 10646 Basic Multilingual Plane created by the compiler.
for I in CVII(Half_Bound) .. CVII(Upper_Bound) loop
Table_Of_Character (I) := new String'(Character'Image(I));
end loop;
-- Fill table with strings (positions of Row 00 (0000-001F) of the ISO
-- 10646 Basic Multilingual Plane defined by the language.
TC_Table (CVII(0)) := new String'("nul");
TC_Table (CVII(1)) := new String'("soh");
TC_Table (CVII(2)) := new String'("stx");
TC_Table (CVII(3)) := new String'("etx");
TC_Table (CVII(4)) := new String'("eot");
TC_Table (CVII(5)) := new String'("enq");
TC_Table (CVII(6)) := new String'("ack");
TC_Table (CVII(7)) := new String'("bel");
TC_Table (CVII(8)) := new String'("bs");
TC_Table (CVII(9)) := new String'("ht");
TC_Table (CVII(10)) := new String'("lf");
TC_Table (CVII(11)) := new String'("vt");
TC_Table (CVII(12)) := new String'("ff");
TC_Table (CVII(13)) := new String'("cr");
TC_Table (CVII(14)) := new String'("so");
TC_Table (CVII(15)) := new String'("si");
TC_Table (CVII(16)) := new String'("dle");
TC_Table (CVII(17)) := new String'("dc1");
TC_Table (CVII(18)) := new String'("dc2");
TC_Table (CVII(19)) := new String'("dc3");
TC_Table (CVII(20)) := new String'("dc4");
TC_Table (CVII(21)) := new String'("nak");
TC_Table (CVII(22)) := new String'("syn");
TC_Table (CVII(23)) := new String'("etb");
TC_Table (CVII(24)) := new String'("can");
TC_Table (CVII(25)) := new String'("em");
TC_Table (CVII(26)) := new String'("sub");
TC_Table (CVII(27)) := new String'("esc");
TC_Table (CVII(28)) := new String'("fs");
TC_Table (CVII(29)) := new String'("gs");
TC_Table (CVII(30)) := new String'("rs");
TC_Table (CVII(31)) := new String'("us");
TC_Table (CVII(127)) := new String'("del");
-- Fill table with strings (positions of Row 00 (007F-009F) of the ISO
-- 10646 Basic Multilingual Plane defined by the language.
TC_Table (CVII(128)) := new String'("reserved_128");
TC_Table (CVII(129)) := new String'("reserved_129");
TC_Table (CVII(130)) := new String'("bph");
TC_Table (CVII(131)) := new String'("nbh");
TC_Table (CVII(132)) := new String'("reserved_132");
TC_Table (CVII(133)) := new String'("nel");
TC_Table (CVII(134)) := new String'("ssa");
TC_Table (CVII(135)) := new String'("esa");
TC_Table (CVII(136)) := new String'("hts");
TC_Table (CVII(137)) := new String'("htj");
TC_Table (CVII(138)) := new String'("vts");
TC_Table (CVII(139)) := new String'("pld");
TC_Table (CVII(140)) := new String'("plu");
TC_Table (CVII(141)) := new String'("ri");
TC_Table (CVII(142)) := new String'("ss2");
TC_Table (CVII(143)) := new String'("ss3");
TC_Table (CVII(144)) := new String'("dcs");
TC_Table (CVII(145)) := new String'("pu1");
TC_Table (CVII(146)) := new String'("pu2");
TC_Table (CVII(147)) := new String'("sts");
TC_Table (CVII(148)) := new String'("cch");
TC_Table (CVII(149)) := new String'("mw");
TC_Table (CVII(150)) := new String'("spa");
TC_Table (CVII(151)) := new String'("epa");
TC_Table (CVII(152)) := new String'("sos");
TC_Table (CVII(153)) := new String'("reserved_153");
TC_Table (CVII(154)) := new String'("sci");
TC_Table (CVII(155)) := new String'("csi");
TC_Table (CVII(156)) := new String'("st");
TC_Table (CVII(157)) := new String'("osc");
TC_Table (CVII(158)) := new String'("pm");
TC_Table (CVII(159)) := new String'("apc");
-- Compare the first half of two tables.
for I in CVII(Lower_Bound) .. CVII(Middle_Bound) loop
if TC_Table(I).all /= Table_Of_Character(I).all then
Report.Failed("Value of character#" & Integer'Image(Character'Pos(I)) &
" is not the same in the first half of the table");
end if;
end loop;
-- Compare the second half of two tables.
for I in CVII(Half_Bound) .. CVII(Upper_Bound) loop
if TC_Table(I).all /= Table_Of_Character(I).all then
Report.Failed("Value of character#" & Integer'Image(Character'Pos(I)) &
" is not the same in the second half of the table");
end if;
end loop;
-- Check the first character.
if Character'Image( Character'First ) /= "NUL" then
Report.Failed("Value of character#" &
Integer'Image(Character'Pos (Character'First)) &
" is not NUL");
end if;
-- Check that the names of the non-graphic characters are usable with
-- Image and Value attributes.
if Character'Value( Character'Image( CVII(153) )) /=
CVII( 153 ) then
Report.Failed ("Value of character#" &
Integer'Image( Character'Pos(CVII(153)) ) &
" is not reserved_153");
end if;
for I in CVII(Lower_Bound) .. CVII(Max_Bound) loop
if Character'Value(
Report.Ident_Str(
Character'Image(CVII(Character'Pos(I)))))
/= CVII( Character'Pos(I)) then
Report.Failed ("Value of character#" &
Integer'Image( Character'Pos(I) ) &
" is not the same as the predefined character type");
end if;
end loop;
-- Check Wide_Character attributes.
for I in Wide_Character'Val(Lower_Bound) .. Wide_Character'Val(Max_Bound)
loop
if Wide_Character'Wide_Value(
Report.Ident_Wide_Str(
Wide_Character'Wide_Image(
Wide_Character'Val(Wide_Character'Pos(I)))))
/= Wide_Character'Val(Wide_Character'Pos(I))
then
Report.Failed ("Value of the predefined Wide_Character type " &
"is not correct");
end if;
end loop;
if Wide_Character'Value( Wide_Character'Image(Wide_Character'Val(132)) )
/= Wide_Character'Val( Report.Ident_Int(132) ) then
Report.Failed ("Wide_Character at 132 is not reserved_132");
end if;
if Wide_Character'Image( Wide_Character'First ) /= "NUL" then
Report.Failed ("Wide_Character'First is not NUL");
end if;
if Wide_Character'Image
(Wide_Character'Pred (Wide_Character'Last) ) /= "FFFE" then
Report.Failed ("Wide_Character at 65534 is not FFFE");
end if;
if Wide_Character'Image(Wide_Character'Last) /= "FFFF" then
Report.Failed ("Wide_Character'Last is not FFFF");
end if;
Report.Result;
end C352001;