Skip to content

Commit

Permalink
ADD: last parsing test
Browse files Browse the repository at this point in the history
  • Loading branch information
Joan-Cordelier committed Apr 9, 2024
1 parent 2d843f0 commit 836639d
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 2 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ SRC = ./src/graph/add.c \
./src/put/my_putchar.c \
./src/put/my_putstr.c \
./src/put/my_show_word_array.c \
./src/str/is_in_str.c \
./src/str/my_str_to_word_array.c \
./src/str/my_strcmp.c \
./src/str/my_strcpy.c \
Expand Down
4 changes: 3 additions & 1 deletion include/my.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ char *my_strcpy(char *dest, char *src);
char *my_strncpy(char *dest, char *src, int i);
char *my_strdup(char *src);
char *my_strsub(char *str, char c);
char *rm_tag_str(char *str);
int is_in_str(char *str, char c);
int my_strcmp(char *str1, char *str2);
int my_strlen(char *str);
int tab_len(char **tab);
char *rm_tag_str(char *str);

//Free
void free_tab(char **tab);
Expand Down
10 changes: 10 additions & 0 deletions input
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
4
0 47 42
##start
1 13 18
2 2 30
3 4 16
##end
4 28 39
4-0
4-1
2 changes: 2 additions & 0 deletions robots
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#nb_bites
3
9 changes: 9 additions & 0 deletions room
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#nb_bites
3
#bhc njsdlk
##start
0 1 0 dmage ca passe a la TA
##end
1 13 0
1 15 48
2 5 0 #je baize ton __GCC_HAVE_SYNC_COMPARE_AND_SWAP_1
2 changes: 1 addition & 1 deletion src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ static void print_output(void *data)
mini_printf("#number_of_robots\n%s\n", (temp)->str);
(temp) = (temp)->next;
mini_printf("#rooms\n");
while ((temp)->str[1] != '-') {
while ((temp) != NULL && is_in_str((temp)->str, '-') == 0) {
mini_printf("%s\n", (temp)->str);
(temp) = (temp)->next;
}
Expand Down
17 changes: 17 additions & 0 deletions src/str/is_in_str.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
** EPITECH PROJECT, 2023
** A-Maze-d
** File description:
** is_in_str.c
*/

#include "my.h"

int is_in_str(char *str, char c)
{
for (int i = 0; str[i] != '\0'; i++) {
if (str[i] == c)
return 1;
}
return 0;
}
10 changes: 10 additions & 0 deletions tunel
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
3
##start
0 1 0
##end
1 13 0
1 15 48
2 5 0
3 9 0
0-2
2-3

0 comments on commit 836639d

Please sign in to comment.