-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain_tests.c
46 lines (31 loc) · 833 Bytes
/
main_tests.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include <assert.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "ecosys.h"
int main(void) {
int i;
Animal *liste_proie = NULL;
Animal *liste_predateur = NULL;
int energie=10;
srand(time(NULL));
Animal *a1 = creer_animal(0,10, energie);
Animal *a2 = creer_animal(15,35, energie);
Animal *a3 = creer_animal(2,42, energie);
Animal *a4 = creer_animal(18,13, energie);
a1->suivant=a2;
a2->suivant=a3;
a3->suivant=a4;
liste_proie=a1;
Animal *a5 = creer_animal(2,5, energie);
Animal *a6 = creer_animal(15,35, energie);
Animal *a7 = creer_animal(9,22, energie);
Animal *a8 = creer_animal(17,3, energie);
a5->suivant=a6;
a6->suivant=a7;
a7->suivant=a8;
liste_predateur=a5;
afficher_ecosys(liste_proie,liste_predateur);
return 0;
}