39 lines
1.3 KiB
C
39 lines
1.3 KiB
C
/* ************************************************************************** */
|
|
/* */
|
|
/* ::: :::::::: */
|
|
/* tests_vec_clear.c :+: :+: :+: */
|
|
/* +:+ +:+ +:+ */
|
|
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
|
|
/* +#+#+#+#+#+ +#+ */
|
|
/* Created: 2024/05/24 11:21:55 by bgoulard #+# #+# */
|
|
/* Updated: 2024/05/24 21:05:10 by bgoulard ### ########.fr */
|
|
/* */
|
|
/* ************************************************************************** */
|
|
|
|
#include "ft_vector.h"
|
|
#include "ft_vector_types.h"
|
|
|
|
int test_vec_clear(void)
|
|
{
|
|
t_vector *vec;
|
|
int a;
|
|
int b;
|
|
int c;
|
|
|
|
a = 0;
|
|
b = 1;
|
|
c = 2;
|
|
vec = ft_vec_new();
|
|
ft_vec_add(&vec, &a);
|
|
ft_vec_add(&vec, &b);
|
|
ft_vec_add(&vec, &c);
|
|
ft_vec_clear(vec);
|
|
if (vec->count != 0)
|
|
return (1);
|
|
else if (vec->cappacity == 0)
|
|
return (1);
|
|
else if (vec->datas[0])
|
|
return (1);
|
|
ft_vec_destroy(&vec);
|
|
return (0);
|
|
}
|