iterators_0.1.0_b3abe21d/src/iterators-tests.ads

 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
with Ada.Containers.Ordered_Maps;
with Ada.Containers.Vectors;

with Iterators.From.Elements.Lists;
with Iterators.From.Ordered_Maps;
with Iterators.From.Vectors;
with Iterators.Generators.Arrays;
with Iterators.Operators;
with Iterators.Shebang;

package Iterators.Tests is

   --  Supporting instantiations:

   package Ints    is new From.Elements (Integer);
   package Strings is new From.Elements (String);
   package Int2str is new Operators (Ints.Iterators, Strings.Iterators);
   package Str2int is new Operators (Strings.Iterators, Ints.Iterators);

   package Chars is new Shebang (Character);

   package Int_Lists is new Ints.Lists;

   package Int_Maps      is new Ada.Containers.Ordered_Maps (Positive, Integer);
   package Int_Map_Iters is new From.Ordered_Maps (Int_Maps);

   package Int_Vectors   is new Ada.Containers.Vectors (Positive, Integer);
   package Int_Vec_Iters is new From.Vectors (Int_Vectors);

   package Arrs is new Generators.Arrays (Any_Index   => Positive,
                                          Any_Element => Integer,
                                          Root        => Ints.Iterators);

   subtype Number_Array is Arrs.Element_Array;

   --  Supporting subprograms:

   function Add (L, R : Integer) return Integer is (L + R);

   procedure Check (It : Ints.Iterators.Iterator'Class;
                    Ok : Number_Array);

   function Double (I : Integer) return Integer is (I * 2);

   function Image (I : Integer) return String is (Integer'Image (I));

   function Is_Odd (I : Integer) return Boolean is (I mod 2 = 1);

   function Value (S : String) return Integer is (Integer'Value (S));

end Iterators.Tests;