Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 40c14a4e authored by PRATS Tommy's avatar PRATS Tommy
Browse files

test faile because I forgot to change -1 for return when apply_input fail

parent 6657bd4f
No related branches found
No related tags found
2 merge requests!131Testing merge against main, to verify CI,!97Engines have test and no leak of memory
Pipeline #1002220 failed
......@@ -81,7 +81,15 @@ bool move_entity(map *map, int fy, int fx, int ty, int tx) {
if (entity_from != EMPTY && can_move_to(map, fy, fx, ty, tx)) {
#endif
#ifndef EVENTS
if ( map->tiles[ty][tx] == '~' && map->player_x == fx && map->player_y == fy ){
#ifdef ENTITY_STRUCT
#ifdef MAP_ENTITY_STACKING
if ( map->tiles[fy][fx]->display_symbol == '~' && map->player_x == fx && map->player_y == fy ){
#else
if ( get_entity(map, ty, tx)->display_symbol == '~' && map->player_x == fx && map->player_y == fy ){
#endif
#else
if ( get_entity(map, ty, tx) == '~' && map->player_x == fx && map->player_y == fy ){
#endif
message ("Vous vous noyez !");
free_map(map);
exit (EXIT_FAILURE);
......
......@@ -71,7 +71,7 @@ Test(command_args, apply_input)
// wrong
c = get_next_command();
res = apply_input(m, c );
cr_assert_eq(res, 0);
cr_assert_eq(res, -1);
cr_assert_eq(m->player_x, 1);
cr_assert_eq(m->player_y, 5);
free_command(c);
......
......@@ -65,7 +65,7 @@ Test(read_input, apply_input)
// wrong
c = get_next_command();
res = apply_input(m, c);
cr_assert_eq(res, 0);
cr_assert_eq(res, -1);
cr_assert_eq(m->player_x, 2);
cr_assert_eq(m->player_y, 4);
free_command(c);
......@@ -101,11 +101,11 @@ Test(read_input, handle_problems, .exit_code = 2)
command *c = get_next_command();
res = apply_input(m, c);
cr_expect(res == 0, "unknown command");
cr_expect(res == -1, "unknown command");
free_command(c);
c = get_next_command();
res = apply_input(m, c);
cr_expect(res == 0, "empty command");
cr_expect(res == -1, "empty command");
free_command(c);
// Next one should make read fail with unavailable resource
fclose(f_stdin);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment