Closed thomas-touhey closed 9 years ago
Hi, I'm not sure why this is happening.
Try to add some debug in this file : moulitest/libft_tests/tests/00_part1_ft_isprint.spec.c and examine the result.
printf("ft_isprint(%c) : %d\n", tested_char, ft_isprint(tested_char));
printf("isprint(%c) : %d\n", tested_char, isprint(tested_char));
mt_assert(ft_isprint(tested_char) == isprint(tested_char));
I obtain this result... O_O
ft_isprint(a) : 1
isprint(a) : 16384
ft_isprint(a) : 1
isprint(a) : 0
ft_isprint(2) : 1
isprint(2) : 16384
ft_isprint(Z) : 1
isprint(Z) : 16384
ft_isprint(t) : 1
isprint(t) : 16384
I'll edit this message as soon as I find why.
Hello, may you work only on Darwin kernel (MacOS) with yyang moulitest because of varying returning libc fonctions under linux kernel. On 11 Nov 2015 6:49 am, "Thomas Touhey" notifications@github.com wrote:
I obtain this result... O_O
ft_isprint(a) : 1 isprint(a) : 16384 ft_isprint(a) : 1 isprint(a) : 0 ft_isprint(2) : 1 isprint(2) : 16384 ft_isprint(Z) : 1 isprint(Z) : 16384 ft_isprint(t) : 1 isprint(t) : 16384
I'll edit this message as soon as I find why.
— Reply to this email directly or view it on GitHub https://github.com/yyang42/moulitest/issues/15#issuecomment-155673431.
Oh, that may be the reason then : I'm actually on my own computer, which is on Debian 8.2 Jessie. Anyway, I found a workaround which is correct according to the manual, so everything works all right now ^^
@JulienBalestra This PR from @touhey solves the issue: https://github.com/yyang42/moulitest/pull/16
Il y a le meme probleme avec isalpha, isascii, isdigit et isprint sous linux, j'essaye de faire un PR demain. @touhey http://lxr.free-electrons.com/source/include/linux/ctype.h, linux is using a mask like for the permissions on a file (rwx), that's why you were getting 'strange' values.
Thanks @marc3825 your PR https://github.com/yyang42/moulitest/pull/17 has been merged.
I replace the ft_isalnum(tested_char) && 1
with ft_isalnum(tested_char) != 0
to expressed a bit better the what the man
says. https://github.com/yyang42/moulitest/commit/3cbc39deba4b4f969bbcccff4a859c777b835ae4
RETURN VALUES The isalpha() function returns zero if the character tests false and returns non-zero if the character tests true.
Hi, I have a strange error for ft_isprint testing, I don't understand it...
My ft_isprint function is defined like this :
And I tested it personally for 'a', it returned 1. So why is it considered as a fail ?