46 lines
1.1 KiB
Ada
46 lines
1.1 KiB
Ada
|
with Ada.Text_IO; use Ada.Text_IO;
|
||
|
with Ada.Float_Text_IO; use Ada.Float_Text_IO;
|
||
|
with Vecteurs_Creux; use Vecteurs_Creux;
|
||
|
|
||
|
-- Exemple d'utilisation des vecteurs creux.
|
||
|
procedure Exemple_Vecteurs_Creux is
|
||
|
|
||
|
V : T_Vecteur_Creux;
|
||
|
Epsilon: constant Float := 1.0e-5;
|
||
|
|
||
|
begin
|
||
|
Put_Line ("Début du scénario");
|
||
|
|
||
|
-- question 1
|
||
|
Put_Line ( "question 1" );
|
||
|
Initialiser (V);
|
||
|
Afficher(V); New_Line;
|
||
|
|
||
|
-- question 2
|
||
|
Put_Line ( "question 2" );
|
||
|
pragma Assert ( true = Est_Nul(V) );
|
||
|
|
||
|
-- question 3
|
||
|
Put_Line ( "question 3" );
|
||
|
Detruire(v);
|
||
|
pragma Assert ( true = Est_Nul(V) );
|
||
|
|
||
|
-- question 5
|
||
|
Put_Line ( "question 5" );
|
||
|
Modifier (V, 18, 0.0);
|
||
|
Afficher(V); New_Line;
|
||
|
|
||
|
-- question 4
|
||
|
Put_Line ( "question 4" );
|
||
|
pragma Assert ( 0.0 = Composante_Recursif (V, 18) );
|
||
|
pragma Assert ( 0.0 = Composante_Iteratif (V, 18) );
|
||
|
|
||
|
-- question 6
|
||
|
Put_Line ( "question 6" );
|
||
|
pragma Assert ( true = Sont_Egaux_Recursif (V, V) );
|
||
|
pragma Assert ( true = Sont_Egaux_Iteratif (V, V) );
|
||
|
|
||
|
|
||
|
Put_Line ("Fin du scénario");
|
||
|
end Exemple_Vecteurs_Creux;
|