added bgoulard lib + made lib sources in their own directory in build/ for readability
This commit is contained in:
parent
83cc8419a0
commit
0a390934d6
457 changed files with 21807 additions and 61 deletions
35
libft_personal/tests/ft_optional/tests_optional_from_val.c
Normal file
35
libft_personal/tests/ft_optional/tests_optional_from_val.c
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* test_optional_from_val.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/23 22:30:45 by bgoulard #+# #+# */
|
||||
/* Updated: 2024/05/23 22:32:41 by bgoulard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_optional.h"
|
||||
#include "ft_optional_types.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
int test_optional_from_val(void)
|
||||
{
|
||||
int *ptr;
|
||||
t_optional *opt;
|
||||
|
||||
ptr = malloc(sizeof(int));
|
||||
*ptr = 42;
|
||||
opt = ft_optional_from_val(ptr);
|
||||
if (!opt)
|
||||
return (1);
|
||||
if (opt->pres != OPT_SOME)
|
||||
return (2);
|
||||
if (opt->val != ptr)
|
||||
return (3);
|
||||
opt->pres = OPT_NONE;
|
||||
ft_optional_destroy(opt);
|
||||
free(ptr);
|
||||
return (0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue