Skip to content
This repository has been archived by the owner on Sep 12, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3 from malatinipro/addTest
Browse files Browse the repository at this point in the history
add tests
  • Loading branch information
mahautlatinis authored Oct 7, 2023
2 parents 274e055 + 9888c33 commit 5e6515e
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 22 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/c-cpp-macos-compilation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: macOS C/C++ compilation CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: macos-latest

steps:
- uses: actions/checkout@v3
- name: make
run: cd ./minitalk; make
17 changes: 17 additions & 0 deletions .github/workflows/c-cpp-ubuntu-compilation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Ubuntu C/C++ compilation CI

on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: make
run: cd ./minitalk; make
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*.*o
*/*server
*/*client
.vscode
2 changes: 1 addition & 1 deletion minitalk/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# By: mahautlatinis <mahautlatinis@student.42 +#+ +:+ +#+ #
# +#+#+#+#+#+ +#+ #
# Created: 2021/06/14 19:28:43 by malatini #+# #+# #
# Updated: 2023/09/28 18:59:38 by mahautlatin ### ########.fr #
# Updated: 2023/10/07 20:08:27 by mahautlatin ### ########.fr #
# #
# **************************************************************************** #

Expand Down
5 changes: 3 additions & 2 deletions minitalk/bonus/client_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,18 @@
/* ::: :::::::: */
/* client_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: malatini <marvin@42.fr> +#+ +:+ +#+ */
/* By: mahautlatinis <mahautlatinis@student.42 +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/06/16 16:07:06 by malatini #+# #+# */
/* Updated: 2021/06/16 16:07:09 by malatini ### ########.fr */
/* Updated: 2023/10/07 20:21:32 by mahautlatin ### ########.fr */
/* */
/* ************************************************************************** */

#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include "../minitalk.h"

int ft_isdigit(int c)
{
Expand Down
9 changes: 4 additions & 5 deletions minitalk/bonus/server_bonus.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
/* ::: :::::::: */
/* server_bonus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: malatini <marvin@42.fr> +#+ +:+ +#+ */
/* By: mahautlatinis <mahautlatinis@student.42 +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/06/16 16:06:51 by malatini #+# #+# */
/* Updated: 2021/06/16 16:06:53 by malatini ### ########.fr */
/* Updated: 2023/10/07 20:20:56 by mahautlatin ### ########.fr */
/* */
/* ************************************************************************** */

#include <unistd.h>
#include <stdio.h>
#include <signal.h>
#include <stdlib.h>
#include "../minitalk.h"

/* On fait un ft_putnbr pour afficher le pid */
void ft_putchar(char c)
{
write(1, &c, 1);
Expand Down Expand Up @@ -71,7 +71,6 @@ void translate_message_32(int num)
}
}

/* Je vais pouvoir afficher le caractère une fois les 8 bits transmis */
int main(int argc, char **argv)
{
pid_t pid;
Expand All @@ -86,7 +85,7 @@ int main(int argc, char **argv)
signal(SIGUSR1, translate_message_32);
signal(SIGUSR2, translate_message_32);
while (42)
pause();
;
}
return (0);
}
4 changes: 2 additions & 2 deletions minitalk/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: mahautlatinis <mahautlatinis@student.42 +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/06/14 19:53:59 by malatini #+# #+# */
/* Updated: 2023/09/28 19:29:56 by mahautlatin ### ########.fr */
/* Updated: 2023/10/07 20:20:48 by mahautlatin ### ########.fr */
/* */
/* ************************************************************************** */

Expand Down Expand Up @@ -84,7 +84,7 @@ int main(int argc, char **argv)
}
else if (argc == 2)
{
write(2, "Error.\nYou did not inputed a string.\n", 39);
write(2, "Error.\nYou did not inputed a string.\n", 38);
exit (EXIT_FAILURE);
}
}
Expand Down
4 changes: 2 additions & 2 deletions minitalk/minitalk.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
/* By: mahautlatinis <mahautlatinis@student.42 +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/06/16 15:46:39 by malatini #+# #+# */
/* Updated: 2023/09/28 19:29:56 by mahautlatin ### ########.fr */
/* Updated: 2023/10/07 20:18:23 by mahautlatin ### ########.fr */
/* */
/* ************************************************************************** */

Expand All @@ -26,4 +26,4 @@ int ft_isdigit(int c);
int ft_atoi(const char *str);
void send_char_as_signals_signals(char c, int pid);

#endif
#endif
17 changes: 7 additions & 10 deletions minitalk/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@
/* By: mahautlatinis <mahautlatinis@student.42 +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/06/14 19:55:37 by malatini #+# #+# */
/* Updated: 2023/09/28 19:31:47 by mahautlatin ### ########.fr */
/* Updated: 2023/10/07 20:20:46 by mahautlatin ### ########.fr */
/* */
/* ************************************************************************** */

#include "./minitalk.h"

/* On fait un ft_putnbr pour afficher le pid */
void ft_putchar(char c)
{
write(1, &c, 1);
}

void ft_putstr(char *str)
{
int i;
Expand Down Expand Up @@ -47,7 +41,11 @@ void ft_putnbr(int nb)
ft_putchar(nb % 10 + '0');
}

/* Traduction des différents bits envoyés pour reconstruire le char */
void ft_putchar(char c)
{
write(1, &c, 1);
}

void decrypt_message(int signalValue)
{
static int power = 0;
Expand All @@ -64,7 +62,6 @@ void decrypt_message(int signalValue)
}
}

/* Je vais pouvoir afficher le caractère une fois les 8 bits transmis */
int main(int argc, char **argv)
{
pid_t pid;
Expand All @@ -79,7 +76,7 @@ int main(int argc, char **argv)
signal(SIGUSR1, decrypt_message);
signal(SIGUSR2, decrypt_message);
while (42)
pause();
;
}
return (0);
}

0 comments on commit 5e6515e

Please sign in to comment.