Giter Club home page Giter Club logo

libft-unit-test's People

Contributors

0xdeafbeef avatar alelievr avatar bricewge avatar cacharle avatar fabinca avatar flevesqu42 avatar ggjulio avatar jeanbonok avatar jgigault avatar keit0728 avatar malwarepup avatar mfunyu avatar probot-auto-merge[bot] avatar reysand avatar stankudrow avatar sylvainboilard avatar xicodomingues avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libft-unit-test's Issues

strcmp test issues?

I'm not sure if this is an issue, but I noticed that the tests seem to expect ft_strcmp to exactly match the values returned by strcmp. But according to the man pages, and what I can tell from the internet, only the sign characteristics are defined, and not the actual return values of strcmp. Meaning that if s1[i] is larger than s2[i] the return should be positive, if they're equal the return should be 0, and if s1[i] is smaller than s2[i] the return should be negative. Now my function shows the correct sign behavior, but it does not equal strcmp's return values. I suppose my question is am I at fault, or is the test being unreasonable?

Could the fact that I'm using the libft-unit-test on ubuntu have an impact on anything?

strtrim test

I think that the strtrim test functions are wrong as they seem to pass only 1 arg to ft_strtrim

char *s1 = "   \t  \n\n \t\t  \n\n\nHello \t  Please\n Trim me !";
char *s2 = "Hello \t  Please\n Trim me !";
char *ret = ft_strtrim(s1);

if (!strcmp(ret, s2))
    exit(TEST_SUCCESS);
    exit(TEST_FAILED);

The weird thing is:

char *ret = ft_strtrim(s1);

while the prototype is:

char *ft_strjoin(char const *s1, char const *s2);

Memcpy no crash

Hello, I just run the libft-unit-test and the test say me that there is an error in ft_memcpy because is doesn't crash when both pointer are null and size at 0.
I was first thinking that was weird that a function who do not crash can be seen as an error but then I think that surely the original memcpy behave that manner... but no.
Literaly try the two functions in one main with the parameters you set in the test (I check the source) but the original function do not crash.

outputs inverses dans le result.log pour ft_strsplit

ft_strsplit:   [OK] [OK] [OK] [FAILED] [OK] [OK] [FAILED] [CRASH] [FAILED] {not protected}
[fail]: your strsplit does not work with one word
Test code:
char *s = "olol                     ";
char **result = ft_strsplit(s, ' ');

split_cmp_array(expected, result);

Diffs:
strsplit: ||
ft_strsplit: |olol|

L'erreur est vraiment mineure. Après test, mon programme est celui qui a sorti '||' et strsplit a sorti '|olol|'.
Autrement, dans la diff les outputs sont inversés. On aurait du avoir :

Diffs:
strsplit: |olol|
ft_strsplit: ||

ft_strnstr len = 0 test missing

When testing ft_strnstr, len = 0, needle = "", the function should return a pointer to the haystack but this test doesnt check that.

strsplit

I believe there is an issue on the strsplit test. this is the report of the result.log file :

ft_strsplit:   [FAILED] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] {protected}
[fail]: your strsplit does not work with basic input
Test code:
        char *string = "      split       this for   me  !       ";
        char *expected = ((char[6]){"split", "this", "for", "me", "!", ((void *)0)});
        char **result = ft_strsplit(string, ' ');

        split_cmp_array(expected, result);

Diffs:
    strsplit: |p^Bàà°^?|
ft_strsplit: |split|

it seems that my ft_strsplit works well by printing out the result "split" but your output looks weird "p^Bàà°^?", or am i wrong ?

EDIT : on my computer with linux mint it did this weird result, but on Mac everything's ok

ft_putchar

it is not possible to print unicode with function putchar

ft_memcmp has four tests which are expecting wrong results.

ft_memcmp: [OK] [OK] [OK] [FAILED] [FAILED] [FAILED] [FAILED] [OK] [OK] [OK]
[fail]: your memcmp does not work with basic input
[fail]: your memcmp does not cast the memory in unsigned char
[fail]: your memcmp stop at
[fail]: your memcmp does not work with basic input

According to 'man memcmp', those four test above should not expect -1 or 1 but difference between the first two differing bytes.

RETURN VALUES
     The memcmp() function returns zero if the two strings are identical, otherwise returns the difference between the first
     two differing bytes (treated as unsigned char values, so that `\200' is greater than `\0', for example).  Zero-length
     strings are always identical.  This behavior is not required by C and portable code should only depend on the sign of the
     returned value.

relocation R_X86_64_32 against `.rodata'

Hello,

I have try to compile this on my Linux :

➜ libft-unit-test git:(master) ✗ uname -a
Linux reya 4.4.0-51-generic #72-Ubuntu SMP Thu Nov 24 18:29:54 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux

and i have this error :
➤ clang -shared -fPIC assets/tmp/ft_atoi.o assets/tmp/ft_bubble_sort_char.o assets/tmp/ft_bubble_sort_char_reverse.o assets/tmp/get_next_line.o [...] -o libft.so

/usr/bin/ld: assets/tmp/ft_mini_tabi.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC

assets/tmp/ft_mini_tabi.o: error adding symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:145: recipe for target 'libft.so' failed
make: *** [libft.so] Error 1

but in your Makefile :

CFLAGS = -Werror -Wall -Wextra# -ggdb# -fsanitize=address
CSOFLAGS = -shared -fPIC
CSOFLAGS2 =
CC = clang

any idea what happen ?

atof test

Tu compare le résultat à l'original, mais par définition, le NaN n'est égal à rien, même pas à lui-même, donc le test semble impossible par conception.

(nan == nan) -> false
isnan(nan) -> true

Des bisous et merci pour tout !

ft_memmove: check malloc

le test authorise malloc/free dans ft_memmove alors que la fonction ne devrais pas en contenir, je me demandais si cela etait voulu ou s'il s'agissait d'un oubli :)

Bug with ft_strrchr

Le test ne valide pas la fonction environ une fois sur deux en me précisant "[crash]: your strrchr crash cause it read too many bytes or attempt to write on s !", mais pourtant quand je relance quelques fois ca passe. Cette fonction passes tout les autres tests (42 FC, Maintest, Libftest, Moulitest).

voici le code concerné :

#include "libft.h"

char *ft_strrchr(const char *s, int c)
{
size_t i;
char *str;

 str = (char *)s;
 i = ft_strlen(s);
 if ((char)c == '\0')
      return (&str[i]);
 while (str[i] >= 0)
  {
       if (str[i] == (char)c)
           return (&str[i]);
        i--;
    }
     return (0);

}

ft_lstdelone() test should be updated !!

The tester is working on the old ft_lstdelone() function which has the prototype [ void ft_lstdelone(t_list **alst, void (*del)(void*, size_t)); ] , while the new subject has a function ft_lstdelone() which has the prototype [void ft_lstdelone(t_list *lst, void (*del)(void*));] and also the description is changed ! the old function was deleting the content and the node, while the new one deletes just the content ! Please change the test to test just the node's content if it is NULL or not !
Thanks in advance !

le test requier un crash sur ft_lstiter

salut,
la fonction ft_lstiter a besoin d un crash dans le test alors que par nature la fonction ne crash pas:

void ft_lstiter(t_list _lst, void (_f)(t_list *elem))
{
t_list *x;

if (!lst)
    ft_crash();
x = lst;
while (x)
{
    f(x);
    x = x->next;
}

}

j ai donc du faire une fonction ft_crash pour faire segfault le programe et passer le test, un peu bizard non ?
gerer un simple return NULL ne serais il pas une meilleur solution ?

snicolet

relocation R_X86_64_PC32 against symbol `ft_isspace'

Hi, when trying to test my library, I got the error on the title. Here is the full ouput of make f

➤  clang -shared -fPIC assets/tmp/ft_atoi.o assets/tmp/ft_bzero.o assets/tmp/ft_debugn.o assets/tmp/ft_debug.o assets/tmp/ft_isalnum.o assets/tmp/ft_isalpha.o assets/tmp/ft_isascii.o assets/tmp/ft_isdigit.o assets/tmp/ft_islower.o assets/tmp/ft_isprint.o assets/tmp/ft_isspace.o assets/tmp/ft_isupper.o assets/tmp/ft_itoa.o assets/tmp/ft_lstadd.o assets/tmp/ft_lstcmp.o assets/tmp/ft_lstdel.o assets/tmp/ft_lstdelone.o assets/tmp/ft_lstequ.o assets/tmp/ft_lstfoldl.o assets/tmp/ft_lstindex.o assets/tmp/ft_lstiter.o assets/tmp/ft_lstmap.o assets/tmp/ft_lstnew.o assets/tmp/ft_lstrange.o assets/tmp/ft_lstsize.o assets/tmp/ft_lsttail.o assets/tmp/ft_max.o assets/tmp/ft_memalloc.o assets/tmp/ft_memccpy.o assets/tmp/ft_memchr.o assets/tmp/ft_memcmp.o assets/tmp/ft_memcpy.o assets/tmp/ft_memdel.o assets/tmp/ft_memmove.o assets/tmp/ft_memoffset.o assets/tmp/ft_memset.o assets/tmp/ft_pow.o assets/tmp/ft_putchar_fd.o assets/tmp/ft_putchar.o assets/tmp/ft_putendl_fd.o assets/tmp/ft_putendl.o assets/tmp/ft_putintlst.o assets/tmp/ft_putnbr_fd.o assets/tmp/ft_putnbr.o assets/tmp/ft_putstr_fd.o assets/tmp/ft_putstr.o assets/tmp/ft_strcat.o assets/tmp/ft_strchr.o assets/tmp/ft_strclr.o assets/tmp/ft_strcmp.o assets/tmp/ft_strcpy.o assets/tmp/ft_strdel.o assets/tmp/ft_strdup.o assets/tmp/ft_strend.o assets/tmp/ft_strequ.o assets/tmp/ft_strfind.o assets/tmp/ft_striteri.o assets/tmp/ft_striter.o assets/tmp/ft_strjoin.o assets/tmp/ft_strlcat.o assets/tmp/ft_strlen.o assets/tmp/ft_strmapi.o assets/tmp/ft_strmap.o assets/tmp/ft_strncat.o assets/tmp/ft_strncmp.o assets/tmp/ft_strncpy.o assets/tmp/ft_strnequ.o assets/tmp/ft_strnew.o assets/tmp/ft_strnstr.o assets/tmp/ft_strrchr.o assets/tmp/ft_strrev.o assets/tmp/ft_strsplit.o assets/tmp/ft_strstr.o assets/tmp/ft_strsub.o assets/tmp/ft_strtrim.o assets/tmp/ft_tolower.o assets/tmp/ft_toupper.o -o libft.so
/usr/bin/ld: assets/tmp/ft_atoi.o: relocation R_X86_64_PC32 against symbol `ft_isspace' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:136: recipe for target 'shared' failed
make: *** [shared] Error 1

Any clues?

EDIT: Might be relevant.

» uname -a
Linux HAL 4.2.5-1-ARCH #1 SMP PREEMPT Tue Oct 27 08:13:28 CET 2015 x86_64 GNU/Linux
» clang --version
clang version 3.7.0 (tags/RELEASE_370/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

MAP_ANONYMOUS n'est pas déclaré

Problème quand je fait un make avec un git clone tout frais :

src/main.c:266:72: error: use of undeclared identifier 'MAP_ANONYMOUS'
if ((g_shared_mem = mmap(NULL, sizeof(t_map), PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_SHARED, -1, 0)) == MAP_FAILED)

test missing ft_strnstr

there is something that my ft_strnstr did wrong but that wasn't catch by this unit test : if the little string to find in the big string is one position ahead of the lenth sended, it should return NULL but I was returning little (at least in case little is a single character), like so :

strnstr("0123456789", "9", 8);

strnstr shouldn't find 9 because it's in ninth position and length is 8, but mine ft_strnstr was missing a >= instead of just > somewhere and it returned back 9.

'\0' dans ft_strcpy

Salut,
Il n'y a pas de tests permettant de vérifier qu'il y avait bien un '\0' à la fin de notre chaine dst.
A+

Calloc timeout

Calloc timeout at test_ft_calloc_too_big :

ft_calloc:     [OK] [OK] [OK] [OK] [OK] [TIMEOUT] Test code:
	void *d1 = ft_calloc((9223372036854775807L *2UL+1UL), sizeof(char));

	void *d2 = ft_calloc(2, 1073741829);
	void *d3 = ft_calloc(1, (9223372036854775807L *2UL+1UL));
	if (d1 || d3 || !d2)
		exit(TEST_FAILED);
	exit(TEST_SUCCESS);
void            test_ft_calloc_too_big(void *ptr) {
    typeof(calloc)  *ft_calloc = ptr;
    SET_EXPLANATION("your calloc does not work with too large numbers");

    SANDBOX_RAISE(
            void *d1 = ft_calloc(ULONG_MAX, sizeof(char));
            void *d2 = ft_calloc(2, 1073741829); // overflow the int max
            void *d3 = ft_calloc(1, ULONG_MAX);
            if (d1 || d3 || !d2)
                exit(TEST_FAILED);
            exit(TEST_SUCCESS);
            );
}

When I forked your repo Monday, and fixed calloc renaming memalloc into calloc.
There was also a timeout, but not in the same function -> test_ft_calloc_zero:


ft_calloc:     [OK] [TIMEOUT] [OK] [OK] [OK] Test code:
	size_t size = 514;
	char *cmp = malloc(size);
	int diff;

	char *ret = ft_calloc(size);
	__builtin___memset_chk (cmp, 0, size, __builtin_object_size (cmp, 0));
	if ((diff = memcmp(cmp, ret, size)))
	{
		exit(TEST_FAILED);
	}
	free(ret);
	exit(TEST_SUCCESS);

void            test_ft_calloc_zero(void *ptr) {
    void *  (*ft_calloc)(size_t) = ptr;
    SET_EXPLANATION("your calloc does not set allocated mem to 0");

    SANDBOX_RAISE(
            size_t  size = 514;
            char    *cmp = malloc(size);
            int     diff;

            MALLOC_MEMSET;
            char    *ret = ft_calloc(size);
            MALLOC_RESET;

            bzero(cmp, size);
            if ((diff = memcmp(cmp, ret, size))) {
		SET_DIFF_INT(0, diff);
                exit(TEST_FAILED);
            }
            free(ret);
            exit(TEST_SUCCESS);
            );
}

I don't undertand why.

ft_strnstr missing test?

there are some implementations of strnstr that pass all tests even though there are tests that they fail.
for instance i've found the following test to fail in some implementation but not to be treated in the unit-tests

char *big = "abcdef";
char *little = "abcdefghijklmnop"

ft_strnstr(big, little, strlen(big));

Specifically a test case in which both strings are equal up to a point but little is actually greater in length than big, though strnstr is being asked to search only the first strlen(big) characters. In this case little is not found in big, but there are some wrong implementations of ft_strncat which will return a pointer to 'a', which is wrong. The thing is that your unit tests don't seem to catch that mistake.

This is an example of an implementation of ft_strnstr that passed the unit tests in this library but doesn't actually work like the real strnstr.

#include "libft.h"

char	*ft_strnstr(const char *big, const char *little, size_t len)
{
	size_t len_little;
	size_t i;

	len_little = ft_strlen(little);
	if (len_little == '\0')
		return ((char*)big);
	if (len_little > len)
		len_little = len;
	i = 0;
	while (i <= len - len_little)
	{
		if (big[i] == little[0])
			if (!ft_strncmp(big + i, little, len_little))
				return ((char*)(big + i));
		i++;
	}
	return (NULL);
}

ft_lstdelone segmentation violation

Was testing this function:

#include "libft.h"

void ft_lstdelone(t_list **alst, void (*del)(void *, size_t))
{
	del((*alst)->content, (*alst)->content_size);
	free(*alst);
	*alst = NULL;
}

Tests crashed with this message:

ft_lstdelone:  [OK] [SIGSEGV]: segmentation violation
OMG you crashed my program, please report this bug to @alelievr !
thanks

However jtoty/Libftest works well with it.

I'm running all of this in WSL (Windows Subsystem for Linux) with Ubuntu 18.04.
Can provide more info if you need.

Bug in ft_atoi unit test

Hey!

I have found the bug in ft_atoi unit test:
result.log:
ft_atoi: [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [KO] [OK] [OK]
[KO]: your atoi does not work with over long max value
Test code:
char n[40] = "99999999999999999999999999";
int i1 = atoi(n);
int i2 = ft_atoi(n);

if (i1 == i2)
	exit(TEST_SUCCESS);
exit(TEST_KO);

Diffs:
atoi: |-1|
ft_atoi: |-469762049|

But 42checker shows that "A -> libft-unit-test (https://github.com/alelievr/libft-unit-test) All Unit Tests passed"

does not compile on linux

i'm trying to run test on this system:

$ uname -a
Linux computername 4.4.0-47-generic #68~14.04.1-Ubuntu SMP Wed Oct 26 19:42:11 UTC 2016 x86_64 x86_64 x86_64 GNU/Linu

i've have right structure of files&folders (already run tests on mac, wanted to test at home)
i've tried to make sudo chmod 777 -R for both folders
i've tried to run make re with sudo
gcc is:

$ gcc --version
gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4

clang version:

$ clang --version
Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix

but i'm getting next error (i've added -v flag to CSOFLAGS):


~/libft-unit-test$ make re
 make -j 3 re -C ../libft 
make[1]: Entering directory `/home/username/libft'
/bin/rm -f ft_bzero.o ft_isdigit.o ft_memset.o ft_strcmp.o ft_strlen.o ft_strnstr.o ft_toupper.o ft_isalnum.o ft_isprint.o ft_strcat.o ft_strcpy.o ft_strncat.o ft_strrchr.o ft_isalpha.o ft_memccpy.o ft_strchr.o ft_strdup.o ft_strncmp.o ft_strstr.o  ft_atoi.o ft_isascii.o ft_memcpy.o ft_strclr.o ft_strlcat.o ft_strncpy.o ft_tolower.o ft_memmove.o ft_memchr.o ft_memcmp.o
gcc -Wall -Werror -Wextra -I./ -c  ft_bzero.c ft_isdigit.c ft_memset.c ft_strcmp.c ft_strlen.c ft_strnstr.c ft_toupper.c ft_isalnum.c ft_isprint.c ft_strcat.c ft_strcpy.c ft_strncat.c ft_strrchr.c ft_isalpha.c ft_memccpy.c ft_strchr.c ft_strdup.c ft_strncmp.c ft_strstr.c  ft_atoi.c ft_isascii.c ft_memcpy.c ft_strclr.c ft_strlcat.c ft_strncpy.c ft_tolower.c ft_memmove.c ft_memchr.c ft_memcmp.c
/bin/rm -f libft.a
ar rc libft.a ft_bzero.o ft_isdigit.o ft_memset.o ft_strcmp.o ft_strlen.o ft_strnstr.o ft_toupper.o ft_isalnum.o ft_isprint.o ft_strcat.o ft_strcpy.o ft_strncat.o ft_strrchr.o ft_isalpha.o ft_memccpy.o ft_strchr.o ft_strdup.o ft_strncmp.o ft_strstr.o  ft_atoi.o ft_isascii.o ft_memcpy.o ft_strclr.o ft_strlcat.o ft_strncpy.o ft_tolower.o ft_memmove.o ft_memchr.o ft_memcmp.o
ranlib libft.a 
make[1]: Leaving directory `/home/username/libft'
[  Cleaning #0  ]
➤  rm -f obj/src/main.o obj/src/test_functions.o obj/src/display_test_result.o obj/src/signal.o obj/src/sandbox.o obj/src/bench_functions.o obj/hardcore-mode/hardcore-main.o obj/hardcore-mode/error.o obj/hardcore-mode/ncurses-display.o obj/hardcore-mode/test-init.o obj/hardcore-mode/test-utils.o obj/hardcore-mode/test-strcpy.o obj/hardcore-mode/test-strcmp.o obj/hardcore-mode/test-strncmp.o obj/hardcore-mode/test-memset.o obj/hardcore-mode/test-memcpy.o obj/hardcore-mode/test-memccpy.o obj/hardcore-mode/test-memmove.o obj/hardcore-mode/test-memchr.o obj/hardcore-mode/test-memcmp.o obj/hardcore-mode/test-strlen.o obj/hardcore-mode/test-strncpy.o obj/hardcore-mode/test-strcat.o obj/hardcore-mode/test-strncat.o obj/hardcore-mode/test-strchr.o obj/hardcore-mode/test-strrchr.o obj/hardcore-mode/test-strstr.o 
➤  rm -f libft.so assets/libft.a assetslibtests assets/malloc.dylib 
➤  rm -f run_test 
 make -j 3 -C ../libft 
make[1]: Entering directory `/home/username/libft'
gcc -Wall -Werror -Wextra -I./ -c  ft_bzero.c ft_isdigit.c ft_memset.c ft_strcmp.c ft_strlen.c ft_strnstr.c ft_toupper.c ft_isalnum.c ft_isprint.c ft_strcat.c ft_strcpy.c ft_strncat.c ft_strrchr.c ft_isalpha.c ft_memccpy.c ft_strchr.c ft_strdup.c ft_strncmp.c ft_strstr.c  ft_atoi.c ft_isascii.c ft_memcpy.c ft_strclr.c ft_strlcat.c ft_strncpy.c ft_tolower.c ft_memmove.c ft_memchr.c ft_memcmp.c
ar rc libft.a ft_bzero.o ft_isdigit.o ft_memset.o ft_strcmp.o ft_strlen.o ft_strnstr.o ft_toupper.o ft_isalnum.o ft_isprint.o ft_strcat.o ft_strcpy.o ft_strncat.o ft_strrchr.o ft_isalpha.o ft_memccpy.o ft_strchr.o ft_strdup.o ft_strncmp.o ft_strstr.o  ft_atoi.o ft_isascii.o ft_memcpy.o ft_strclr.o ft_strlcat.o ft_strncpy.o ft_tolower.o ft_memmove.o ft_memchr.o ft_memcmp.o
ranlib libft.a 
make[1]: Leaving directory `/home/username/libft'
 cp ../libft/libft.a assets/ 
 clang -shared -fPIC -v assets/tmp/ft_atoi.o assets/tmp/ft_bzero.o assets/tmp/ft_isalnum.o assets/tmp/ft_isalpha.o assets/tmp/ft_isascii.o assets/tmp/ft_isdigit.o assets/tmp/ft_isprint.o assets/tmp/ft_memccpy.o assets/tmp/ft_memchr.o assets/tmp/ft_memcmp.o assets/tmp/ft_memcpy.o assets/tmp/ft_memmove.o assets/tmp/ft_memset.o assets/tmp/ft_strcat.o assets/tmp/ft_strchr.o assets/tmp/ft_strclr.o assets/tmp/ft_strcmp.o assets/tmp/ft_strcpy.o assets/tmp/ft_strdup.o assets/tmp/ft_strlcat.o assets/tmp/ft_strlen.o assets/tmp/ft_strncat.o assets/tmp/ft_strncmp.o assets/tmp/ft_strncpy.o assets/tmp/ft_strnstr.o assets/tmp/ft_strrchr.o assets/tmp/ft_strstr.o assets/tmp/ft_tolower.o assets/tmp/ft_toupper.o -o libft.so 
Ubuntu clang version 3.4-1ubuntu3 (tags/RELEASE_34/final) (based on LLVM 3.4)
Target: x86_64-pc-linux-gnu
Thread model: posix
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.3
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8
 "/usr/bin/ld" -z relro --hash-style=gnu --build-id --eh-frame-hdr -m elf_x86_64 -shared -o libft.so /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crti.o /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/crtbeginS.o -L/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8 -L/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu -L/lib/x86_64-linux-gnu -L/lib/../lib64 -L/usr/lib/x86_64-linux-gnu -L/usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../.. -L/lib -L/usr/lib assets/tmp/ft_atoi.o assets/tmp/ft_bzero.o assets/tmp/ft_isalnum.o assets/tmp/ft_isalpha.o assets/tmp/ft_isascii.o assets/tmp/ft_isdigit.o assets/tmp/ft_isprint.o assets/tmp/ft_memccpy.o assets/tmp/ft_memchr.o assets/tmp/ft_memcmp.o assets/tmp/ft_memcpy.o assets/tmp/ft_memmove.o assets/tmp/ft_memset.o assets/tmp/ft_strcat.o assets/tmp/ft_strchr.o assets/tmp/ft_strclr.o assets/tmp/ft_strcmp.o assets/tmp/ft_strcpy.o assets/tmp/ft_strdup.o assets/tmp/ft_strlcat.o assets/tmp/ft_strlen.o assets/tmp/ft_strncat.o assets/tmp/ft_strncmp.o assets/tmp/ft_strncpy.o assets/tmp/ft_strnstr.o assets/tmp/ft_strrchr.o assets/tmp/ft_strstr.o assets/tmp/ft_tolower.o assets/tmp/ft_toupper.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/crtendS.o /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/crtn.o
/usr/bin/ld: assets/tmp/ft_isalnum.o: relocation R_X86_64_PC32 against symbol `ft_isalpha' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libft.so] Error 1

Atoi does not work with over long min value

In all tests, including direct placement of Vals in the original function and in my function, the result is the same, but in your test it failed. This behavior started last night.

Error on isalnum / toupper / tolower

Trace result.log :

ft_isalnum: [FAILED]
[fail]: your isalnum just doesn't work, REALLY ?!
Test code:
int i;

    i = -1;
    while (i < 530)
    {
            if (!!ft_isalnum(i) != !!((*__ctype_b_loc ())[(int) ((i))] & (unsigned shortint) _ISalnum))
                    exit(TEST_FAILED);
            i++;
    }
    exit(TEST_SUCCESS);

Diffs:

ft_isascii: [OK]
ft_isprint: [OK]
ft_toupper: [FAILED]
[fail]: your toupper just doesn't work, REALLY ?!
Test code:
int i;

    i = -100;
    while (i < 530)
    {
            if (ft_toupper(i) != (__extension__ ({ int __res; if (sizeof (i) > 1) { if (__builtin_constant_p (i)) { int __c = (i); __res = __c < -128 || __c > 255 ? __c : (*__ctype_toupper_loc ())[__c]; } else __res = toupper (i); } else __res = (*__ctype_toupper_loc ())[(int) (i)]; __res; })))
            {
                            ;
                    exit(TEST_FAILED);
            }
            i++;
    }
    exit(TEST_SUCCESS);

Diffs:
toupper: |156|
ft_toupper: |-100|
param: (-100)

ft_tolower: [FAILED]
[fail]: your tolower just doesn't work, REALLY ?!
Test code:
int i;

    i = -100;
    while (i < 530)
    {
            if (ft_tolower(i) != (__extension__ ({ int __res; if (sizeof (i) > 1) { if (__builtin_constant_p (i)) { int __c = (i); __res = __c < -128 || __c > 255 ? __c : (*__ctype_tolower_loc ())[__c]; } else __res = tolower (i); } else __res = (*__ctype_tolower_loc ())[(int) (i)]; __res; })))
            {
                            ;
                    exit(TEST_FAILED);
            }
            i++;
    }
    exit(TEST_SUCCESS);

Diffs:
tolower: |156|
ft_tolower: |-68|
param: (-100)

Mais pourtant, mon code est sure :

par exemple : fonction tolower

int ft_tolower(int c)
{
return ((c >= 'A' && c <= 'Z') ? (c) : (c + 32));
}

C'est possible de vérifier et confirmer si l'erreur est normale ?

Merci.
Cordialement.

Bug quand on lance le check si un fichier est ouvert avec vim

Bonjour, si on lance le checking, la partie "A" bug si un fichier est ouvert ca dit que ca n'a pas pu compiler, si on ferme vim et le fichier ca ne bug plus.
J'en conclu que le fichier .swp doit avoir un impact. ca vient ptet de mon Makefile mais je vous invite a tester de votre coté au cas ou :)

Possible bug?

ft_strnstr: [OK] [OK] [FAILED] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK]
[fail]: your strnstr does not work with basic input
Test code:
char *s1 = "MZIRIBMZIRIBMZE123";
char *s2 = "MZIRIBMZE";
size_t max = strlen(s2);
char *i1 = strnstr(s1, s2, max);
char *i2 = ft_strnstr(s1, s2, max);

if (i1 == i2)
	exit(TEST_SUCCESS);
exit(TEST_FAILED);

Diffs:
strnstr: |(null)|
ft_strnstr: |MZIRIBMZE123|

test missing on ft_strrchr.c

my ft_strrchr succeed all your tests but it's actually wrong, it doesn't check the str[0] character, so I think you'r missing a test, something for this situation : ft_strrchr("abbbbbbbb", 'a'); which should render "abbbbbbbb" (and not NULL like mine do...)

make error

make: Entering directory '/home/john/github/42FileChecker/libft-unit-test'
\033[38;5;46m make re -C /home/john/github/terence_libft \033[31m
make[1]: Entering directory '/home/john/github/terence_libft'
rm -f ft*.o
rm -f libft.a
gcc -c -Wall -Wextra -Werror ft*.c
ar rc libft.a ft*.o
ranlib libft.a
make[1]: Leaving directory '/home/john/github/terence_libft'
\033[38;5;196;m[ Cleaning #0 ]\033[0m
\033[38;5;196mM-bM-^-$ \033[38;5;9m rm -f obj/src/main.o obj/src/test_functions.o obj/src/display_test_result.o obj/src/signal.o obj/src/sandbox.o obj/src/bench_functions.o obj/src/additional_functions.o obj/hardcore-mode/hardcore-main.o obj/hardcore-mode/error.o obj/hardcore-mode/ncurses-display.o obj/hardcore-mode/test-init.o obj/hardcore-mode/test-utils.o obj/hardcore-mode/test-strcpy.o obj/hardcore-mode/test-strcmp.o obj/hardcore-mode/test-strncmp.o obj/hardcore-mode/test-memset.o obj/hardcore-mode/test-memcpy.o obj/hardcore-mode/test-memccpy.o obj/hardcore-mode/test-memmove.o obj/hardcore-mode/test-memchr.o obj/hardcore-mode/test-memcmp.o obj/hardcore-mode/test-strlen.o obj/hardcore-mode/test-strncpy.o obj/hardcore-mode/test-strcat.o obj/hardcore-mode/test-strncat.o obj/hardcore-mode/test-strchr.o obj/hardcore-mode/test-strrchr.o obj/hardcore-mode/test-strstr.o \033[31m
\033[38;5;196mM-bM-^-$ \033[38;5;9m rm -f libft.so assets/libft.a assetslibtests assets/malloc.dylib \033[31m
\033[38;5;196mM-bM-^-$ \033[38;5;9m rm -f run_test \033[31m
\033[38;5;46m make -j 3 -C /home/john/github/terence_libft \033[31m
make[1]: Entering directory '/home/john/github/terence_libft'
make[1]: Nothing to be done for 'all'.
make[1]: Leaving directory '/home/john/github/terence_libft'
\033[38;5;46m make bonus -j 3 -C /home/john/github/terence_libft \033[31m
make[1]: Entering directory '/home/john/github/terence_libft'
make[1]: *** No rule to make target 'bonus'. Stop.
make[1]: Leaving directory '/home/john/github/terence_libft'
make: *** [Makefile:180: assets/libft.a] Error 2
make: Leaving directory '/home/john/github/42FileChecker/libft-unit-test'

strlcat test 2 expects the wrong value

I'm loving the libft-unit-test, it's really helpful, but I noticed an issue with the one of the strlcat tests.

On the second test ft_strlcat is given two strings: "the cake is a lie !\0I'm hidden lol\r\n" and "there are no stars in the sky"

According to the test ft_strlcat should return 42, but in actuality the combined length of those two strings is 47, I counted it, and double checked with strlen. I also took into account that the first string's length should be up to but not including the '\0', and completely ignoring the "I'm hidden" part.

I'm using the libft-unit-test on Ubuntu.

ft_memcmp does not work in linux

ft_memcmp: [OK] [OK] [OK] [FAILED] [FAILED] [OK] [OK] [OK] [OK] [OK]
[fail]: your memcmp does not work with basic input
[fail]: your memcmp does not cast the memory in unsigned char

See result.log for more informations !
kryshac:~/Desktop/42v2/libft-unit-test$> cat result.log
ft_memcmp: [OK] [OK] [OK] [FAILED] [FAILED] [OK] [OK] [OK] [OK] [OK]
[fail]: your memcmp does not work with basic input
Test code:

uint8_t *s1 = (uint8_t *)"\xff\xaa\xde\xffMACOSX\xff";

uint8_t *s2 = (uint8_t *)"\xff\xaa\xde\x02";
size_t size = 8;
if (memcmp(s1, s2, size) == ft_memcmp(s1, s2, size))
	exit(TEST_SUCCESS);
exit(TEST_FAILED);

Diffs:
memcmp: |64768|
ft_memcmp: |253|

[fail]: your memcmp does not cast the memory in unsigned char
Test code:

uint8_t *s1 = (uint8_t *)"\xff\xaa\xde\200";

uint8_t *s2 = (uint8_t *)"\xff\xaa\xde\0";
size_t size = 8;
if (memcmp(s1, s2, size) == ft_memcmp(s1, s2, size))
	exit(TEST_SUCCESS);
exit(TEST_FAILED);

Diffs:
memcmp: |32768|
ft_memcmp: |128|

my code:

int	ft_memcmp(const void *s1, const void *s2, size_t n)
{
	unsigned char	*p1;
	unsigned char	*p2;

	p1 = (unsigned char *)s1;
	p2 = (unsigned char *)s2;
	while (n--)
		if (*p1++ != *p2++)
			return (*--p1 - *--p2);
	return (0);
}

On MAC OS X all tests work correctly.

Some test that PASS on Unix FAIL on linux.

I've run your tests on loads of libfts, mine as well while being at 42 using their computers, and everything seems to be okay, as in, tests pass, libfts are all green. Now, the problem is that when running the same tests on linux (after installing the packages, adding the so rule, installing whatever is still missing) some tests that PASS on Unix will FAIL on linux. Tests such as ft_isalpha, ft_isdigit, ft_isalnum (from any libft ever, be it mine, yours or others) and such which are really simple functions that are obviously correct. Since the code compares the results those functions return to the results some functions that you used return, and they fail ONLY on linux with the exact same libft that passed everything on Unix, wouldn't the problem be linux libraries related or something?

Test strcmp && strncmp

Les tests strcmp && strncmp ne sont pas complet;

Il manque de verifier si s1 != '\0' || s2[i] != '\0';
A la moulinette mes deux fonctions ont fail a cause de cette verification, il faudrait ajouter les tests suivants :
-strcmp("aaa", "");
-strncmp("aaa", "");
-strcmp("", "aaa");
-strncmp("", "aaa");

cordialement tdenion;

OMG you crashed my program

Salut, j'ai un message d'erreur qui me demande d'etre reporté !

` First part
.-"-. .-"-. .-"-. .-"-. .-"-. .-"-.
"-.-" "-.-" "-.-" "-.-" "-.-"
ft_memset: [OK] [OK] [OK] [OK] [OK] [OK] [OK]
ft_bzero: [OK] [OK] [OK] [OK]
ft_memcpy: [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK]
ft_memccpy: [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK]
ft_memmove: [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK]
ft_memchr: [OK] [OK] [OK] [OK] [OK] [OK] [OK]
ft_memcmp: [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK] [OK]
ft_strlen: [OK] [OK] [NO CRASH] [OK] [OK] [OK] [OK] run_test(61676,0x7fff7dc57000) malloc: *** error for object 0x1074c963e: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

[no crash]: your strlen does not segv when null is sended
[SIGABRT]: abort program (formerly SIGIOT)
OMG you crashed my program, please report this bug to @alelievr !
thanks`

ca a l'air d'etre le 8eme test de ft_strlen (SANDBOX_SPEED) qui crash, je comprends pas pourquoi

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.