init: tests
This commit is contained in:
parent
2db2ce9a26
commit
652b718b2b
3 changed files with 21 additions and 5 deletions
7
includes/test.h
Normal file
7
includes/test.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef OTHELLO_TEST_H
|
||||
#define OTHELLO_TEST_H 1
|
||||
|
||||
/* Run the tests */
|
||||
void run_tests(void);
|
||||
|
||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "../includes/jeu.h"
|
||||
#include "../includes/test.h"
|
||||
|
||||
/* Affiche un message d'aide */
|
||||
void help(char const progName[]);
|
||||
|
@ -22,6 +22,10 @@ int main(int argc, char const *argv[]) {
|
|||
// Affiche le message d'aide
|
||||
help(argv[0]);
|
||||
exit(EXIT_SUCCESS);
|
||||
} else {
|
||||
if (strcmp(argv[1], "--test") == 0 || strcmp(argv[1], "-t") == 0) {
|
||||
run_tests();
|
||||
exit(EXIT_SUCCESS);
|
||||
} else {
|
||||
fprintf(stderr, "Il manque des arguments.\n");
|
||||
// Affichage du message d'aide
|
||||
|
@ -29,6 +33,7 @@ int main(int argc, char const *argv[]) {
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (argc == 3) { // s'il y a 2 arguments
|
||||
// Concernant les noirs
|
||||
if (strcmp(argv[1], "humain") == 0 || strcmp(argv[1], "h") == 0) {
|
||||
|
@ -96,6 +101,7 @@ void help(char const progName[]) {
|
|||
"\t\t\t\t- alphabeta\t - a\n"
|
||||
"\t\t\t\t=> exemple : %s humain alphabeta\n",
|
||||
progName, progName);
|
||||
printf("-> %s -t, --test || Test l'efficacité des IA.\n", progName);
|
||||
printf("-> %s -h, --help || Affiche ce message d'aide.\n", progName);
|
||||
printf("==============================================================\n");
|
||||
}
|
||||
|
|
3
src/test.c
Normal file
3
src/test.c
Normal file
|
@ -0,0 +1,3 @@
|
|||
#include "../includes/test.h"
|
||||
|
||||
void run_tests(void) {}
|
Reference in a new issue