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 wide character literals are supported.
28 -- Check that wide character string literals are supported.
31 -- This test utilizes the brackets scheme for representing wide character
32 -- values in transportable 7 bit ASCII as proposed by Robert Dewar;
33 -- this test defines Wide_Character and Wide_String objects, and assigns
34 -- and tests several sample values.
36 -- SPECIAL REQUIREMENTS:
38 -- This file must be preprocessed before it can be executed as a test.
40 -- This test requires that all occurrences of the bracket escape
41 -- representation for wide characters be replaced, as appropriate, with
42 -- the corresponding wide character as represented by the implementation.
44 -- Characters above ASCII.Del are represented by an 8 character sequence:
48 -- where the character code represented is specified by four hexadecimal
49 -- digits, (<xxxx>) upper case. For example the wide character with the
50 -- code 16#ABCD# is represented by the eight character sequence:
54 -- The following function documents the translation algorithm:
56 -- function To_Wide( S:String ) return Wide_character is
57 -- Numerical : Natural := 0;
58 -- type Xlate is array(Character range '0'..'F') of Natural;
60 -- := ('0' => 0, '1' => 1, '2' => 2, '3' => 3, '4' => 4,
61 -- '5' => 5, '6' => 6, '7' => 7, '8' => 8, '9' => 9,
62 -- 'A' => 10, 'B' => 11, 'C' => 12, 'D' => 13, 'E' => 14,
63 -- 'F' => 15, others => 0 );
65 -- for I in S'Range loop
66 -- Numerical := Numerical * 16 + Xlation(S(I));
68 -- return Wide_Character'Val(Numerical); -- the returned value is
69 -- implementation dependent
71 -- when Constraint_Error => raise;
76 -- 26 OCT 95 SAIC Initial .Aversion
77 -- 11 APR 96 SAIC Minor robustness changes for 2.1
78 -- 12 NOV 96 SAIC Changed file extension to .AW
82 ----------------------------------------------------------------- C250001_0
86 -- The wide characters used in this test are sequential starting with
87 -- the character '["4F42"]' 16#0F42#
89 Four_Eff_Four_Two : constant Wide_Character := '["4F42"]';
91 Four_Eff_4_3_Through_9 : constant Wide_String :=
92 "["4F43"]["4F44"]["4F45"]["4F46"]["4F47"]["4F48"]["4F49"]";
94 Four_Eff_A_B : constant Wide_String := "["4F4A"]["4F4B"]";
98 -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
100 -- no package body C250001_0 is required or allowed
102 ------------------------------------------------------------------- C250001
111 function Hex( N: Natural ) return String is
112 S : String := "xxxx";
113 T : String := "0123456789ABCDEF";
116 for I in reverse 1..4 loop
117 S(I) := T(V rem 16 +1);
123 procedure Match( Check : Wide_Character; Matching : Natural ) is
125 if Wide_Character'Pos( Check ) /= Matching then
126 Report.Failed( "Didn't match for " & Hex(Matching) );
130 type Value_List is array(Positive range <>) of Natural;
132 procedure Match( Check : Wide_String; Matching : Value_List ) is
134 if Check'Length /= Matching'Length then
135 Report.Failed( "Check'Length /= Matching'Length" );
137 for I in Check'Range loop
138 Match( Check(I), Matching(I) );
143 begin -- Main test procedure.
145 Report.Test ("C250001", "Check that wide character literals " &
146 "are supported. Check that wide character " &
147 "string literals are supported." );
149 Match( Four_Eff_Four_Two, 16#4F42# );
151 Match(Four_Eff_4_3_Through_9,
152 (16#4F43#,16#4F44#,16#4F45#,16#4F46#,16#4F47#,16#4F48#,16#4F49#) );
156 Match( Four_Eff_Four_Two & Four_Eff_Four_Two, (16#4F42#,16#4F42#) );
158 Match( Four_Eff_Four_Two & Four_Eff_A_B, (16#4F42#,16#4F4A#,16#4F4B#) );
160 Match( Four_Eff_A_B & Four_Eff_Four_Two, (16#4F4A#,16#4F4B#,16#4F42#) );
162 Match( Four_Eff_A_B & Four_Eff_A_B,
163 (16#4F4A#,16#4F4B#,16#4F4A#,16#4F4B#) );