removing the libft of rparodi
This commit is contained in:
parent
0391323626
commit
be6038dcc8
523 changed files with 724 additions and 3336 deletions
37
libft/tests/ft_optional/tests_optional_unwrap.c
Normal file
37
libft/tests/ft_optional/tests_optional_unwrap.c
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* tests_optional_unwrap.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/23 22:32:05 by bgoulard #+# #+# */
|
||||
/* Updated: 2024/06/25 22:30:19 by bgoulard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_optional.h"
|
||||
#include "ft_optional_types.h"
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
||||
int test_optional_unwrap(void)
|
||||
{
|
||||
t_optional opt;
|
||||
int *ptr;
|
||||
|
||||
opt.pres = OPT_SOME;
|
||||
ptr = malloc(sizeof(int));
|
||||
*ptr = 42;
|
||||
opt.val = ptr;
|
||||
if (ft_optional_unwrap(opt) != ptr)
|
||||
return (1);
|
||||
free(ptr);
|
||||
opt.pres = OPT_NONE;
|
||||
opt.val = (void *)0xDEADBEEF;
|
||||
if (ft_optional_unwrap(opt) != NULL)
|
||||
return (2);
|
||||
return (0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue