3 -- Grant of Unlimited Rights
5 -- Under contracts F33600-87-D-0337, F33600-84-D-0280, MDA903-79-C-0687,
6 -- F08630-91-C-0015, and DCA100-97-D-0025, the U.S. Government obtained
7 -- unlimited rights in the software and documentation contained herein.
8 -- Unlimited rights are defined in DFAR 252.227-7013(a)(19). By making
9 -- this public release, the Government intends to confer upon all
10 -- recipients unlimited rights equal to those held by the Government.
11 -- These rights include rights to use, duplicate, release or disclose the
12 -- released technical data and computer software in whole or in part, in
13 -- any manner and for any purpose whatsoever, and to have or permit others
18 -- ALL MATERIALS OR INFORMATION HEREIN RELEASED, MADE AVAILABLE OR
19 -- DISCLOSED ARE AS IS. THE GOVERNMENT MAKES NO EXPRESS OR IMPLIED
20 -- WARRANTY AS TO ANY MATTER WHATSOEVER, INCLUDING THE CONDITIONS OF THE
21 -- SOFTWARE, DOCUMENTATION OR OTHER INFORMATION RELEASED, MADE AVAILABLE
22 -- OR DISCLOSED, OR THE OWNERSHIP, MERCHANTABILITY, OR FITNESS FOR A
23 -- PARTICULAR PURPOSE OF SAID MATERIAL.
27 -- Check that characters in Latin-1 above ASCII.Del can be used in
28 -- identifiers, character literals and strings.
31 -- This test utilizes the brackets scheme for representing Latin-1
32 -- character values in transportable 7 bit ASCII as proposed by
33 -- Robert Dewar; this test defines Character and String objects,
34 -- assigns and tests several sample values. Several Identifiers
35 -- used in this test also include Characters via the bracket escape
38 -- Note that C250001 checks Wide_Characters and Wide_Strings.
40 -- SPECIAL REQUIREMENTS:
42 -- This file must be preprocessed before it can be executed as a test.
44 -- This test requires that all occurrences of the bracket escaped
45 -- characters be replaced with the corresponding 8 bit character.
47 -- Characters above ASCII.Del are represented by a 6 character sequence:
51 -- where the character code represented is specified by two hexadecimal
52 -- digits (<xx>) upper case. For example the Latin-1 character with the
53 -- code 16#AB# is represented by the six character sequence:
57 -- None of the values used in this test should be interpreted as
58 -- a control character.
60 -- The following function documents the translation algorithm:
62 -- function To_Char( S:String ) return Character is
63 -- Numerical : Natural := 0;
64 -- type Xlate is array(Character range '0'..'F') of Natural;
66 -- := ('0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4,
67 -- '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9,
68 -- 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14,
69 -- 'F' => 15, others => 0 );
71 -- for I in S'Range loop
72 -- Numerical := Numerical * 16 + Xlation(S(I));
74 -- return Character'Val(Numerical);
79 -- 10 JAN 96 SAIC Initial version
80 -- 12 NOV 96 SAIC Changed file extension to .AW
84 ----------------------------------------------------------------- C250002_0
88 -- The extended characters used in this test start with
89 -- the character '["A1"]' 16#A1# and increase from there
91 type Tagged_["C0"]_Id is tagged record
92 Length, Width: Natural;
95 X_Char_A2 : constant Character := '["A2"]';
97 X_Char_A3_Through_A9 : constant String :=
98 "["A3"]["A4"]["A5"]["A6"]["A7"]["A8"]["A9"]";
100 X_Char_AA_AB : constant String := "["AA"]["AB"]";
104 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
106 -- no package body C250002_0 is required or allowed
108 ----------------------------------------------------------------- C250002_X
110 with Ada.Characters.Latin_1;
111 package C250002_["C1"] is
113 type Enum is ( Item, 'A', '["AD"]', AE_["C6"]["E6"]_ae,
114 '["2D"]', '["FF"]' );
116 task type C2_["C2"] is
122 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
124 package body C250002_["C1"] is
126 task body C2_["C2"] is
133 ------------------------------------------------------------------- C250002
144 My_Task: C250002_["C1"].C2_["C2"];
146 function Hex( N: Natural ) return String is
148 T : String := "0123456789ABCDEF";
150 S(1) := T(N / 16 +1);
151 S(2) := T(N mod 16 +1);
155 procedure Match( Check : Character; Matching : Natural ) is
157 if Check /= Character'Val( Matching ) then
158 Report.Failed( "Didn't match for " & Hex(Matching) );
162 type Value_List is array(Positive range <>) of Natural;
164 procedure Match( Check : String; Matching : Value_List ) is
166 if Check'Length /= Matching'Length then
167 Report.Failed( "Check'Length /= Matching'Length" );
169 for I in Check'Range loop
170 Match( Check(I), Matching(I - Check'First + Matching'First) );
175 TC_Count : Natural := 0;
177 begin -- Main test procedure.
179 Report.Test ("C250002", "Check that characters above ASCII.Del can be " &
180 "used in identifiers, character literals and " &
183 Report.Comment( Ada.Tags.Expanded_Name(Tagged_["C0"]_Id'Tag) );
185 for Specials in C250002_["C1"].Enum loop
186 TC_Count := TC_Count +1;
189 if TC_Count /= 6 then
190 Report.Failed("Expected 6 literals in Enum");
193 Match( X_Char_A2, 16#A2# );
195 Match(X_Char_A3_Through_A9,
196 (16#A3#,16#A4#,16#A5#,16#A6#,16#A7#,16#A8#,16#A9#) );
200 Match( X_Char_A2 & X_Char_A2, (16#A2#,16#A2#) );
202 Match( X_Char_A2 & X_Char_AA_AB, (16#A2#,16#AA#,16#AB#) );
204 Match( X_Char_AA_AB & X_Char_A2, (16#AA#,16#AB#,16#A2#) );
206 Match( X_Char_AA_AB & X_Char_AA_AB,
207 (16#AA#,16#AB#,16#AA#,16#AB#) );