alelievr/libft-unit-test

isalnum, tolower, toupper, calloc different behavior on Linux

m0d1nst4ll3r opened this issue · 3 comments

isalnum returns 8 (instead of 0) on 262, 266, 272, 274, 280 etc... for some reason and since tests include non-unsigned char values, they fail when it shouldn't matter and there's no way to get it right

The same happens for tolower and toupper. Toupper returns the int cast as unsigned char for int values between -128 and -2 (yes, -1 is excluded, it returns -1). Unlike isalnum, it's possible to OK it with a simple condition, but it makes no sense catering to this odd behavior.

As for calloc, I haven't gone through it entirely yet, but the manual is different on linux and mac. The linux manual claims calloc protects against 0 values and size_t overflows whereas the mac manual claims nothing like this.

Waiting for merging or declining this pull request #111 concerning ft_is* functions. On ft_calloc function: could you possibly provide some screenshots illustrating your point?

For calloc, the linux manual says:
If nmemb or size is 0, then calloc() returns either NULL, or a unique pointer value that can later be successfully passed to free()
The tester counts NULL returns (in case of 0) as a fail. I'm not sure the moulinette will fail this behavior. Maybe a yellow KO?

The manual also says:
If the multiplication of nmemb and size would result in integer overflow, then calloc() returns an error
The mac manual doesn't, however, so it's unclear what the moulinette tests and what the correct behavior should be.

Hello! Thanks for contributing to the libft unit test.

Note that this repository is not maintained by the owner anymore, instead there is a bot that will automatically merge any reviewed pull requests.
If you feel like it, here are some links that can help you submiting a change in the code base::