Debian Codegraph @

gcc/testsuite/gnat.dg/encode_string1.adb

raw
1 -- { dg-do run }
2
3 with Ada.Text_IO; use Ada.Text_IO;
4 with Encode_String1_Pkg;
5 with GNAT.Encode_String;
6 with System.WCh_Con; use System.WCh_Con;
7
8 procedure Encode_String1 is
9 High_WS : constant Wide_String (1000 .. 1009) := (others => '1');
10 High_WWS : constant Wide_Wide_String (1000 .. 1009) := (others => '2');
11 Low_WS : constant Wide_String (3 .. 12) := (others => '3');
12 Low_WWS : constant Wide_Wide_String (3 .. 12) := (others => '4');
13
14 procedure Test_Method (Method : WC_Encoding_Method);
15 -- Test Wide_String and Wide_Wide_String encodings using method Method to
16 -- encode them.
17
18 -----------------
19 -- Test_Method --
20 -----------------
21
22 procedure Test_Method (Method : WC_Encoding_Method) is
23 package Encoder is new GNAT.Encode_String (Method);
24
25 procedure WS_Tester is new Encode_String1_Pkg
26 (C => Wide_Character,
27 S => Wide_String,
28 Encode => Encoder.Encode_Wide_String);
29
30 procedure WWS_Tester is new Encode_String1_Pkg
31 (C => Wide_Wide_Character,
32 S => Wide_Wide_String,
33 Encode => Encoder.Encode_Wide_Wide_String);
34 begin
35 WS_Tester (High_WS);
36 WS_Tester (Low_WS);
37
38 WWS_Tester (High_WWS);
39 WWS_Tester (Low_WWS);
40 end Test_Method;
41
42 -- Start of processing for Main
43
44 begin
45 for Method in WC_Encoding_Method'Range loop
46 Test_Method (Method);
47 end loop;
48 end;