vss_24.0.0_b4d0be7c/testsuite/text/performance/U816-022/main.adb

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
with Ada.Containers.Vectors;
--  with Ada.Strings.Wide_Wide_Unbounded;
with Ada.Wide_Wide_Text_IO; use Ada.Wide_Wide_Text_IO;

--  with VSS.Strings.Character_Iterators;

with Test_U816_022;

procedure Main is

   package Test_Vectors is
     new Ada.Containers.Vectors
       (Positive, Test_U816_022.Test_Item, Test_U816_022."=");

   Test_Data : Test_Vectors.Vector;

   procedure Load;

   ----------
   -- Load --
   ----------

   procedure Load is
      File   : Ada.Wide_Wide_Text_IO.File_Type;
      Buffer : Wide_Wide_String (1 .. 1_024);
      Last   : Natural;
      Item   : Test_U816_022.Test_Item;

   begin
      Ada.Wide_Wide_Text_IO.Open
        (File, Ada.Wide_Wide_Text_IO.In_File, "tail.txt", "wcem=8");

      while not Ada.Wide_Wide_Text_IO.End_Of_File (File) loop
         Ada.Wide_Wide_Text_IO.Get_Line (File, Buffer, Last);
         Item.Offset := Integer'Wide_Wide_Value (Buffer (4 .. Last));

         Ada.Wide_Wide_Text_IO.Get_Line (File, Buffer, Last);
         Item.Text := new Wide_Wide_String'(Buffer (1 .. Last));

         Test_Data.Append (Item);
      end loop;

      Ada.Wide_Wide_Text_IO.Close (File);
   end Load;

   ----------
   -- Test --
   ----------

   procedure Test is
   begin
      for Item of Test_Data loop
         Test_U816_022.Run_Test_Iteration (Item);
      end loop;
   end Test;

begin
   Load;
   Test;
end Main;