alelievr/libft-unit-test

False positive in ft_toupper.c test

pedrodesu opened this issue · 2 comments

#define THRESHOLD 'a' - 'A'

int	ft_toupper(int c)
{
	if (c >= 'a' && c <= 'z')
	{
		return (c - THRESHOLD);
	}
	else
	{
		return (c);
	}
}
int	ft_toupper(int c)
{
	if (c >= 'a' && c <= 'z')
	{
		return (c - ('a' - 'A'));
	}
	else
	{
		return (c);
	}
}

The first snippet fails, whereas the second one passes. They're equivalent and there doesn't seem to exist any apparent reason for the first one not to pass. I'm guessing it's some type of problem with macros?

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::

Complete noob mistake on my part, there's no false positive. thx for the heads up @Kuninoto. closing.