30 int sont_dans_l_ensemble(
int n,
Ensemble * ens, ... ){
36 res &= est_dans_l_ensemble( ens, va_arg(pile,
int) );
42 int l_ensemble_est_egal(
int n,
const Ensemble* ens, ... ){
47 Ensemble * e = creer_ensemble( NULL, NULL, NULL );
51 ajouter_element( e, va_arg(pile,
int) );
54 res = comparer_ensemble( ens, e );
55 liberer_ensemble( e );
61 void action_test_transitions_automate(
62 int origine,
char lettre,
int fin,
void* data
64 int * res = (
int*) data;
68 int test_transitions_automate(
int nb_transitions,
const Automate* aut, ... ){
73 if( nb_transitions != nb ){
return 0; }
76 for (i=0;i<nb_transitions;i++){
77 int origine = va_arg(pile,
int);
78 char lettre = (char) va_arg(pile,
int);
79 int fin = va_arg(pile,
int);
82 aut, origine, lettre, fin
94 int test_get_min_max_etat(){
142 int test_translater_automate_entier(){
152 && taille_ensemble(
get_etats( trans ) ) == 0
154 && taille_ensemble(
get_finaux( trans ) ) == 0
174 && l_ensemble_est_egal( 4,
get_etats( trans ), -1, 2, 7, 9)
175 && l_ensemble_est_egal( 2,
get_initiaux( trans ), -1, 2)
176 && l_ensemble_est_egal( 2,
get_finaux( trans ), 7, 9)
177 && test_transitions_automate(
191 int test_translater_automate(){
202 && taille_ensemble(
get_etats( trans ) ) == 0
204 && taille_ensemble(
get_finaux( trans ) ) == 0
226 && l_ensemble_est_egal( 4,
get_etats( trans ), -3, 0, 5, 7)
227 && l_ensemble_est_egal( 2,
get_initiaux( trans ), -3, 0)
228 && l_ensemble_est_egal( 2,
get_finaux( trans ), 5, 7)
229 && test_transitions_automate(
255 && taille_ensemble(
get_etats( trans ) ) == 0
257 && taille_ensemble(
get_finaux( trans ) ) == 0
284 && l_ensemble_est_egal( 4,
get_etats( trans ), 8, 11, 16, 18)
285 && l_ensemble_est_egal( 2,
get_initiaux( trans ), 8, 11)
286 && l_ensemble_est_egal( 2,
get_finaux( trans ), 16, 18)
287 && test_transitions_automate(
304 if( ! test_get_min_max_etat() ){
return 1; }
305 if( ! test_translater_automate_entier() ){
return 1; }
306 if( ! test_translater_automate() ){
return 1; }
void liberer_automate(Automate *automate)
Détruit un automate.
int est_une_transition_de_l_automate(const Automate *automate, int origine, char lettre, int fin)
Renvoie 1 si ('origine', 'lettre', 'fin') est une transition de l'automate et 0 sinon.
Automate * translater_automate_entier(const Automate *automate, int translation)
Crée une copie de l'automate passé en paramètre dont les numéros de tous les états ont été translatés...
void ajouter_transition(Automate *automate, int origine, char lettre, int fin)
Ajoute une transition à l'automate passé en paramètre.
Automate * creer_automate()
Crée un automate vide, sans états, sans lettres et sans transitions.
int get_max_etat(const Automate *automate)
const Ensemble * get_finaux(const Automate *automate)
Renvoie l'ensemble des états finaux d'un automate.
void pour_toute_transition(const Automate *automate, void(*action)(int origine, char lettre, int fin, void *data), void *data)
La fonction passe en revue toutes les transitions de l'automate et appelle la fonction passée en para...
const Ensemble * get_initiaux(const Automate *automate)
Renvoie l'ensemble des états intiaux d'un automate.
const Ensemble * get_etats(const Automate *automate)
Renvoie l'ensemble des états d'un automate.
void ajouter_etat_final(Automate *automate, int etat_final)
Ajoute un état final à un automate passé en paramètre.
void ajouter_etat_initial(Automate *automate, int etat_initial)
Ajoute un état initial à un automate passé en paramètre.
int get_min_etat(const Automate *automate)
Renvoie l'état ayant le numéro le plus petit de l'automate passé en paramètre.
Automate * translater_automate(const Automate *automate, const Automate *automate_a_eviter)
Crée une copie de l'automate passé en paramètre. Les entiers des états du nouvel automate évitent ceu...