Commit 16e67e7ee00ce5cb3d029758f1dd74f38d7c1464
1 parent
946cc8e0
l'utilisateur peut choisir les fichiers de dico et a tester
Showing
4 changed files
with
55 additions
and
27 deletions
Show diff stats
american-english
dico_test
1 | -Although testing can determine the correctness of software under the assumption of some specific hypotheses (see the hierarchy of testing difficulty below), testing cannot identify all the defects within the software. Instead, it furnishes a criticism or comparison that compares the state and behavior of the product against test oracles principles or mechanisms by which someone might recognize a problem. These oracles may include (but are not limited to) specifications, contracts, comparable products, past versions of the same product, inferences about intended or expected purpose, user or customer expectations, relevant standards, applicable laws, or other criteria. 111 | |
2 | 1 | \ No newline at end of file |
2 | +Sandra and Betty are sitting in the park, Sandra asks Betty:' Tell me about your family' | |
3 | + | |
4 | + | |
5 | + | |
6 | +Betty:' My family is a rather small one, with only three people, my father, my mother and me. My father is a doctor. My mother is a middle-school teacher. I am still a student. My mother is very gentle and soft while my father is a little bit hot-tempered. We love each other very much. Although sometimes we might become angry at one another, very soon we will forget the unpleasant things. We're a happy family, how about you?' | |
7 | + | |
8 | + | |
9 | + | |
10 | +Sandra:' I have a big family with seven people, my grandparents, parents, two brothers and me. We take care of one another, share housework, and often communicate all together.' | |
11 | + | ... | ... |
... | ... | @@ -3,32 +3,51 @@ |
3 | 3 | int main() |
4 | 4 | { |
5 | 5 | setlocale(LC_ALL, ""); |
6 | - FILE* fp = fopen("american-english","r"); | |
7 | - FILE* fp2 = fopen("dico_test","r"); | |
8 | - | |
9 | - if(fp == NULL) return 1 ; //File is not readable | |
10 | - | |
11 | - dico Dico; | |
12 | 6 | |
7 | + //Récupération du fichier contenant le dictionnaire | |
8 | + char fichier[100]; | |
9 | + FILE* fp = NULL; | |
10 | + printf("Quel fichier voulez-vous utiliser comme dictionnaire ?\n"); | |
11 | + do{ | |
12 | + scanf("%s",fichier); | |
13 | + fp = fopen(fichier,"r"); | |
14 | + if(fp == NULL) | |
15 | + { | |
16 | + printf("Le fichier n'est pas accessible !\nEntrez un autre nom de fichier :\n"); | |
17 | + } | |
18 | + }while(fp == NULL); | |
19 | + | |
20 | + //Chargement du dictionnaire | |
21 | + dico Dico; | |
13 | 22 | init_dico(&Dico); |
14 | - load_dico(fp,&Dico);//chargement de l'arbre | |
15 | - | |
16 | - printf("Loading done!\n"); | |
17 | - | |
18 | - | |
19 | - int result = find_erreur(Dico,fp2); | |
20 | - printf("%d\n",result); | |
21 | - | |
22 | - /*wchar_t mot[50]; | |
23 | - wscanf(L"%ls",mot); | |
24 | - int result; | |
25 | - result = find_mot(Dico,mot); | |
26 | - printf("%d\n",result);*/ | |
23 | + load_dico(fp,&Dico); | |
24 | + fclose(fp); | |
25 | + printf("Chargement du dictionnaire effectué!\n\n"); | |
26 | + | |
27 | + //Récupération du fichier contenant les mots à tester | |
28 | +char recommencer = ' '; | |
29 | + do{ | |
30 | + FILE* fp = NULL; | |
31 | + printf("Quel fichier voulez-vous tester ?\n"); | |
32 | + do{ | |
33 | + scanf("%s",fichier); | |
34 | + fp = fopen(fichier,"r"); | |
35 | + if(fp == NULL) | |
36 | + { | |
37 | + printf("Le fichier n'est pas accessible !\nEntrez un autre nom de fichier :\n"); | |
38 | + } | |
39 | + }while(fp == NULL); | |
40 | + | |
41 | + //Vérification des mots du fichier | |
42 | + int result = find_erreur(Dico,fp); | |
43 | + printf("Le fichier testé contient %d mots qui ne sont pas présent dans le dictionnaire.\n",result); | |
44 | + fclose(fp); | |
27 | 45 | |
46 | + printf("Voulez vous tester un autre fichier ?[Y]\n"); | |
47 | + scanf(" %c",&recommencer); | |
48 | + }while(recommencer == 'Y' || recommencer == 'y'); | |
28 | 49 | |
29 | - free_dico(Dico);//libérer la mémoire | |
30 | - fclose(fp); | |
31 | - fclose(fp2); | |
50 | + free_dico(Dico);//libérer la mémoire du dictionnaire | |
32 | 51 | |
33 | 52 | printf("Fin du programme\n"); |
34 | 53 | ... | ... |
... | ... | @@ -102,7 +102,7 @@ void splitcarac(dico *Dico,wchar_t message[]) |
102 | 102 | |
103 | 103 | void load_dico(FILE *fp, dico *Dico) |
104 | 104 | { |
105 | - wchar_t val[50]; | |
105 | + wchar_t val[3000]; | |
106 | 106 | |
107 | 107 | while(fwscanf(fp, L"%ls",val)==1) |
108 | 108 | { |
... | ... | @@ -147,7 +147,7 @@ int find_mot(dico Dico,wchar_t mot[]) |
147 | 147 | return 0; |
148 | 148 | } |
149 | 149 | if(mot[0]>='0' && mot[0]<='9')return 0; |
150 | - | |
150 | + | |
151 | 151 | int fl =-1; |
152 | 152 | if(mot[0]>='a' && mot[0]<='z') |
153 | 153 | { |
... | ... | @@ -191,7 +191,7 @@ int find_mot(dico Dico,wchar_t mot[]) |
191 | 191 | |
192 | 192 | int find_erreur(dico Dico, FILE *fp) |
193 | 193 | { |
194 | - wchar_t val[5000]; | |
194 | + wchar_t val[3000]; | |
195 | 195 | int cpt_erreur =0; |
196 | 196 | |
197 | 197 | while(fwscanf(fp, L"%ls",val)==1) | ... | ... |