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
48
libft_personal/tests/ft_map/tests_map_destroy.c
Normal file
48
libft_personal/tests/ft_map/tests_map_destroy.c
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* tests_map_destroy.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: bgoulard <bgoulard@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2024/05/19 18:08:04 by bgoulard #+# #+# */
|
||||
/* Updated: 2024/06/01 12:07:40 by bgoulard ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "ft_map.h"
|
||||
#include "ft_string.h"
|
||||
#include "ft_map_types.h"
|
||||
#include <stdlib.h>
|
||||
|
||||
// check valgrind for no memory leak
|
||||
int test_map_destroy(void)
|
||||
{
|
||||
t_map *map;
|
||||
|
||||
map = ft_map_create(10);
|
||||
ft_map_destroy(map);
|
||||
return (0);
|
||||
}
|
||||
|
||||
// accessing to key[0] and value[0] after the call to check
|
||||
// that no free occured on the data at first call
|
||||
int test_map_destroy_free(void)
|
||||
{
|
||||
t_map *map;
|
||||
char *key;
|
||||
char *value;
|
||||
|
||||
key = ft_strdup("keys");
|
||||
value = ft_strdup("values");
|
||||
map = ft_map_create(10);
|
||||
ft_map_set(map, key, value, ft_strlen(key));
|
||||
ft_map_destroy_free(map, NULL);
|
||||
key[0] = 'k';
|
||||
value[0] = 'v';
|
||||
map = ft_map_create(15);
|
||||
ft_map_set(map, key, value, ft_strlen(key));
|
||||
ft_map_destroy_free(map, free);
|
||||
free(key);
|
||||
return (0);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue