Cub3D/libft/tests/ft_vector/tests_vec_shift.c
2024-11-08 19:37:30 +01:00

42 lines
1.4 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* tests_vec_shift.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/05/24 11:28:19 by bgoulard #+# #+# */
/* Updated: 2024/05/24 11:28:35 by bgoulard ### ########.fr */
/* */
/* ************************************************************************** */
#include "ft_vector.h"
#include "ft_vector_types.h"
int test_vec_shift(void)
{
t_vector *vec;
int a;
int b;
int c;
int d;
a = 42;
b = 43;
c = 44;
d = 45;
vec = ft_vec_new();
ft_vec_add(&vec, &a);
ft_vec_add(&vec, &b);
ft_vec_add(&vec, &c);
ft_vec_add(&vec, &d);
ft_vec_shift(vec, 1, 2);
if (vec->count != 2)
return (1);
else if (*(int *)ft_vec_at(vec, 0) != 42)
return (1);
else if (*(int *)ft_vec_at(vec, 1) != 45)
return (1);
ft_vec_destroy(&vec);
return (0);
}