-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_ensembles.adb
More file actions
52 lines (38 loc) · 1.25 KB
/
test_ensembles.adb
File metadata and controls
52 lines (38 loc) · 1.25 KB
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
with Ensembles, Ada.Text_IO;
procedure Test_Ensembles is
package Txt renames Ada.Text_IO;
function Inf (G, D : Integer) return Boolean is
begin return G < D; end Inf;
function Eq (G, D : Integer) return Boolean is
begin return G = D; end Eq;
package Ensembles_Entiers is new Ensembles (Integer, Inf, Eq, Integer'Image);
package EE renames Ensembles_Entiers;
E1, E2, E3 : EE.Ensemble;
begin
EE.Init(E1);
Txt.Put_Line("E1 :" & EE.ToString(E1));
if EE.Est_Vide(E1) then
Txt.Put_Line("E1 est vide");
else
Txt.Put_Line("E1 n'est pas vide");
end if;
EE.Inserer(1, E1);
EE.Inserer(5, E1);
EE.Inserer(3, E1);
EE.Inserer(3, E1);
EE.Inserer(8, E1);
EE.Inserer(2, E1);
EE.Inserer(7, E1);
EE.Inserer(9, E1);
Txt.Put_Line("E1 :" & EE.ToString(E1));
if EE.Appartient(7, E1) then
Txt.Put_Line("7 appartient à E1");
else
Txt.Put_Line("7 n'appartient pas à E1");
end if;
Txt.Put_Line(Integer'Image(EE.Premier(E1)) & " est le premier élément de E1");
EE.Supprimer(3, E1);
Txt.Put_Line("E1 :" & EE.ToString(E1));
EE.Init(E2);
Txt.Put_Line(Integer'Image(EE.Premier(E2)) & " est le premier élément de E2");
end Test_Ensembles;