From ac0559db82bfef3b7ca3d976b1d7700ed2c1c1fc Mon Sep 17 00:00:00 2001 From: Charles Date: Fri, 31 Jan 2020 10:44:30 +0100 Subject: hash table unit testing, norming --- include/libft_ctype.h | 10 ++++----- include/libft_ht.h | 60 ++++++++++++++++++++++++++++++-------------------- include/libft_io.h | 17 +++++++++++--- include/libft_lst.h | 11 +++++++++ include/libft_mem.h | 15 +++++++++++-- include/libft_printf.h | 15 +++++++++++-- include/libft_str.h | 15 +++++++++++-- include/libft_types.h | 15 +++++++++++-- 8 files changed, 118 insertions(+), 40 deletions(-) (limited to 'include') diff --git a/include/libft_ctype.h b/include/libft_ctype.h index 44e88b8..85e0e05 100644 --- a/include/libft_ctype.h +++ b/include/libft_ctype.h @@ -1,17 +1,17 @@ /* ************************************************************************** */ /* */ /* ::: :::::::: */ -/* ft_ctype.h :+: :+: :+: */ +/* libft_ctype.h :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: cacharle +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ -/* Created: 2020/01/17 09:59:10 by cacharle #+# #+# */ -/* Updated: 2020/01/17 10:00:13 by cacharle ### ########.fr */ +/* Created: 2020/01/31 10:35:31 by cacharle #+# #+# */ +/* Updated: 2020/01/31 10:36:34 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ -#ifndef FT_CTYPE_H -# define FT_CTYPE_H +#ifndef LIBFT_CTYPE_H +# define LIBFT_CTYPE_H /* ** assertion diff --git a/include/libft_ht.h b/include/libft_ht.h index 8dff87a..8551ddb 100644 --- a/include/libft_ht.h +++ b/include/libft_ht.h @@ -1,44 +1,56 @@ - -#ifndef LIBFT_HT -# define LIBFT_HT +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft_ht.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/01/31 10:36:09 by cacharle #+# #+# */ +/* Updated: 2020/01/31 10:41:24 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef LIBFT_HT_H +# define LIBFT_HT_H # include "libft.h" # include "libft_lst.h" -typedef struct +typedef struct s_ftht_content { - char *key; - void *value; -} t_ftht_content; + char *key; + void *value; +} t_ftht_content; typedef t_ftlst* t_ftht_entry; -typedef struct +typedef struct s_ftht { - t_ftsize size; - t_ftht_entry *entries; -} t_ftht; + t_ftsize size; + t_ftht_entry *entries; +} t_ftht; typedef t_ftuint t_ftht_digest; +t_ftht_digest ft_hthash(t_ftht *ht, char *key); -t_ftht_digest ft_hthash(t_ftht *ht, char *key); - -t_ftht *ft_htnew(t_ftsize size); -void ft_htdestroy(t_ftht *ht, void (*del)(t_ftht_content*)); -void ft_htdestroy_all(t_ftht *ht); -void ft_htdestroy_key(t_ftht *ht); -t_ftht_content *ft_htget(t_ftht *ht, char *key); -t_ftht_content *ft_htset(t_ftht *ht, char *key, void *value); -void ft_htdelone(t_ftht *ht, char *key, void (*del)(t_ftht_content*)); -void ft_htdelone_key(t_ftht *ht, char *key); -t_ftht_content *ft_htcontent_new(char *key, void *value); +t_ftht *ft_htnew(t_ftsize size); +void ft_htdestroy(t_ftht *ht, void (*del)(t_ftht_content*)); +void ft_htdestroy_all(t_ftht *ht); +void ft_htdestroy_key(t_ftht *ht); +t_ftht_content *ft_htget(t_ftht *ht, char *key); +t_ftht_content *ft_htset(t_ftht *ht, char *key, void *value); +void ft_htdelone(t_ftht *ht, char *key, + void (*del)(t_ftht_content*)); +void ft_htdelone_key(t_ftht *ht, char *key); +t_ftht_content *ft_htcontent_new(char *key, void *value); /* ** internals */ -void ft_inter_htdelcontent_key(t_ftht_content *content); -t_ftbool ft_inter_htkey_equal(char *ref_key, t_ftht_content *content); +void ft_inter_htdelcontent_key(t_ftht_content *content); +t_ftbool ft_inter_htkey_equal(char *ref_key, + t_ftht_content *content); #endif diff --git a/include/libft_io.h b/include/libft_io.h index 75dda57..e1a2536 100644 --- a/include/libft_io.h +++ b/include/libft_io.h @@ -1,6 +1,17 @@ - -#ifndef FT_IO_H -# define FT_IO_H +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft_io.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/01/31 10:35:43 by cacharle #+# #+# */ +/* Updated: 2020/01/31 10:35:48 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#ifndef LIBFT_IO_H +# define LIBFT_IO_H # include # include diff --git a/include/libft_lst.h b/include/libft_lst.h index b9475f9..2a420c4 100644 --- a/include/libft_lst.h +++ b/include/libft_lst.h @@ -1,3 +1,14 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft_lst.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/01/31 10:36:39 by cacharle #+# #+# */ +/* Updated: 2020/01/31 10:36:41 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ #ifndef LIBFT_LST_H # define LIBFT_LST_H diff --git a/include/libft_mem.h b/include/libft_mem.h index a9717b8..5465d72 100644 --- a/include/libft_mem.h +++ b/include/libft_mem.h @@ -1,6 +1,17 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft_mem.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/01/31 10:35:57 by cacharle #+# #+# */ +/* Updated: 2020/01/31 10:35:59 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ -#ifndef FT_MEM_H -# define FT_MEM_H +#ifndef LIBFT_MEM_H +# define LIBFT_MEM_H void ft_bzero(void *s, size_t n); void *ft_memset(void *s, int c, size_t n); diff --git a/include/libft_printf.h b/include/libft_printf.h index 1200478..8e64208 100644 --- a/include/libft_printf.h +++ b/include/libft_printf.h @@ -1,6 +1,17 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft_printf.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/01/31 10:36:47 by cacharle #+# #+# */ +/* Updated: 2020/01/31 10:36:51 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ -#ifndef FT_PRINTF_H -# define FT_PRINTF_H +#ifndef LIBFT_PRINTF_H +# define LIBFT_PRINTF_H int ft_printf(const char *format, ...); int ft_sprintf(char *str, const char *format, ...); diff --git a/include/libft_str.h b/include/libft_str.h index 8c4bef5..e44c995 100644 --- a/include/libft_str.h +++ b/include/libft_str.h @@ -1,6 +1,17 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft_str.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/01/31 10:39:22 by cacharle #+# #+# */ +/* Updated: 2020/01/31 10:39:26 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ -#ifndef FT_STR_H -# define FT_STR_H +#ifndef LIBFT_STR_H +# define LIBFT_STR_H /* ** std diff --git a/include/libft_types.h b/include/libft_types.h index be1cc20..8df4e00 100644 --- a/include/libft_types.h +++ b/include/libft_types.h @@ -1,6 +1,17 @@ +/* ************************************************************************** */ +/* */ +/* ::: :::::::: */ +/* libft_types.h :+: :+: :+: */ +/* +:+ +:+ +:+ */ +/* By: cacharle +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2020/01/31 10:36:56 by cacharle #+# #+# */ +/* Updated: 2020/01/31 10:37:01 by cacharle ### ########.fr */ +/* */ +/* ************************************************************************** */ -#ifndef FT_TYPES_H -# define FT_TYPES_H +#ifndef LIBFT_TYPES_H +# define LIBFT_TYPES_H # define TRUE 1 # define FALSE 0 -- cgit