Projet Informatique Théorique 2016
Instructions et Documentation
test_get_max_etat.c
1 /*
2  * Ce fichier fait partie d'un projet de programmation donné en Licence 3
3  * à l'Université de Bordeaux
4  *
5  * Copyright (C) 2015 Adrien Boussicault
6  *
7  * This Library is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This Library is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this Library. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 
22 #include "automate.h"
23 #include "outils.h"
24 
25 int test_get_max_etat(){
26  int result = 1;
27 
28  {
29  Automate * automate = creer_automate();
30 
31  ajouter_transition( automate, 1, 'a', 1 );
32  ajouter_transition( automate, 1, 'b', 2 );
33  ajouter_transition( automate, 1, 'c', 42 );
34  ajouter_etat_initial( automate, 1);
35  ajouter_etat_final( automate, 2);
36 
37  TEST(
38  1
39  && automate
40  && (get_max_etat(automate) == 42)
41  , result
42  );
43  liberer_automate( automate );
44  }
45 
46  return result;
47 }
48 
49 
50 int main(){
51 
52  if( ! test_get_max_etat() ){ return 1; };
53 
54  return 0;
55 
56 }
Le type d'un automate.
Definition: automate.h:39
void liberer_automate(Automate *automate)
Détruit un automate.
Definition: automate.c:168
void ajouter_transition(Automate *automate, int origine, char lettre, int fin)
Ajoute une transition à l'automate passé en paramètre.
Definition: automate.c:206
Automate * creer_automate()
Crée un automate vide, sans états, sans lettres et sans transitions.
Definition: automate.c:91
int get_max_etat(const Automate *automate)
Definition: automate.c:38
void ajouter_etat_final(Automate *automate, int etat_final)
Ajoute un état final à un automate passé en paramètre.
Definition: automate.c:226
void ajouter_etat_initial(Automate *automate, int etat_initial)
Ajoute un état initial à un automate passé en paramètre.
Definition: automate.c:233