agpl_1.0.0_b5da3320/src/tests/t005_permutations.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
with Text_Io; use Text_Io;
with Ada.Exceptions; use Ada.Exceptions;

with Permutations;

procedure T005_Permutations is
   type Int is new Integer range 1 .. 4;

   package Perm is new Permutations (Int, Integer);

   procedure Print (P : in Perm.Permutation) is
   begin
      for I in P'Range loop
         Put (P (I)'Img);
      end loop;
      New_Line;
   end Print;

   procedure Enumerate is new Perm.Enumeration (Print);

begin
   Enumerate;
exception
   when E : others =>
      Put_Line ("Exception: " & Exception_Information (E));
end T005_Permutations;