text
stringlengths 0
234
|
|---|
Loc : Source_Location) is
|
Error : constant String := (if Message /= "" then Message else "Condition false");
|
begin
|
pragma Unreferenced (Op);
|
raise Test_Failure with "Assertion Failed: (" & Error & ") at " & Image (Loc);
|
end Report_Failure;
|
function "and" (Left, Right: Test_Result) return Test_Result is
|
Either_Failed : constant Boolean := Left = Failed or else Right = Failed;
|
Both_Skipped : constant Boolean := Left = Skipped and then Right = Skipped;
|
begin
|
return (if Either_Failed then Failed else (if Both_Skipped then Skipped else Passed));
|
end "and";
|
procedure Register (TG : in Test_Group) is
|
begin
|
All_Test_Groups.Append (TG);
|
end Register;
|
function Run (TG : Test_Group) return Test_Result is
|
Passes : Natural := 0;
|
Fails : Natural := 0;
|
Total : Natural := 0;
|
Instance : Test;
|
use Ada.Text_IO;
|
use Ada.Strings.Unbounded.Text_IO;
|
use type Ada.Strings.Unbounded.Unbounded_String;
|
begin
|
for T of TG loop
|
declare
|
begin
|
T.all (Instance);
|
Put_Line ("[ PASS ] " & Instance.Name);
|
Passes := Passes + 1;
|
exception
|
when Test_Disabled =>
|
Put_Line ("[ SKIP ] " & Instance.Name);
|
when Error : Test_Failure =>
|
Put_Line ("[ FAIL ] " & Instance.Name);
|
Put_Line (" " & Ada.Exceptions.Exception_Message (Error));
|
Fails := Fails + 1;
|
Function Definition: procedure Main is
|
Function Body: -- On utilise des chaines de taille variable
|
package Ada_Strings_Io is new Ada.Text_Io.Bounded_Io (Sb);
|
use Ada_Strings_Io;
|
type T_Menu is
|
(Menu_Principal, Menu_Registre, Menu_Registre_Consultation_Selection,
|
Menu_Registre_Consultation_Personne,
|
Menu_Registre_Consultation_Recherche, Menu_Registre_Ajout,
|
Menu_Registre_Modification, Menu_Arbre_Selection,
|
Menu_Arbre_Consultation, Menu_Arbre_Ajouter_Relation,
|
Menu_Arbre_Supprimer_Relation, Menu_Arbre_Parente, Menu_Statistiques,
|
Quitter);
|
-- Etat global du programme
|
type T_Etat is record
|
Arbre : T_Arbre_Genealogique;
|
Cle : Integer;
|
Menu : T_Menu;
|
end record;
|
-- Affiche la phrase "Votre choix [1, 2, ... `Nb_Choix`]"
|
-- et capture la saisie de l'utilisateur dans `Choix`.
|
procedure Choisir (Nb_Choix : in Integer; Choix : out Integer) is
|
procedure Afficher_Liste_Choix is
|
begin
|
for I in 1 .. Nb_Choix - 2 loop
|
Put (I, 0);
|
Put (", ");
|
end loop;
|
Put (Nb_Choix - 1, 0);
|
Put (" ou ");
|
Put (Nb_Choix - 0, 0);
|
end Afficher_Liste_Choix;
|
Correct : Boolean := False;
|
-- Premiere_Entree : Boolean := True;
|
begin
|
while not Correct loop
|
Put ("Votre choix [");
|
Afficher_Liste_Choix;
|
-- Fonctionnalité desactivée :
|
--if not Premiere_Entree then
|
-- Put (" / 0 pour quitter");
|
--end if;
|
Put ("] : ");
|
begin
|
Get (Choix);
|
Correct := Choix in 1 .. Nb_Choix;
|
--Correct := Choix in 0 .. Nb_Choix;
|
exception
|
when Ada.Io_Exceptions.Data_Error =>
|
Correct := False;
|
Function Definition: procedure Choisir_Cle (Cle : out Integer) is
|
Function Body: Correct : Boolean := False;
|
Premiere_Entree : Boolean := True;
|
begin
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.