mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
tests: add testutils
This commit is contained in:
parent
5b00059526
commit
18a2835a7c
3 changed files with 43 additions and 1 deletions
|
|
@ -4,7 +4,7 @@ rawtests = \
|
|||
|
||||
tests = $(addprefix test_,$(rawtests))
|
||||
test_objs = $(addsuffix .o,$(tests))
|
||||
objs := $(addprefix ../,$(objs))
|
||||
objs := $(addprefix ../,$(objs)) testutil.o
|
||||
all_objs = $(objs) $(test_objs)
|
||||
deps = $(all_objs:.o=.d)
|
||||
LDLIBS = \
|
||||
|
|
|
|||
24
tests/testutil.c
Normal file
24
tests/testutil.c
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* testutil.c :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 15:21:09 by khais #+# #+# */
|
||||
/* Updated: 2025/02/13 15:57:00 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#include "libft.h"
|
||||
#include <assert.h>
|
||||
|
||||
void assert_strequal(char *str1, char *str2)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = ft_strcmp(str1, str2);
|
||||
if (ret != 0)
|
||||
ft_dprintf(STDERR_FILENO, "Expected '%s' to eq '%s'\n", str1, str2);
|
||||
assert(ret == 0);
|
||||
}
|
||||
18
tests/testutil.h
Normal file
18
tests/testutil.h
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/* ************************************************************************** */
|
||||
/* */
|
||||
/* ::: :::::::: */
|
||||
/* testutil.h :+: :+: :+: */
|
||||
/* +:+ +:+ +:+ */
|
||||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/02/13 15:57:21 by khais #+# #+# */
|
||||
/* Updated: 2025/02/13 15:57:44 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
#ifndef TESTUTIL_H
|
||||
# define TESTUTIL_H
|
||||
|
||||
void assert_strequal(char *str1, char *str2);
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue