- Clone this repository to the root directory of your libft repository.
- Run the make command inside this repository.
$ cd /path/to/your/libft/directory
$ git clone https://github.com/usatie/libft-tester-tokyo.git
$ cd libft-tester-tokyo
- If you would like to clone this repository to somewhere else, you can. In that case, please run the make command like this.
$ make LIBFT_DIR=/path/to/your/libft/dir
$ make all
If you want to test Libft-00 ~ Libft-02, please use below. (Please change part number 00
to same as your project.)
$ make libft-00
$ make bonus
$ make strlen
$ make atoi
$ make strnstr
If you want to test functions when trying to Libft-00 ~ Libft-02, please type with suffix .re
like below.
$ make strlen.re
$ make atoi.re
$ make strnstr.re
$ make norm
If you want to run norm check for Libft-00 ~ Libft-02, please use below. (Please change part number 00
to same as your project.)
$ make norm00
Thanks for trying it out! If you notice anything or want to add some test cases, feel free to send issues/PRs!
ASSERT_EQ
functions are very easy to use.
Basically the first argument is the actual value and the second argument is the expected value.
for creating unit tests
int main(void)
{
ASSERT_EQ_I(ft_atoi("123"), 123);
ASSERT_EQ_I(ft_atoi("-42"), -42);
ASSERT_EQ_STR(ft_itoa(123), "123");
ASSERT_EQ_STR(ft_itoa(-42), "-42");
int len = 10;
char *actual = ft_calloc(len, sizeof(char));
char *expected = calloc(len, sizeof(char));
ASSERT_EQ_MEM(actual, expected, len);
}
This project is inspired by these projects, and many cases are imported from them too. Thanks a lot!