Merge branch 'main' of gitlab.emi.u-bordeaux.fr:pt2/teams/a42/lightup-a42e
This commit is contained in:
commit
93428486ec
3 files changed
+32
-9
No files matched your search
+2
-1
@@ -28,4 +28,5 @@ add_test(test_thoguet_default ./game_test_thoguet game_default)
|
||||
add_test(test_thoguet_game_default_solution ./game_test_thoguet game_default_solution)
|
||||
add_test(test_game_restart ./game_test_thoguet game_restart)
|
||||
|
||||
add_test(test_thperrier_dummy ./game_test_thperrier dummy)
|
||||
add_test(test_thperrier_dummy ./game_test_thperrier dummy)
|
||||
add_test(test_thperrier_game_new_empty ./game_test_thperrier game_new_empty)
|
||||
@@ -10,13 +10,13 @@
|
||||
|
||||
### void game_delete(game g) -> thperrier -> à faire
|
||||
|
||||
### void game_set_square(game g, uint i, uint j, square s) ->
|
||||
### void game_set_square(game g, uint i, uint j, square s) -> nnunes -> à faire
|
||||
|
||||
### square game_get_square(cgame g, uint i, uint j) -> thoguet -> fini
|
||||
|
||||
### square game_get_state(cgame g, uint i, uint j) ->
|
||||
### square game_get_state(cgame g, uint i, uint j) -> nnunes -> à faire
|
||||
|
||||
### square game_get_flags(cgame g, uint i, uint j) ->
|
||||
### square game_get_flags(cgame g, uint i, uint j) -> nnunes -> à faire
|
||||
|
||||
### bool game_is_blank(cgame g, uint i, uint j) -> thperrier -> à faire
|
||||
|
||||
@@ -26,15 +26,15 @@
|
||||
|
||||
### int game_get_black_number(cgame g, uint i, uint j) -> thperrier -> à faire
|
||||
|
||||
### bool game_is_marked(cgame g, uint i, uint j) ->
|
||||
### bool game_is_marked(cgame g, uint i, uint j) -> nnunes -> à faire
|
||||
|
||||
### bool game_is_lighted(cgame g, uint i, uint j) ->
|
||||
### bool game_is_lighted(cgame g, uint i, uint j) -> nnunes -> à faire
|
||||
|
||||
### bool game_has_error(cgame g, uint i, uint j) ->
|
||||
### bool game_has_error(cgame g, uint i, uint j) -> nnunes -> à faire
|
||||
|
||||
### bool game_check_move(cgame g, uint i, uint j, square s) ->
|
||||
### bool game_check_move(cgame g, uint i, uint j, square s) -> nnunes -> à faire
|
||||
|
||||
### void game_play_move(game g, uint i, uint j, square s) ->
|
||||
### void game_play_move(game g, uint i, uint j, square s) -> nnunes -> à faire
|
||||
|
||||
### void game_update_flags(game g) -> thoguet -> pas fait
|
||||
|
||||
|
||||
@@ -2,11 +2,30 @@
|
||||
#include <stdio.h>
|
||||
#include <stdbool.h>
|
||||
#include <string.h>
|
||||
#include "game.h"
|
||||
#include "game_aux.c"
|
||||
|
||||
|
||||
/* ********** DUMMY ********** */
|
||||
bool test_dummy(){
|
||||
return true;
|
||||
}
|
||||
|
||||
/* ********** game_new_empty ********** */
|
||||
bool test_game_new_empty(){
|
||||
game g = game_new_empty();
|
||||
assert(g);
|
||||
for (int i = 0; i < DEFAULT_SIZE; i++){
|
||||
for (int j = 0; j < DEFAULT_SIZE; j++){
|
||||
if (game_get_flags(g, i, j) != S_BLANK){
|
||||
game_delete(g);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
game_delete(g);
|
||||
return true;
|
||||
}
|
||||
|
||||
void usage(int argc, char *argv[]){
|
||||
fprintf(stderr, "Usage: %s <testname>\n", argv[0]);
|
||||
@@ -21,6 +40,9 @@ int main (int argc, char *argv[]){
|
||||
else if (strcmp("dummy", argv[1]) == 0){
|
||||
success = test_dummy();
|
||||
}
|
||||
else if (strcmp("game_new_empty", argv[1]) == 0){
|
||||
success = test_game_new_empty();
|
||||
}
|
||||
else{
|
||||
fprintf (stderr, "test \"%s\" is not a valid test name.\n", argv[1]);
|
||||
return EXIT_FAILURE;
|
||||
|
||||
Reference in new issue
Block a user