diff --git a/tests/C/test-01-from-nothing/Bakefile b/tests/C/test-01-from-nothing/bake/Bakefile similarity index 100% rename from tests/C/test-01-from-nothing/Bakefile rename to tests/C/test-01-from-nothing/bake/Bakefile diff --git a/tests/C/test-01-from-nothing/README.md b/tests/C/test-01-from-nothing/bake/README.md similarity index 100% rename from tests/C/test-01-from-nothing/README.md rename to tests/C/test-01-from-nothing/bake/README.md diff --git a/tests/C/test-01-from-nothing/main.c b/tests/C/test-01-from-nothing/bake/main.c similarity index 100% rename from tests/C/test-01-from-nothing/main.c rename to tests/C/test-01-from-nothing/bake/main.c diff --git a/tests/C/test-01-from-nothing/Makefile b/tests/C/test-01-from-nothing/make/Makefile similarity index 100% rename from tests/C/test-01-from-nothing/Makefile rename to tests/C/test-01-from-nothing/make/Makefile diff --git a/tests/C/test-01-from-nothing/make/README.md b/tests/C/test-01-from-nothing/make/README.md new file mode 100644 index 0000000..6e14f57 --- /dev/null +++ b/tests/C/test-01-from-nothing/make/README.md @@ -0,0 +1,12 @@ +# Test 1 : Compilation depuis rien + +## Description +Ce test vérifie que lorsque les fichiers objets et exécutables sont absents, +le programme Bake compile correctement le fichier source `main.c` en `main`. + +## Fichiers utilisés +- `main.c` : Fichier source en C. +- `Bakefile` : Contient les règles de compilation. + +## Résultat attendu +La compilation doit se faire. diff --git a/tests/C/test-05-variables/main.c b/tests/C/test-01-from-nothing/make/main.c similarity index 100% rename from tests/C/test-05-variables/main.c rename to tests/C/test-01-from-nothing/make/main.c diff --git a/tests/C/test-02-already-exist/Bakefile b/tests/C/test-02-already-exist/bake/Bakefile similarity index 100% rename from tests/C/test-02-already-exist/Bakefile rename to tests/C/test-02-already-exist/bake/Bakefile diff --git a/tests/C/test-02-already-exist/README.md b/tests/C/test-02-already-exist/bake/README.md similarity index 100% rename from tests/C/test-02-already-exist/README.md rename to tests/C/test-02-already-exist/bake/README.md diff --git a/tests/C/test-02-already-exist/main b/tests/C/test-02-already-exist/bake/main similarity index 100% rename from tests/C/test-02-already-exist/main rename to tests/C/test-02-already-exist/bake/main diff --git a/tests/C/test-02-already-exist/main.c b/tests/C/test-02-already-exist/bake/main.c similarity index 100% rename from tests/C/test-02-already-exist/main.c rename to tests/C/test-02-already-exist/bake/main.c diff --git a/tests/C/test-02-already-exist/Makefile b/tests/C/test-02-already-exist/make/Makefile similarity index 100% rename from tests/C/test-02-already-exist/Makefile rename to tests/C/test-02-already-exist/make/Makefile diff --git a/tests/C/test-04-edited/README.md b/tests/C/test-02-already-exist/make/README.md similarity index 100% rename from tests/C/test-04-edited/README.md rename to tests/C/test-02-already-exist/make/README.md diff --git a/tests/C/test-04-edited/main b/tests/C/test-02-already-exist/make/main similarity index 100% rename from tests/C/test-04-edited/main rename to tests/C/test-02-already-exist/make/main diff --git a/tests/C/test-04-edited/main.c b/tests/C/test-02-already-exist/make/main.c similarity index 100% rename from tests/C/test-04-edited/main.c rename to tests/C/test-02-already-exist/make/main.c diff --git a/tests/C/test-03-circular/Bakefile b/tests/C/test-03-circular/bake/Bakefile similarity index 100% rename from tests/C/test-03-circular/Bakefile rename to tests/C/test-03-circular/bake/Bakefile diff --git a/tests/C/test-03-circular/README.md b/tests/C/test-03-circular/bake/README.md similarity index 100% rename from tests/C/test-03-circular/README.md rename to tests/C/test-03-circular/bake/README.md diff --git a/tests/C/test-03-circular/a.c b/tests/C/test-03-circular/bake/a.c similarity index 100% rename from tests/C/test-03-circular/a.c rename to tests/C/test-03-circular/bake/a.c diff --git a/tests/C/test-03-circular/a.h b/tests/C/test-03-circular/bake/a.h similarity index 100% rename from tests/C/test-03-circular/a.h rename to tests/C/test-03-circular/bake/a.h diff --git a/tests/C/test-03-circular/b.c b/tests/C/test-03-circular/bake/b.c similarity index 100% rename from tests/C/test-03-circular/b.c rename to tests/C/test-03-circular/bake/b.c diff --git a/tests/C/test-03-circular/b.h b/tests/C/test-03-circular/bake/b.h similarity index 100% rename from tests/C/test-03-circular/b.h rename to tests/C/test-03-circular/bake/b.h diff --git a/tests/C/test-03-circular/c.c b/tests/C/test-03-circular/bake/c.c similarity index 100% rename from tests/C/test-03-circular/c.c rename to tests/C/test-03-circular/bake/c.c diff --git a/tests/C/test-03-circular/c.h b/tests/C/test-03-circular/bake/c.h similarity index 100% rename from tests/C/test-03-circular/c.h rename to tests/C/test-03-circular/bake/c.h diff --git a/tests/C/test-03-circular/Makefile b/tests/C/test-03-circular/make/Makefile similarity index 100% rename from tests/C/test-03-circular/Makefile rename to tests/C/test-03-circular/make/Makefile diff --git a/tests/C/test-03-circular/make/README.md b/tests/C/test-03-circular/make/README.md new file mode 100644 index 0000000..6a847eb --- /dev/null +++ b/tests/C/test-03-circular/make/README.md @@ -0,0 +1,15 @@ +# Test 3 : Gestion des dépendances circulaires + +## Description +Ce test vérifie que le système de compilation peut détecter et gérer correctement les dépendances circulaires. Il simule un projet où plusieurs fichiers `.c` et `.h` s'incluent mutuellement, créant ainsi une boucle dans les dépendances. + +## Fichiers utilisés +- `a.c` : Implémente functionA qui appelle functionB. +- `b.c` : Implémente functionB qui appelle functionC. +- `c.c` : Implémente functionC et inclut a.h, créant une boucle indirecte. +- `a.h`, `b.h`, `c.h` : Fichiers d'en-tête correspondant. +- `Bakefile` : Contient les règles de compilation et les dépendances. +- `bakefile.jar` : Version compilée de notre système de build. + +## Résultat attendu +Si le système de build détecte une dépendance circulaire, il doit la gérer automatiquement en évitant la boucle infinie et en compilant correctement les fichiers. \ No newline at end of file diff --git a/tests/C/test-03-circular/make/a.c b/tests/C/test-03-circular/make/a.c new file mode 100644 index 0000000..283d470 --- /dev/null +++ b/tests/C/test-03-circular/make/a.c @@ -0,0 +1,12 @@ +#include +#include "b.h" + +void functionA(void) { + printf("Fonction A appelée\n"); + functionB(); +} + +int main(void) { + functionA(); + return 0; +} diff --git a/tests/C/test-03-circular/make/a.h b/tests/C/test-03-circular/make/a.h new file mode 100644 index 0000000..f043ff5 --- /dev/null +++ b/tests/C/test-03-circular/make/a.h @@ -0,0 +1,6 @@ +#ifndef A_H +#define A_H + +void functionA(void); + +#endif diff --git a/tests/C/test-03-circular/make/b.c b/tests/C/test-03-circular/make/b.c new file mode 100644 index 0000000..6be825f --- /dev/null +++ b/tests/C/test-03-circular/make/b.c @@ -0,0 +1,7 @@ +#include +#include "c.h" + +void functionB(void) { + printf("Fonction B appelée\n"); + functionC(); +} diff --git a/tests/C/test-03-circular/make/b.h b/tests/C/test-03-circular/make/b.h new file mode 100644 index 0000000..622ae55 --- /dev/null +++ b/tests/C/test-03-circular/make/b.h @@ -0,0 +1,6 @@ +#ifndef B_H +#define B_H + +void functionB(void); + +#endif diff --git a/tests/C/test-03-circular/make/c.c b/tests/C/test-03-circular/make/c.c new file mode 100644 index 0000000..aee51b0 --- /dev/null +++ b/tests/C/test-03-circular/make/c.c @@ -0,0 +1,8 @@ +#include +#include +#include "a.h" + +void functionC(void) { + printf("Fonction C appelée\n"); + return; +} diff --git a/tests/C/test-03-circular/make/c.h b/tests/C/test-03-circular/make/c.h new file mode 100644 index 0000000..312d6d6 --- /dev/null +++ b/tests/C/test-03-circular/make/c.h @@ -0,0 +1,6 @@ +#ifndef C_H +#define C_H + +void functionC(void); + +#endif diff --git a/tests/C/test-04-edited/Bakefile b/tests/C/test-04-edited/bake/Bakefile similarity index 100% rename from tests/C/test-04-edited/Bakefile rename to tests/C/test-04-edited/bake/Bakefile diff --git a/tests/C/test-04-edited/bake/README.md b/tests/C/test-04-edited/bake/README.md new file mode 100644 index 0000000..6910a2c --- /dev/null +++ b/tests/C/test-04-edited/bake/README.md @@ -0,0 +1,13 @@ +# Test 2 : Compilation où le résultat existe déjà + +## Description +Ce test vérifie que si l'exécutable `main` est déjà présent et que `main.c` +n'a pas été modifié, alors `Bake` ne tente pas de recompiler. + +## Fichiers utilisés +- `main.c` : Fichier source inchangé. +- `Bakefile` : Contient les règles de compilation. +- `main` : Exécutable déjà généré. + +## Résultat attendu +Aucun message indiquant la compilation ne doit apparaître. diff --git a/tests/C/test-04-edited/bake/main b/tests/C/test-04-edited/bake/main new file mode 100755 index 0000000..a65d3dd Binary files /dev/null and b/tests/C/test-04-edited/bake/main differ diff --git a/tests/C/test-04-edited/bake/main.c b/tests/C/test-04-edited/bake/main.c new file mode 100644 index 0000000..dee38e7 --- /dev/null +++ b/tests/C/test-04-edited/bake/main.c @@ -0,0 +1,7 @@ +#include + +int main(void) { + printf("Ceci est un programme de test du Bakefile !\n"); + printf("test\n"); + return 0; +} diff --git a/tests/C/test-04-edited/Makefile b/tests/C/test-04-edited/make/Makefile similarity index 100% rename from tests/C/test-04-edited/Makefile rename to tests/C/test-04-edited/make/Makefile diff --git a/tests/C/test-04-edited/make/README.md b/tests/C/test-04-edited/make/README.md new file mode 100644 index 0000000..6910a2c --- /dev/null +++ b/tests/C/test-04-edited/make/README.md @@ -0,0 +1,13 @@ +# Test 2 : Compilation où le résultat existe déjà + +## Description +Ce test vérifie que si l'exécutable `main` est déjà présent et que `main.c` +n'a pas été modifié, alors `Bake` ne tente pas de recompiler. + +## Fichiers utilisés +- `main.c` : Fichier source inchangé. +- `Bakefile` : Contient les règles de compilation. +- `main` : Exécutable déjà généré. + +## Résultat attendu +Aucun message indiquant la compilation ne doit apparaître. diff --git a/tests/C/test-04-edited/make/main b/tests/C/test-04-edited/make/main new file mode 100755 index 0000000..a65d3dd Binary files /dev/null and b/tests/C/test-04-edited/make/main differ diff --git a/tests/C/test-04-edited/make/main.c b/tests/C/test-04-edited/make/main.c new file mode 100644 index 0000000..dee38e7 --- /dev/null +++ b/tests/C/test-04-edited/make/main.c @@ -0,0 +1,7 @@ +#include + +int main(void) { + printf("Ceci est un programme de test du Bakefile !\n"); + printf("test\n"); + return 0; +} diff --git a/tests/C/test-05-variables/Bakefile b/tests/C/test-05-variables/bake/Bakefile similarity index 100% rename from tests/C/test-05-variables/Bakefile rename to tests/C/test-05-variables/bake/Bakefile diff --git a/tests/C/test-05-variables/README.md b/tests/C/test-05-variables/bake/README.md similarity index 100% rename from tests/C/test-05-variables/README.md rename to tests/C/test-05-variables/bake/README.md diff --git a/tests/C/test-06-variables-on-cascade/main.c b/tests/C/test-05-variables/bake/main.c similarity index 100% rename from tests/C/test-06-variables-on-cascade/main.c rename to tests/C/test-05-variables/bake/main.c diff --git a/tests/C/test-05-variables/Makefile b/tests/C/test-05-variables/make/Makefile similarity index 100% rename from tests/C/test-05-variables/Makefile rename to tests/C/test-05-variables/make/Makefile diff --git a/tests/C/test-05-variables/make/README.md b/tests/C/test-05-variables/make/README.md new file mode 100644 index 0000000..28b2bdc --- /dev/null +++ b/tests/C/test-05-variables/make/README.md @@ -0,0 +1 @@ +# Test 5 : Utilisation de variables diff --git a/tests/C/test-05-variables/make/main.c b/tests/C/test-05-variables/make/main.c new file mode 100644 index 0000000..145de7a --- /dev/null +++ b/tests/C/test-05-variables/make/main.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("Ceci est un programme de test du Bakefile !\n"); + return 0; +} diff --git a/tests/C/test-06-variables-on-cascade/Bakefile b/tests/C/test-06-variables-on-cascade/bake/Bakefile similarity index 100% rename from tests/C/test-06-variables-on-cascade/Bakefile rename to tests/C/test-06-variables-on-cascade/bake/Bakefile diff --git a/tests/C/test-06-variables-on-cascade/Makefile b/tests/C/test-06-variables-on-cascade/bake/Makefile similarity index 100% rename from tests/C/test-06-variables-on-cascade/Makefile rename to tests/C/test-06-variables-on-cascade/bake/Makefile diff --git a/tests/C/test-06-variables-on-cascade/README.md b/tests/C/test-06-variables-on-cascade/bake/README.md similarity index 100% rename from tests/C/test-06-variables-on-cascade/README.md rename to tests/C/test-06-variables-on-cascade/bake/README.md diff --git a/tests/C/test-06-variables-on-cascade/bake/main.c b/tests/C/test-06-variables-on-cascade/bake/main.c new file mode 100644 index 0000000..145de7a --- /dev/null +++ b/tests/C/test-06-variables-on-cascade/bake/main.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("Ceci est un programme de test du Bakefile !\n"); + return 0; +} diff --git a/tests/C/test-06-variables-on-cascade/make/Bakefile b/tests/C/test-06-variables-on-cascade/make/Bakefile new file mode 100644 index 0000000..8c7779b --- /dev/null +++ b/tests/C/test-06-variables-on-cascade/make/Bakefile @@ -0,0 +1,6 @@ +FLAGS = -ansi -pedantic +FLAGSS = $(FLAGS) +FLAGSSS = $(FLAGSS) + +main: main.c + gcc $(FLAGSSS) -o main main.c diff --git a/tests/C/test-06-variables-on-cascade/make/Makefile b/tests/C/test-06-variables-on-cascade/make/Makefile new file mode 100644 index 0000000..8c7779b --- /dev/null +++ b/tests/C/test-06-variables-on-cascade/make/Makefile @@ -0,0 +1,6 @@ +FLAGS = -ansi -pedantic +FLAGSS = $(FLAGS) +FLAGSSS = $(FLAGSS) + +main: main.c + gcc $(FLAGSSS) -o main main.c diff --git a/tests/C/test-06-variables-on-cascade/make/README.md b/tests/C/test-06-variables-on-cascade/make/README.md new file mode 100644 index 0000000..0baeab4 --- /dev/null +++ b/tests/C/test-06-variables-on-cascade/make/README.md @@ -0,0 +1 @@ +# Test 6 : Gestion des variables en cascade diff --git a/tests/C/test-06-variables-on-cascade/make/main.c b/tests/C/test-06-variables-on-cascade/make/main.c new file mode 100644 index 0000000..145de7a --- /dev/null +++ b/tests/C/test-06-variables-on-cascade/make/main.c @@ -0,0 +1,6 @@ +#include + +int main(void) { + printf("Ceci est un programme de test du Bakefile !\n"); + return 0; +} diff --git a/tests/Java/test-01-from-nothing/Bakefile b/tests/Java/test-01-from-nothing/bake/Bakefile similarity index 100% rename from tests/Java/test-01-from-nothing/Bakefile rename to tests/Java/test-01-from-nothing/bake/Bakefile diff --git a/tests/Java/test-01-from-nothing/Devinette.java b/tests/Java/test-01-from-nothing/bake/Devinette.java similarity index 100% rename from tests/Java/test-01-from-nothing/Devinette.java rename to tests/Java/test-01-from-nothing/bake/Devinette.java diff --git a/tests/Java/test-01-from-nothing/test1.java b/tests/Java/test-01-from-nothing/bake/test1.java similarity index 100% rename from tests/Java/test-01-from-nothing/test1.java rename to tests/Java/test-01-from-nothing/bake/test1.java diff --git a/tests/Java/test-01-from-nothing/make/Devinette.java b/tests/Java/test-01-from-nothing/make/Devinette.java new file mode 100644 index 0000000..f504b8b --- /dev/null +++ b/tests/Java/test-01-from-nothing/make/Devinette.java @@ -0,0 +1,36 @@ +import java.util.Scanner; +import java.util.Random; + +public class Devinette { + public static void main(String[] args) { + Scanner scanner = new Scanner(System.in); + Random random = new Random(); + int nombreMystere = random.nextInt(100) + 1; // Nombre entre 1 et 100 + int essais = 5; + boolean gagne = false; + + System.out.println("Bienvenue dans le jeu de devinette !"); + System.out.println("Essayez de deviner le nombre mystère entre 1 et 100. Vous avez " + essais + " tentatives."); + + for (int i = 0; i < essais; i++) { + System.out.print("Entrez votre tentative : "); + int tentative = scanner.nextInt(); + + if (tentative == nombreMystere) { + System.out.println("Bravo ! Vous avez trouvé le nombre mystère."); + gagne = true; + break; + } else if (tentative < nombreMystere) { + System.out.println("Trop bas ! Essayez encore."); + } else { + System.out.println("Trop haut ! Essayez encore."); + } + } + + if (!gagne) { + System.out.println("Dommage ! Le nombre mystère était : " + nombreMystere); + } + + scanner.close(); + } +} diff --git a/tests/Java/test-01-from-nothing/Makefile b/tests/Java/test-01-from-nothing/make/Makefile similarity index 100% rename from tests/Java/test-01-from-nothing/Makefile rename to tests/Java/test-01-from-nothing/make/Makefile diff --git a/tests/Java/test-01-from-nothing/make/test1.java b/tests/Java/test-01-from-nothing/make/test1.java new file mode 100644 index 0000000..eb247cd --- /dev/null +++ b/tests/Java/test-01-from-nothing/make/test1.java @@ -0,0 +1,6 @@ +public class test1 { + + public static void main(String[] args) { + System.out.println("Compilation à partir de rien !"); + } +} \ No newline at end of file diff --git a/tests/Java/test-03-circular/Bakefile b/tests/Java/test-03-circular/bake/Bakefile similarity index 100% rename from tests/Java/test-03-circular/Bakefile rename to tests/Java/test-03-circular/bake/Bakefile diff --git a/tests/Java/test-03-circular/ClasseA.java b/tests/Java/test-03-circular/bake/ClasseA.java similarity index 100% rename from tests/Java/test-03-circular/ClasseA.java rename to tests/Java/test-03-circular/bake/ClasseA.java diff --git a/tests/Java/test-03-circular/ClasseB.java b/tests/Java/test-03-circular/bake/ClasseB.java similarity index 100% rename from tests/Java/test-03-circular/ClasseB.java rename to tests/Java/test-03-circular/bake/ClasseB.java diff --git a/tests/Java/test-03-circular/ClasseC.java b/tests/Java/test-03-circular/bake/ClasseC.java similarity index 100% rename from tests/Java/test-03-circular/ClasseC.java rename to tests/Java/test-03-circular/bake/ClasseC.java diff --git a/tests/Java/test-03-circular/Main.java b/tests/Java/test-03-circular/bake/Main.java similarity index 100% rename from tests/Java/test-03-circular/Main.java rename to tests/Java/test-03-circular/bake/Main.java diff --git a/tests/Java/test-03-circular/make/ClasseA.java b/tests/Java/test-03-circular/make/ClasseA.java new file mode 100644 index 0000000..7d10704 --- /dev/null +++ b/tests/Java/test-03-circular/make/ClasseA.java @@ -0,0 +1,7 @@ +public class ClasseA { + private ClasseB b; + + public ClasseA(ClasseB b) { + this.b = b; + } +} diff --git a/tests/Java/test-03-circular/make/ClasseB.java b/tests/Java/test-03-circular/make/ClasseB.java new file mode 100644 index 0000000..67fd6ac --- /dev/null +++ b/tests/Java/test-03-circular/make/ClasseB.java @@ -0,0 +1,7 @@ +public class ClasseB { + private ClasseA a; + + public ClasseB(ClasseA a) { + this.a = a; + } +} diff --git a/tests/Java/test-03-circular/make/ClasseC.java b/tests/Java/test-03-circular/make/ClasseC.java new file mode 100644 index 0000000..4f9f759 --- /dev/null +++ b/tests/Java/test-03-circular/make/ClasseC.java @@ -0,0 +1,9 @@ +public class ClasseC { + private ClasseA a; + private ClasseB b; + + public ClasseC(ClasseA a, ClasseB b) { + this.a = a; + this.b = b; + } +} diff --git a/tests/Java/test-03-circular/make/Main.java b/tests/Java/test-03-circular/make/Main.java new file mode 100644 index 0000000..c8c8ab7 --- /dev/null +++ b/tests/Java/test-03-circular/make/Main.java @@ -0,0 +1,16 @@ +public class Main { + private ClasseA a; + private ClasseB b; + private ClasseC c; + + public Main() { + this.a = new ClasseA(b); + this.b = new ClasseB(a); + this.c = new ClasseC(a,b); + } + + public static void main(String[] args) { + Main m = new Main(); + System.out.println("Ceci est un test de dépendences circulaires"); + } +} diff --git a/tests/Java/test-03-circular/Makefile b/tests/Java/test-03-circular/make/Makefile similarity index 100% rename from tests/Java/test-03-circular/Makefile rename to tests/Java/test-03-circular/make/Makefile