TP-programmation-imperative/tp06/scenario_stock.adb
2023-06-10 21:03:54 +02:00

46 lines
1.3 KiB
Ada
Executable file

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;
with Stocks_Materiel; use Stocks_Materiel;
-- Auteur:
-- Gérer un stock de matériel informatique.
--
procedure Scenario_Stock is
Mon_Stock : T_Stock;
begin
-- Créer un stock vide
Creer (Mon_Stock);
pragma Assert (Nb_Materiels (Mon_Stock) = 0);
-- Enregistrer quelques matériels
Enregistrer (Mon_Stock, 1012, UNITE_CENTRALE, 2016);
pragma Assert (Nb_Materiels (Mon_Stock) = 1);
Enregistrer (Mon_Stock, 2143, ECRAN, 2016);
pragma Assert (Nb_Materiels (Mon_Stock) = 2);
Enregistrer (Mon_Stock, 3001, IMPRIMANTE, 2017);
pragma Assert (Nb_Materiels (Mon_Stock) = 3);
Enregistrer (Mon_Stock, 3012, UNITE_CENTRALE, 2017);
pragma Assert (Nb_Materiels (Mon_Stock) = 4);
pragma Assert ( Nb_Materiels (Mon_Stock) = 4 );
change_state (Mon_Stock, false, 2143);
pragma Assert ( Nb_Materiels_DEAD (Mon_Stock) = 1 );
supprimer_all_dead(Mon_Stock);
pragma Assert ( Nb_Materiels_DEAD (Mon_Stock) = 0 );
pragma Assert ( Nb_Materiels (Mon_Stock) = 3 );
supprimer_materiel(Mon_Stock, 3001);
pragma Assert ( Nb_Materiels (Mon_Stock) = 2 );
put("test ok");
end Scenario_Stock;